コード例 #1
0
ファイル: ActorComponent.cs プロジェクト: zj831007/Egametang
        public void Add(ActorMessageInfo info)
        {
            this.queue.Enqueue(info);

            if (this.tcs == null)
            {
                return;
            }

            var t = this.tcs;

            this.tcs = null;
            t.SetResult(this.queue.Dequeue());
        }
コード例 #2
0
ファイル: ActorComponent.cs プロジェクト: zj831007/Egametang
        private async void HandleAsync()
        {
            while (true)
            {
                try
                {
                    ActorMessageInfo info = await this.GetAsync();

                    await this.entityActorHandler.Handle(info.Session, this.Entity, info.Message);
                }
                catch (Exception e)
                {
                    Log.Error(e.ToString());
                }
            }
        }