Example #1
0
        static HarmonyPatches()
        {
            if (ToolkitSettings.SyncStreamElements)
            {
                StreamElements.ImportPoints();
            }

            SaveHelper.LoadListOfViewers();

            HarmonyInstance harmony = HarmonyInstance.Create("com.github.harmony.rimworld.mod.twitchtoolkit");

            MethodInfo saveMethod = AccessTools.Method(typeof(Verse.GameDataSaveLoader), "SaveGame");

            HarmonyMethod savePostfix = new HarmonyMethod(typeof(HarmonyPatches).GetMethod("SaveGame_Postfix"));

            harmony.Patch(saveMethod, null, savePostfix, null);
            harmony.Patch(original: AccessTools.Method(type: typeof(LetterMaker), name: "MakeLetter", parameters: new[] { typeof(string), typeof(string), typeof(LetterDef) }), prefix: new HarmonyMethod(type: patchType, name: nameof(AddLastPlayerMessagePrefix)));

            harmony.Patch(
                original: AccessTools.Method(
                    type: typeof(StorytellerUI),
                    name: "DrawStorytellerSelectionInterface"
                    ),
                postfix: new HarmonyMethod(type: patchType, name: nameof(DrawCustomStorytellerInterface)
                                           )
                );
        }
Example #2
0
        static HarmonyPatches()
        {
            if (ToolkitSettings.SyncStreamElements)
                StreamElements.ImportPoints();

            SaveHelper.LoadListOfViewers();

            HarmonyInstance harmony = HarmonyInstance.Create("com.github.harmony.rimworld.mod.twitchtoolkit");

            harmony.Patch(
                    original: AccessTools.Method(
                            type: typeof(GameDataSaveLoader),
                            name: "SaveGame"),
                    postfix: new HarmonyMethod(typeof(HarmonyPatches).GetMethod("SaveGame_Postfix"))
                );

            harmony.Patch(
                    original: AccessTools.Method(
                        type: typeof(LetterMaker), 
                        name: "MakeLetter", 
                        parameters: new[] { typeof(string), typeof(string), typeof(LetterDef) }), 
                    prefix: new HarmonyMethod(type: patchType, name: nameof(AddLastPlayerMessagePrefix))
                );

            harmony.Patch(
                original: AccessTools.Method(
                        type: typeof(StorytellerUI),
                        name: "DrawStorytellerSelectionInterface"),
                    postfix: new HarmonyMethod(type: patchType, name: nameof(DrawCustomStorytellerInterface)
                )
            );

            harmony.Patch(
                    original: AccessTools.Method(
                        type: typeof(GameDataSaveLoader),
                        name: "LoadGame",
                        parameters: new[] { typeof(string) }),
                    postfix: new HarmonyMethod(type: patchType, name: nameof(NewTwitchConnection))
                );

            harmony.Patch(
                original: AccessTools.Method(
                    type: typeof(MapInterface),
                    name: "MapInterfaceOnGUI_BeforeMainTabs"),
                postfix: new HarmonyMethod(type: patchType, name: nameof(ChatMessageReadout))
            );

            //StringBuilder json = new StringBuilder();

            //foreach (ModMetaData modMeta in ModsConfig.ActiveModsInLoadOrder)
            //{
            //    json.Append(modMeta.GetPublishedFileId() + ", ");
            //}

            //Helper.Log(json.ToString());
        }
Example #3
0
        private static void StreamElementsMenu(Rect rect)
        {
            Listing_TwitchToolkit listingStandard = new Listing_TwitchToolkit();

            listingStandard.Begin(rect);
            JWTToken  = listingStandard.TextEntry(JWTToken, 3);
            AccountID = listingStandard.TextEntry(AccountID);

            var inputRect = new Rect(_padding + 140f, _padding + _height * 3, rect.width - (_padding * 2) - 140f, 20f);

            if (Widgets.ButtonText(inputRect, "Import Points"))
            {
                StreamElements element = new StreamElements(AccountID, JWTToken);
                element.ImportPoints();
            }

            listingStandard.End();
        }
Example #4
0
        public static void DoWindowContents(Rect rect, Listing_Standard optionsListing)
        {
            optionsListing.CheckboxLabeled("TwitchToolkitStreamlabsSync".Translate(), ref ToolkitSettings.SyncStreamLabs);

            optionsListing.Gap();

            //optionsListing.CheckboxLabeled("TwitchToolkitStreamelementsSync".Translate(), ref ToolkitSettings.SyncStreamElements);

            optionsListing.Label("Temp Stream Elements - WILL UPDATE LATER");
            if (optionsListing.CenteredButton("TwitchToolkitImportStreamElements".Translate()))
            {
                StreamElements.ImportPoints();
            }

            if (optionsListing.CenteredButton("TwitchToolkitExportStreamElements".Translate()))
            {
                StreamElements.SyncViewerStatsToWeb();
            }
        }