Beispiel #1
0
    ///// <summary>
    ///// 更新Room信息
    ///// </summary>
    ///// <param name="room_info"></param>
    //[MethodType(MethodTypeEnum.InvokeForServerRequest)]
    //[CommandID((int)ClientCommand.UpdateRoom)]
    public void UpdateRoom(RoomInfo room_info)
    {
        if (room_info != null)
        {
            room_info.InitSort(UserData.Instance.user.uid);
            bool init = (this.room_info == null);

            this.room_info = room_info;
            UserData.Instance.CorrectTime(room_info.now);
            if (init)
            {
                SendMsg(Event.LoadingUpdate);
                InitGameInfo();
            }

            //准备和发牌状态下需要刷新玩家信息
            if (init || room_info.game_state == GameState.Ready || room_info.game_state == GameState.DealCard)
            {
                InitPlayerInfo();
            }
            //出牌和发牌 结束状态下需要刷新出牌状态
            if ((init && room_info.game_state != GameState.Ready) || room_info.game_state == GameState.Discard || room_info.game_state == GameState.DealCard || room_info.game_state == GameState.GameOver)
            {
                DiscardInit(room_info);
            }
            //发牌状态需要处理发牌动画
            if ((init && room_info.game_state != GameState.Ready) || room_info.game_state == GameState.DealCard)
            {
                StartCoroutine(InitHandCard());
            }
            //游戏结束需要显示结果
            if (room_info.game_state == GameState.GameOver)
            {
                StartCoroutine(ShowResult());
            }
        }
    }