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 Window_InGameFormationMenu()
 {
     Instance                    = this;
     this.OnlyShowInGame         = true;
     this.SupportsMasterMenuKeys = true;
 }