public static bool UnregisterClient(TreeClient client) { if (treeManager != null) { bool success = treeManager.clients.Remove(client); return(success); } else { return(false); } }
public static bool RegisterClient(TreeClient client) { Init(); if (!treeManager.clients.Contains(client)) { treeManager.clients.Add(client); return(true); } else { return(false); } }
private TreeManager() { HudMain.Init(); if (treeManager == null) { treeManager = this; } else { throw new Exception($"Only one instance of {GetType().Name} can exist at any given time."); } updateAccessors = new List <HudUpdateAccessors>(200); distMap = new Dictionary <Func <Vector3D>, ushort>(50); uniqueOriginFuncs = new HashSet <Func <Vector3D> >(); indexBuffer = new List <ulong>(200); depthTestActions = new List <Action>(200); depthTestActionBuffer = new List <Action>(200); inputActions = new List <Action>(200); inputActionBuffer = new List <Action>(200); drawActions = new List <Action>(200); drawActionBuffer = new List <Action>(200); layoutActions = new List <Action <bool> >(200); clients = new List <TreeClient>(); mainClient = new TreeClient() { GetUpdateAccessors = instance._root.GetUpdateAccessors }; drawTimer = new Stopwatch(); drawTimes = new long[tickResetInterval]; inputTimer = new Stopwatch(); inputTimes = new long[tickResetInterval]; treeTimer = new Stopwatch(); treeTimes = new long[tickResetInterval]; }
public void BubblingOfCollectionChangedEventAfterListPropertyIsChangedInTreeWithAop() { var client = new TreeClient(); int count = 0; client.RootChanged += delegate { count++; }; var node1 = new ClassImplementingIEventedList(); var node2 = new ClassImplementingIEventedList(); node1.Children.Add(node2); client.Root.Add(node1); Assert.AreEqual(1, count); node2.Add(new ClassImplementingIEventedList()); Assert.AreEqual(2, count); node1.Remove(node2); Assert.AreEqual(3, count); }