public static Scene CreateScene(long id, string name, SceneType sceneType, Scene parent = null) { Scene scene = (Scene)Game.ObjectPool.Fetch(typeof(Scene)); scene.Id = id; Game.EventSystem.Remove(scene.InstanceId); // 高14位是进程id scene.InstanceId = IdGenerater.GenerateSceneInstanceId(id); Game.EventSystem.RegisterSystem(scene); if (parent != null) { scene.Parent = parent; } scene.Domain = scene; scene.Name = name; scene.SceneType = sceneType; return(scene); }
protected Object() { Id = IdGenerater.GenerateId(); }
protected Disposer() : base(IdGenerater.GenerateId()) { ObjectEvents.Instance.Add(this); }
protected Component() { this.Id = IdGenerater.GenerateId(); }
protected AChannel(AService service, ChannelType channelType) { this.Id = IdGenerater.GenerateId(); this.ChannelType = channelType; this.service = service; }
protected Entity() { this.Id = IdGenerater.GenerateId(); }
protected Disposer() : base(IdGenerater.GenerateId()) { }
protected Disposer() { this.Id = IdGenerater.GenerateId(); ObjectEvents.Instance.Add(this); }
public virtual async Task <Session> Accept() { AChannel channel = await this.Service.AcceptChannel(); Session session = ComponentFactory.CreateWithId <Session, NetworkComponent, AChannel>(IdGenerater.GenerateId(), this, channel); session.Parent = this; channel.ErrorCallback += (c, e) => { this.Remove(session.Id); }; this.sessions.Add(session.Id, session); return(session); }
/// <summary> /// 创建一个新Session /// </summary> public virtual Session Create(IPEndPoint ipEndPoint) { try { AChannel channel = this.Service.ConnectChannel(ipEndPoint); Session session = ComponentFactory.CreateWithId <Session, NetworkComponent, AChannel>(IdGenerater.GenerateId(), this, channel); session.Parent = this; channel.ErrorCallback += (c, e) => { this.Remove(session.Id); }; this.sessions.Add(session.Id, session); return(session); } catch (Exception e) { Log.Error(e.ToString()); return(null); } }
protected Object() { Id = IdGenerater.GenerateId(); ObjectManager.Add(this); }
protected Entity() { this.Id = IdGenerater.GenerateId(); this.components = new HashSet<Component>(); this.componentDict = new Dictionary<Type, Component>(); }
protected Disposer() { this.Id = IdGenerater.GenerateId(); }
protected Disposer() : base(IdGenerater.GenerateId()) { Game.Disposers.Add(this); }