feat(battle-engine): full Unity primitive/runtime surface + game extension copies
Grows Vector2/3, Mathf, Color, Quaternion, GameObject, Transform, Camera, Material, ParticleSystem, Rect, Bounds, Time to the surface the engine references; adds Input/ Random/Resources statics + full KeyCode enum. Copies the verbatim extension files that collapse thousands of CS1061s at once (ContentKeywordExt, JsonData/LitJson extensions, EventExtension.Call, GameObjectExtension(s)). 26.5k -> 15.9k errors; residual now dominated by god-object member surface (GameMgr/UIManager/EffectMgr/Vfx*).
This commit is contained in:
64
SVSim.BattleEngine/Engine/JsonDataExtension.cs
Normal file
64
SVSim.BattleEngine/Engine/JsonDataExtension.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using LitJson;
|
||||
|
||||
public static class JsonDataExtension
|
||||
{
|
||||
public static bool TryGetValue(this JsonData data, string key, out JsonData value)
|
||||
{
|
||||
value = null;
|
||||
if (!data.IsObject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!data.Keys.Contains(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
value = data[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string GetValueOrDefault(this JsonData data, string key, string defaultValue)
|
||||
{
|
||||
if (!data.TryGetValue(key, out var value))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
public static int GetValueOrDefault(this JsonData data, string key, int defaultValue)
|
||||
{
|
||||
if (!data.TryGetValue(key, out var value))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return value.ToInt();
|
||||
}
|
||||
|
||||
public static long GetValueOrDefault(this JsonData data, string key, long defaultValue)
|
||||
{
|
||||
if (!data.TryGetValue(key, out var value))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return value.ToLong();
|
||||
}
|
||||
|
||||
public static double GetValueOrDefault(this JsonData data, string key, double defaultValue)
|
||||
{
|
||||
if (!data.TryGetValue(key, out var value))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return value.ToDouble();
|
||||
}
|
||||
|
||||
public static bool GetValueOrDefault(this JsonData data, string key, bool defaultValue)
|
||||
{
|
||||
if (!data.TryGetValue(key, out var value))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return value.ToBoolean();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user