Beispiel #1
0
        void InitUsersInfo(ISFSObject data)
        {
            ISFSArray users = data.GetSFSArray("users");

            foreach (ISFSObject user in users)
            {
                int id = user.GetInt("id");
                if (id < 0)
                {
                    continue;
                }
                var userInfo = new SummaryUserInfo
                {
                    Id      = id,
                    Nick    = user.GetUtfString("nick"),
                    Seat    = user.GetInt("seat"),
                    Gold    = user.GetInt("gold"),
                    SexI    = user.GetShort("sex"),
                    Record  = user.GetIntArray("record"),
                    AvatarX = user.GetUtfString("avatar"),
                };
                _summaryUserInfoList.Add(userInfo);
            }
            _summaryUserInfoList.Sort((s1, s2) => Sequence * (s1.Gold - s2.Gold));

            int count = _summaryUserInfoList.Count;

            var parent  = UserInfoGrid.transform;
            int bwIndex = -1;
            int bwScore = -1;

            for (int i = 0; i < count; i++)
            {
                var userInfo = _summaryUserInfoList[i];

                int ttScore = userInfo.Gold;
                if (ttScore > bwScore)
                {
                    bwIndex = i;
                    bwScore = ttScore;
                }
                var sumUser = Instantiate(SumUserPrefab);
                sumUser.transform.parent     = parent;
                sumUser.transform.localScale = Vector3.one;
                sumUser.Init(userInfo);
                SumUserList.Add(sumUser);
            }
            SumUserList[bwIndex].ShowBigWinnerMark();
            int space = Area / count;

            foreach (var item in SumUserList)
            {
                item.SetWidget(space);
            }

            UserInfoGrid.cellWidth    = space;
            UserInfoGrid.hideInactive = true;
            UserInfoGrid.Reposition();
            SumUserList[count - 1].HideLine();
        }
Beispiel #2
0
        public void Init(SummaryUserInfo sumInfo)
        {
            SetLabel(_totalScoreLabel, sumInfo.Gold);

            _nameLabel.text = sumInfo.Nick;
            Id            = sumInfo.Id;
            _idLabel.text = "ID:" + Id;
            ScoreArray    = sumInfo.Record;
            gameObject.SetActive(Id > 0);
            var seat     = sumInfo.Seat;
            var userInfo = App.GetGameData <SssGameData>().GetPlayerInfo(seat, true);

            if (userInfo != null)
            {
                PortraitDb.SetPortrait(userInfo.AvatarX, _userIcon, userInfo.SexI);
            }
        }