예제 #1
0
            protected ModuleBase(bool runOnServer, bool runOnClient, ModBase parent)
            {
                this.runOnServer = runOnServer;
                this.runOnClient = runOnClient;

                RegisterComponent(parent);
            }
 /// <summary>
 /// Registers the <see cref="ModBase"/> with the handler if it isn't already registered.
 /// </summary>
 public static void RegisterClient(ModBase client)
 {
     if (!instance.clients.Contains(client))
     {
         instance.clients.Add(client);
         WriteToLog($"[{client.GetType().Name}] Session component registered.", true);
     }
 }
예제 #3
0
            /// <summary>
            /// Used to manually remove object from update queue. This should only be used for objects that
            /// need to be closed while the mod is running.
            /// </summary>
            public void UnregisterComponent(int index)
            {
                if (Parent != null && index < Parent.modules.Count && Parent.modules[index] == this)
                {
                    Parent.modules.RemoveAt(index);

                    ExceptionHandler.WriteToLog($"[{Parent.GetType().Name}] Unregistered {GetType().Name} module.", true);
                    Parent = null;
                }
            }
예제 #4
0
            /// <summary>
            /// Used to manually remove object from update queue. This should only be used for objects that
            /// need to be closed while the mod is running.
            /// </summary>
            public void UnregisterComponent()
            {
                if (Parent != null)
                {
                    Parent.modules.Remove(this);

                    ExceptionHandler.WriteToLog($"[{Parent.GetType().Name}] Unregistered {GetType().Name} module.", true);
                    Parent = null;
                }
            }
예제 #5
0
            public void RegisterComponent(ModBase parent)
            {
                if (Parent == null)
                {
                    parent.modules.Add(this);

                    Parent = parent;
                    ExceptionHandler.WriteToLog($"[{Parent.GetType().Name}] Registered {GetType().Name} module.", true);
                }
            }
예제 #6
0
 protected ParallelModuleBase(bool runOnServer, bool runOnClient, ModBase parent) : base(runOnServer, runOnClient, parent)
 {
     taskPool = new TaskPool(ErrorCallback);
 }