示例#1
0
        private void Dungeon_Update(On.Dungeon.orig_Update orig, Dungeon self)
        {
            orig(self);
            float   increment = (mod.settings as SimpleCheatsSettings).IncrementAmount;
            KeyCode iKey      = (KeyCode)Enum.Parse(typeof(KeyCode), (mod.settings as SimpleCheatsSettings).IndustryKey);

            if (Input.GetKeyDown(iKey))
            {
                mod.Log("Adding: " + increment + " industry!");
                Player.LocalPlayer.AddIndustry(increment);
            }
            KeyCode sKey = (KeyCode)Enum.Parse(typeof(KeyCode), (mod.settings as SimpleCheatsSettings).ScienceKey);

            if (Input.GetKeyDown(sKey))
            {
                mod.Log("Adding: " + increment + " science!");
                Player.LocalPlayer.AddScience(increment);
            }
            KeyCode fKey = (KeyCode)Enum.Parse(typeof(KeyCode), (mod.settings as SimpleCheatsSettings).FoodKey);

            if (Input.GetKeyDown(fKey))
            {
                mod.Log("Adding: " + increment + " food!");
                Player.LocalPlayer.AddFood(increment);
            }
            KeyCode dKey = (KeyCode)Enum.Parse(typeof(KeyCode), (mod.settings as SimpleCheatsSettings).DustKey);

            if (Input.GetKeyDown(dKey))
            {
                mod.Log("Adding: " + increment + " dust!");
                self.AddDust(increment);
            }
        }
示例#2
0
        private void Dungeon_Update(On.Dungeon.orig_Update orig, Dungeon self)
        {
            orig(self);
            float   increment = incrementWrapper.Value;
            KeyCode iKey      = (KeyCode)Enum.Parse(typeof(KeyCode), indKeyWrapper.Value);

            if (Input.GetKeyDown(iKey))
            {
                mod.Log("Adding: " + increment + " industry!");
                Player.LocalPlayer.AddIndustry(increment);
            }
            KeyCode sKey = (KeyCode)Enum.Parse(typeof(KeyCode), sciKeyWrapper.Value);

            if (Input.GetKeyDown(sKey))
            {
                mod.Log("Adding: " + increment + " science!");
                Player.LocalPlayer.AddScience(increment);
            }
            KeyCode fKey = (KeyCode)Enum.Parse(typeof(KeyCode), foodKeyWrapper.Value);

            if (Input.GetKeyDown(fKey))
            {
                mod.Log("Adding: " + increment + " food!");
                Player.LocalPlayer.AddFood(increment);
            }
            KeyCode dKey = (KeyCode)Enum.Parse(typeof(KeyCode), dustKeyWrapper.Value);

            if (Input.GetKeyDown(dKey))
            {
                mod.Log("Adding: " + increment + " dust!");
                self.AddDust(increment);
            }
        }
示例#3
0
        private void Dungeon_Update(On.Dungeon.orig_Update orig, Dungeon self)
        {
            orig(self);
            List <Hero> heroes = Hero.GetAllPlayersActiveRecruitedHeroes();

            if (!CompletedSkip && self.Level == 1 && levelTargetWrapper.Value >= 2 && self.ShipConfig != null && self.RoomCount != 0 && self.StartRoom != null && heroes != null && heroes.Count > 0 && heroes[0] != null && heroes[0].RoomElement != null)
            {
                Room exit = self.StartRoom;

                var method = typeof(Dungeon).GetMethod("SpawnExit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

                if (method.Equals(null))
                {
                    mod.Log("SpawnExit method is null!");
                    return;
                }
                if (Services.GetService <IAudioLayeredMusicService>() == null)
                {
                    // Waiting for music!
                    mod.Log("Music does not exist!");
                    return;
                }

                mod.Log("Calling SpawnExit!");

                method.Invoke(self, new object[] { self.StartRoom });

                mod.Log("Attempting to plug exit and end level immediately!");
                self.NotifyCrystalStateChanged(CrystalState.Unplugged);
                self.ExitRoom = exit;
                //new DynData<Dungeon>(self).Set("ExitRoom", exit);

                mod.Log("Setting heroes to contain crystal and be in exit room!");
                typeof(Hero).GetProperty("HasCrystal").SetValue(heroes[0], true, null);
                //new DynData<Hero>(heroes[0]).Set("HasCrystal", true);
                foreach (Hero h in heroes)
                {
                    h.RoomElement.SetParentRoom(exit);
                    h.WasInExitRoomAtExitTime = true;
                }
                // Must be greater than 0!
                float delay = 1f;
                new DynData <Dungeon>(self).Set("vistoryScreenDisplayDelay", delay);
                mod.Log("Attempting to end level with wait delay of: " + delay);
                self.LevelOver(true);
                self.OnCrystalPlugged();
                CompletedSkip = true;
            }
        }