public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); if (planet == null) { return; } GameEntity hacker = localSide.Entities.GetFirstMatching(EntityRollupType.KingUnits); if (hacker == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameHackingMenu windowController = (Window_InGameHackingMenu)Element.Window.Controller; if (windowController != null) { } //prevent compiler warning if (hacker.ActiveHack != Instance.LastObservedActiveHack) { Instance.LastObservedActiveHack = hacker.ActiveHack; windowController.PlanetChangedSinceLastButtonSetUpdate = true; } if (windowController.PlanetChangedSinceLastButtonSetUpdate) { elementAsType.ClearButtons(); int x = 0; for (int i = 0; i < HackingTypeTable.Instance.Rows.Count; i++) { HackingType type = HackingTypeTable.Instance.Rows[i]; planet.Combat.DoForEntities(EntityRollupType.Hackable, delegate(GameEntity entity) { if (!entity.TypeData.EligibleForHacks.Contains(type)) { return(DelReturn.Continue); } if (!type.Implementation.GetCanBeHacked(entity, hacker)) { return(DelReturn.Continue); } bItem newButtonController = new bItem(type, entity); Vector2 offset; offset.x = x * elementAsType.ButtonWidth; offset.y = 0; Vector2 size; size.x = elementAsType.ButtonWidth; size.y = elementAsType.ButtonHeight; elementAsType.AddButton(newButtonController, size, offset); x++; return(DelReturn.Continue); }); } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); windowController.PlanetChangedSinceLastButtonSetUpdate = false; } }
public bItem(HackingType Type, GameEntity Target) { this.Type = Type; this.Target = Target; }