private static void RainWorld_Start(On.RainWorld.orig_Start orig, RainWorld self)
        {
            CustomWorldMod.LoadCustomWorldResources();
            CustomWorldMod.rainWorldInstance = self;

            orig(self);
        }
Пример #2
0
        private static void LoadResourcesPatch(On.RainWorld.orig_LoadResources orig, RainWorld self)
        {
            orig(self);

            Futile.atlasManager.LoadAtlas("Atlases" + Path.DirectorySeparatorChar + "arenaIconAtlas");
            Futile.atlasManager.LoadAtlas("Atlases" + Path.DirectorySeparatorChar + "objectAtlas");
        }
Пример #3
0
        private static void StartHK(On.RainWorld.orig_Start orig, RainWorld self)
        {
            mainRW = self;
            try
            {
                if (MonklandSteamManager.instance == null)
                {
                    MonklandSteamManager.CreateManager();
                }
            }
            catch (Exception e)
            {
                Debug.Log(e);
            }

            orig(self);

            if (MonklandSteamManager.DEBUG)
            {
                self.buildType            = BuildType.Development;
                self.setup.devToolsActive = true;
            }
            else
            {
                self.buildType            = BuildType.Development;
                self.setup.devToolsActive = false;
            }
        }
Пример #4
0
        public void Start()
        {
            mainRW = this;
            try
            {
                if (MonklandSteamManager.instance == null)
                {
                    MonklandSteamManager.CreateManager();
                }
            }
            catch (System.Exception e)
            {
                Debug.Log(e);
            }

            orig_Start();
            if (MonklandSteamManager.DEBUG)
            {
                this.buildType       = BuildType.Development;
                setup.devToolsActive = true;
            }
            else
            {
                this.buildType       = BuildType.Development;
                setup.devToolsActive = false;
            }
        }
Пример #5
0
        internal static void ProcessManagerCtor(On.ProcessManager.orig_ctor orig, ProcessManager self, RainWorld rainWorld)
        {
            try
            {
                pm = self;
                rw = rainWorld;
                //if (rw == null) { return; }
                try
                {
                    Initialize();
                }
                catch (Exception ex) { Debug.LogError(ex); Debug.LogException(ex); }
                for (int i = 0; i < dtHistory.Length; i++)
                {
                    dtHistory[i] = 0.016667f;
                }
                init = true;

                ConfigMenu.currentTab = null;
            }
            finally
            {
                orig(self, rainWorld);
            }
        }
Пример #6
0
        public static void Initialize(RainWorld rainworld)
        {
            ModLogger.EnableLogging();
            Debug.Log("---- Rain World Mod Loader Initializing... -----\n");

            // Iterate over mods, load them in order

            string modsPath = Path.Combine(GetGameRootPath(), "Mods");
            var    modDirs  = Directory.GetDirectories(modsPath);

            for (int i = 0; i < modDirs.Length; i++)
            {
                var assembly = LoadModAssemblyFromDirectory(modDirs[i]);
                if (assembly != null)
                {
                    LoadModFromAssembly(assembly);
                }
                else
                {
                    Debug.LogError("Failed to load mod assembly, skipping...");
                }
            }

            Debug.Log("\nLoaded mods:");
            for (int i = 0; i < _loadedMods.Count; i++)
            {
                Debug.Log("" + i + ": " + _loadedMods[i].FullName);
            }

            Debug.Log("\n---- Rain World Mod Loader Done! -----\n");
        }
Пример #7
0
        // Apply modules that must be added late
        private void RainWorld_Start(On.RainWorld.orig_Start orig, RainWorld self)
        {
            // Compatibility fixes (applied over other hooks)
            Compatibility.FancySlugcats.Apply();

            orig(self);
            On.RainWorld.Start -= RainWorld_Start;
        }
Пример #8
0
        private static void RainWorld_Start(On.RainWorld.orig_Start orig, RainWorld self)
        {
            CustomWorldMod.LoadCustomWorldResources();
            CustomWorldMod.rainWorldInstance = self;
            CustomWorldMod.Log($"Assigning RW instance. Null [{CustomWorldMod.rainWorldInstance == null}]", false, CustomWorldMod.DebugLevel.MEDIUM);

            orig(self);
        }
Пример #9
0
        public void Update()
        {
            CheckInputs();

            if (this.rainworldInstance == null)
            {
                this.rainworldInstance = FindObjectOfType <RainWorld>();
                return;
            }
            this.updateTimer -= Time.deltaTime;
            if (this.updateTimer <= 0f)
            {
                this.UpdateLists();
                this.updateTimer = 0.1f;
            }

            CharacterExtender.instance.Update();
        }
Пример #10
0
        public void Start()
        {
            patch_World.firstRoom = true;
            mainRW = this;
            try {
                if (MonklandSteamManager.instance == null)
                {
                    MonklandSteamManager.CreateManager();
                }
            } catch (System.Exception e) {
                Debug.Log(e);
            }


            orig_Start();
            this.buildType       = BuildType.Development;
            setup.devToolsActive = true;
        }
Пример #11
0
        public void Update()
        {
            if (rw == null)
            {
                rw = UnityEngine.Object.FindObjectOfType <RainWorld>();
                pm = rw.processManager;

                if (rw != null)
                {
                    RunModification();
                    AddAtlas();
                }
            }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                //DataManager.EncodeExteriorPNG();
            }
        }
Пример #12
0
 public patch_HUD(FContainer[] fContainers, RainWorld rainWorld, IOwnAHUD owner) : base(fContainers, rainWorld, owner)
 {
 }
Пример #13
0
        /// <summary>
        /// MonoBehavior Update
        /// </summary>
        public void Update()
        {
            if (!init)
            {
                rw = UnityEngine.Object.FindObjectOfType <RainWorld>();
                if (rw == null)
                {
                    return;
                }
                pm = rw.processManager;
                if (pm.upcomingProcess == ProcessManager.ProcessID.MainMenu)
                {
                    try
                    {
                        Initialize();
                    }
                    catch (Exception ex) { Debug.LogError(ex); }
                    init = true;
                }
                ConfigMenu.currentTab = null;
                return;
            }
            if (pm == null)
            {
                rw = UnityEngine.Object.FindObjectOfType <RainWorld>();
                if (rw == null)
                {
                    return;
                }
                pm = rw.processManager;
                return;
            }

            if (pm.currentMainLoop?.ID != ProcessManager.ProcessID.OptionsMenu)
            {
                goto BackgroundUpdate;
            }
            else if (!OptionsMenuPatch.mod)
            {
                return;
            }

            //Option is running
            ConfigMenu.script = this;

            if (ConfigMenu.currentTab != null)
            {
                ConfigMenu.description = "";
                ConfigMenu.menuTab.Update(Time.deltaTime);
                if (soundFill > 0)
                {
                    soundFill--;
                }
                try
                {
                    if (!ConfigMenu.freezeMenu)
                    {
                        ConfigMenu.currentTab.Update(Time.deltaTime);
                    }
                    else
                    {
                        bool h = false;
                        foreach (UIelement element in ConfigMenu.currentTab.items)
                        {
                            if (element.GetType().IsSubclassOf(typeof(UIconfig)))
                            {
                                if ((element as UIconfig).held)
                                {
                                    h = true; element.Update(Time.deltaTime); continue;
                                }
                            }
                        }
                        if (!h)
                        {
                            foreach (UIelement element in ConfigMenu.currentTab.items)
                            {
                                element.Update(Time.deltaTime);
                            }
                        }
                    }
                    ConfigMenu.currentInterface.Update(Time.deltaTime);
                }
                catch (Exception ex)
                { //Update Error Handle!
                    PartialityMod    mod    = ConfigMenu.currentInterface.mod;
                    List <Exception> unload = new List <Exception>();
                    ConfigMenu       menu   = (pm.currentMainLoop as ConfigMenu);
                    foreach (OpTab tab in ConfigMenu.currentInterface.Tabs)
                    {
                        try
                        {
                            tab.Hide();
                            tab.Unload();
                        }
                        catch (Exception ex0) { unload.Add(ex0); }
                    }
                    string fullLog = string.Concat(
                        mod.ModID, " had error in Update(Time.deltaTime)!", Environment.NewLine,
                        ex.ToString());
                    foreach (Exception ex0 in unload)
                    {
                        fullLog += Environment.NewLine + "TabUnloadError: " + ex0.ToString();
                    }

                    UnconfiguableOI newItf = new UnconfiguableOI(mod, new GenericUpdateException(fullLog));
                    loadedInterfaceDict.Remove(mod.ModID);
                    loadedInterfaceDict.Add(mod.ModID, newItf);

                    int index = 0;
                    foreach (KeyValuePair <int, string> item in menu.modList)
                    {
                        if (item.Value == mod.ModID)
                        {
                            index = item.Key; break;
                        }
                    }
                    int i = 0;
                    do
                    {
                        string key = string.Concat(index.ToString("D3") + "_" + i.ToString("D2"));
                        if (tabs.ContainsKey(key))
                        {
                            tabs.Remove(key);
                        }
                        else
                        {
                            break;
                        }
                        i++;
                    } while (i < 100);


                    newItf.Initialize();
                    ConfigMenu.selectedTabIndex = 0;
                    tabs.Add(string.Concat(index.ToString("D3") + "_00"), newItf.Tabs[0]);

                    foreach (UIelement element in newItf.Tabs[0].items)
                    {
                        foreach (MenuObject obj in element.subObjects)
                        {
                            menu.pages[0].subObjects.Add(obj);
                        }
                        menu.pages[0].Container.AddChild(element.myContainer);
                    }
                    newItf.Tabs[0].Show();

                    ConfigMenu.currentInterface = newItf;
                    ConfigMenu.currentTab       = newItf.Tabs[0];

                    (pm.currentMainLoop as ConfigMenu).PlaySound(SoundID.MENU_Error_Ping);
                    (pm.currentMainLoop as ConfigMenu).opened = false;
                    (pm.currentMainLoop as ConfigMenu).OpenMenu();
                }
            }

            return;

BackgroundUpdate:
            //Background running
            if (pm.currentMainLoop?.ID == ProcessManager.ProcessID.IntroRoll)
            {
                return;
            }

            /*
             * foreach (OptionInterface oi in loadedInterfaces)
             * {
             *
             * }
             */
        }
Пример #14
0
 public patch_ProcessManager(RainWorld rainWorld) : base(rainWorld)
 {
 }
Пример #15
0
        /// <summary>
        /// Gets a summary of the content in a SlugBase character's save file.
        /// </summary>
        /// <param name="rainWorld">The current <see cref="RainWorld"/> instance.</param>
        /// <param name="name">The name of the SlugBase character.</param>
        /// <param name="slot">The game's current save slot.</param>
        /// <returns>A summary of the given character's save file.</returns>
        public static SlugcatSelectMenu.SaveGameData GetCustomSaveData(RainWorld rainWorld, string name, int slot)
        {
            if (!HasCustomSaveData(name, slot))
            {
                return(null);
            }

            string saveData = File.ReadAllText(GetSaveFilePath(name, slot));

            List <SaveStateMiner.Target> targets = new List <SaveStateMiner.Target>();

            targets.Add(new SaveStateMiner.Target(">DENPOS", "<svB>", "<svA>", 20));
            targets.Add(new SaveStateMiner.Target(">CYCLENUM", "<svB>", "<svA>", 50));
            targets.Add(new SaveStateMiner.Target(">FOOD", "<svB>", "<svA>", 20));
            targets.Add(new SaveStateMiner.Target(">HASTHEGLOW", null, "<svA>", 20));
            targets.Add(new SaveStateMiner.Target(">REINFORCEDKARMA", "<dpB>", "<dpA>", 20));
            targets.Add(new SaveStateMiner.Target(">KARMA", "<dpB>", "<dpA>", 20));
            targets.Add(new SaveStateMiner.Target(">KARMACAP", "<dpB>", "<dpA>", 20));
            targets.Add(new SaveStateMiner.Target(">HASTHEMARK", null, "<dpA>", 20));
            targets.Add(new SaveStateMiner.Target(">REDEXTRACYCLES", null, "<svA>", 20));
            targets.Add(new SaveStateMiner.Target(">ASCENDED", null, "<dpA>", 20));

            List <SaveStateMiner.Result> results = SaveStateMiner.Mine(rainWorld, saveData, targets);

            SlugcatSelectMenu.SaveGameData saveGameData = new SlugcatSelectMenu.SaveGameData();

            for (int i = 0; i < results.Count; i++)
            {
                string targetName = results[i].name;
                try
                {
                    switch (targetName)
                    {
                    case ">DENPOS":
                        saveGameData.shelterName = results[i].data;
                        break;

                    case ">CYCLENUM":
                        saveGameData.cycle = int.Parse(results[i].data);
                        break;

                    case ">FOOD":
                        saveGameData.food = int.Parse(results[i].data);
                        break;

                    case ">HASTHEGLOW":
                        saveGameData.hasGlow = true;
                        break;

                    case ">REINFORCEDKARMA":
                        saveGameData.karmaReinforced = (results[i].data == "1");
                        break;

                    case ">KARMA":
                        saveGameData.karma = int.Parse(results[i].data);
                        break;

                    case ">KARMACAP":
                        saveGameData.karmaCap = int.Parse(results[i].data);
                        break;

                    case ">HASTHEMARK":
                        saveGameData.hasMark = true;
                        break;

                    case ">REDEXTRACYCLES":
                        saveGameData.redsExtraCycles = true;
                        break;

                    case ">REDSDEATH":
                        saveGameData.redsDeath = true;
                        break;

                    case ">ASCENDED":
                        saveGameData.ascended = true;
                        break;
                    }
                }
                catch (Exception e)
                {
                    Debug.LogException(new Exception($"Failed to parse value from slugbase save (\"{name}\") for \"{targetName}\"!", e));
                }
            }
            return(saveGameData);
        }
Пример #16
0
 public Game()
 {
     this.instance      = UnityEngine.Object.FindObjectOfType <RainWorld>();
     this.rainWorldGame = instance.processManager.currentMainLoop as RainWorldGame;
     this.player        = (rainWorldGame.Players.FirstOrDefault <AbstractCreature>().realizedCreature as Player);
 }
Пример #17
0
 private void RainWorld_Start(On.RainWorld.orig_Start orig, RainWorld self)
 {
     orig(self);
     self.buildType    = RainWorld.BuildType.Development;
     On.Player.Update += Player_Update;
 }
 public patch_PlayerProgression(RainWorld rainWorld, bool tryLoad) : base(rainWorld, tryLoad)
 {
 }
Пример #19
0
 private static void Load(On.RainWorld.orig_LoadResources orig, RainWorld self)
 {
     orig(self);
 }
Пример #20
0
 private static void RainWorld_LoadResources(On.RainWorld.orig_LoadResources orig, RainWorld self)
 {
     Futile.atlasManager.LoadAtlasFromTexture("snowpile", Downpour.snowPileTex);
     Futile.atlasManager.LoadAtlasFromTexture("logo", Downpour.logo);
     Futile.atlasManager.LoadAtlasFromTexture("logo2", Downpour.logo2);
     Futile.atlasManager.LoadAtlasFromTexture("blizzard", Downpour.blizzardTexture);
     Futile.atlasManager.LoadAtlasFromTexture("overlay1", Downpour.overlay1);
     Futile.atlasManager.LoadAtlasFromTexture("overlay2", Downpour.overlay2);
     orig.Invoke(self);
 }