public IEnumerator PrepareDataForEnterGame(Coroutine coroutine,
                                            RankService _this,
                                            PrepareDataForEnterGameInMessage msg)
 {
     msg.Reply();
     Logger.Info("Enter Game {0} - PrepareDataForEnterGame - 1 - {1}", msg.CharacterId,
                 TimeManager.Timer.ElapsedMilliseconds);
     return(null);
 }
Example #2
0
        public IEnumerator PrepareDataForEnterGame(Coroutine coroutine,
                                                   ChatService _this,
                                                   PrepareDataForEnterGameInMessage msg)
        {
            Logger.Info("Enter Game {0} - PrepareDataForEnterGame - 1 - {1}", msg.CharacterId,
                        TimeManager.Timer.ElapsedMilliseconds);
            //var result = AsyncReturnValue<CharacterController>.Create();
            //var co1 =CoroutineFactory.NewSubroutine(CharacterManager.Instance.GetOrCreateCharacterController, co,msg.CharacterId, new object[] { }, false, result);
            //if (co1.MoveNext())
            //{
            //    yield return co1;
            //}

            //if (result.Value == null)
            //{
            //    msg.Reply((int)ErrorCodes.Error_PrepareEnterGameFailed);
            //    yield break;
            //}

            var characterId = msg.CharacterId;
            var result      = AsyncReturnValue <ChatCharacterController> .Create();

            var co = CoroutineFactory.NewSubroutine(CharacterManager.Instance.GetOrCreateCharacterController, coroutine,
                                                    characterId, new object[] {}, false, result);

            if (co.MoveNext())
            {
                yield return(co);
            }
            var obj = result.Value;

            result.Dispose();
            if (obj == null)
            {
                msg.Reply((int)ErrorCodes.Error_PrepareEnterGameFailed);
                yield break;
            }
            msg.Reply();
        }