Exemplo n.º 1
0
        public override void DoWindowContents(Rect canvas)
        {
            Rect buttonRect = new Rect(0f, 0f, 200f, 30f);
            if (Widgets.TextButton(buttonRect, CurrentTab.Label))
            {
                List<FloatMenuOption> list = new List<FloatMenuOption>();
                for (int i = 0; i < Manager.ManagerTabs.Length; i++)
                {
                    ManagerTab current = Manager.ManagerTabs[i];
                    list.Add(new FloatMenuOption(current.Label, delegate
                    {
                        CurrentTab = current;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }

            // Title
            Text.Font = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(new Rect(0f, 0f, canvas.width, 55f), "FM.Manager".Translate() + " - " + CurrentTab.Label);
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font = GameFont.Small;

            // delegate actual content to the specific manager.
            Rect contentCanvas = new Rect(0f, 55f, canvas.width, canvas.height - 55f);
            GUI.BeginGroup(contentCanvas);
            CurrentTab.DoWindowContents(contentCanvas);
            GUI.EndGroup();
        }
Exemplo n.º 2
0
 public MainTabWindowManager()
 {
     if (CurrentTab == null) CurrentTab = DefaultTab;
 }