コード例 #1
0
ファイル: TeaRoomInfo.cs プロジェクト: narakai/chessgame
        void GetTableItem(object msg)
        {
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;

            if (dic.ContainsKey("totalCount"))
            {
                _totalCount = int.Parse(dic["totalCount"].ToString());
            }
            object        obj     = dic["data"];
            List <object> objList = (List <object>)obj;

            foreach (Dictionary <string, object> info in objList)
            {
                TeaRoomInfoItem item     = YxWindowUtils.CreateItem(InfoItem, grid.transform);
                RoomInfoData    roomInfo = new RoomInfoData();
                roomInfo.ParseData(info);
                item.UpdateView(roomInfo);
            }
            grid.Reposition();
            _request = false;
            if (ScrollView != null && _curPageNum == 2)
            {
                ScrollView.ResetPosition();
            }
        }
コード例 #2
0
ファイル: TeaTableItem.cs プロジェクト: narakai/chessgame
 /// <summary>
 /// 消耗显示处理
 /// </summary>
 /// <param name="roomData"></param>
 private void CostShow(RoomInfoData roomData)
 {
     if (CostContainer)
     {
         bool         showState = false;
         EnumCostType costtype  = (EnumCostType)Enum.Parse(typeof(EnumCostType), roomData.GoldType);
         if (costtype != null)
         {
             if (costtype != EnumCostType.TempCoin)
             {
                 showState = true;
                 CostContainer.SetActive(true);
                 if (GoldMin)
                 {
                     GoldMin.text = string.Format(MinLabelForMat, roomData.GoldMin);
                 }
                 if (GoldMax)
                 {
                     GoldMax.text = roomData.GoldMax.ToString();
                 }
                 if (Goldtype)
                 {
                     Goldtype.spriteName = roomData.GoldType;
                 }
             }
         }
         CostContainer.SetActive(showState);
     }
 }
コード例 #3
0
ファイル: TeaRoomInfo.cs プロジェクト: narakai/chessgame
        private void BackHistoryList(object msg)
        {
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;

            if (dic.ContainsKey("totalCount"))
            {
                _totalCount = int.Parse(dic["totalCount"].ToString());
            }
            object        obj     = dic["data"];
            List <object> objList = (List <object>)obj;

            foreach (Dictionary <string, object> info in objList)
            {
                TeaRoomInfoItem item = YxWindowUtils.CreateItem(InfoItem, grid.transform);
                item.SetIndex(_rowIndex++);
                item.TeaId = TeaId;
                item.JieSanBt.SetActive(false);
                RoomInfoData roomInfo = new RoomInfoData();
                roomInfo.ParseData(info, true);
                item.UpdateView(roomInfo);
            }
            grid.Reposition();
            _request = false;
            if (ScrollView != null && _curPageNum == 2)
            {
                ScrollView.ResetPosition();
            }
        }
コード例 #4
0
ファイル: TeaRoomInfo.cs プロジェクト: xinrui5577/roomgame
        void GetTableItem(object msg)
        {
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;
            object        obj     = dic["history"];
            List <object> objList = (List <object>)obj;

            foreach (Dictionary <string, object> info in objList)
            {
                TeaRoomInfoItem item     = YxWindowUtils.CreateItem(InfoItem, grid.transform);
                RoomInfoData    roomInfo = new RoomInfoData();
                roomInfo.ParseData(info);
                item.UpdateView(roomInfo);
            }
            grid.Reposition();
        }
コード例 #5
0
        /// <summary>
        /// 牌桌历史记录数据
        /// </summary>
        /// <param name="msg"></param>
        void GetHistoryTableItem(object msg)
        {
            if (msg == null)
            {
                TableNum = _tableNum;
                return;
            }
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;
            object        obj     = dic["history"];
            List <object> objList = (List <object>)obj;

            foreach (Dictionary <string, object> info in objList)
            {
                TeaTableItem item;
                if (_totalDatas.Count + objList.Count > Grid.transform.childCount)
                {
                    item = YxWindowUtils.CreateItem(TableItem, Grid.transform);
                }
                else
                {
                    item = _usedItemList[0];
                    _usedItemList.RemoveAt(0);
                }
                item.Id       = (_tableNum + 1).ToString();
                item.TeaPanel = this;
                item.SetTableState(TableState.Over);
                RoomInfoData roomInfo = new RoomInfoData();
                roomInfo.ParseData(info);
                if (TeaState == 2)
                {
                    item.CloseBt.SetActive(false);
                }
                item.UpdateView(roomInfo);
                _tableNum++;
            }
            TableNum = _tableNum;
            foreach (TeaTableItem item in _usedItemList)
            {
                if (item != null)
                {
                    DestroyImmediate(item.gameObject);
                }
            }
            if (Grid)
            {
                Grid.Reposition();
            }
        }
コード例 #6
0
ファイル: TeaRoomInfo.cs プロジェクト: xinrui5577/roomgame
        private void BackHistoryList(object msg)
        {
            int RowIndex = 1;
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;
            object        obj     = dic["history"];
            List <object> objList = (List <object>)obj;

            foreach (Dictionary <string, object> info in objList)
            {
                TeaRoomInfoItem item = YxWindowUtils.CreateItem(InfoItem, grid.transform);
                item.SetIndex(RowIndex++);
                item.TeaId = TeaId;
                item.JieSanBt.SetActive(false);
                RoomInfoData roomInfo = new RoomInfoData();
                roomInfo.ParseData(info, true);
                item.UpdateView(roomInfo);
            }
            grid.Reposition();
        }
コード例 #7
0
        void GetTableItem(object msg)
        {
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;
            object        obj     = dic["history"];
            List <object> objList = (List <object>)obj;

            foreach (Dictionary <string, object> info in objList)
            {
                TeaTableItem item;
                if (UsedItemList.Count > 0 && UsedItemList[0] != null)
                {
                    item = UsedItemList[0];
                    UsedItemList.RemoveAt(0);
                }
                else
                {
                    item = YxWindowUtils.CreateItem(TableItem, Grid.transform);
                }
                item.TeaPanel = this;
                item.SetTableState(TableState.Over);
                RoomInfoData roomInfo = new RoomInfoData();
                roomInfo.ParseData(info);
                item.UpdateView(roomInfo);
                TableNum++;
                ItemList.Add(item);
            }
            foreach (TeaTableItem item in UsedItemList)
            {
                if (item != null)
                {
                    Destroy(item.gameObject);
                }
            }
            if (Grid)
            {
                Grid.Reposition();
            }
        }
コード例 #8
0
        public void ChangeTableItemBg(RoomInfoData roomData, UISprite[] emptySeat)
        {
            if (BackGround)
            {
                if (roomData.UserNum <= UserSeats[0])
                {
                    BackGround.spriteName = BgPrefix + UserSeats[0];
                }

                for (int i = 0; i < UserSeats.Count; i++)
                {
                    if (UserSeats[i] < roomData.UserNum && roomData.UserNum <= UserSeats[i + 1])
                    {
                        BackGround.spriteName = BgPrefix + UserSeats[i + 1];
                    }
                }

                for (int i = 0; i < emptySeat.Length; i++)
                {
                    emptySeat[i].gameObject.SetActive(false);
                }
            }
        }
コード例 #9
0
ファイル: TeaTableItem.cs プロジェクト: narakai/chessgame
        protected override void OnFreshView()
        {
            _roomData = GetData <RoomInfoData>();
            if (_roomData == null)
            {
                return;
            }
            TableGameKey = _roomData.GameKey;
            Reset();
            InfoStr        = _roomData.InfoStr;
            RealRoomId     = _roomData.RoomId;
            RoomId.text    = TeaUtil.SubId(_roomData.RoomId);
            GameName.text  = _roomData.GameName;
            GameRound.text = _roomData.GameRound + (_roomData.IsQuan? "圈":"局") + _roomData.LimitGold;
            CostShow(_roomData);
            SetOrderId(Id);
            if (Layout)
            {
                Layout.SetLayoutByNum(_roomData.UserNum);
            }
            if (_roomData.UserNum > 0)
            {
                for (int i = 0; i < EmptySeat.Length; i++)
                {
                    if (_roomData.UserNum > i)
                    {
                        EmptySeat[i].gameObject.SetActive(true);
                    }
                    else
                    {
                        EmptySeat[i].gameObject.SetActive(false);
                    }
                }
            }

            for (int i = 0; i < _roomData.UserInfos.Length; i++)
            {
                if (string.IsNullOrEmpty(_roomData.UserInfos[i].UserName))
                {
                    continue;
                }
                UserNames[i].text = _roomData.UserInfos[i].UserName;
                string url = _roomData.UserInfos[i].Avatar;
                if (!string.IsNullOrEmpty(url))
                {
                    PortraitDb.SetPortrait(url, Avatars[i], 1);
                }
                Avatars[i].gameObject.SetActive(true);
            }
            if (TeaPanel.TableGameKey.Contains(_roomData.GameKey))
            {
                for (int i = 0; i < TeaPanel.TableGameKey.Length; i++)
                {
                    if (_roomData.GameKey == TeaPanel.TableGameKey[i])
                    {
                        ColorSprite.color = TeaPanel.TableColor[i];
                    }
                }
            }
            if (_roomData.Status > 0)
            {
                yxz.SetActive(true);
            }

            if (TeaRoomCtrl)
            {
                TeaRoomCtrl.ChangeTableItemBg(_roomData, EmptySeat);
            }
            if (gameObject.activeInHierarchy)
            {
                StartCoroutine(ShareStateAction.WaitExcuteCalls());
            }
        }
コード例 #10
0
        private void GetTeaRoomList(object msg)
        {
            if (Time.time - _lastGetListTime < 0.1f)
            {
                return;
            }
            if (this == null) //todo 很奇葩,但是真的走里面去了,猜测为:收到消息回调时,当前对象已销毁?,待验证
            {
                YxDebug.LogError("当前对象Teapanel是空的........");
                return;
            }
            _usedItemList.Clear();

            foreach (Transform child in Grid.transform)
            {
                TeaTableItem item = child.GetComponent <TeaTableItem>();
                if (item)
                {
                    _usedItemList.Add(item);
                }
            }

            List <object> dic = (List <object>)msg;

            if (dic != null)
            {
                _totalDatas.AddRange(dic);
                if (dic.Count == _groupRoomsPageSize)
                {
                    var dict = new Dictionary <string, object>();
                    dict["id"] = CurTeaId;
                    dict["p"]  = _currentPage++;
                    RoomListController.Instance.GetGroupRoomList(dict, GetTeaRoomList);
                    return;
                }
                else
                {
                    _currentPage = 0;
                    StopCoroutine("AutoFrash");
                    StartCoroutine("AutoFrash");
                    if (_showLog)
                    {
                        Dictionary <string, object> dic2 = new Dictionary <string, object>();
                        object obj1 = Code.text;
                        dic2["id"] = obj1;
                        Facade.Instance <TwManager>().SendAction("group.historyRoom", dic2, GetHistoryTableItem, false, null, false);
                    }
                }
            }

            _lastGetListTime = Time.time;
            _tableNum        = 0;

            foreach (Dictionary <string, object> dicItem in _totalDatas)
            {
                TeaTableItem item;
                if (_usedItemList.Count > 0 && _usedItemList[0] != null)
                {
                    item = _usedItemList[0];
                    _usedItemList.RemoveAt(0);
                }
                else
                {
                    item = YxWindowUtils.CreateItem(TableItem, Grid.transform);
                }
                if (TeaState == 1)
                {
                    item.SetTableState(TableState.BeforePlay);
                }
                if (TeaState == 2)
                {
                    item.SetTableState(TableState.PlayerBeforPlay);
                }
                item.Id       = (TableNum + 1).ToString();
                item.TeaPanel = this;
                RoomInfoData roomInfo = new RoomInfoData();
                roomInfo.ParseGameServerData(dicItem);
                roomInfo.GameName = string.Format(TableNameFormat, roomInfo.GameName, roomInfo.AnteInfo);
                item.UpdateView(roomInfo);
                _tableNum++;
            }

            if (!_showLog)
            {
                TableNum = _tableNum;
            }
            //            if (TeaState == 2)
            //            {
            Grid.Reposition();
            if (!_showLog)
            {
                foreach (TeaTableItem item in _usedItemList)
                {
                    if (item != null)
                    {
                        DestroyImmediate(item.gameObject);
                    }
                }
            }
        }
コード例 #11
0
        private void GetTeaRoomList(object msg)
        {
            if (Time.time - GetTeaRoomListLast < 0.1f)
            {
                return;
            }
            if (this == null)
            {
                YxDebug.LogError("当前对象Teapanel是空的........");
                return;
            }
            GetTeaRoomListLast = Time.time;
            TableNum           = 0;
            //Grid.transform.DestroyChildren();
            List <object> dic = (List <object>)msg;

            foreach (Dictionary <string, object> dicItem in dic)
            {
                TeaTableItem item;
                if (UsedItemList.Count > 0 && UsedItemList[0] != null)
                {
                    item = UsedItemList[0];
                    UsedItemList.RemoveAt(0);
                }
                else
                {
                    item = YxWindowUtils.CreateItem(TableItem, Grid.transform);
                }
                if (TeaState == 1)
                {
                    item.SetTableState(TableState.BeforePlay);
                }
                if (TeaState == 2)
                {
                    item.SetTableState(TableState.PlayerBeforPlay);
                }

                item.TeaPanel = this;
                RoomInfoData roomInfo = new RoomInfoData();
                roomInfo.ParseGameServerData(dicItem);
                item.UpdateView(roomInfo);
                TableNum++;
                ItemList.Add(item);
            }

            if (TeaState == 1)
            {
                Dictionary <string, object> dic2 = new Dictionary <string, object>();
                object obj1 = Code.text;
                dic2["id"] = obj1;
                Facade.Instance <TwManger>().SendAction("group.historyRoom", dic2, GetTableItem, false, null, false);
            }
            if (TeaState == 2)
            {
                Grid.Reposition();
                foreach (TeaTableItem item in UsedItemList)
                {
                    if (item != null)
                    {
                        Destroy(item.gameObject);
                    }
                }
            }
        }