Exemple #1
0
 List <FloatMenuOption> IAddonMenu.MenuOptions() => new List <FloatMenuOption>
 {
     new FloatMenuOption("Settings", delegate()
     {
         Window_ModSettings window = new Window_ModSettings(LoadedModManager.GetMod <ToolkitPoints>());
         Find.WindowStack.TryRemove(window.GetType());
         Find.WindowStack.Add(window);
     }),
     new FloatMenuOption("Ledger", delegate()
     {
         ManageLedgerWindow window = new ManageLedgerWindow();
         Find.WindowStack.TryRemove(window.GetType());
         Find.WindowStack.Add(window);
     }),
     new FloatMenuOption("All Ledgers", delegate()
     {
         LedgersWindow window = new LedgersWindow();
         Find.WindowStack.TryRemove(window.GetType());
         Find.WindowStack.Add(window);
     })
 };
Exemple #2
0
        public void DoWindowContents(Rect inRect)
        {
            if (Event.current.type == EventType.Layout)
            {
                return;
            }

            GameFont original = Text.Font;

            Text.Font = GameFont.Medium;

            // Button texts
            string rewardButtonText = "Reward Viewers";
            string activeLedgerText = "Active Ledger";
            string allLedgersText   = "All Ledgers";

            // Rect regions
            float estBtnWidth = Mathf.Max(
                Text.CalcSize(rewardButtonText).x,
                Text.CalcSize(activeLedgerText).x,
                Text.CalcSize(allLedgersText).x
                )
                                + 24f;

            Rect buttonRegion   = new Rect(inRect.width - estBtnWidth, 0f, estBtnWidth, inRect.height);
            Rect settingsRegion = new Rect(0f, 0f, inRect.width - buttonRegion.width - 23f, inRect.height);

            GUI.BeginGroup(inRect);

            Listing_Standard listing = new Listing_Standard(GameFont.Medium);

            listing.Begin(settingsRegion);
            DrawSettingsPanel(listing);
            listing.End();

            float btnLineHeight = inRect.height * 0.9f;

            Widgets.DrawLineVertical(
                settingsRegion.x + settingsRegion.width + 12f,
                0f,
                btnLineHeight
                );

            listing.Begin(buttonRegion);

            if (listing.ButtonText(rewardButtonText))
            {
                Rewarder.TryRewardingViewers();
            }

            if (listing.ButtonText(activeLedgerText))
            {
                ManageLedgerWindow window = new ManageLedgerWindow();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            if (listing.ButtonText(allLedgersText))
            {
                LedgersWindow window = new LedgersWindow();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            listing.End();
            GUI.EndGroup();

            Text.Font = original;
        }