Пример #1
0
        public void DoWindowContents(Rect rect)
        {
            Listing_Standard options      = new Listing_Standard();
            Color            defaultColor = new Color(100, 65, 164);

            options.Begin(rect);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            GUI.color   = Color.magenta;
            options.Label("TwitchToolkitSettingsTitle".Translate());
            GUI.color   = defaultColor;
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            options.GapLine();
            options.Gap();

            options.ColumnWidth = (rect.width / 3) - 20f;

            // Left column
            if (options.ButtonText("TwitchToolkitChat".Translate()))
            {
                currentTab = SettingsTab.Chat;
            }

            if (options.ButtonText("TwitchToolkitCoins".Translate()))
            {
                currentTab = SettingsTab.Coins;
            }

            if (options.ButtonText("Storyteller"))
            {
                currentTab = SettingsTab.Storyteller;
            }

            if (options.ButtonText("Patches"))
            {
                currentTab = SettingsTab.Patches;
            }

            options.Gap();

            if (options.ButtonText("Wiki"))
            {
                Application.OpenURL("https://github.com/hodldeeznuts/twitchtoolkit/wiki");
            }

            // Middle column
            options.NewColumn();
            options.Gap(53f);

            if (options.ButtonText("TwitchToolkitStore".Translate()))
            {
                currentTab = SettingsTab.Store;
            }

            if (options.ButtonText("TwitchToolkitKarma".Translate()))
            {
                currentTab = SettingsTab.Karma;
            }

            if (options.ButtonText("TwitchToolkitCommands".Translate()))
            {
                currentTab = SettingsTab.Commands;
            }

            if (options.ButtonText("TwitchToolkitCooldowns".Translate()))
            {
                currentTab = SettingsTab.Cooldowns;
            }

            // Right Column
            options.NewColumn();
            options.Gap(53f);

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Options;
            }

            if (options.ButtonText("TwitchToolkitViewers".Translate()))
            {
                currentTab = SettingsTab.Viewers;
            }

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Integrations;
            }

            if (options.ButtonText(""))
            {
                currentTab = SettingsTab.Votes;
            }

            options.End();

            Listing_Standard gapline   = new Listing_Standard();
            Rect             gapliRect = new Rect(rect.x, rect.y, rect.width, rect.height);

            gapline.Begin(gapliRect);
            gapline.Gap();
            gapline.End();

            Rect optionsRect = rect;

            optionsRect.y      = 145;
            optionsRect.height = 620f;
            optionsRect.yMax   = 765f;

            Rect scrollViewer = new Rect(optionsRect);

            scrollViewer.height -= 145f;
            scrollViewer.yMax   -= 145f;

            Rect viewRect = new Rect(0, 0, rect.width - 125f, 430f);

            if (currentTab == SettingsTab.Chat)
            {
                viewRect.height += 150f;
            }
            if (currentTab == SettingsTab.Storyteller)
            {
                viewRect.height += 400f;
            }
            if (currentTab == SettingsTab.Karma)
            {
                viewRect.height += 250f;
            }
            if (currentTab == SettingsTab.Viewers)
            {
                viewRect.height += 80f;
            }

            Listing_Standard optionsListing = new Listing_Standard();

            optionsListing.Begin(optionsRect);
            optionsListing.BeginScrollView(scrollViewer, ref scrollVector2, ref viewRect);

            switch (currentTab)
            {
            case SettingsTab.Coins:
                Settings_Coins.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Storyteller:
                Settings_Storyteller.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Patches:
                Settings_Patches.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Store:
                Settings_Store.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Karma:
                Settings_Karma.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Commands:
                Settings_Commands.DoWindowContents(viewRect, optionsListing);
                break;

            case SettingsTab.Cooldowns:
                Settings_Cooldowns.DoWindowContents(viewRect, optionsListing);
                break;

            //case SettingsTab.Options:
            //    Settings_Options.DoWindowContents(viewRect, optionsListing);
            //    break;
            case SettingsTab.Viewers:
                Settings_Viewers.DoWindowContents(viewRect, optionsListing);
                break;

            //case SettingsTab.Integrations:
            //    Settings_Integrations.DoWindowContents(viewRect, optionsListing);
            //    break;
            //case SettingsTab.Votes:
            //    Settings_VoteWeights.DoWindowContents(viewRect, optionsListing);
            //    break;
            default:
                Settings_Chat.DoWindowContents(viewRect, optionsListing);
                break;
            }

            optionsListing.EndScrollView(ref viewRect);
            optionsListing.End();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(inRect);

            Text.Font = GameFont.Medium;
            listing.Label("<color=#4BB543>HodlBot</color> Settings");
            Text.Font = GameFont.Small;

            listing.Gap();

            listing.GapLine();

            listing.Label("HodlBot chooses events from a random category or type. The chance of one of these categories/types being picked is based on weights below. Setting to 0% disables it.");

            listing.Gap();

            string hodlbotMTBDays = Math.Truncate(((double)ToolkitSettings.HodlBotMTBDays * 100) / 100).ToString();

            listing.TextFieldNumericLabeled <float>("Average Days Between Events", ref ToolkitSettings.HodlBotMTBDays, ref hodlbotMTBDays, 0.5f, 10f);

            listing.Gap();

            if (listing.ButtonTextLabeled("Default HodlBot Weights", "Reset Weights"))
            {
                Settings_Storyteller.NewVoteCategoryWeightsHodlBot();
                Settings_Storyteller.NewVoteTypeWeightsHodlBot();
            }

            listing.Gap();

            listing.Label("Random Category Weights");

            listing.Gap();

            List <string> VoteCategoryList      = ToolkitSettings.VoteCategoryWeights.Keys.ToList();
            List <float>  VoteCategoryFloatList = ToolkitSettings.VoteCategoryWeights.Values.ToList();

            int newWeights = 0;

            for (int i = 0; i < VoteCategoryList.Count(); i++)
            {
                string buffer     = VoteCategoryFloatList[i].ToString();
                float  newValue   = VoteCategoryFloatList[i];
                float  percentage = (float)Math.Round((newValue / totalWeightsForCategories) * 100f, 2);
                listing.TextFieldNumericLabeled <float>(VoteCategoryList[i] + " " + percentage + "% - ", ref newValue, ref buffer);

                ToolkitSettings.VoteCategoryWeights[VoteCategoryList[i]] = newValue;
                newWeights += (int)newValue;
            }

            totalWeightsForCategories = newWeights;

            listing.Gap();

            listing.Label("Random Type Weights");

            listing.Gap();

            List <string> VoteTypeList      = ToolkitSettings.VoteTypeWeights.Keys.ToList();
            List <float>  VoteTypeFloatList = ToolkitSettings.VoteTypeWeights.Values.ToList();

            newWeights = 0;

            for (int i = 0; i < VoteTypeList.Count(); i++)
            {
                string buffer     = VoteTypeFloatList[i].ToString();
                float  newValue   = VoteTypeFloatList[i];
                float  percentage = (float)Math.Round((newValue / totalWeightsForKarma) * 100f, 2);
                listing.TextFieldNumericLabeled <float>(VoteTypeList[i] + " " + percentage + "% - ", ref newValue, ref buffer);

                ToolkitSettings.VoteTypeWeights[VoteTypeList[i]] = newValue;
                newWeights += (int)newValue;
            }

            totalWeightsForKarma = newWeights;

            listing.End();
        }
Пример #3
0
        public override void ExposeData()
        {
            Scribe_Values.Look(ref FirstTimeInstallation, "FirstTimeInstallation", true);

            Scribe_Values.Look(ref Channel, "Channel", "");
            Scribe_Values.Look(ref Username, "Username", "");
            Scribe_Values.Look(ref OAuth, "OAuth", "");
            Scribe_Values.Look(ref AutoConnect, "AutoConnect", true);

            Scribe_Values.Look(ref UseSeparateChatRoom, "UseSeparateChatRoom", false);
            Scribe_Values.Look(ref AllowBothChatRooms, "AllowBothChatRooms", false);
            Scribe_Values.Look(ref WhispersGoToChatRoom, "WhispersGoToChatRoom", true);
            Scribe_Values.Look(ref ChannelID, "ChannelID", "");
            Scribe_Values.Look(ref ChatroomUUID, "ChatroomUUID", "");

            Scribe_Values.Look(ref VoteTime, "VoteTime", 2);
            Scribe_Values.Look(ref VoteOptions, "VoteOptions", 3);
            Scribe_Values.Look(ref TimedStorytelling, "TimedStorytelling", false);
            Scribe_Values.Look(ref TimeBetweenStorytellingEvents, "TimeBetweenStorytellingEvents", 10);
            Scribe_Values.Look(ref VotingChatMsgs, "VotingChatMsgs", false);
            Scribe_Values.Look(ref VotingWindow, "VotingWindow", true);
            Scribe_Values.Look(ref VotingWindowx, "VotingWindowx", -1);
            Scribe_Values.Look(ref VotingWindowy, "VotingWindowy", -1);
            Scribe_Values.Look(ref LargeVotingWindow, "LargeVotingWindow", true);

            Scribe_Values.Look(ref StartingBalance, "StartingBalance", 150);
            Scribe_Values.Look(ref CoinInterval, "CoinInterval", 2);
            Scribe_Values.Look(ref CoinAmount, "CoinAmount", 30);
            Scribe_Values.Look(ref MinimumPurchasePrice, "MinimumPurchasePrice", 60);
            Scribe_Values.Look(ref UnlimitedCoins, "UnlimitedCoins", false);

            Scribe_Values.Look(ref EarningCoins, "EarningCoins", true);
            Scribe_Values.Look(ref CustomPricingSheetLink, "CustomPricingSheetLink", "bit.ly/toolkit-list");

            Scribe_Values.Look(ref WhisperCmdsAllowed, "WhisperCmdsAllowed", true);
            Scribe_Values.Look(ref WhisperCmdsOnly, "WhisperCmdsOnly", false);
            Scribe_Values.Look(ref PurchaseConfirmations, "PurchaseConfirmations", true);
            Scribe_Values.Look(ref RepeatViewerNames, "RepeatViewerNames", false);
            Scribe_Values.Look(ref MinifiableBuildings, "MinifiableBuildings", false);

            Scribe_Values.Look(ref SyncStreamElements, "SyncStreamElements", false);
            Scribe_Values.Look(ref AccountID, "AccountID", "");
            Scribe_Values.Look(ref JWTToken, "JWTToken", "");

            Scribe_Values.Look(ref SyncStreamLabs, "SyncStreamLabs", false);

            Scribe_Values.Look(ref StartingKarma, "StartingKarma", 100);
            Scribe_Values.Look(ref KarmaCap, "KarmaCap", 140);
            Scribe_Values.Look(ref BanViewersWhoPurchaseAlwaysBad, "BanViewersWhoPurchaseAlwaysBad", true);
            Scribe_Values.Look(ref KarmaReqsForGifting, "KarmaReqsForGifting", false);
            Scribe_Values.Look(ref MinimumKarmaToRecieveGifts, "MinimumKarmaToRecieveGifts", 33);
            Scribe_Values.Look(ref MinimumKarmaToSendGifts, "MinimumKarmaToSendGifts", 100);
            Scribe_Values.Look(ref KarmaMinimum, "KarmaMinimum", 10);

            Scribe_Values.Look(ref TierOneGoodBonus, "TierOneGoodBonus", 16, true);
            Scribe_Values.Look(ref TierOneNeutralBonus, "TierOneNeutralBonus", 36, true);
            Scribe_Values.Look(ref TierOneBadBonus, "TierOneBadBonus", 24, true);

            Scribe_Values.Look(ref TierTwoGoodBonus, "TierTwoGoodBonus", 10, true);
            Scribe_Values.Look(ref TierTwoNeutralBonus, "TierTwoNeutralBonus", 30, true);
            Scribe_Values.Look(ref TierTwoBadBonus, "TierTwoBadBonus", 20, true);

            Scribe_Values.Look(ref TierThreeGoodBonus, "TierThreeGoodBonus", 10, true);
            Scribe_Values.Look(ref TierThreeNeutralBonus, "TierThreeNeutralBonus", 24, true);
            Scribe_Values.Look(ref TierThreeBadBonus, "TierThreeBadBonus", 18, true);

            Scribe_Values.Look(ref TierFourGoodBonus, "TierFourGoodBonus", 6, true);
            Scribe_Values.Look(ref TierFourNeutralBonus, "TierFourNeutralBonus", 18, true);
            Scribe_Values.Look(ref TierFourBadBonus, "TierFourBadBonus", 12, true);

            Scribe_Values.Look(ref DoomBonus, "DoomBonus", 67, true);

            Scribe_Values.Look(ref ChatReqsForCoins, "ChatReqsForCoins", true);
            Scribe_Values.Look(ref TimeBeforeHalfCoins, "TimeBeforeHalfCoins", 30);
            Scribe_Values.Look(ref TimeBeforeNoCoins, "TimeBeforeNoCoins", 60);

            Scribe_Values.Look(ref KarmaDecay, "KarmaDecay", false);
            Scribe_Values.Look(ref KarmaDecayPeriod, "KarmaDecayPeriod", 5);
            Scribe_Values.Look(ref MaxBadEventsBeforeDecay, "MaxBadEventsBeforeDecay", 0);
            Scribe_Values.Look(ref MaxGoodEventsBeforeDecay, "MaxGoodEventsBeforeDecay", 0);
            Scribe_Values.Look(ref MaxNeutralEventsBeforeDecay, "MaxNeutralEventsBeforeDecay", 0);

            Scribe_Values.Look(ref MaxEvents, "MaxEvents", false);
            Scribe_Values.Look(ref MaxEventsPeriod, "MaxEventsPeriod", 5);
            Scribe_Values.Look(ref MaxBadEventsPerInterval, "MaxBadEventsPerInterval", 3);
            Scribe_Values.Look(ref MaxGoodEventsPerInterval, "MaxGoodEventsPerInterval", 10);
            Scribe_Values.Look(ref MaxNeutralEventsPerInterval, "MaxNeutralEventsPerInterval", 10);
            Scribe_Values.Look(ref MaxCarePackagesPerInterval, "MaxCarePackagesPerInterval", 10);

            Scribe_Values.Look(ref EventsHaveCooldowns, "EventsHaveCooldowns", true);
            Scribe_Values.Look(ref EventCooldownInterval, "EventCooldownInterval", 5);

            Scribe_Collections.Look(ref ViewerColorCodes, "ViewerColorCodes", LookMode.Value, LookMode.Value);
            Scribe_Collections.Look(ref ViewerModerators, "ViewerModerators", LookMode.Value, LookMode.Value);
            Scribe_Collections.Look(ref BannedViewers, "BannedViewers", LookMode.Value);
            Scribe_Collections.Look(ref GloballyBannedViewers, "GloballyBannedViewers", LookMode.Value);
            Scribe_Collections.Look(ref GlobalToolkitMods, "GlobalToolkitMods", LookMode.Value);

            Scribe_Values.Look(ref EnableViewerQueue, "EnableViewerQueue", true);
            Scribe_Values.Look(ref ViewerNamedColonistQueue, "ViewerNamedColonistQueue", true);
            Scribe_Values.Look(ref ChargeViewersForQueue, "ChargeViewersForQueue", false);
            Scribe_Values.Look(ref CostToJoinQueue, "CostToJoinQueue", 0);

            Scribe_Values.Look(ref SubscriberExtraCoins, "SubscriberExtraCoins", 10);
            Scribe_Values.Look(ref SubscriberCoinMultiplier, "SubscriberCoinMultiplier", 1.25f);
            Scribe_Values.Look(ref SubscriberExtraVotes, "SubscriberExtraVotes", 1);

            Scribe_Values.Look(ref VIPExtraCoins, "VIPExtraCoins", 5);
            Scribe_Values.Look(ref VIPCoinMultiplier, "VIPCoinMultiplier", 1.15f);
            Scribe_Values.Look(ref VIPExtraVotes, "VIPExtraVotes", 0);

            Scribe_Values.Look(ref ModExtraCoins, "ModExtraCoins", 3);
            Scribe_Values.Look(ref ModCoinMultiplier, "ModCoinMultiplier", 1.15f);
            Scribe_Values.Look(ref ModExtraVotes, "ModExtraVotes", 0);

            Scribe_Collections.Look(ref VoteWeights, "VoteWeights", LookMode.Value, LookMode.Value);

            Scribe_Values.Look(ref ToryTalkerEnabled, "ToryTalkerEnabled", false);
            Scribe_Values.Look(ref ToryTalkerMTBDays, "ToryTalkerMTBDays", 2);

            Scribe_Values.Look(ref HodlBotEnabled, "HodlBotEnabled", true);
            Scribe_Values.Look(ref HodlBotMTBDays, "HodlBotMTBDays", 1);

            Scribe_Collections.Look(ref VoteTypeWeights, "VoteTypeWeights", LookMode.Value, LookMode.Value);
            Scribe_Collections.Look(ref VoteCategoryWeights, "VoteCategoryWeights", LookMode.Value, LookMode.Value);

            Scribe_Values.Look(ref UristBotEnabled, "UristBotEnabled", false);
            Scribe_Values.Look(ref UristBotMTBDays, "UristBotMTBDays", 6);

            Scribe_Values.Look(ref MilasandraEnabled, "MilasandraEnabled", false);

            Scribe_Values.Look(ref MercuriusEnabled, "MercuriusEnabled", false);

            Scribe_Values.Look(ref CommandsModsEnabled, "CommandsModsEnabled", true);

            Scribe_Collections.Look(ref CustomCommandDefs, "CustomCommandDefs", LookMode.Value);

            Scribe_Values.Look(ref ChatBoxEnabled, "ChatBoxEnabled", false);
            Scribe_Values.Look(ref ChatBoxPositionX, "ChatBoxPositionX", 100);
            Scribe_Values.Look(ref ChatBoxPositionY, "ChatBoxPositionY", 100);

            Scribe_Values.Look(ref ChatBoxMaxWidth, "ChatBoxMaxWidth", 400);
            Scribe_Values.Look(ref ChatBoxMessageCount, "ChatBoxMessageCount", 10);

            List <StoreIncidentVariables> variableIncidents = DefDatabase <StoreIncidentVariables> .AllDefs.Where(s => s.customSettings).ToList();

            foreach (StoreIncidentVariables incident in variableIncidents)
            {
                incident.RegisterCustomSettings();
                incident.settings.ExposeData();
            }

            if (BannedViewers == null || BannedViewers.Count < 1)
            {
                BannedViewers = new List <string>(PubliclyKnownBots);
            }

            if (AutoConnect)
            {
                if (Toolkit.client == null)
                {
                    ToolkitIRC.Reset();
                }
            }

            if (VoteWeights == null || VoteWeights.Count < 1)
            {
                ToolkitSettings.VoteWeights = new Dictionary <string, int>();

                foreach (VotingIncident vote in DefDatabase <VotingIncident> .AllDefs)
                {
                    ToolkitSettings.VoteWeights.Add(vote.defName, 100);
                }
            }
            else
            {
                Settings_VoteWeights.Load_VoteWeights();
            }

            if ((VoteTypeWeights == null || VoteTypeWeights.Count < 1) || (VoteCategoryWeights == null || VoteCategoryWeights.Count < 1))
            {
                Settings_Storyteller.ResetVoteWeights();
            }
        }