Esempio n. 1
0
        public static void AddMissingRegions(OverWorld self)
        {
            int num          = self.regions[self.regions.Length - 1].firstRoomIndex;
            int regionNumber = self.regions[self.regions.Length - 1].regionNumber + 1;

            foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks)
            {
                foreach (string regionToAdd in CustomWorldMod.installedPacks[keyValues.Key].regions)
                {
                    bool shouldAdd = true;
                    for (int i = 0; i < self.regions.Length; i++)
                    {
                        if (regionToAdd.Equals(self.regions[i].name))
                        {
                            shouldAdd = false;
                        }
                    }
                    if (shouldAdd)
                    {
                        Array.Resize(ref self.regions, self.regions.Length + 1);
                        self.regions[self.regions.Length - 1] = new Region(regionToAdd, num, regionNumber);
                        CustomWorldMod.Log($"Added new region [{regionToAdd}] from [{keyValues.Value}]. " +
                                           $"Number of rooms [{self.regions[self.regions.Length - 1].numberOfRooms}]. Region number [{regionNumber}]");
                        num += self.regions[self.regions.Length - 1].numberOfRooms;
                        regionNumber++;
                    }
                }
            }
        }
Esempio n. 2
0
 private static void OverWorld_LoadWorld(On.OverWorld.orig_LoadWorld orig, OverWorld self, string worldName, int playerCharacterNumber, bool singleRoomWorld)
 {
     CustomWorldMod.Log($"Custom Regions: Loading world. Worldname [{worldName}], using [{textLoadWorld}]. SingleWorld [{singleWorld}]");
     orig(self, textLoadWorld ?? worldName, playerCharacterNumber, singleWorld ?? singleRoomWorld);
     // TEST THIS
     textLoadWorld = null;
     singleWorld   = null;
 }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     OW       = GameObject.Find("OverWorld");
     OWScript = OW.GetComponent <OverWorld>();
     player   = GameObject.Find("PlayerOW");
     target   = GameObject.Find("Level_1");
     player.transform.position = target.transform.position;
 }
 private static void OverWorld_WorldLoaded(On.OverWorld.orig_WorldLoaded orig, OverWorld self)
 {
     orig.Invoke(self);
     if (self.game.session is StoryGameSession)
     {
         KarmaAppetite_ExtraInventory.RecreateSave(self.game.session as StoryGameSession);
         KarmaAppetite_ExtraInventory.ReloadInventories(self.game.session as StoryGameSession);
     }
 }
Esempio n. 5
0
        public void LoadSounds()
        {
            GainOneUp                       = content.Load <SoundEffect>("smb_1-up");
            GainPowerUp                     = content.Load <SoundEffect>("smb_powerup");
            Coin                            = content.Load <SoundEffect>("smb_coin");
            CoinScore                       = content.Load <SoundEffect>("smb_coin_score");
            PowerUpAppears                  = content.Load <SoundEffect>("smb_powerup_appears");
            BlockBump                       = content.Load <SoundEffect>("smb_bump");
            BlockBreaking                   = content.Load <SoundEffect>("smb_breakblock");
            SmallJump                       = content.Load <SoundEffect>("smb_jump-small");
            BigJump                         = content.Load <SoundEffect>("smb_jump-super");
            PowerDown                       = content.Load <SoundEffect>("smb_pipe");
            EnemyStomp                      = content.Load <SoundEffect>("smb_stomp");
            EnemyKick                       = content.Load <SoundEffect>("smb_kick");
            MarioDeath                      = content.Load <SoundEffect>("smb_mariodie");
            Fireball                        = content.Load <SoundEffect>("smb_fireball");
            Flagpole                        = content.Load <SoundEffect>("smb_flagpole");
            LevelClear                      = content.Load <SoundEffect>("smb_stage_clear");
            TimeWarning                     = content.Load <SoundEffect>("smb_warning");
            TimeRunningOutOverworld         = content.Load <SoundEffect>("Overworld_Theme_Fast");
            TimeRunningOutStar              = content.Load <SoundEffect>("Star_Theme_Fast");
            WorldClear                      = content.Load <SoundEffect>("smb_world_clear");
            Fireworks                       = content.Load <SoundEffect>("smb_fireworks");
            GamePause                       = content.Load <SoundEffect>("smb_pause");
            GameOver                        = content.Load <SoundEffect>("smb_gameover");
            LevelComplete                   = content.Load <SoundEffect>("smb_level_complete");
            Star                            = content.Load <SoundEffect>("Star Theme");
            OverWorld                       = content.Load <SoundEffect>("Overworld_Theme");
            Underground                     = content.Load <SoundEffect>("smb_underground");
            YourCodeSucks                   = content.Load <SoundEffect>("YourCodeSucks");
            Laugh                           = content.Load <SoundEffect>("NormalLaugh");
            EvilLaugh                       = content.Load <SoundEffect>("EvilLaugh");
            YoshiSound                      = content.Load <SoundEffect>("YoshiSound");
            EggHatchingSound                = content.Load <SoundEffect>("EggHatchingSound");
            YoshiTongueSound                = content.Load <SoundEffect>("YoshiTongueSound");
            YoshiSwallowSound               = content.Load <SoundEffect>("YoshiSwallowSound");
            Dubstep                         = content.Load <SoundEffect>("Dubstep");
            UndergroundInstance             = Underground.CreateInstance();
            OverWorldInstance               = OverWorld.CreateInstance();
            StarInstance                    = Star.CreateInstance();
            TimeRunningOutOverworldInstance = TimeRunningOutOverworld.CreateInstance();
            TimeRunningOutStarInstance      = TimeRunningOutStar.CreateInstance();
            TimeWarningInstance             = TimeWarning.CreateInstance();
            LevelCompleteInstance           = LevelComplete.CreateInstance();
            GameOverInstance                = GameOver.CreateInstance();
            DubstepInstance                 = Dubstep.CreateInstance();

            TimeWarningInstance.IsLooped = false;
        }
Esempio n. 6
0
        public void PlainWorldTest()
        {
            var generator = new PlainTerrainGeneratorMock();
            var player    = new PlayerMock();
            var world     = new OverWorld(player, generator);

            for (int r = -Preferences.ChunkRenderRadius; r < Preferences.ChunkRenderRadius; r++)
            {
                for (int h = -Preferences.ChunkRenderRadius; h < Preferences.ChunkRenderRadius; h++)
                {
                    var position = new Vector2(r, h);
                    var chunk    = world.GetChunk(position);

                    var x = 0;
                    var y = PlainTerrainGeneratorMock.Height;
                    var z = 0;
                    Assert.That(chunk.Map[x, y, z],
                                Is.EqualTo(PlainTerrainGeneratorMock.Block),
                                $"In chunk {position} in map at [{x}, {y}, {z}]");
                }
            }
        }
Esempio n. 7
0
        private static void OverWorld_LoadFirstWorld(On.OverWorld.orig_LoadFirstWorld orig, OverWorld self)
        {
            textLoadWorld = null;
            singleWorld   = null;

            AddMissingRegions(self);

            bool   flag = false;
            string text = string.Empty;

            if (self.game.IsArenaSession)
            {
                flag = true;
                text = self.game.GetArenaGameSession.arenaSitting.GetCurrentLevel;
            }
            else if (self.game.manager.menuSetup.startGameCondition == ProcessManager.MenuSetup.StoryGameInitCondition.Dev)
            {
                string[] array = File.ReadAllLines(Custom.RootFolderDirectory() + "setup.txt");
                text = Regex.Split(array[0], ": ")[1];
                flag = !self.game.setupValues.world;
            }
            else if (self.game.manager.menuSetup.startGameCondition == ProcessManager.MenuSetup.StoryGameInitCondition.RegionSelect || self.game.manager.menuSetup.FastTravelInitCondition)
            {
                text = self.game.manager.menuSetup.regionSelectRoom;
                flag = false;
            }
            else
            {
                text = (self.game.session as StoryGameSession).saveState.denPosition;
                flag = false;
            }

            if (self.game.startingRoom != string.Empty)
            {
                text = self.game.startingRoom;
            }

            string text2 = Regex.Split(text, "_")[0];

            if (!flag)
            {
                bool flag2 = false;

                // Check vanilla first
                string directory  = Custom.RootFolderDirectory() + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + text2;
                string directory2 = Custom.RootFolderDirectory() + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + Regex.Split(text, "_")[1];

                if (Directory.Exists(directory))
                {
                    flag2 = true;
                }
                else if (Regex.Split(text, "_").Length > 2 && Directory.Exists(directory2))
                {
                    text2 = Regex.Split(text, "_")[1];
                    flag2 = true;
                }

                // Check custom regions
                if (!flag2)
                {
                    text2 = Regex.Split(text, "_")[0];
                    foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks)
                    {
                        string customDirectory = Custom.RootFolderDirectory() + CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + text2;
                        //string customDirectory2 = Custom.RootFolderDirectory() + CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar + "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + Regex.Split(text, "_")[1];
                        CustomWorldMod.Log($"Custom Regions: CustomDirectory [{customDirectory}]");
                        //CustomWorldMod.Log($"Custom Regions: CustomDirectory2 [{customDirectory2}]");
                        if (Directory.Exists(customDirectory))
                        {
                            flag2 = true;
                            break;
                        }
                        else if (Regex.Split(text, "_").Length > 2 && Directory.Exists(directory2))
                        {
                            text2 = Regex.Split(text, "_")[1];
                            flag2 = true;
                            break;
                        }
                    }
                }


                if (!flag2)
                {
                    flag = true;
                }
            }


            // If arena or SetupWorld
            if (flag)
            {
                textLoadWorld = text;
                singleWorld   = true;
            }
            else
            {
                textLoadWorld = text2;
                singleWorld   = false;
            }

            self.FIRSTROOM = text;

            orig(self);
        }
Esempio n. 8
0
        public static void AddMissingRegions(OverWorld self)
        {
            int num          = self.regions[self.regions.Length - 1].firstRoomIndex;
            int regionNumber = self.regions[self.regions.Length - 1].regionNumber + 1;

            foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks)
            {
                foreach (string regionToAdd in CustomWorldMod.installedPacks[keyValues.Key].regions)
                {
                    bool shouldAdd = true;
                    for (int i = 0; i < self.regions.Length; i++)
                    {
                        if (regionToAdd.Equals(self.regions[i].name))
                        {
                            shouldAdd = false;
                        }
                    }
                    if (shouldAdd)
                    {
                        Array.Resize(ref self.regions, self.regions.Length + 1);
                        self.regions[self.regions.Length - 1] = new Region(regionToAdd, num, regionNumber);
                        CustomWorldMod.Log($"Custom Regions: Added new region [{regionToAdd}] from [{keyValues.Value}]. Number of rooms [{self.regions[self.regions.Length - 1].numberOfRooms}]. Region number [{regionNumber}]");
                        num += self.regions[self.regions.Length - 1].numberOfRooms;
                        regionNumber++;
                    }
                }

                /*
                 * string path = CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar + "World" + Path.DirectorySeparatorChar + "Regions";
                 *
                 * if (Directory.Exists(path))
                 * {
                 *  string[] regions = Directory.GetDirectories(path);
                 *  foreach (string regionEach in regions)
                 *  {
                 *      string regionToAdd = Path.GetFileNameWithoutExtension(regionEach);
                 *      if (regionToAdd != keyValues.Key)
                 *      {
                 *          continue;
                 *      }
                 *
                 *      bool shouldAdd = true;
                 *
                 *      for (int i = 0; i < self.regions.Length; i++)
                 *      {
                 *          if (regionToAdd.Equals(self.regions[i].name))
                 *          {
                 *              shouldAdd = false;
                 *          }
                 *      }
                 *      if (shouldAdd)
                 *      {
                 *          Array.Resize(ref self.regions, self.regions.Length + 1);
                 *          self.regions[self.regions.Length - 1] = new Region(regionToAdd, num, regionNumber);
                 *          CustomWorldMod.Log($"Custom Regions: Added new region [{regionToAdd}] from [{keyValues.Value}]. Number of rooms [{self.regions[self.regions.Length - 1].numberOfRooms}]. Region number [{regionNumber}]");
                 *          num += self.regions[self.regions.Length - 1].numberOfRooms;
                 *          regionNumber++;
                 *      }
                 *  }
                 * }
                 */
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Used for debugging purposes
        /// </summary>
        private static Region OverWorld_GetRegion_1(On.OverWorld.orig_GetRegion_1 orig, OverWorld self, string rName)
        {
            CustomWorldMod.Log($"Custom Region: Getting region. AbstractRoom [{rName}]).");

            string debug = "Custom Region: All regions: {";

            for (int i = 0; i < self.regions.Length; i++)
            {
                debug += $" {self.regions[i].name}";
            }
            debug += "}";

            CustomWorldMod.Log(debug);

            return(orig(self, rName));
        }
Esempio n. 10
0
 public void setup()
 {
     ov = new OverWorld(player);
 }
Esempio n. 11
0
 public OverWorldObserver(GameState gameState, OverWorld overWorld)
 {
     this.gameState = gameState;
     this.overWorld = overWorld;
     this.heroes = new List<Hero>();
 }
Esempio n. 12
0
	// Use this for initialization
	void Start () {
		OW = GameObject.Find("OverWorld");
		OWScript = OW.GetComponent<OverWorld>();
		player = GameObject.Find("PlayerOW");
		target = GameObject.Find("Level_1");
		player.transform.position = target.transform.position;
	}
Esempio n. 13
0
 //attaches an observer to look for changes in the gamestate and to tell the current screen the new updates.
 private Screen newWorld()
 {
     OverWorld world = new OverWorld(game);
     observer = new OverWorldObserver(gameState, world);
     gameState.Camera.attachObserver(observer);
     return world;
 }
Esempio n. 14
0
        /// <summary>
        /// Used for debugging purposes
        /// </summary>
        private static Region OverWorld_GetRegion_1(On.OverWorld.orig_GetRegion_1 orig, OverWorld self, string rName)
        {
            CustomWorldMod.Log($"Getting region: [{rName}]).");

            CustomWorldMod.Log($"Loaded regions [{string.Join(", ", self.regions.Select(x => x.name).ToArray())}]");

            return(orig(self, rName));
        }