public static ILoadingExtension BeforeOnLevelLoaded(ILoadingExtension loadingExtension)
 {
     Log.Info($"calling {loadingExtension}.OnLevelLoaded()", copyToGameLog: true);
     sw.Reset();
     sw.Start();
     return(loadingExtension);
 }
        public static void SelfDestructCall(ILoadingExtension currentInstance)
        {
            if (currentInstance == null || _selfDestructExecuted) return;

            _selfDestructExecuted = true;
            currentInstance.OnLevelUnloading();
            currentInstance.OnReleased();
        }
Ejemplo n.º 3
0
 public static ILoadingExtension BeforeOnCreated(ILoadingExtension loadingExtension)
 {
     if (ConfigUtil.Config.LogPerModOnCreatedTimes)
     {
         Log.Info($"calling {loadingExtension}.OnCreated()", copyToGameLog: false);
         sw.Reset();
         sw.Start();
     }
     return(loadingExtension);
 }
Ejemplo n.º 4
0
        public static void SelfDestructCall(ILoadingExtension currentInstance)
        {
            if (currentInstance == null || _selfDestructExecuted)
            {
                return;
            }

            _selfDestructExecuted = true;
            currentInstance.OnLevelUnloading();
            currentInstance.OnReleased();
        }
        public static void DestructOldInstances(ILoadingExtension currentInstance)
        {
            var targetType = typeof (SelfDestruct);
            var currentAssemblyName = Assembly.GetAssembly(targetType).GetName().Name;
            var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(
                a => a.GetName().Name == currentAssemblyName);

            foreach (var selfDestructMethod in from assembly in assemblies
                        select assembly.GetTypes().FirstOrDefault(t => t.Name == targetType.Name) 
                        into oldInstance where oldInstance != null && oldInstance != targetType
                            select oldInstance.GetMethod("SelfDestructCall"))
            {
                selfDestructMethod?.Invoke(null, new object[] {currentInstance});
            }
        }
Ejemplo n.º 6
0
        public static void DestructOldInstances(ILoadingExtension currentInstance)
        {
            var targetType          = typeof(SelfDestruct);
            var currentAssemblyName = Assembly.GetAssembly(targetType).GetName().Name;
            var assemblies          = AppDomain.CurrentDomain.GetAssemblies().Where(
                a => a.GetName().Name == currentAssemblyName);

            foreach (var selfDestructMethod in from assembly in assemblies
                     select assembly.GetTypes().FirstOrDefault(t => t.Name == targetType.Name)
                     into oldInstance where oldInstance != null && oldInstance != targetType
                     select oldInstance.GetMethod("SelfDestructCall"))
            {
                selfDestructMethod?.Invoke(null, new object[] { currentInstance });
            }
        }
Ejemplo n.º 7
0
        public static ILoadingExtension BeforeOnLevelLoaded(ILoadingExtension loadingExtension)
        {
            Log.Info($"calling {loadingExtension}.OnLevelLoaded()", copyToGameLog: true);
#if DEBUG
            var asm = loadingExtension.GetType().Assembly;
            var p   = PluginManager.instance.GetPluginsInfo().Single(_p => _p.ContainsAssembly(asm));
            if (p.HasLoadOrder())
            {
                Log.Debug($"loadOrder={p.GetLoadOrder()}", true);
            }
#endif

            sw.Reset();
            sw.Start();
            return(loadingExtension);
        }