Beispiel #1
0
            public override void OnUpdate()
            {
                WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide();

                if (localSide == null)
                {
                    return;
                }
                ArcenUI_ImageButtonSet elementAsType = (ArcenUI_ImageButtonSet)Element;

                if (Window_InGameBuildTabMenu.Instance.EntityChangedSinceLastButtonSetUpdate_Queue)
                {
                    elementAsType.ClearButtons();

                    GameEntity entity = World_AIW2.Instance.GetEntityByID(Window_InGameBuildTabMenu.Instance.EntityID);
                    if (entity != 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;
                        }

                        float runningX = 0;
                        if (entity.BuildQueue != null)
                        {
                            List <BuildQueueItem> items = entity.BuildQueue.Items;
                            for (int x = 0; x < items.Count; x++)
                            {
                                BuildQueueItem item = items[x];
                                bQueueItem     newButtonController = new bQueueItem(entity.TypeData, item, x);
                                Vector2        offset;
                                offset.x = runningX;
                                offset.y = 0;
                                Vector2 size;
                                size.x = aspectRatioAdjustedButtonWidth;
                                size.y = aspectRatioAdjustedButtonHeight;
                                elementAsType.AddImageButton(newButtonController, size, offset);
                                runningX += size.x;
                            }
                        }
                    }

                    elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();

                    Window_InGameBuildTabMenu.Instance.EntityChangedSinceLastButtonSetUpdate_Queue = false;
                    Window_InGameBuildTabMenu.Instance.MenuIndexChangedSinceLastButtonSetUpdate    = true;
                }
            }
            public override void OnUpdate()
            {
                WorldSide localSide = World_AIW2.Instance.GetLocalSide();

                if (localSide == null)
                {
                    return;
                }
                ArcenUI_ButtonSet      elementAsType    = (ArcenUI_ButtonSet)Element;
                Window_InGameBuildMenu windowController = (Window_InGameBuildMenu)Element.Window.Controller;

                if (windowController.EntityChangedSinceLastButtonSetUpdate_Queue)
                {
                    elementAsType.ClearButtons();

                    GameEntity entity = World_AIW2.Instance.GetEntityByID(windowController.EntityID);
                    if (entity != null)
                    {
                        float runningX = 0;
                        {
                            bTogglePause newButtonController = new bTogglePause();
                            Vector2      offset;
                            offset.x = runningX;
                            offset.y = 0;
                            Vector2 size;
                            size.x = elementAsType.ButtonWidth / 2;
                            size.y = elementAsType.ButtonHeight;
                            elementAsType.AddButton(newButtonController, size, offset);
                            runningX += size.x;
                        }
                        {
                            bToggleLoop newButtonController = new bToggleLoop();
                            Vector2     offset;
                            offset.x = runningX;
                            offset.y = 0;
                            Vector2 size;
                            size.x = elementAsType.ButtonWidth / 2;
                            size.y = elementAsType.ButtonHeight;
                            elementAsType.AddButton(newButtonController, size, offset);
                            runningX += size.x;
                        }
                        if (entity.BuildQueue != null)
                        {
                            List <BuildQueueItem> items = entity.BuildQueue.Items;
                            for (int x = 0; x < items.Count; x++)
                            {
                                BuildQueueItem item = items[x];
                                bQueueItem     newButtonController = new bQueueItem(entity.TypeData, item, x);
                                Vector2        offset;
                                offset.x = runningX;
                                offset.y = 0;
                                Vector2 size;
                                size.x = elementAsType.ButtonWidth;
                                size.y = elementAsType.ButtonHeight;
                                elementAsType.AddButton(newButtonController, size, offset);
                                runningX += size.x;
                            }
                        }
                    }

                    elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();

                    windowController.EntityChangedSinceLastButtonSetUpdate_Queue = false;
                    windowController.MenuIndexChangedSinceLastButtonSetUpdate    = true;
                }
            }