public static T Create <T, A>(AComponent parent, A a) where T : AComponent { var component = Generate <T>(parent); App.Inst.EventSystem.Awake(component, a); return(component); }
public static T Create <T, A, B, C, D>(AComponent parent, A a, B b, C c, D d) where T : AComponent { var component = Generate <T>(parent); App.Inst.EventSystem.Awake(component, a, b, c, d); return(component); }
public void Destroy(AComponent component) { var iDestroySystems = this.destroySystems[component.GetType()]; if (iDestroySystems == null) { return; } foreach (var iDestroySystem in iDestroySystems) { if (iDestroySystem == null) { continue; } try { iDestroySystem.Run(component); } catch (Exception e) { Log.Error(e); } } }
public void Awake <A, B, C, D>(AComponent component, A a, B b, C c, D d) { var iAwakeSystems = this.awakeSystems[component.GetType()]; if (iAwakeSystems == null) { return; } foreach (var aAwakeSystem in iAwakeSystems) { if (!(aAwakeSystem is IAwakeRun <A, B, C, D> iAwake)) { continue; } try { iAwake.Run(component, a, b, c, d); } catch (Exception e) { Log.Error(e); } } }
public void Awake(AComponent component) { var iAwakeSystems = this.awakeSystems[component.GetType()]; if (iAwakeSystems == null) { return; } foreach (var aAwakeSystem in iAwakeSystems) { if (!(aAwakeSystem is IAwakeRun iAwake)) { continue; } try { iAwake.Run(component); } catch (Exception e) { Log.Error(e); } } }
public AComponent Get(long id) { AComponent component = null; this.allComponents.TryGetValue(id, out component); return(component); }
public void AddComponent(AComponent component) { this.allComponents.Add(component.Id, component); Type type = component.GetType(); if (this.loadSystems.ContainsKey(type)) { this.loaders.Enqueue(component.Id); } if (this.updateSystems.ContainsKey(type)) { this.updates.Enqueue(component.Id); } if (this.startSystems.ContainsKey(type)) { this.starts.Enqueue(component.Id); } if (this.lateUpdateSystems.ContainsKey(type)) { this.lateUpdates.Enqueue(component.Id); } }
private static T Generate <T>(AComponent parent) where T : AComponent { var type = typeof(T); var component = (T)Activator.CreateInstance(type); component.Id = IdGenerateHelper.GenerateComponentId(); component.Parent = parent; App.Inst.EventSystem.AddComponent(component); return(component); }