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); } }
/// <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; } }
/// <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; } }
public void RegisterComponent(ModBase parent) { if (Parent == null) { parent.modules.Add(this); Parent = parent; ExceptionHandler.WriteToLog($"[{Parent.GetType().Name}] Registered {GetType().Name} module.", true); } }
protected ParallelModuleBase(bool runOnServer, bool runOnClient, ModBase parent) : base(runOnServer, runOnClient, parent) { taskPool = new TaskPool(ErrorCallback); }