Files
SVSimServer/SVSim.BattleEngine/Engine/Cute/AssetErrorState.cs
gamer147 0d9d8acae0 feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
2026-06-05 16:57:20 -04:00

94 lines
1.5 KiB
C#

using System.Collections.Generic;
namespace Cute;
public class AssetErrorState
{
public enum Code
{
NONE = 0,
SERVER_TIMEOUT = 1,
SERVER_UNDEFINED_ERROR = 2,
LOCAL_CAPACITY_OVER = 4,
CANCELED = 8,
FILE_READ_ERROR = 0x10,
SERVER_NOT_FOUND_ERROR = 0x20
}
public enum DialogDecision
{
UNDECIDED,
RETRY,
TERMINATE
}
private Dictionary<string, Code> errors = new Dictionary<string, Code>();
public DialogDecision lastDialogDecision;
public int errorFlag { get; private set; }
public bool canceled { get; private set; }
public bool HasError()
{
return errorFlag != 0;
}
public bool HasError(Code code)
{
return ((uint)errorFlag & (uint)code) != 0;
}
public void SetCanceled()
{
canceled = true;
}
public int ErrorCount()
{
return errors.Count;
}
public AssetErrorState()
{
Reset();
}
public void Report(string filename, Code errorCode)
{
if (errorCode != Code.NONE)
{
errorFlag |= (int)errorCode;
errors[filename] = errorCode;
}
}
public Code Query(string filename)
{
if (!errors.TryGetValue(filename, out var value))
{
return Code.NONE;
}
return value;
}
public void Reset()
{
errorFlag = 0;
lastDialogDecision = DialogDecision.UNDECIDED;
errors.Clear();
canceled = false;
}
public List<string> GatherErrorFilenames()
{
List<string> list = new List<string>();
foreach (KeyValuePair<string, Code> error in errors)
{
list.Add(error.Key);
}
return list;
}
}