Beispiel #1
0
        /// <summary>
        /// 重建房间
        /// </summary>
        /// <param name="room"></param>
        private void ReBuildRoom(RoomEntity room)
        {
            Debug.Log(RoomPaoDeKuaiProxy.Instance.CurrentRoom.Status);
            if (RoomPaoDeKuaiProxy.Instance.CurrentRoom.Status != RoomEntity.RoomStatus.Ready && RoomPaoDeKuaiProxy.Instance.CurrentRoom.Status != RoomEntity.RoomStatus.Settle)
            {
                Begin(room, false, false);
            }

            //====================确认当前游戏状态=====================
            for (int i = 0; i < room.SeatList.Count; ++i)
            {
                //if (room.SeatList[i].Status == SeatEntity.SeatStatus.Fight && room.SeatList[i].Pos == RoomMaJiangProxy.Instance.PlayerSeat.Pos)
                //{

                //    if (RoomMaJiangProxy.Instance.AskPokerGroup != null && RoomMaJiangProxy.Instance.AskPokerGroup.Count > 0)
                //    {
                //        IGameCommand command = new AskOperateCommand(RoomMaJiangProxy.Instance.AskPokerGroup, 0);
                //        MaJiangGameCtrl.Instance.CommandQueue.Enqueue(command);
                //    }

                //}

                if (room.SeatList[i].DisbandState == DisbandState.Agree)
                {
                    PaoDeKuaiGameCtrl.Instance.OpenDisbandView();
                    break;
                }
            }

            RoomPaoDeKuaiProxy.Instance.SendRoomInfoChangeNotify();
        }
        public void SetUI(RoomEntity room)
        {
            m_TextRoomId.SafeSetText(room.roomId.ToString());
            int winerIndex = 0;
            int gold       = 0;

            for (int i = 0; i < room.SeatList.Count; ++i)
            {
                if (room.SeatList[i].Gold > gold)
                {
                    winerIndex = i;
                    gold       = room.SeatList[i].Gold;
                }
            }
            m_TextDateTime.SafeSetText(System.DateTime.Now.ToString(ConstDefine.TIME_FORMAT));


            UIViewManager.Instance.LoadItemAsync(ConstDefine_PaoDeKuai.UIItemNameResult, (GameObject prefab) =>
            {
                for (int i = 0; i < room.SeatList.Count; ++i)
                {
                    GameObject go = Instantiate(prefab);
                    go.SetParent(m_SeatInfoContainer);
                    UIItemPaoDeKuaiResult result = go.GetComponent <UIItemPaoDeKuaiResult>();
                    result.SetUI(room.SeatList[i], winerIndex == i, 0);
                }
            });

            //m_TextBack.SafeSetText(RoomMaJiangProxy.Instance.CurrentRoom.matchId > 0 ? "继续" : "返回");
        }
        /// <summary>
        /// 房间信息变更
        /// </summary>
        /// <param name="obj"></param>
        private void OnRoomInfoChanged(TransferData data)
        {
            RoomEntity room = data.GetValue <RoomEntity>("Room");


            base.ShowLoop(room.currentLoop, room.maxLoop, room.isQuan);
        }
Beispiel #4
0
        /// <summary>
        /// 开局
        /// </summary>
        /// <param name="room">房间信息</param>
        /// <param name="isPlayAnimation">是否播放动画</param>
        /// <param name="isReplay">是否是回放</param>
        public void Begin(RoomEntity room, bool isPlayAnimation, bool isReplay)
        {
            //加载牌墙
            List <PokerCtrl> wall = PrefabManager.Instance.Rebuild(RoomPaoDeKuaiProxy.Instance.CurrentRoom.PokerTotal);

            //发牌
            for (int i = 0; i < room.SeatCount; i++)
            {
                if (room.SeatList[i] == null || room.SeatList[i].PlayerId == 0)
                {
                    continue;
                }

                Debug.Log(string.Format("DrawMaJiang  Pos:{0}  Count:{1}", room.SeatList[i].Pos, room.SeatList[i].pokerList.Count));

                bool isPlayer = room.SeatList[i] == RoomPaoDeKuaiProxy.Instance.PlayerSeat;
                for (int j = 0; j < room.SeatList[i].pokerList.Count; j++)
                {
                    PrefabManager.Instance.DrawPoker(room.SeatList[i].Pos, room.SeatList[i].pokerList[j], isPlayer, true);
                }
                PrefabManager.Instance.SortHandPokers(room.SeatList[i].Pos);
            }



            m_UIScenePaoDeKuaiView.Begin(room.Status, room.SeatList, isPlayAnimation, RoomPaoDeKuaiProxy.Instance.GetSeatBySeatPos(room.SpadesThreePos),
                                         () =>
            {
                SeatEntity seat = RoomPaoDeKuaiProxy.Instance.GetSeatBySeatPos(room.CurrAlreadyPlayPos);
                if (seat != null)
                {
                    PaoDeKuaiGameCtrl.Instance.MockBroadcastPlayPoker(room.CurrAlreadyPlayPos, room.RecentlyPlayPoker.Pokers);
                }
                for (int i = 0; i < room.SeatList.Count; i++)
                {
                    if (room.SeatList[i].Status == SeatEntity.SeatStatus.Operate)
                    {
                        //判断当前操作座位让其出牌
                        PaoDeKuaiGameCtrl.Instance.MockBroadcastSeatOperate(room.SeatList[i].Pos);
                        break;
                    }
                }
            }
                                         );
        }
Beispiel #5
0
 public CreateRoomCommand(RoomEntity room)
 {
     m_Room = room;
 }
        /// <summary>
        /// 房间信息变更
        /// </summary>
        /// <param name="obj"></param>
        private void OnRoomInfoChanged(TransferData data)
        {
            RoomEntity seat = data.GetValue <RoomEntity>("Room");

            //SetWaitLiangXi(seat.Status == RoomEntity.RoomStatus.Show || seat.Status == RoomEntity.RoomStatus.Jiao);
        }