protected void ProcessFiles( string[] files, Progress progress) { string info = "Reading UIDs from "; for (int i = 0; i < files.Length; ++i) { progress.Info = info + Path.GetFileName(files[i]) + "..."; TNGFile tng = new TNGFile( FileDatabase.Instance.TNGDefinitions); tng.Load(files[i]); for (int j = 0; j < tng.SectionCount; ++j) { foreach (Thing thing in tng.get_Sections(j).Things) { UIDManager.Add(thing.UID); } } tng.Dispose(); progress.Update(); } }
protected bool IsValid(Thing thing) { return (UIDManager.IsNormal(thing.UID) && (thing.Name == "Building" || thing.Name == "Object")); }
protected virtual void Awake() { uidm = FindObjectOfType <UIDManager>(); afterSnapActions = new SimpleActionQueue(); root = transform.parent; anim = GetComponent <Animator>(); table = FindObjectOfType <Table>(); handPlane = FindObjectOfType <HandPlane>(); handPlaneTransform = handPlane.transform; beh = GetComponent <BaseObjectBehaviour>(); }
public void TestBlocking() { UIDManager uidManager = new UIDManager(); Assert.True(uidManager.Block(1)); Assert.True(uidManager.Block(2)); Assert.False(uidManager.Block(1)); try { uidManager.Generate(); }catch (Exception) { Assert.False(true); } }
protected void UpdateThing(Thing thing, List <CTCBlock> ctcs) { string newUID = UIDManager.Generate(); foreach (CTCBlock ctc in ctcs) { Variable v = ctc.get_Variables("OwnerUID"); if (v.StringValue == thing.UID) { v.Value = newUID; } } thing.UID = newUID; }
protected List <CTCBlock> GetOwned(TNGFile tng) { List <CTCBlock> ctcs = new List <CTCBlock>(100); for (int i = 0; i < tng.SectionCount; ++i) { foreach (Thing thing in tng.get_Sections(i).Things) { CTCBlock ctc = thing.get_CTCs("CTCOwnedEntity"); if (ctc != null) { Variable v = ctc.get_Variables("OwnerUID"); if (UIDManager.IsNormal(v.StringValue)) { ctcs.Add(ctc); } } } } return(ctcs); }