Ejemplo n.º 1
0
        public void GetTableList(bool WaitBox = true)
        {
            if (!WaitBox)
            {
                LastSecond = 0;
            }
            float NowSecond = Time.time;

            if (NowSecond - LastSecond < 2f)
            {
                return;
            }
            LastSecond   = NowSecond;
            UsedItemList = new List <TeaTableItem>();
            foreach (Transform child in Grid.transform)
            {
                TeaTableItem item = child.GetComponent <TeaTableItem>();
                UsedItemList.Add(item);
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();
            object obj1 = Code.text;

            dic["id"] = obj1;
            if (TeaState == 1 || TeaState == 2)
            {
                RoomListController.Instance.GetGroupRoomList(dic, GetTeaRoomList, WaitBox);
            }
        }
Ejemplo n.º 2
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);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void AddEmptyTable()
        {
            TeaTableItem item = YxWindowUtils.CreateItem(TableItem, Grid.transform);

            item.SetTableState(TableState.Empty);
        }