/// <summary> /// Used internally to modify the state of hud nodes /// </summary> public static void SetNodesState <TCon, TNode>(HudElementStates state, bool mask, IReadOnlyList <TCon> nodes, int index, int count) where TCon : IHudElementContainer <TNode>, new() where TNode : HudNodeBase { if (count > 0) { int end = index + count - 1; Utils.Debug.Assert(index >= 0 && end < nodes.Count, $"Range out of bounds. Index: {index}, End: {end}"); if (mask) { for (int i = index; i <= end; i++) { nodes[i].Element.State &= ~state; } } else { for (int i = index; i <= end; i++) { nodes[i].Element.State |= state; } } } }
public HudParentBase() { State |= HudElementStates.IsRegistered; Visible = true; children = new List <HudNodeBase>(); accessorDelegates = new HudUpdateAccessors() { Item1 = GetOrSetApiMember, Item2 = new MyTuple <Func <ushort>, Func <Vector3D> >(() => layerData.fullZOffset, null), Item3 = BeginInputDepth, Item4 = BeginInput, Item5 = BeginLayout, Item6 = BeginDraw }; }
public override void GetUpdateAccessors(List <HudUpdateAccessors> UpdateActions, byte treeDepth) { int preloadRange = Math.Max((End - Start) * 2, 10), preloadStart = MathHelper.Clamp(Start - preloadRange, 0, hudCollectionList.Count - 1), preloadCount = MathHelper.Clamp((2 * preloadRange), 0, hudCollectionList.Count - preloadStart); HudElementStates memberFlags = HudElementStates.CanPreload; if (UseSmoothScrolling) { memberFlags |= HudElementStates.IsSelectivelyMasked; } NodeUtils.SetNodesState <TElementContainer, TElement> (HudElementStates.CanPreload, true, hudCollectionList, 0, hudCollectionList.Count); NodeUtils.SetNodesState <TElementContainer, TElement> (memberFlags, false, hudCollectionList, preloadStart, preloadCount); base.GetUpdateAccessors(UpdateActions, treeDepth); }
/// <summary> /// Used internally to modify the state of hud nodes /// </summary> public static void SetNodesState(HudElementStates state, bool mask, IReadOnlyList <HudNodeBase> nodes, int index, int count) { if (count > 0) { int end = index + count - 1; Utils.Debug.Assert(index >= 0 && end < nodes.Count, $"Range out of bounds. Index: {index}, End: {end}"); if (mask) { for (int i = index; i <= end; i++) { nodes[i].State &= ~state; } } else { for (int i = index; i <= end; i++) { nodes[i].State |= state; } } } }