예제 #1
0
        List <FloatMenuOption> IAddonMenu.MenuOptions() => new List <FloatMenuOption>
        {
            new FloatMenuOption("Settings", delegate()
            {
                Window_ModSettings window = new Window_ModSettings(LoadedModManager.GetMod <TwitchToolkit>());
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Events", delegate()
            {
                StoreIncidentsWindow window = new StoreIncidentsWindow();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Items", delegate()
            {
                StoreItemsWindow window = new StoreItemsWindow();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Commands", delegate()
            {
                Window_Commands window = new Window_Commands();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Viewers", delegate()
            {
                Window_Viewers window = new Window_Viewers();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Name Queue", delegate()
            {
                QueueWindow window = new QueueWindow();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Tracker", delegate()
            {
                Window_Trackers window = new Window_Trackers();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }),
            new FloatMenuOption("Toggle Earning Coins", delegate()
            {
                ToolkitSettings.EarningCoins = !ToolkitSettings.EarningCoins;

                if (ToolkitSettings.EarningCoins)
                {
                    Messages.Message("Earning Coins is Enabled", MessageTypeDefOf.NeutralEvent);
                }
                else
                {
                    Messages.Message("Earning Coins is Disabled", MessageTypeDefOf.NeutralEvent);
                }
            }),
            new FloatMenuOption("Debug Fix", delegate()
            {
                Helper.playerMessages = new List <string>();
                Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>();
            })
        };
예제 #2
0
        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);

            float padding   = 5f;
            float btnWidth  = 100f;
            float btnHeight = 30f;

            var rectBtn = new Rect(padding, 0, btnWidth, btnHeight);

            if (Widgets.ButtonText(rectBtn, "Chat Window") && !Find.WindowStack.TryRemove(typeof(ChatWindow), true))
            {
                ChatWindow chatwnd = new ChatWindow();
                Toolkit.client.activeChatWindow = chatwnd;
                Find.WindowStack.Add(chatwnd);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Events"))
            {
                Type type = typeof(StoreIncidentsWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new StoreIncidentsWindow();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Items"))
            {
                Type type = typeof(StoreItemsWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new StoreItemsWindow();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Settings"))
            {
                Mod  mod  = LoadedModManager.GetMod(typeof(TwitchToolkit));
                Type type = typeof(SettingsWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new SettingsWindow(mod);
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Toolkit.client != null && Toolkit.client.Connected)
            {
                if (Widgets.ButtonText(rectBtn, "TwitchToolkitReconnect".Translate()))
                {
                    Toolkit.client.Reconnect();
                    Helper.playerMessages = new List <string>();
                    Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>();
                }
            }
            else
            {
                if (Widgets.ButtonText(rectBtn, "TwitchToolkitConnect".Translate()))
                {
                    ToolkitIRC.NewInstance();
                }
            }


            rectBtn.x  = padding;
            rectBtn.y += padding + 28f;

            if (Widgets.ButtonText(rectBtn, "Name Queue"))
            {
                Type type = typeof(QueueWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new QueueWindow();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Viewers"))
            {
                Type type = typeof(Window_Viewers);
                Find.WindowStack.TryRemove(type);

                Window window = new Window_Viewers();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Debug Fix"))
            {
                Helper.playerMessages = new List <string>();
                Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>();
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Tracker"))
            {
                Window_Trackers window = new Window_Trackers();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Commands"))
            {
                Window_Commands window = new Window_Commands();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            //rectBtn.x += btnWidth + padding;
            //if (Widgets.ButtonText(rectBtn, "Socket"))
            //{
            //    Window_SocketClient window = new Window_SocketClient();
            //    Find.WindowStack.TryRemove(window.GetType());
            //    Find.WindowStack.Add(window);
            //}

            //rectBtn.x += btnWidth + padding;
            //if (Widgets.ButtonText(rectBtn, "Badges"))
            //{
            //    TwitchBadges.GetBadgeInfo();
            //}

            var rectMessages = new Rect(padding, rectBtn.height + 36f, inRect.width - (padding * 3), 180f);

            if (Toolkit.client != null)
            {
                Widgets.TextArea(rectMessages, string.Join("\r\n", Toolkit.client.MessageLog), true);
            }

            btnWidth = inRect.width - (padding / 2);
            rectBtn  = new Rect(padding, rectMessages.y + rectMessages.height, btnWidth, btnHeight);
            Widgets.CheckboxLabeled(rectBtn, "TwitchToolkitEarningCoins".Translate(), ref ToolkitSettings.EarningCoins);
        }
예제 #3
0
        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);

            float padding   = 5f;
            float btnWidth  = 100f;
            float btnHeight = 30f;

            var rectBtn = new Rect(padding, 0, btnWidth, btnHeight);

            //if (Widgets.ButtonText(rectBtn, "Chat Window") && !Find.WindowStack.TryRemove(typeof(ChatWindow), true))
            //{
            //    ChatWindow chatwnd = new ChatWindow();
            //    Toolkit.client.activeChatWindow = chatwnd;
            //    Find.WindowStack.Add(chatwnd);
            //}

            //rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Events"))
            {
                Type type = typeof(StoreIncidentsWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new StoreIncidentsWindow();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Items"))
            {
                Type type = typeof(StoreItemsWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new StoreItemsWindow();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Settings"))
            {
                Mod  mod  = LoadedModManager.GetMod(typeof(TwitchToolkit));
                Type type = typeof(SettingsWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new SettingsWindow(mod);
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Name Queue"))
            {
                Type type = typeof(QueueWindow);
                Find.WindowStack.TryRemove(type);

                Window window = new QueueWindow();
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Viewers"))
            {
                Type type = typeof(Window_Viewers);
                Find.WindowStack.TryRemove(type);

                Window window = new Window_Viewers();
                Find.WindowStack.Add(window);
            }

            rectBtn.x  = padding;
            rectBtn.y += padding + 28f;
            if (Widgets.ButtonText(rectBtn, "Debug Fix"))
            {
                Helper.playerMessages = new List <string>();
                Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>();
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Tracker"))
            {
                Window_Trackers window = new Window_Trackers();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            rectBtn.x += btnWidth + padding;
            if (Widgets.ButtonText(rectBtn, "Commands"))
            {
                Window_Commands window = new Window_Commands();
                Find.WindowStack.TryRemove(window.GetType());
                Find.WindowStack.Add(window);
            }

            btnWidth = inRect.width - (padding / 2);
            rectBtn  = new Rect(padding, rectBtn.y + rectBtn.height, btnWidth, btnHeight);
            Widgets.CheckboxLabeled(rectBtn, "TwitchToolkitEarningCoins".Translate(), ref ToolkitSettings.EarningCoins);

            Rect   textBox    = new Rect(rectBtn.x, rectBtn.y + rectBtn.height + padding, rectBtn.width, rectBtn.height * 10);
            string outputText = "";

            foreach (ChatMessage message in lastFiveChatMessages)
            {
                outputText += "\n" + message.Username + ": " + message.Message;
            }

            Widgets.TextArea(textBox, outputText, true);
        }