public void DoWindowContents(Rect inRect) { Rect helpButton = new Rect(inRect.width - 120f, verticalSpacing, 90f, verticalHeight); if (Widgets.ButtonText(helpButton, "Help")) { Application.OpenURL("https://github.com/hodldeeznuts/ToolkitCore/wiki/Twitch-Chat-Connection"); } Rect channelDetails = new Rect(0f, verticalSpacing, inRect.width / 2f, 64f); Widgets.Label(channelDetails, TCText.BigText("Channel Details")); float sectionVertical = channelDetails.y + (verticalSpacing * 2f); Rect label = new Rect(0f, sectionVertical, 200f, verticalHeight); Widgets.Label(label, "Channel:"); label.y += verticalSpacing; Widgets.Label(label, "Bot Username:"******"OAuth Token:"); Rect input = new Rect(200f, sectionVertical, 200f, verticalHeight); channel_username = Widgets.TextField(input, channel_username); input.y += verticalSpacing; bot_username = Widgets.TextField(input, bot_username); if (channel_username != "") { Rect copyUsername = new Rect(input.x + input.width + 10f, input.y, 210f, verticalHeight); if (Widgets.ButtonText(copyUsername, "Same as Channel")) { bot_username = channel_username; } } input.y += verticalSpacing; Rect oauthToggle = new Rect(input.x + input.width + 10f, input.y, 60f, verticalHeight); if (showOauth) { oauth_token = Widgets.TextField(input, oauth_token); if (Widgets.ButtonText(oauthToggle, "Hide")) { showOauth = !showOauth; } } else { Widgets.Label(input, new string('*', Math.Min(oauth_token.Length, 16))); if (Widgets.ButtonText(oauthToggle, "Show")) { showOauth = !showOauth; } } Rect newToken = new Rect(oauthToggle.x + oauthToggle.width + 10f, input.y, 140f, verticalHeight); if (Widgets.ButtonText(newToken, "New OAuth Token")) { Application.OpenURL("https://www.twitchapps.com/tmi/"); } input.y += verticalSpacing; if (Widgets.ButtonText(input, "Paste from Clipboard")) { oauth_token = GUIUtility.systemCopyBuffer; } // Connection Rect connectionDetails = new Rect(0f, input.y + (verticalSpacing * 2), inRect.width / 2f, 64f); Widgets.Label(connectionDetails, TCText.BigText("Connection")); sectionVertical = connectionDetails.y + (verticalSpacing * 2f); label.y = sectionVertical; input.y = sectionVertical; Widgets.Label(label, "Status:"); Rect connectionButton = new Rect(input.x, input.y + verticalSpacing, input.width, verticalHeight); if (TwitchWrapper.Client != null && TwitchWrapper.Client.IsConnected) { Widgets.Label(input, TCText.ColoredText("Connected", Color.green)); if (Widgets.ButtonText(connectionButton, "Disconnect")) { TwitchWrapper.Client.Disconnect(); } } else { Widgets.Label(input, TCText.ColoredText("Not Connected", Color.red)); if (Widgets.ButtonText(connectionButton, "Connect")) { TwitchWrapper.StartAsync(); } } label.y += verticalSpacing * 3; Widgets.Label(label, "Auto Connect on Startup:"); input.y = label.y; Widgets.Checkbox(input.position, ref connectOnGameStartup); label.y += verticalSpacing; Widgets.Label(label, "Allow Viewers to Whisper:"); input.y = label.y; Widgets.Checkbox(input.position, ref allowWhispers); }
public void DoWindowContents(Rect inRect) { Rect channelDetails = new Rect(0f, verticalSpacing, inRect.width, 64f); Widgets.Label(channelDetails, TCText.BigText("Channel Details")); float sectionVertical = channelDetails.y + (verticalSpacing); Rect label = new Rect(0f, sectionVertical, 250f, verticalHeight); Widgets.Label(label, "Channel:"); label.y += verticalSpacing; Widgets.Label(label, "Bot Username:"******"OAuth Token:"); Rect input = new Rect(250f, sectionVertical, 150f, verticalHeight); channel_username = Widgets.TextField(input, channel_username); input.y += verticalSpacing; bot_username = Widgets.TextField(input, bot_username); input.y += verticalSpacing; Rect oauthToggle = new Rect(input.x + input.width + 10f, input.y, 60f, verticalHeight); if (showOauth) { oauth_token = Widgets.TextField(input, oauth_token); if (Widgets.ButtonText(oauthToggle, "Hide")) { showOauth = !showOauth; } } else { Widgets.Label(input, new string('*', Math.Min(oauth_token.Length, 16))); if (Widgets.ButtonText(oauthToggle, "Show")) { showOauth = !showOauth; } } Rect newToken = new Rect(500f, input.y, 140f, verticalHeight); if (Widgets.ButtonText(newToken, "New OAuth Token")) { Application.OpenURL("https://www.twitchapps.com/tmi/"); } input.y += verticalSpacing; if (Widgets.ButtonText(input, "Paste from Clipboard")) { oauth_token = GUIUtility.systemCopyBuffer; } // Connection Rect connectionDetails = new Rect(0f, input.y + (verticalSpacing), inRect.width, 64f); Widgets.Label(connectionDetails, TCText.BigText("Connection")); sectionVertical = connectionDetails.y + (verticalSpacing); label.y = sectionVertical; input.y = sectionVertical; Widgets.Label(label, "Status:"); Rect connectionButton = new Rect(input.x, input.y + verticalSpacing, input.width, verticalHeight); if (TwitchWrapper.Client != null && TwitchWrapper.Client.IsConnected) { Widgets.Label(input, TCText.ColoredText("Connected", Color.green)); if (Widgets.ButtonText(connectionButton, "Disconnect")) { TwitchWrapper.Client.Disconnect(); } } else { Widgets.Label(input, TCText.ColoredText("Not Connected", Color.red)); if (Widgets.ButtonText(connectionButton, "Connect")) { TwitchWrapper.StartAsync(true); } } label.y += verticalSpacing * 2; float secondMenu = label.y; Widgets.Label(label, "Auto Connect on Startup:"); input.y = label.y; Widgets.Checkbox(input.position, ref connectOnGameStartup); label.y += verticalSpacing * 1; Widgets.Label(label, "Show welcome message:"); input.y = label.y; Widgets.Checkbox(input.position, ref showWelcomeMessage); label.y += verticalSpacing * 1; Widgets.Label(label, "Use whispers as reply:"); input.y = label.y; Widgets.Checkbox(input.position, ref useWhispers); Rect subsMenu = new Rect(350f, secondMenu, 250f, 25f); Widgets.Label(subsMenu, "Subs Only:"); subsMenu.x += 150f; Widgets.Checkbox(subsMenu.position, ref subsOnlyCommands); subsMenu.x -= 150f; subsMenu.y += verticalSpacing; Widgets.Label(subsMenu, "User Timeout:"); subsMenu.x += 150f; //subsMenu.y -= 15f; userCommandTimeout = Widgets.HorizontalSlider(subsMenu, userCommandTimeout, 0f, 20f, false, userCommandTimeout != 0 ? userCommandTimeout + " seconds" : "Timeout disabled", null, null, 1); subsMenu.x -= 150f; subsMenu.y += verticalSpacing; Widgets.Label(subsMenu, "Spammy replies:"); subsMenu.x += 150f; Widgets.Checkbox(subsMenu.position, ref enableSpammyMessages); Rect footer = new Rect(0f, inRect.height - 10f, inRect.width, 20f); Widgets.Label(footer, "Special thanks to hodldeeznuts!"); footer.y += verticalSpacing * 1; Widgets.Label(footer, "Without him this wouldnt be possible!"); }