public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; //Window_InGameGalaxyMapDisplayModeMenu windowController = (Window_InGameGalaxyMapDisplayModeMenu)Element.Window.Controller; if (elementAsType.Buttons.Count <= 0) { int x = 0; for (int i = 0; i < GalaxyMapDisplayModeTable.Instance.Rows.Count; i++) { GalaxyMapDisplayMode mode = GalaxyMapDisplayModeTable.Instance.Rows[i]; bItem newButtonController = new bItem(mode); 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++; } } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameFormationMenu windowController = (Window_InGameFormationMenu)Element.Window.Controller; if (windowController.TimeOfLastRefresh < Engine_AIW2.Instance.TimeOfLastControlGroupChange) { windowController.NeedRefresh = true; } if (windowController.LastControlGroupID != World_AIW2.Instance.CurrentActiveSelectionControlGroupPrimaryKeyID) { windowController.NeedRefresh = true; } if (windowController.NeedRefresh) { windowController.NeedRefresh = false; windowController.TimeOfLastRefresh = DateTime.Now; windowController.LastControlGroupID = World_AIW2.Instance.CurrentActiveSelectionControlGroupPrimaryKeyID; elementAsType.ClearButtons(); int x = 0; { bClear newButtonController = new bClear(); 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++; } for (int i = 0; i < FormationTypeDataTable.Instance.Rows.Count; i++) { FormationTypeData item = FormationTypeDataTable.Instance.Rows[i]; bItem newButtonController = new bItem(item); 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++; } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; //Window_InGameTracingMenu windowController = (Window_InGameTracingMenu)Element.Window.Controller; if (elementAsType.Buttons.Count <= 0) { int x = 0; for (int flagInt = 1; flagInt < (int)ArcenTracingFlags.Length; flagInt <<= 1, x++) { ArcenTracingFlags flag = (ArcenTracingFlags)flagInt; bItem newButtonController = new bItem(flag); 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); } } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide == null) { return; } GameEntity launcher = localSide.Entities.GetFirstMatching(EntityRollupType.KingUnits); if (launcher == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameWarheadMenu windowController = (Window_InGameWarheadMenu)Element.Window.Controller; if (windowController.PlanetChangedSinceLastButtonSetUpdate) { elementAsType.ClearButtons(); int x = 0; for (int i = 0; i < GameEntityTypeDataTable.Instance.Rows.Count; i++) { GameEntityTypeData type = GameEntityTypeDataTable.Instance.Rows[i]; if (type.SpecialType != SpecialEntityType.Warhead) { continue; } bool foundIt = false; for (int j = 0; j < launcher.WarheadContents.Count; j++) { if (launcher.WarheadContents[j].ContainedType != type) { continue; } foundIt = true; break; } if (!foundIt) { continue; } bItem newButtonController = new bItem(type); 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++; } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); windowController.PlanetChangedSinceLastButtonSetUpdate = false; } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameRallyMenu windowController = (Window_InGameRallyMenu)Element.Window.Controller; if (windowController != null) { } //prevent compiler warning if (windowController.NeedRefresh) { windowController.NeedRefresh = false; elementAsType.ClearButtons(); int x = 0; for (int i = 0; i < localSide.ControlGroups.Count; i++) { ControlGroup controlGroup = localSide.ControlGroups[i]; if (controlGroup.EntityIDs.Count <= 0) { continue; } bItem newButtonController = new bItem(controlGroup); 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++; } { bClear newButtonController = new bClear(); Vector2 offset; offset.x = 9 * elementAsType.ButtonWidth; offset.y = 0; Vector2 size; size.x = elementAsType.ButtonWidth; size.y = elementAsType.ButtonHeight; elementAsType.AddButton(newButtonController, size, offset); } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); if (planet != null) { } //prevent compiler warning ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; if (elementAsType != null) { } //prevent compiler warning Window_InGameTechTabMenu windowController = (Window_InGameTechTabMenu)Element.Window.Controller; if (windowController != null) { } //prevent compiler warning if (elementAsType.Buttons.Count <= 0) { elementAsType.ClearButtons(); List <TechMenu> menus = TechMenuTable.Instance.Rows; int x = 0; for (int i = 0; i < menus.Count; i++) { TechMenu item = menus[i]; if (item.DoNotShowOnTechMenu) { continue; } bItem newButtonController = new bItem(i); 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++; } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); } }
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 override void OnUpdate() { if (Instance.HeightPerRow <= 0) { Instance.HeightPerRow = Element.ButtonHeight; } WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } ArcenUI_ImageButtonSet elementAsType = (ArcenUI_ImageButtonSet)Element; if (elementAsType != null) { } //prevent compiler warning Window_InGameBuildTypeIconMenu windowController = (Window_InGameBuildTypeIconMenu)Element.Window.Controller; if (windowController != null) { } //prevent compiler warning if (Instance.LastMenuIndex != Window_InGameBuildTabMenu.Instance.CurrentMenuIndex || Instance.LastTypeIndex != Instance.CurrentTypeIndex) { Instance.LastMenuIndex = Window_InGameBuildTabMenu.Instance.CurrentMenuIndex; Instance.LastTypeIndex = Instance.CurrentTypeIndex; for (int i = 0; i < Instance.LastShownItems.Count; i++) { Instance.LastShownItems[i].Clear(); } GameEntity entity = World_AIW2.Instance.GetEntityByID(Window_InGameBuildTabMenu.Instance.EntityID); if (entity != null && entity.TypeData.BuildMenus.Count > 0) { int highestRowReached = 0; if (Instance.LastMenuIndex >= entity.TypeData.BuildMenus.Count) { Instance.LastMenuIndex = 0; Window_InGameBuildTabMenu.Instance.CurrentMenuIndex = 0; } BuildMenu menu = entity.TypeData.BuildMenus[Instance.LastMenuIndex]; if (menu != null) { float aspectRatioAdjustedButtonWidth = this.Element.ButtonWidth; float aspectRatioAdjustedButtonHeight = this.Element.ButtonHeight; if (ArcenUI.Instance.PixelsPerPercent_X != ArcenUI.Instance.PixelsPerPercent_Y) { aspectRatioAdjustedButtonWidth *= ArcenUI.Instance.PixelsPerPercent_Y / ArcenUI.Instance.PixelsPerPercent_X; } //int totalColumns = Mathf.FloorToInt( this.Element.Width / aspectRatioAdjustedButtonWidth ); int currentImageListIndex = 0; int shownColumnCount = 0; for (int typeIndex = 0; typeIndex < menu.Columns.Count; typeIndex++) { List <BuildMenuItem> column = menu.Columns[typeIndex]; int buttonsInColumn = 0; for (int markIndex = 0; markIndex < column.Count; markIndex++) { BuildMenuItem menuItem = column[markIndex]; if (menuItem.EntityDataOrNull == null) { continue; } if (localSide.GetCanBuildAtAll(menuItem.EntityDataOrNull) != ArcenRejectionReason.Unknown) { continue; } buttonsInColumn = markIndex + 1; } highestRowReached = Math.Max(highestRowReached, buttonsInColumn); } for (int typeIndex = 0; typeIndex < menu.Columns.Count; typeIndex++) { if (Instance.LastShownItems.Count <= typeIndex) { Instance.LastShownItems.Add(new List <bItem>()); } List <bItem> lastShownItemList = Instance.LastShownItems[typeIndex]; bool haveShownAnythingInThisColumn = false; List <BuildMenuItem> column = menu.Columns[typeIndex]; if (column.Count <= 0) { continue; } for (int markIndex = 0; markIndex < column.Count; markIndex++) { if (lastShownItemList.Count <= markIndex) { lastShownItemList.Add(null); } BuildMenuItem menuItem = column[markIndex]; if (menuItem.EntityDataOrNull == null) { continue; } if (localSide.GetCanBuildAtAll(menuItem.EntityDataOrNull) != ArcenRejectionReason.Unknown) { continue; } haveShownAnythingInThisColumn = true; bItem item = null; if (currentImageListIndex < this.Element.Images.Count) { item = Element.Images[currentImageListIndex].Controller as bItem; currentImageListIndex++; } else { item = new bItem(); Vector2 dummy = Mat.V2_Zero; Vector2 size; size.x = aspectRatioAdjustedButtonWidth; size.y = aspectRatioAdjustedButtonHeight; Element.AddImageButton(item, size, dummy); currentImageListIndex = Element.Images.Count; } item.ColumnIndex = shownColumnCount; lastShownItemList[markIndex] = item; float effectiveX = shownColumnCount * aspectRatioAdjustedButtonWidth; float effectiveY = ((highestRowReached - 1) - markIndex) * aspectRatioAdjustedButtonHeight; item.TypeDoingTheBuilding = entity.TypeData; item.SetTypeToBuild(menuItem.EntityDataOrNull); item.Element.Alignment.XAlignment.Offset = effectiveX; item.Element.Alignment.YAlignment.Offset = effectiveY; item.Element.UpdatePositionAndSize(); } if (haveShownAnythingInThisColumn) { shownColumnCount++; } } //hide any extras for (int i = currentImageListIndex; i < this.Element.Images.Count; i++) { bItem item = this.Element.Images[i].Controller as bItem; item.SetTypeToBuild(null); item.TypeDoingTheBuilding = null; } } if (Instance.HeightPerRow > 0) { float currentExpansion = Instance.Window.SubContainer.Height - Instance.HeightPerRow; float targetExpansion = Instance.HeightPerRow * (highestRowReached - 1); float deltaExpansion = targetExpansion - currentExpansion; if (deltaExpansion != 0) { Instance.Window.SubContainer.Height = Instance.HeightPerRow * highestRowReached; } } } } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameBuildTypeMenu windowController = (Window_InGameBuildTypeMenu)Element.Window.Controller; if (windowController != null) { } //prevent compiler warning if (Window_InGameBuildTypeMenu.Instance.LastMenuIndex != Window_InGameBuildTabMenu.Instance.CurrentMenuIndex) { Window_InGameBuildTypeMenu.Instance.LastMenuIndex = Window_InGameBuildTabMenu.Instance.CurrentMenuIndex; elementAsType.ClearButtons(); GameEntity entity = World_AIW2.Instance.GetEntityByID(Window_InGameBuildTabMenu.Instance.EntityID); if (entity != null && entity.TypeData.BuildMenus.Count > 0) { if (Window_InGameBuildTypeMenu.Instance.LastMenuIndex >= entity.TypeData.BuildMenus.Count) { Window_InGameBuildTypeMenu.Instance.LastMenuIndex = 0; Window_InGameBuildTabMenu.Instance.CurrentMenuIndex = 0; } BuildMenu menu = entity.TypeData.BuildMenus[Window_InGameBuildTypeMenu.Instance.LastMenuIndex]; if (menu != null) { int shownColumnCount = 0; for (int x = 0; x < menu.Columns.Count; x++) { bool haveShownAnythingInThisColumn = false; List <BuildMenuItem> column = menu.Columns[x]; if (column.Count <= 0) { continue; } for (int y = 0; y < column.Count; y++) { BuildMenuItem item = column[y]; haveShownAnythingInThisColumn = true; bItem newButtonController = new bItem(entity.TypeData, item); newButtonController.ItemMenuIndex = Window_InGameBuildTypeMenu.Instance.LastMenuIndex; newButtonController.ItemTypeIndex = x; newButtonController.ItemIndex = y; Vector2 offset; offset.x = shownColumnCount * elementAsType.ButtonWidth; offset.y = 0; Vector2 size; size.x = elementAsType.ButtonWidth; size.y = elementAsType.ButtonHeight; elementAsType.AddButton(newButtonController, size, offset); } if (haveShownAnythingInThisColumn) { shownColumnCount++; } } } } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); } }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return; } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; Window_InGameBuildTabMenu windowController = (Window_InGameBuildTabMenu)Element.Window.Controller; if (windowController != null) { } //prevent compiler warning if (windowController.EntityChangedSinceLastButtonSetUpdate_Menu) { elementAsType.ClearButtons(); GameEntity entity = World_AIW2.Instance.GetEntityByID(windowController.EntityID); if (entity != null) { List <BuildMenu> menus = entity.TypeData.BuildMenus; int x = 0; for (int i = 0; i < menus.Count; i++) { BuildMenu item = menus[i]; if (item.RequiresPresenceOf != null) { bool foundIt = false; planet.Combat.DoForEntities(EntityRollupType.SpecialBuildMenuEnablers, delegate(GameEntity enabler) { if (enabler.TypeData != item.RequiresPresenceOf) { return(DelReturn.Continue); } foundIt = true; return(DelReturn.Break); }); if (!foundIt) { continue; } } bool foundPatternItem = false; for (int j = 0; j < item.Columns.Count; j++) { List <BuildMenuItem> itemList = item.Columns[j]; for (int k = 0; k < itemList.Count; k++) { if (itemList[k].PatternController != null) { foundPatternItem = true; break; } } } bItem newButtonController = new bItem(entity.TypeData, i, foundPatternItem); 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++; } } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); windowController.EntityChangedSinceLastButtonSetUpdate_Menu = false; windowController.MenuIndexChangedSinceLastButtonSetUpdate = true; } }