示例#1
0
 internal static void OnUpdate()
 {
     if (IsInitialized)
     {
         if (was_level_loaded)
         {
             OnLevelWasInitialized(level_loaded_index);
             was_level_loaded   = false;
             level_loaded_index = -1;
         }
         if (Imports.IsIl2CppGame())
         {
             if (IsVRChat)
             {
                 VRChat_CheckUiManager();
             }
             if (!Imports.IsMUPOTMode())
             {
                 CheckForSceneChange();
             }
         }
         if (Mods.Count() > 0)
         {
             foreach (MelonMod mod in Mods)
             {
                 try { mod.OnUpdate(); } catch (Exception ex) { MelonModLogger.LogModError(ex.ToString(), mod.InfoAttribute.Name); }
             }
         }
         if (Imports.IsIl2CppGame() && !Imports.IsMUPOTMode())
         {
             MelonCoroutines.Process();
         }
     }
 }
示例#2
0
 internal static void OnFixedUpdate()
 {
     if (IsInitialized)
     {
         if (Mods.Count() > 0)
         {
             foreach (MelonMod mod in Mods)
             {
                 try { mod.OnFixedUpdate(); } catch (Exception ex) { MelonModLogger.LogModError(ex.ToString(), mod.InfoAttribute.Name); }
             }
         }
         if (Imports.IsIl2CppGame() && !Imports.IsMUPOTMode())
         {
             MelonCoroutines.ProcessWaitForFixedUpdate();
         }
     }
 }
示例#3
0
 internal static void Create()
 {
     if (Imports.IsIl2CppGame())
     {
         if (Imports.IsMUPOTMode())
         {
             CreateComponent();
         }
         else
         {
             Main.OnApplicationStart();
         }
     }
     else
     {
         CreateComponent();
     }
 }
示例#4
0
 public static void Start <T>(T routine)
 {
     if (routine != null)
     {
         if (Imports.IsIl2CppGame() && !Imports.IsMUPOTMode())
         {
             ProcessNextOfCoroutine(new CoroD(typeof(T), routine));
         }
         else
         {
             if (StartCoroutineMethod == null)
             {
                 StartCoroutineMethod = typeof(MonoBehaviour).GetMethods(BindingFlags.Instance | BindingFlags.Public).First(x => (x.Name.Equals("StartCoroutine") && (x.GetParameters().Count() == 1) && (x.GetParameters()[0].GetType() == typeof(IEnumerator))));
             }
             if (StartCoroutineMethod != null)
             {
                 StartCoroutineMethod.Invoke(MelonModComponent.Instance, new object[] { routine });
             }
         }
     }
 }