Exemple #1
0
        public void OnEnabled()
        {
            Log.InfoFormat(
                "TM:PE enabled. Version {0}, Build {1} {2} for game version {3}.{4}.{5}-f{6}",
                VersionString,
                Assembly.GetExecutingAssembly().GetName().Version,
                BRANCH,
                GAME_VERSION_A,
                GAME_VERSION_B,
                GAME_VERSION_C,
                GAME_VERSION_BUILD);
            Log.InfoFormat(
                "Enabled TM:PE has GUID {0}",
                Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId);

            // check for incompatible mods
            if (UIView.GetAView() != null)
            {
                // when TM:PE is enabled in content manager
                CheckForIncompatibleMods();
            }
            else
            {
                // or when game first loads if TM:PE was already enabled
                LoadingManager.instance.m_introLoaded += CheckForIncompatibleMods;
            }

            // Log Mono version
            Type monoRt = Type.GetType("Mono.Runtime");

            if (monoRt != null)
            {
                MethodInfo displayName = monoRt.GetMethod(
                    "GetDisplayName",
                    BindingFlags.NonPublic | BindingFlags.Static);
                if (displayName != null)
                {
                    Log.InfoFormat("Mono version: {0}", displayName.Invoke(null, null));
                }
            }

            Log._Debug("Scene is " + SceneManager.GetActiveScene().name);

            Instance        = this;
            InGameHotReload = InGame();

            HarmonyHelper.EnsureHarmonyInstalled();

#if DEBUG
            const bool installHarmonyASAP = false; // set true for fast testing
            if (installHarmonyASAP)
            {
                HarmonyHelper.DoOnHarmonyReady(delegate() { Patcher.Create().Install(); });
            }
#endif
        }
Exemple #2
0
        public void OnDisabled()
        {
            Log.Info("TM:PE disabled.");
            LoadingManager.instance.m_introLoaded     -= CheckForIncompatibleMods;
            LocaleManager.eventLocaleChanged          -= Translation.HandleGameLocaleChange;
            Translation.IsListeningToGameLocaleChanged = false; // is this necessary?

            if (InGame() && LoadingExtension.Instance != null)
            {
                //Hot reload Unloading
                LoadingExtension.Instance.OnLevelUnloading();
                LoadingExtension.Instance.OnReleased();
            }
            Instance = null;
        }
Exemple #3
0
        public void OnEnabled()
        {
            Log.InfoFormat(
                "TM:PE enabled. Version {0}, Build {1} {2} for game version {3}.{4}.{5}-f{6}",
                VersionString,
                Assembly.GetExecutingAssembly().GetName().Version,
                BRANCH,
                GAME_VERSION_A,
                GAME_VERSION_B,
                GAME_VERSION_C,
                GAME_VERSION_BUILD);
            Log.InfoFormat(
                "Enabled TM:PE has GUID {0}",
                Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId);

            // check for incompatible mods
            if (UIView.GetAView() != null)
            {
                // when TM:PE is enabled in content manager
                CheckForIncompatibleMods();
            }
            else
            {
                // or when game first loads if TM:PE was already enabled
                LoadingManager.instance.m_introLoaded += CheckForIncompatibleMods;
            }

            // Log Mono version
            Type monoRt = Type.GetType("Mono.Runtime");

            if (monoRt != null)
            {
                MethodInfo displayName = monoRt.GetMethod(
                    "GetDisplayName",
                    BindingFlags.NonPublic | BindingFlags.Static);
                if (displayName != null)
                {
                    Log.InfoFormat("Mono version: {0}", displayName.Invoke(null, null));
                }
            }

            Instance        = this;
            InGameHotReload = InGame();
        }