Exemplo n.º 1
0
            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;
                }
            }
Exemplo n.º 2
0
 public Window_InGameWarheadMenu()
 {
     Instance                    = this;
     this.OnlyShowInGame         = true;
     this.SupportsMasterMenuKeys = true;
 }