Beispiel #1
0
        private void OnGUI()
        {
            GUI.skin = guiskin;
            for (int i = 0; i < LoadedMods.Count; i++)
            {
                Mod mod = LoadedMods[i];
                try
                {
                    if (mod.LoadInMenu && !mod.isDisabled)
                    {
                        mod.OnGUI();
                    }
                    else if (Application.loadedLevelName == "GAME" && !mod.isDisabled && allModsLoaded)
                    {
                        mod.OnGUI();
                    }
                }
                catch (Exception e)
                {
                    if (LogAllErrors)
                    {
                        StackFrame frame = new StackTrace(e, true).GetFrame(0);

                        string errorDetails = string.Format("{2}<b>Details: </b>{0} in <b>{1}</b>", e.Message, frame.GetMethod(), Environment.NewLine);
                        ModConsole.Error(string.Format("Mod <b>{0}</b> throw an error!{1}", mod.ID, errorDetails));
                    }
                    UnityEngine.Debug.Log(e);
                }
            }
        }
Beispiel #2
0
        private void OnGUI()
        {
            GUI.skin = guiskin;
            for (int i = 0; i < LoadedMods.Count; i++)
            {
                Mod mod = LoadedMods[i];
                try
                {
                    if (mod.LoadInMenu && !mod.isDisabled)
                    {
                        mod.OnGUI();
                    }
                    else if (Application.loadedLevelName == "GAME" && !mod.isDisabled && allModsLoaded)
                    {
                        mod.OnGUI();
                    }
                }
                catch (Exception e)
                {
                    if (LogAllErrors)
                    {
                        StackFrame frame = new StackTrace(e, true).GetFrame(0);

                        string errorDetails = string.Format("{2}<b>Details: </b>{0} in <b>{1}</b>", e.Message, frame.GetMethod(), Environment.NewLine);
                        ModConsole.Error(string.Format("Mod <b>{0}</b> throw an error!{1}", mod.ID, errorDetails));
                    }
                    UnityEngine.Debug.Log(e);
                    if (allModsLoaded && fullyLoaded)
                    {
                        mod.modErrors++;
                    }
                    if (devMode)
                    {
                        if (mod.modErrors == 30)
                        {
                            ModConsole.Error(string.Format("Mod <b>{0}</b> thrown <b>too many errors</b>!", mod.ID));
                            ModConsole.Error(e.ToString());
                        }
                    }
                    else
                    {
                        if (mod.modErrors > 30)
                        {
                            mod.isDisabled = true;
                            ModConsole.Error(string.Format("Mod <b>{0}</b> has been <b>disabled!</b> Because it thrown too many errors!{1}Report this problem to mod author.", mod.ID, Environment.NewLine));
                        }
                    }
                }
            }
        }
Beispiel #3
0
 internal void ModOnGUI()
 {
     GUI.skin = guiskin;
     for (int i = 0; i < ModMethods[0].Count; i++)
     {
         Mod mod = ModMethods[0][i];
         try { if (!mod.isDisabled && (allModsLoaded || mod.LoadInMenu))
               {
                   mod.OnGUI();
               }
         }
         catch (Exception e) { System.Console.WriteLine(e); }
     }
 }