示例#1
0
        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);
        }
示例#2
0
 protected Object()
 {
     Id = IdGenerater.GenerateId();
 }
示例#3
0
 protected Disposer() : base(IdGenerater.GenerateId())
 {
     ObjectEvents.Instance.Add(this);
 }
示例#4
0
 protected Component()
 {
     this.Id = IdGenerater.GenerateId();
 }
 protected AChannel(AService service, ChannelType channelType)
 {
     this.Id          = IdGenerater.GenerateId();
     this.ChannelType = channelType;
     this.service     = service;
 }
示例#6
0
 protected Entity()
 {
     this.Id = IdGenerater.GenerateId();
 }
示例#7
0
 protected Disposer() : base(IdGenerater.GenerateId())
 {
 }
示例#8
0
 protected Disposer()
 {
     this.Id = IdGenerater.GenerateId();
     ObjectEvents.Instance.Add(this);
 }
示例#9
0
        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);
        }
示例#10
0
 /// <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);
     }
 }
示例#11
0
 protected Object()
 {
     Id = IdGenerater.GenerateId();
     ObjectManager.Add(this);
 }
示例#12
0
文件: Entity.cs 项目: YLiangCode/ET
		protected Entity()
		{
			this.Id = IdGenerater.GenerateId();
			this.components = new HashSet<Component>();
			this.componentDict = new Dictionary<Type, Component>();
		}
示例#13
0
 protected Disposer()
 {
     this.Id = IdGenerater.GenerateId();
 }
示例#14
0
 protected Disposer() : base(IdGenerater.GenerateId())
 {
     Game.Disposers.Add(this);
 }