Exemple #1
0
        /// <summary>
        /// 处理改变代开房间状态的通知
        /// </summary>
        /// <param name="msg"></param>
        public void ChangePlayerInsteadMessage(InsteadOpenStatusNotice msg)
        {
            //遍历玩家的没开始的房间的状态
            for (int i = 0; i < OpenRoomInfo_UnStart.Count; i++)
            {
                //找到当前的对应的桌号
                if (OpenRoomInfo_UnStart[i].iTableNum == msg.sTableNum)
                {
                    OpenRoomInfo_UnStart[i].iuserId = msg.iaUserId;

                    //如果四个玩家都已经坐下,修改房间状态
                    bool Status = false;
                    for (int j = 0; j < 4; j++)
                    {
                        if (OpenRoomInfo_UnStart[i].iuserId[j] > 0)
                        {
                            Status = true;
                        }
                        else
                        {
                            Status = false;
                        }
                    }

                    if (Status)
                    {
                        //添加信息到 OpenRoomInfo_Started
                        OpenRoomInfo_UnStart[i].cOpenRoomStatus = 3;
                        OpenRoomInfo_Started.Add(OpenRoomInfo_UnStart[i]);

                        //在这里直接生成一个新的已经开始游戏的房间
                        if (PanelShow)
                        {
                            Debug.LogError("msg.sTableNum:" + msg.sTableNum);
                            GetPointInsteadOpenRoomStatus(msg.sTableNum, 1).Del();
                            UIMainView.Instance.InsteadOpenRoomPanel.SpwanAllRoomStatus(null);
                            UIMainView.Instance.InsteadOpenRoomPanel.SpwanAllRoomStatus(OpenRoomInfo_UnStart[i]);
                        }
                        //移除信息从OpenRoomInfo_UnStart
                        OpenRoomInfo_UnStart.RemoveAt(i);
                        return;
                    }
                    else
                    {
                        if (PanelShow)
                        {
                            //更新玩家界面信息,只更新玩家的桌面玩家数量
                            InsteadOpenMessage room = GetPointInsteadOpenRoomStatus(msg.sTableNum, 1);
                            room.ShowRoomPlayerStatus(msg.iaUserId);
                        }
                        else
                        {
                            OpenRoomInfo_UnStart[i].cOpenRoomStatus = msg.byOpenRoomStatus;
                            OpenRoomInfo_UnStart[i].iuserId         = msg.iaUserId;
                        }
                        return;
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 获取指定的代开房间的按钮
        /// </summary>
        /// <param name="iTableNum"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public InsteadOpenMessage GetPointInsteadOpenRoomStatus(short iTableNum, int status)
        {
            if (iTableNum <= 0)
            {
                return(null);
            }

            InsteadOpenMessage go = null;

            //处理未开始游戏的房间
            if (status == 1)
            {
                InsteadOpenMessage[] AllRoomStatus = UIMainView.Instance.InsteadOpenRoomPanel.CurrentRoomStatus.
                                                     transform.GetComponentsInChildren <InsteadOpenMessage>();

                for (int i = 0; i < AllRoomStatus.Length; i++)
                {
                    if (AllRoomStatus[i].roomInfo == null)
                    {
                        continue;
                    }
                    if (AllRoomStatus[i].roomInfo.iTableNum == iTableNum)
                    {
                        go = AllRoomStatus[i];
                    }
                }
            }
            else
            {
                InsteadOpenMessage[] AllRoomStatus = UIMainView.Instance.InsteadOpenRoomPanel.RacingRoomStatus.
                                                     transform.GetComponentsInChildren <InsteadOpenMessage>();
                for (int i = 0; i < AllRoomStatus.Length; i++)
                {
                    if (AllRoomStatus[i].roomInfo.iTableNum == iTableNum)
                    {
                        go = AllRoomStatus[i];
                    }
                }
            }

            Debug.LogError("玩家代开信息:" + go.GetComponent <InsteadOpenMessage>().roomInfo.iTableNum);

            return(go);
        }
        /// <summary>
        /// 产生玩家所有的代开房间,如果
        /// </summary>
        /// <param name="roomInfo">该房间的信息</param>
        public void SpwanAllRoomStatus(InsteadOpenRoomPanelData.RoomInfo roomInfo)
        {
            int status = -2;    //-1表示没开,0没使用,1已经预订,2等待开始游戏,3已开始游戏

            if (roomInfo == null)
            {
                status = -1;
            }
            else
            {
                status = roomInfo.cOpenRoomStatus;
            }

            //产生的预置体
            GameObject go = null;

            switch (status)
            {
            case -1:
                go = Instantiate(Resources.Load <GameObject>("Lobby/InsteadCreatRoomPanel/UnOpenRoom"));
                break;

            case 0:
            case 1:
            case 2:
                go = Instantiate(Resources.Load <GameObject>("Lobby/InsteadCreatRoomPanel/RoomStatus"));
                break;

            case 3:
                go = Instantiate(Resources.Load <GameObject>("Lobby/InsteadCreatRoomPanel/RacingRoom"));
                break;

            default:
                break;
            }

            //设定父物体
            if (status < 3)
            {
                go.transform.SetParent(CurrentRoomStatus.transform);
            }
            else
            {
                go.transform.SetParent(RacingRoomStatus.transform);
                //设定顺序
                if (status == -1)
                {
                    go.transform.SetSiblingIndex(CurrentRoomStatus.transform.childCount - 1);
                }
            }
            go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0);
            go.transform.localScale    = Vector3.one;

            InsteadOpenMessage roomMessage = go.GetComponent <InsteadOpenMessage>();

            if (roomMessage == null)
            {
                return;
            }

            //更新房间状态的界面
            roomMessage.roomInfo = roomInfo;
        }