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.
This commit is contained in:
93
SVSim.BattleEngine/Engine/BMSymbol.cs
Normal file
93
SVSim.BattleEngine/Engine/BMSymbol.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class BMSymbol
|
||||
{
|
||||
public string sequence;
|
||||
|
||||
public string spriteName;
|
||||
|
||||
private UISpriteData mSprite;
|
||||
|
||||
private bool mIsValid;
|
||||
|
||||
private int mLength;
|
||||
|
||||
private int mOffsetX;
|
||||
|
||||
private int mOffsetY;
|
||||
|
||||
private int mWidth;
|
||||
|
||||
private int mHeight;
|
||||
|
||||
private int mAdvance;
|
||||
|
||||
private Rect mUV;
|
||||
|
||||
public int length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mLength == 0)
|
||||
{
|
||||
mLength = sequence.Length;
|
||||
}
|
||||
return mLength;
|
||||
}
|
||||
}
|
||||
|
||||
public int offsetX => mOffsetX;
|
||||
|
||||
public int offsetY => mOffsetY;
|
||||
|
||||
public int width => mWidth;
|
||||
|
||||
public int height => mHeight;
|
||||
|
||||
public int advance => mAdvance;
|
||||
|
||||
public Rect uvRect => mUV;
|
||||
|
||||
public void MarkAsChanged()
|
||||
{
|
||||
mIsValid = false;
|
||||
}
|
||||
|
||||
public bool Validate(UIAtlas atlas)
|
||||
{
|
||||
if (atlas == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!mIsValid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(spriteName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mSprite = ((atlas != null) ? atlas.GetSprite(spriteName) : null);
|
||||
if (mSprite != null)
|
||||
{
|
||||
Texture texture = atlas.texture;
|
||||
if (texture == null)
|
||||
{
|
||||
mSprite = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
mUV = new Rect(mSprite.x, mSprite.y, mSprite.width, mSprite.height);
|
||||
mUV = NGUIMath.ConvertToTexCoords(mUV, texture.width, texture.height);
|
||||
mOffsetX = mSprite.paddingLeft;
|
||||
mOffsetY = mSprite.paddingTop;
|
||||
mWidth = mSprite.width;
|
||||
mHeight = mSprite.height;
|
||||
mAdvance = mSprite.width + (mSprite.paddingLeft + mSprite.paddingRight);
|
||||
mIsValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mSprite != null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user