Ejemplo n.º 1
0
 private static void MenuScene_BuildScene(On.Menu.MenuScene.orig_BuildScene orig, Menu.MenuScene self)
 {
     if (self.sceneID == Menu.MenuScene.SceneID.SleepScreen)
     {
         BuildCustomSleepScene(self);
     }
     else
     {
         orig.Invoke(self);
     }
 }
Ejemplo n.º 2
0
        private static void MenuScene_BuildScene(On.Menu.MenuScene.orig_BuildScene orig, Menu.MenuScene self)
        {
            orig(self);

            if (self.sceneID != MenuScene.SceneID.Empty && (int)self.sceneID > 69)
            {
                CustomWorldMod.Log($"Custom Regions: Building custom scene [{self.sceneID}]");
                string regionID = string.Empty;
                try
                {
                    regionID = Regex.Split(self.sceneID.ToString(), "Landscape_")[1];
                }
                catch (Exception e) { CustomWorldMod.Log($"Error trimming regionID [{self.sceneID}] {e}", true); return; }

                string regionPackFolder = string.Empty;
                try
                {
                    // This might be slow
                    regionPackFolder = CustomWorldMod.installedPacks.FirstOrDefault(x => (x.Value.activated && x.Value.regions.Contains(regionID))).Value.folderName;
                }
                catch (Exception e) { CustomWorldMod.Log($"Error finding regionName [{self.sceneID}] {e}", true); return; }

                string sceneFolder = CRExtras.BuildPath(regionPackFolder, CRExtras.CustomFolder.Scenes, folder: $"Landscape - {regionID}", includeRoot: false);
                CustomWorldMod.Log($"Custom Regions: Searching assets at {sceneFolder}", false, CustomWorldMod.DebugLevel.MEDIUM);
                if (Directory.Exists(sceneFolder))
                {
                    CustomWorldMod.Log($"Custom Regions: Found custom scene [{sceneFolder}]");
                    self.sceneFolder = sceneFolder;
                    BuildCustomRegionScene(self, regionID, sceneFolder);
                }
            }
        }
Ejemplo n.º 3
0
    private static void BuildCustomSleepScene(Menu.MenuScene self)
    {
        if (self is InteractiveMenuScene)
        {
            (self as InteractiveMenuScene).idleDepths = new List <float>();
        }
        Vector2 vector = new Vector2(0f, 0f);
        int     num;

        if (self.menu.manager.currentMainLoop is RainWorldGame)
        {
            num = (self.menu.manager.currentMainLoop as RainWorldGame).StoryCharacter;
        }
        else
        {
            num = self.menu.manager.rainWorld.progression.PlayingAsSlugcat;
        }
        string text = "White";

        if (num != 0)
        {
            text = ((num != 1) ? "Red" : "Yellow");
        }
        self.sceneFolder = string.Concat(new object[]
        {
            "KarmaAppetiteScenes",
            Path.DirectorySeparatorChar,
            "Sleep Screen - ",
            text
        });
        if (self.flatMode)
        {
            self.AddIllustration(new MenuIllustration(self.menu, self, self.sceneFolder, "Sleep Screen - " + text + " - Flat", new Vector2(683f, 384f), false, true));
        }
        else
        {
            self.AddIllustration(new MenuDepthIllustration(self.menu, self, self.sceneFolder, "Sleep - 5", new Vector2(23f, 17f), 3.5f, MenuDepthIllustration.MenuShader.Normal));
            self.AddIllustration(new MenuDepthIllustration(self.menu, self, self.sceneFolder, "Sleep - 4", new Vector2(23f, 17f), 2.8f, MenuDepthIllustration.MenuShader.Normal));
            self.depthIllustrations[self.depthIllustrations.Count - 1].setAlpha = new float?(0.24f);
            self.AddIllustration(new MenuDepthIllustration(self.menu, self, self.sceneFolder, "Sleep - 3", new Vector2(23f, 17f), 2.2f, MenuDepthIllustration.MenuShader.Normal));
            self.AddIllustration(new MenuDepthIllustration(self.menu, self, self.sceneFolder, "Sleep - 2 - " + text, new Vector2(23f, 17f), 1.7f, MenuDepthIllustration.MenuShader.Normal));
            self.AddIllustration(new MenuDepthIllustration(self.menu, self, self.sceneFolder, "Sleep - 1", new Vector2(23f, 17f), 1.2f, MenuDepthIllustration.MenuShader.Normal));
            (self as InteractiveMenuScene).idleDepths.Add(3.3f);
            (self as InteractiveMenuScene).idleDepths.Add(2.7f);
            (self as InteractiveMenuScene).idleDepths.Add(1.8f);
            (self as InteractiveMenuScene).idleDepths.Add(1.7f);
            (self as InteractiveMenuScene).idleDepths.Add(1.6f);
            (self as InteractiveMenuScene).idleDepths.Add(1.2f);
        }

        if (self.sceneFolder.Length >= "KarmaAppetite".Length && self.sceneFolder.Substring(0, "KarmaAppetite".Length) == "KarmaAppetite")
        {
            self.sceneFolder = self.sceneFolder.Remove(0, "KarmaAppetite".Length);
        }

        if (self.sceneFolder != string.Empty && File.Exists(string.Concat(new object[]
        {
            Custom.RootFolderDirectory(),
            Path.DirectorySeparatorChar,
            "Assets",
            Path.DirectorySeparatorChar,
            "Futile",
            Path.DirectorySeparatorChar,
            "Resources",
            Path.DirectorySeparatorChar,
            self.sceneFolder,
            Path.DirectorySeparatorChar,
            "positions.txt"
        })))
        {
            string[] array = File.ReadAllLines(string.Concat(new object[]
            {
                Custom.RootFolderDirectory(),
                Path.DirectorySeparatorChar,
                "Assets",
                Path.DirectorySeparatorChar,
                "Futile",
                Path.DirectorySeparatorChar,
                "Resources",
                Path.DirectorySeparatorChar,
                self.sceneFolder,
                Path.DirectorySeparatorChar,
                "positions.txt"
            }));
            int num2 = 0;
            while (num2 < array.Length && num2 < self.depthIllustrations.Count)
            {
                self.depthIllustrations[num2].pos.x   = float.Parse(Regex.Split(array[num2], ", ")[0]) + vector.x;
                self.depthIllustrations[num2].pos.y   = float.Parse(Regex.Split(array[num2], ", ")[1]) + vector.y;
                self.depthIllustrations[num2].lastPos = self.depthIllustrations[num2].pos;
                num2++;
            }
        }
    }
Ejemplo n.º 4
0
        private static void MenuScene_BuildScene(On.Menu.MenuScene.orig_BuildScene orig, Menu.MenuScene self)
        {
            /* if(self.sceneID == EnumExt_extendedSceneID.CustomSceneID)
             * {
             *   self.sceneID = MenuScene.SceneID.MainMenu;
             * }*/
            orig(self);

            //ID = (MenuScene.SceneID)Enum.Parse(typeof(MenuScene.SceneID), regionName);

            if (self.sceneID != MenuScene.SceneID.Empty && (int)self.sceneID > 69)
            {
                CustomWorldMod.Log($"Custom Regions: Building custom scene [{self.sceneID}]");
                //bool notFound = true;

                /*
                 * foreach (KeyValuePair<string, string> keyValues in CustomWorldMod.loadedRegions)
                 * {
                 * }
                 */
                string regionID = string.Empty;
                try
                {
                    regionID = Regex.Split(self.sceneID.ToString(), "Landscape_")[1];
                }
                catch (Exception e) { CustomWorldMod.Log($"Error trimming regionID [{self.sceneID}] {e}", true); return; }

                string regionName = string.Empty;
                try
                {
                    // This might be slow
                    regionName = CustomWorldMod.installedPacks.FirstOrDefault(x => x.Value.regions.Contains(regionID)).Key;
                }
                catch (Exception e) { CustomWorldMod.Log($"Error finding regionName [{self.sceneID}] {e}", true); return; }

                string path        = CustomWorldMod.resourcePath + regionName + Path.DirectorySeparatorChar;
                string sceneFolder = path + "Assets" + Path.DirectorySeparatorChar + "Futile" + Path.DirectorySeparatorChar +
                                     "Resources" + Path.DirectorySeparatorChar + "Scenes" + Path.DirectorySeparatorChar + $"Landscape - {regionID}" + Path.DirectorySeparatorChar;

                CustomWorldMod.Log($"Custom Regions: Searching assets at {sceneFolder}");
                if (Directory.Exists(sceneFolder))
                {
                    CustomWorldMod.Log($"Custom Regions: Found custom scene [{sceneFolder}]");
                    //notFound = false;
                    self.sceneFolder = sceneFolder;
                    BuildCustomRegionScene(self, regionID, sceneFolder);
                    //break;
                }
            }
        }