示例#1
0
        private void LevelActivated(Scene sceneFrom, Scene sceneTo)
        {
            string sceneName = sceneTo.name;

            if (_loadingChar)
            {
                TimeSpan timeSpan  = TimeSpan.FromSeconds(PlayerData.instance.playTime);
                string   text      = string.Format("{0:00}.{1:00}", Math.Floor(timeSpan.TotalHours), timeSpan.Minutes);
                int      profileID = PlayerData.instance.profileID;
                //string saveFilename = GameManager.instance.GetSaveFilename(profileID);
                //DateTime lastWriteTime = File.GetLastWriteTime(Application.persistentDataPath + saveFilename);
                Console.AddLine("New savegame loaded. Profile playtime " + text + " Completion: " + PlayerData.instance.completionPercentage + " Save slot: " + profileID + " Game Version: " + PlayerData.instance.version);// + " Last Written: " + lastWriteTime);

                _loadingChar = false;
            }

            if (GM.IsGameplayScene())
            {
                _loadTime = Time.realtimeSinceStartup;
                Console.AddLine("New scene loaded: " + sceneName);
                EnemiesPanel.Reset();
                PlayerDeathWatcher.Reset();
                BossHandler.LookForBoss(sceneName);
            }
        }
示例#2
0
 public static void RespawnGhost()
 {
     BossHandler.RespawnGhost();
 }
示例#3
0
 public static void RespawnBoss()
 {
     BossHandler.RespawnBoss();
 }
示例#4
0
        public override void Initialize()
        {
            instance = this;

            instance.Log("Initializing");

            float startTime = Time.realtimeSinceStartup;

            instance.Log("Building MethodInfo dict...");

            bindMethods.Clear();
            foreach (MethodInfo method in typeof(BindableFunctions).GetMethods(BindingFlags.Public | BindingFlags.Static))
            {
                object[] attributes = method.GetCustomAttributes(typeof(BindableMethod), false);

                if (attributes.Any())
                {
                    BindableMethod attr = (BindableMethod)attributes[0];
                    string         name = attr.name;
                    string         cat  = attr.category;

                    bindMethods.Add(name, new Pair(cat, method));
                }
            }

            instance.Log("Done! Time taken: " + (Time.realtimeSinceStartup - startTime) + "s. Found " + bindMethods.Count + " methods");

            settings = GlobalSettings;

            if (settings.FirstRun)
            {
                instance.Log("First run detected, setting default binds");

                settings.FirstRun = false;
                settings.binds.Clear();

                settings.binds.Add("Toggle All UI", (int)KeyCode.F1);
                settings.binds.Add("Toggle Info", (int)KeyCode.F2);
                settings.binds.Add("Toggle Menu", (int)KeyCode.F3);
                settings.binds.Add("Toggle Console", (int)KeyCode.F4);
                settings.binds.Add("Force Pause", (int)KeyCode.F5);
                settings.binds.Add("Hazard Respawn", (int)KeyCode.F6);
                settings.binds.Add("Set Respawn", (int)KeyCode.F7);
                settings.binds.Add("Force Camera Follow", (int)KeyCode.F8);
                settings.binds.Add("Toggle Enemy Panel", (int)KeyCode.F9);
                settings.binds.Add("Self Damage", (int)KeyCode.F10);
                settings.binds.Add("Toggle Binds", (int)KeyCode.BackQuote);
                settings.binds.Add("Nail Damage +4", (int)KeyCode.Equals);
                settings.binds.Add("Nail Damage -4", (int)KeyCode.Minus);
                settings.binds.Add("Increase Timescale", (int)KeyCode.KeypadPlus);
                settings.binds.Add("Decrease Timescale", (int)KeyCode.KeypadMinus);
                settings.binds.Add("Toggle Hero Light", (int)KeyCode.Home);
                settings.binds.Add("Toggle Vignette", (int)KeyCode.Insert);
                settings.binds.Add("Zoom In", (int)KeyCode.PageUp);
                settings.binds.Add("Zoom Out", (int)KeyCode.PageDown);
                settings.binds.Add("Reset Camera Zoom", (int)KeyCode.End);
                settings.binds.Add("Toggle HUD", (int)KeyCode.Delete);
                settings.binds.Add("Hide Hero", (int)KeyCode.Backspace);
            }

            UnityEngine.SceneManagement.SceneManager.activeSceneChanged += LevelActivated;
            GameObject UIObj = new GameObject();

            UIObj.AddComponent <GUIController>();
            GameObject.DontDestroyOnLoad(UIObj);

            ModHooks.Instance.SavegameLoadHook    += LoadCharacter;
            ModHooks.Instance.NewGameHook         += NewCharacter;
            ModHooks.Instance.BeforeSceneLoadHook += OnLevelUnload;
            ModHooks.Instance.TakeHealthHook      += PlayerDamaged;
            ModHooks.Instance.ApplicationQuitHook += SaveSettings;

            BossHandler.PopulateBossLists();
            GUIController.Instance.BuildMenus();

            Console.AddLine("New session started " + DateTime.Now);
        }