Beispiel #1
0
        protected override void OnFreshView()
        {
            base.OnFreshView();
            var infoData = Data as Dictionary <string, object>;

            if (infoData != null)
            {
                var gameName = infoData["game_name"].ToString();
                var str      = string.Format("({0})", gameName);
                YxTools.TrySetComponentValue(GameName, str);
                var roomId = infoData["room_id"].ToString().Substring(3, 6);
                YxTools.TrySetComponentValue(RoomId, roomId);
                var gameCreatTime = infoData["create_dt"].ToString();
                YxTools.TrySetComponentValue(GameCreatTime, gameCreatTime);
                var infos     = infoData["overinfo"];
                var infoLists = infos as List <object>;
                if (infoLists != null)
                {
                    foreach (var infoList in infoLists)
                    {
                        var infoDic = infoList as Dictionary <string, object>;
                        if (infoDic != null)
                        {
                            var item = YxWindowUtils.CreateItem(MahPlayerHeadItem, MahPlayerHeadGrid.transform);
                            item.UpdateView(infoDic);
                        }
                    }
                    MahPlayerHeadGrid.repositionNow = true;
                }
            }
        }
Beispiel #2
0
        protected override void OnFreshView()
        {
            if (!IsShow())
            {
                return;
            }
            var gdata = App.GetGameData <SlyzGameData>();

            if (gdata == null)
            {
                return;
            }
            YxWindowUtils.CreateMonoParent(GridPrefab, ref _curGrid);
            var gridTs = _curGrid.gameObject.transform;
            var list   = gdata.StartData.CardStatistics;
            var len    = list.Count;

            for (var i = 0; i < len; i++)
            {
                var item = YxWindowUtils.CreateItem(ItemPrefab, gridTs);
                item.UpdateView(list[i]);
            }
            _curGrid.repositionNow = true;
            if (ScrollView != null)
            {
                ScrollView.ResetPosition();
            }
        }
Beispiel #3
0
        protected override void OnFreshView()
        {
            base.OnFreshView();
            if (Data is string) // 比赛类型
            {
                var param = new Dictionary <string, object>();
                param["type"] = Data.ToString();
                CurTwManager.SendAction(ActionName, param, UpdateView);
                return;
            }
            YxWindowUtils.CreateMonoParent(PrefabGridAdapter, ref _gridAdapter);
            //数据
            var dict = GetData <Dictionary <string, object> >();

            if (dict == null)
            {
                return;
            }
            List <object> list = null;

            if (dict.Parse("list", ref list))
            {
                FreshItems(list);
            }
        }
Beispiel #4
0
 private void DealContent()
 {
     RankItemView.RankType = RankTypes;
     if (_curTabData != null)
     {
         RankItemView.ItemNotice = _curTabData.Notice;
     }
     RankItemView.TotalCount = _data.RankCount;
     if (ShowPanel)
     {
         SpringPanel.Begin(ShowPanel.gameObject, Vector3.zero, int.MaxValue);
     }
     YxWindowUtils.CreateItemGrid(GridPrefab, ref _itemGrid);
     foreach (var rankItemData in _data.RankDatas)
     {
         RankItemView item = YxWindowUtils.CreateItem(PrefabItem, _itemGrid.transform);
         item.UpdateView(rankItemData);
     }
     _itemGrid.repositionNow = true;
     if (SelfRankItem == null)
     {
         return;
     }
     SelfRankItem.UpdateView(_data.SelfRankDatas);
 }
Beispiel #5
0
        protected override void OnFreshView()
        {
            if (!IsShow())
            {
                return;
            }
            var gdata = App.GetGameData <SlyzGameData>();

            if (gdata == null)
            {
                return;
            }
            // 先删除上次添加的ITEM
            YxWindowUtils.CreateMonoParent(GridPrefab, ref _curGrid, ScrollView.transform);
            var gridTs = _curGrid.transform;
            // 本次添加ITEM
            var pList = gdata.PrizeList;
            var len   = pList.Count;

            for (var i = 0; i < len; i++)
            {
                var prefItem = YxWindowUtils.CreateItem(PrizeItemPrefab, gridTs);
                prefItem.UpdateView(pList[i]);
            }

            _curGrid.repositionNow = true;
            _curGrid.Reposition();
            ScrollView.ResetPosition();
        }
        public void Init(List <FriendItemData> list, string roomId)
        {
            if (list.Count != 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    //有多余的预制体
                    if (mItemCache.Count - 1 >= i)
                    {
                        mItemCache[i].gameObject.SetActive(true);
                        mItemCache[i].Init(list[i], roomId);
                    }
                    else
                    {
                        InviteFriendItem temp = YxWindowUtils.CreateItem(Item, Parent);
                        if (temp != null)
                        {
                            temp.Init(list[i], roomId);
                            mItemCache.Add(temp);
                        }
                    }
                }
            }

            Meg.gameObject.SetActive(list.Count == 0);
        }
Beispiel #7
0
        private void UpdateViewData(object msg)
        {
            YxWindowUtils.CreateMonoParent(ItemGridPrefab, ref _itemGrid);
            var info = msg as Dictionary <string, object>;

            if (info == null)
            {
                return;
            }
            var data = info.ContainsKey("data") ? info["data"] : null;
            var list = data as List <object>;

            if (list == null || list.Count < 1)
            {
                if (NoDataSign != null)
                {
                    NoDataSign.SetActive(true);
                }
                return;
            }
            if (NoDataSign != null)
            {
                NoDataSign.SetActive(false);
            }
            OnSetItems(list, _itemGrid);
        }
Beispiel #8
0
        protected override void OnFreshView()
        {
            base.OnFreshView();

            YxWindowUtils.CreateMonoParent(GridPrefab, ref _gridprefGrid);
            var data = App.GetGameData <BjlGameData>().TrendConfig;
            var list = data.HistoryData;

            if (list == null)
            {
                return;
            }

            if (Inverted)
            {
                for (int i = list.Count - 1; i >= 0; i--)
                {
                    CreateItem(list[i]);
                }
            }
            else
            {
                foreach (var item in list)
                {
                    CreateItem(item);
                }
            }

            _gridprefGrid.Reposition();
        }
Beispiel #9
0
        protected override void OnFreshView()
        {
            YxWindowUtils.CreateMonoParent(GridPrefab, ref Grid);
            var resultCtrl = App.GetGameManager <BrnnGameManager>().ResultListCtrl;
            var list       = resultCtrl.HistoryData;

            if (list == null)
            {
                return;
            }

            if (Inverted)
            {
                for (int i = list.Count - 1; i >= 0; i--)
                {
                    CreateItem(list[i]);
                }
            }
            else
            {
                foreach (var data in list)
                {
                    CreateItem(data);
                }
            }

            Grid.repositionNow = true;
            Grid.Reposition();
        }
Beispiel #10
0
        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();
            }
        }
Beispiel #11
0
        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();
            }
        }
Beispiel #12
0
        protected override void OnFreshView()
        {
            UpUserInfo();
            base.OnFreshView();
            var back = UserInfoModel.Instance.BackPack;
            var keys = back.GetKeys();

            YxWindowUtils.CreateMonoParent(ItemGridPerfab, ref _itemGrid);
            var ts = _itemGrid.transform;

            foreach (var key in keys)
            {
                var count = back.GetItem(key);
                if (count < 1)
                {
                    continue;
                }
                var item = YxWindowUtils.CreateItem(ItemPerfab, ts);
                item.UpdateView();
            }
            if (_itemGrid is YxNguiGrid)
            {
                var iGrid = _itemGrid as YxNguiGrid;
                iGrid.Makeup();
            }
            _itemGrid.repositionNow = true;
            _itemGrid.Reposition();
        }
Beispiel #13
0
        protected override void OnFreshView()
        {
            var goodsDict = GetData <Dictionary <string, object> >();

            YxWindowUtils.CreateMonoParent(GridPerfab, ref _goodsgrid, null, "goodsContainer");
            if (goodsDict == null)
            {
                return;
            }
            if (!goodsDict.ContainsKey("goods"))
            {
                return;
            }
            var type  = goodsDict.ContainsKey("type") ? goodsDict["type"].ToString() : "";
            var goods = goodsDict["goods"] as Dictionary <string, object>;

            if (goods == null)
            {
                return;
            }
            var gridTs = _goodsgrid.transform;

            foreach (var keyValue in goods)
            {
                var item = YxWindowUtils.CreateItem(ItemViewPerfab, gridTs);
                item.Id = type;
                item.UpdateView(keyValue.Value);
            }
            _goodsgrid.Reposition();
        }
Beispiel #14
0
        public void OnRejoin(object data)
        {
            View.SetActive(true);
            var hupData = (ISFSObject)data;
            var time    = hupData.GetLong("time");
            var hup     = hupData.GetUtfString("hup");
            var selfId  = hupData.GetUtfString("userId");

            string[] ids = hup.Split(',');

            for (int i = 0; i < _players.Length; i++)
            {
                var item = YxWindowUtils.CreateItem(JlGameHupUpItem, JlGameHupUpGrid.transform);
                item.SetItemView(_players[i].Info.AvatarX, _players[i].Info.SexI, false, _players[i].Info.NickM);
                for (int j = 0; j < ids.Length; j++)
                {
                    if (selfId.Equals(ids[j]))
                    {
                        AgreeBtn.SetActive(false);
                        RefuseBtn.SetActive(false);
                    }
                    if (_players[i].Info.UserId.Equals(ids[j]))
                    {
                        item.ChangeIcon();
                    }
                }
            }

            JlGameHupUpGrid.repositionNow = true;

            StartCoroutine(CuntDownTime((int)time));
        }
        /// <summary>
        /// 创建组
        /// </summary>
        /// <param name="groupData">标签</param>
        /// <param name="pts"></param>
        /// <param name="callBack"></param>
        /// <param name="pos"></param>
        private NguiView CreateGroup(GroupData groupData, Transform pts, Action <object> callBack, Vector3 pos = default(Vector3))
        {
            var groupView = YxWindowUtils.CreateItem(GroupViewPerfab, pts, pos);

            groupView.UpdateViewWithCallBack(groupData, callBack);
            return(groupView);
        }
Beispiel #16
0
        public override void OnTableClick(YxTabItem tableView)
        {
            if (!tableView.GetToggle().value)
            {
                return;
            }

            YxWindowUtils.CreateItemParent(ContainerTs, ref _containerTs, ContainerTs.parent);
            var tdata = tableView.GetData <TabData>();

            if (tdata == null)
            {
                return;
            }
            if (NameInView != null)
            {
                NameInView.text = tdata.Name;
            }
            var gk       = tdata.Data.ToString();
            var rulePath = App.RuleListPath;
            var ruleName = string.Format("{0}_{1}", rulePath, gk);
            var pfb      = ResourceManager.LoadAsset(rulePath, ruleName, ruleName);

            if (pfb == null)
            {
                return;
            }
            var content = YxWindowUtils.CreateGameObject(pfb, _containerTs);
            var widget  = content.GetComponent <UIWidget>();

            widget.SetAnchor(_containerTs.gameObject, 0, 0, 0, 0);
            UpOrder();
        }
Beispiel #17
0
        protected void UpdateTabs(IList <TabData> tabDatas)
        {
            if (TabelGridPerfab == null)
            {
                return;
            }
            YxWindowUtils.CreateMonoParent(TabelGridPerfab, ref _tabGrid);
            var count  = tabDatas.Count;
            var gridTs = _tabGrid.transform;

            _tabItems.Clear();
            for (var i = 0; i < count; i++)
            {
                if ((TabSatate & (1 << i)) == 0)
                {
                    continue;
                }
                var data = tabDatas[i];
                var item = YxWindowUtils.CreateItem(PerfabTableItem, gridTs);
                item.UpdateView(data);
                item.name    = i.ToString(CultureInfo.InvariantCulture);
                _tabItems[i] = item;
            }
            if (TabsView != null)
            {
                TabsView.localScale = _tabItems.Count < 2 ? new Vector3(0, 1, 1) : Vector3.one;
            }
            StartCoroutine(SelectFirst());
            _tabGrid.repositionNow = true;
            _tabGrid.Reposition();
        }
Beispiel #18
0
        private void TabItemClick(YxTabItem tableView)
        {
            YxWindowUtils.CreateItemParent(ContainerTs, ref _containerTs, ContainerTs.parent);
            var tdata = tableView.GetData <TabData>();

            if (tdata == null)
            {
                return;
            }
            if (NameInView != null)
            {
                NameInView.text = tdata.Name;
            }
            var gk         = tdata.Data.ToString();
            var prefix     = App.Skin.GameInfo;
            var ruleName   = string.Format("rulelist_{0}", gk);
            var namePrefix = string.Format("{0}_{1}", prefix, gk);
            var bundleName = string.Format("{0}/{1}", namePrefix, ruleName);
            var pfb        = ResourceManager.LoadAsset(prefix, bundleName, ruleName);

            if (pfb == null)
            {
                return;
            }
            var content = YxWindowUtils.CreateGameObject(pfb, _containerTs);
            var widget  = content.GetComponent <UIWidget>();

            if (widget)
            {
                widget.SetAnchor(_containerTs.gameObject, 0, 0, 0, 0);
            }
            UpOrder();
        }
Beispiel #19
0
        protected override void InitViews()
        {
            ClearBufferView();
            var rowData = GetData <ItemRowData>();

            if (rowData == null || rowData.Parent.ViewIsHide(rowData.Id))
            {
                CallBack(IdCode);
                return;
            }
            YxWindowUtils.CreateItemParent(RowContainer, ref _rowContainer, transform);
            var rowX         = rowData.X;
            var rowY         = rowData.Y;
            var containerPos = _rowContainer.localPosition;

            if (!float.IsNaN(rowX))
            {
                containerPos.x = rowX;
            }
            if (!float.IsNaN(rowY))
            {
                containerPos.y = rowY;
            }
            _rowContainer.localPosition = containerPos;
            var rowItems  = rowData.Items;
            var dataCount = rowItems.Count;

            CreateNewView(0, dataCount, rowItems, _rowContainer);
            if (BufferViewCount < 1)
            {
                OnFreshLayout();
            }
        }
Beispiel #20
0
        public void OnResultShow(object data)
        {
            RoomTime.text = string.Format("对战时间{0}",
                                          DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
            Result.SetActive(true);
            if (data is List <ResultData> )
            {
                var resultDatas = data as List <ResultData>;
                for (int i = 0; i < resultDatas.Count; i++)
                {
                    var resultItem = YxWindowUtils.CreateItem(ResultItem, ResultGrid.transform);
                    resultItem.SetData(resultDatas[i]);
                    _gdata.GetPlayerInfo(resultDatas[i].Seat, true).CoinA += resultDatas[i].Win;
                    if (resultDatas[i].IsYouSelf)
                    {
                        if (resultDatas[i].Win > 0)
                        {
                            WinEffect.SetActive(true);
                            PortraitDb.SetPortrait(resultDatas[i].Head, UserHead, resultDatas[i].Sex);
                            UserHead.gameObject.SetActive(true);
                            LoseEffect.SetActive(false);
                        }
                        else
                        {
                            LoseEffect.SetActive(true);
                            WinEffect.SetActive(false);
                            UserHead.gameObject.SetActive(false);
                        }
                    }
                }

                ResultGrid.repositionNow = true;
            }
        }
Beispiel #21
0
        protected override void OnFreshView()
        {
            if (Data == null)
            {
                return;
            }
            var groupData = Data as GroupData;

            if (groupData == null)
            {
                return;
            }
            if (TabTagLabel != null)
            {
                var groupName = groupData.Name;
                TabTagLabel.text = string.IsNullOrEmpty(groupName) || groupName == "none" ? "" : groupName;
                if (groupData.NameWidth > 0)
                {
                    TabTagLabel.overflowMethod = UILabel.Overflow.ShrinkContent;
                    TabTagLabel.width          = groupData.NameWidth;
                }
                else
                {
                    TabTagLabel.overflowMethod = UILabel.Overflow.ResizeFreely;
                }
            }
            var listData = groupData.RowDatas;// pair.Value as IList;

            if (listData == null)
            {
                return;
            }
            var gridTs = RowViewGrid.transform;
            var count  = listData.Count;

            if (RuleRowViewPrefab == null)
            {
                return;
            }
            ReadyRepaint(count);
            for (var i = 0; i < count; i++)
            {
                var rowData = listData[i];
                if (rowData == null)
                {
                    continue;
                }
                Transform rowContainer = null;
                YxWindowUtils.CreateItemParent(RowContainer, ref rowContainer, gridTs);
                var rowView = YxWindowUtils.CreateItem(RuleRowViewPrefab, rowContainer);
                if (_Line != null)
                {
                    var line = rowView.gameObject.AddChild(_Line);
                    line.SetActive(true);
                }
                _curViewList.Add(rowView);
                rowView.UpdateViewWithCallBack(rowData, FreshRowsView);
            }
        }
Beispiel #22
0
 private YxView GetChildView(int index)
 {
     if (Grid.transform.childCount <= index)
     {
         return(YxWindowUtils.CreateItem(DetailItem, Grid.transform));
     }
     return(Grid.transform.GetChild(index).GetComponent <YxView>());
 }
 protected override void OnDisable()
 {
     base.OnDisable();
     YxWindowUtils.DisplayUI(HideUIs);
     RoomIdLabel.text = "";
     RoomAction.text  = "输入麻将馆号";
     _roomState       = 0;
 }
Beispiel #24
0
        protected override void OnFreshView()
        {
            YxWindowUtils.CreateMonoParent(ItemGridPrefab, ref _itemGrid);
            var dict = Data as IDictionary;

            if (dict == null)
            {
                return;
            }
            _roomId = dict.Contains("room_id") ? dict["room_id"].ToString() : "";
            if (RoomId != null)
            {
                RoomId.text = _roomId;
            }
            if (Round != null)
            {
                Round.text = dict.Contains("round") ? dict["round"].ToString() : "";
            }
            if (BetAnte != null)
            {
                BetAnte.text = dict.Contains("betAnte") ? dict["betAnte"].ToString() : "";
            }
            if (GameType != null)
            {
                GameType.text = dict.Contains("gameType") ? dict["gameType"].ToString() : "";
            }
            _gameKey  = dict.Contains("game_key_c") ? dict["game_key_c"].ToString() : "";
            _function = dict.Contains("function") ? dict["function"].ToString() : "";
            if (CreateDt != null)
            {
                CreateDt.text = dict.Contains("create_dt") ? dict["create_dt"].ToString() : "----/--/-- --:--:--";
            }
            if (DetialBtn.GetComponent <UIButton>().onClick.Count == 0)
            {
                DetialBtn.GetComponent <UIButton>().onClick.Add(new EventDelegate(OnDetialBtn));
            }
            if (!dict.Contains("overinfo"))
            {
                return;
            }
            if (!(dict["overinfo"] is List <object>))
            {
                return;
            }
            var infoLists = dict["overinfo"] as List <object>;

            foreach (var infoList in infoLists)
            {
                if (!(infoList is Dictionary <string, object>))
                {
                    continue;
                }
                var infoData = infoList as Dictionary <string, object>;
                var item     = YxWindowUtils.CreateItem(NnRecordItem, _itemGrid.transform);
                item.UpdateView(infoData);
            }
            _itemGrid.repositionNow = true;
        }
Beispiel #25
0
        private void OnFreshRoomInfo(object data)
        {
            if (data == null)
            {
                return;
            }
            while (RoomInfoGrid.transform.childCount > 0)
            {
                DestroyImmediate(RoomInfoGrid.transform.GetChild(0).gameObject);
            }
            if (!(data is List <object>))
            {
                return;
            }

            var dataInfos = data as List <object>;

            foreach (var dataInfo in dataInfos)
            {
                if (!(dataInfo is Dictionary <string, object>))
                {
                    continue;
                }
                var rInfo    = dataInfo as Dictionary <string, object>;
                var userNum  = 0;
                var id       = rInfo.ContainsKey("id") ? rInfo["id"].ToString() : "";
                var rndId    = rInfo.ContainsKey("rndId") ? rInfo["rndId"].ToString() : "";
                var gameName = rInfo.ContainsKey("name") ? rInfo["name"].ToString() : "";
                var gamekey  = rInfo.ContainsKey("gamekey") ? rInfo["gamekey"].ToString() : "";
                var round    = rInfo.ContainsKey("round") ? rInfo["round"].ToString() : "";
                var capacity = rInfo.ContainsKey("capacity") ? rInfo["capacity"].ToString() : "";
                var status   = rInfo.ContainsKey("status") ? rInfo["status"].ToString() : "";
                var users    = rInfo.ContainsKey("users") ? rInfo["users"] : null;
                var ante     = rInfo.ContainsKey("ante") ? rInfo["ante"].ToString() : "1";
                if (users is List <object> )
                {
                    var userNames = users as List <object>;
                    userNum += userNames.Count(userName => (string)userName != "");
                }
                var avatars          = rInfo.ContainsKey("avatars") ? rInfo["avatars"].ToString() : "";
                var info             = rInfo.ContainsKey("info") ? rInfo["info"].ToString() : "";
                var currentRound     = string.Format("{0}/{1}", status, round);
                var currentUserCount = string.Format("{0}/{1}", userNum, capacity);
                var obj = YxWindowUtils.CreateGameObject(CreateRoomListItem.gameObject, RoomInfoGrid.transform);
                obj.name = id;
                obj.GetComponent <CreateRoomListItem>().InitData(rndId, info, ante, currentRound, currentUserCount, gamekey);
                var joinRoom = UIEventListener.Get(obj);
                joinRoom.onClick   = OnJoinRoom;
                joinRoom.parameter = obj;
                var weiChat = UIEventListener.Get(obj.GetComponent <CreateRoomListItem>().BtnWeiChat.gameObject);
                weiChat.onClick   = OnClickWeiChatInviteBtn;
                weiChat.parameter = obj;
            }
            RoomInfoGrid.cellHeight    = 90;
            RoomInfoGrid.repositionNow = true;
            RoomInfoGrid.Reposition();
        }
Beispiel #26
0
        /// <summary>
        /// 查找好友的回调数据
        /// </summary>
        /// <param name="data"></param>
        private void GroupFriendCallBack(object data)
        {
            var info = data as Dictionary <string, object>;

            if (info == null)
            {
                return;
            }
            var userData = info.ContainsKey("data") ? info["data"] : null;

            if (userData is List <object> )
            {
                _currentGroupUesrData.Clear();
                while (GroupMemberGrid.transform.childCount > 0)
                {
                    DestroyImmediate(GroupMemberGrid.transform.GetChild(0).gameObject);
                }
                var memberInfos = userData as List <object>;
                for (int i = 0; i < memberInfos.Count; i++)
                {
                    var objects = memberInfos[i] as Dictionary <string, object>;
                    if (objects == null)
                    {
                        return;
                    }
                    var memberData = objects;
                    _currentGroupUesrData.Add(memberData);
                    var userId = memberData.ContainsKey("user_id")
                                         ? memberData["user_id"].ToString()
                                         : "";
                    var coin     = memberData.ContainsKey("coin_t") ? memberData["coin_t"].ToString() : "";
                    var nickName = memberData.ContainsKey("nick_m")
                                        ? memberData["nick_m"].ToString()
                                        : "";
                    var avatar = memberData.ContainsKey("avatar_x")
                                        ? memberData["avatar_x"].ToString()
                                        : "";
                    var item = YxWindowUtils.CreateItem(NnGroupMemberItem, GroupMemberGrid.transform);
                    item.InitData(nickName, userId, avatar, i == 0, coin);
                    if (i == 0)
                    {
                        var userdata = UserInfoModel.Instance.UserInfo;
                        if (userId.Equals(userdata.UserId))
                        {
                            BtnShowDeleteBg.SetActive(true);
                            ShowBtnShowDeleteBgState.text = "删除成员";
                        }
                        else
                        {
                            BtnShowDeleteBg.SetActive(false);
                            ShowBtnShowDeleteBgState.text = "成员列表";
                        }
                    }
                }
                GroupMemberGrid.repositionNow = true;
            }
        }
Beispiel #27
0
 public void OnFreshGold(List <int> golds)
 {
     foreach (var gold in golds)
     {
         var item = YxWindowUtils.CreateItem(GoldItem, GoldGrid.transform);
         item.text = gold.ToString(CultureInfo.InvariantCulture);
     }
     GoldGrid.repositionNow = true;
 }
Beispiel #28
0
        private void OnChangeTab(int index)
        {
            YxWindowUtils.CreateItemParent(RoomItemParentPerfab, ref _roomItemParent, RoomItemParentPerfab.parent);
            if (index >= TabDatas.Length)
            {
                return;
            }
            var tabData = TabDatas[index];

            if (tabData == null)
            {
                return;
            }
            var itemView = YxWindowUtils.CreateItem(RoomItemViewPerfab, _roomItemParent);
            var itemData = tabData.Data;

            if (itemData == null)
            {
                return;
            }
            if (itemData is RuleInfo)
            {
                var data = itemData as RuleInfo;
                UpdateItemView(data, itemView);
                return;
            }
            RoomListController.Instance.GetCreateRoomParm(itemData.ToString(), obj =>
            {
                if (!(obj is List <object>))
                {
                    return;
                }
                var list = (List <object>)obj;
                foreach (var itemObj in list)
                {
                    if (!(itemObj is Dictionary <string, object>))
                    {
                        continue;
                    }
                    var itemDict = itemObj as Dictionary <string, object>;
                    var ruleInfo = new RuleInfo(itemDict, TabDefaultIndex);
                    if (!_tabWithData.ContainsKey(ruleInfo.Id))
                    {
                        continue;
                    }
                    var tbData  = _tabWithData[ruleInfo.Id];
                    tbData.Data = ruleInfo;
                }
                itemData = tabData.Data;
                if (!(itemData is RuleInfo))
                {
                    return;
                }
                var data = itemData as RuleInfo;
                UpdateItemView(data, itemView);
            });
        }
Beispiel #29
0
        /// <summary>
        /// 显示最近赢牌的类型
        /// </summary>
        protected void SetWinType(List <ITrendReciveData> data)
        {
            if (!CardTypeGrid && !CardTypeItem)
            {
                return;
            }
            List <TrendLoadItem> itemList = new List <TrendLoadItem>();

            foreach (Transform child in CardTypeGrid.transform)
            {
                TrendLoadItem item = child.GetComponent <TrendLoadItem>();
                if (item)
                {
                    item.gameObject.SetActive(false);
                    itemList.Add(item);
                }
            }

            for (int i = 0; i < data.Count; i++)
            {
                TrendLoadItem trendLoadItem;
                if (itemList.Count > 0 && itemList[0] != null)
                {
                    trendLoadItem = itemList[0];
                    trendLoadItem.gameObject.SetActive(true);
                    itemList.RemoveAt(0);
                }
                else
                {
                    trendLoadItem = YxWindowUtils.CreateItem(CardTypeItem, CardTypeGrid.transform);
                }

                var recordData = data[i];
                if (recordData.GetResultType() != -1)
                {
                    int colorIndex;
                    var str = GetCardType(recordData.GetResultType(), out colorIndex);
                    trendLoadItem.SetItemContent(str, colorIndex);
                    trendLoadItem.SetItemBg(colorIndex);
                }

                if (i == data.Count - 1)
                {
                    trendLoadItem.StartFlash();
                }
            }

            CardTypeGrid.Reposition();
            CardTypeGrid.repositionNow = true;
            if (!gameObject.activeSelf)
            {
                return;
            }
            StartCoroutine(FreshScrollBar());
        }
Beispiel #30
0
        protected override void OnFreshView()
        {
            base.OnFreshView();
            var sfsObj = Data as Dictionary <string, object>;

            if (sfsObj == null)
            {
                return;
            }
            if (sfsObj.ContainsKey("roomId"))
            {
                _roomId = int.Parse(sfsObj["roomId"].ToString());
            }
            if (sfsObj.ContainsKey("_roomShowId"))
            {
                if (RoomIdLabel != null)
                {
                    RoomIdLabel.text = string.Format(RoomIdFormat, sfsObj["_roomShowId"]);
                }
            }
            if (sfsObj.ContainsKey("ownerName"))
            {
                var ownerName = sfsObj["ownerName"].ToString().Split('|');
                if (OwnerLabel != null)
                {
                    OwnerLabel.text = string.Format(OwnerFormat, ownerName[0]);
                }
            }
            _gameKey = sfsObj.ContainsKey("gameKey") ? sfsObj["gameKey"].ToString() : null;
            if (!sfsObj.ContainsKey("users"))
            {
                return;
            }
            var users   = sfsObj["users"];
            var objects = users as List <object>;

            if (objects != null)
            {
                var list  = objects;
                var count = list.Count;
                if (UserCount != null)
                {
                    UserCount.text = count.ToString();
                }
                var pts = UserInfoGrid.transform;
                for (var i = 0; i < count; i++)
                {
                    var label = YxWindowUtils.CreateItem(UserInfoLabelPerfab, pts);
                    label.text = list[i].ToString();
                }
            }
            UserInfoGrid.repositionNow = true;
            UserInfoGrid.Reposition();
        }