Example #1
0
        //static LoadOrderMod() => Log.Debug("Static Ctor "   + Environment.StackTrace);
        //public LoadOrderMod() => Log.Debug("Instance Ctor " + Environment.StackTrace);

        public void OnEnabled()
        {
            try {
                Log.Called();
                Util.LoadOrderUtil.ApplyGameLoggingImprovements();

                var args = Environment.GetCommandLineArgs();
                Log.Info("command line args are: " + string.Join(" ", args));

                Log.ShowGap = true;
#if DEBUG
                Log.Buffered = true;
#else
                Log.Buffered = true;
#endif

                //Log.Debug("Testing StackTrace:\n" + new StackTrace(true).ToString(), copyToGameLog: true);
                //KianCommons.UI.TextureUtil.EmbededResources = false;
                //HelpersExtensions.VERBOSE = false;
                //foreach(var p in ColossalFramework.Plugins.PluginManager.instance.GetPluginsInfo()) {
                //    string savedKey = p.name + p.modPath.GetHashCode().ToString() + ".enabled";
                //    Log.Debug($"plugin info: savedKey={savedKey} cachedName={p.name} modPath={p.modPath}");
                //}
                CheckPatchLoader();

                HarmonyHelper.DoOnHarmonyReady(() => {
                    //HarmonyLib.Harmony.DEBUG = true;
                    HarmonyUtil.InstallHarmony(HARMONY_ID, null, null); // continue on error.
                });
                SceneManager.sceneLoaded        += OnSceneLoaded;
                SceneManager.activeSceneChanged += OnActiveSceneChanged;

                LoadingManager.instance.m_introLoaded += LoadOrderUtil.TurnOffSteamPanels;
                LoadingManager.instance.m_introLoaded += CheckPatchLoader;

                LoadOrderUtil.TurnOffSteamPanels();

                bool introLoaded = ContentManagerUtil.IsIntroLoaded;
                if (introLoaded)
                {
                    CacheUtil.CacheData();
                }
                else
                {
                    LoadingManager.instance.m_introLoaded += CacheUtil.CacheData;
                }


                if (!Settings.ConfigUtil.Config.IgnoranceIsBliss)
                {
                    CheckSubsUtil.RegisterEvents();
                }
                Log.Flush();
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Example #2
0
 public static void OnActiveSceneChanged(Scene from, Scene to)
 {
     Log.Info($"OnActiveSceneChanged({from.name}, {to.name})", true);
     Log.Flush();
     if (Helpers.InStartupMenu)
     {
         LoadOrderUtil.TurnOffSteamPanels();
     }
 }