示例#1
0
        public override void OnOtherPlayerJoinRoom(ISFSObject sfsObject)
        {
            base.OnOtherPlayerJoinRoom(sfsObject);
            var userInfo = new RbwarUserInfo();

            userInfo.Parse(sfsObject.GetSFSObject("user"));
            _gdata.AllUserInfos.Add(userInfo);
        }
示例#2
0
        protected override void InitGameData(ISFSObject gameInfo)
        {
            base.InitGameData(gameInfo);
            PlayerRecordNum = gameInfo.ContainsKey("playerRecordNum") ? gameInfo.GetInt("playerRecordNum") : -1;

            var rankData = new Rank();

            rankData.SetRank(gameInfo);
            GoldRank = rankData.GoldRank;

            var luckRate = gameInfo.ContainsKey("luckRate") ? gameInfo.GetIntArray("luckRate") : null;

            if (luckRate != null)
            {
                LuckRate = new List <int>(luckRate);
            }
            var record = gameInfo.ContainsKey("record") ? gameInfo.GetSFSArray("record") : null;

            if (record != null)
            {
                for (int i = 0; i < record.Count; i++)
                {
                    if (record.GetSFSObject(i) == null)
                    {
                        continue;
                    }
                    var recordValue = new RecordValue();
                    recordValue.SetRecord(record.GetSFSObject(i));
                    RecordSpot.Add(recordValue.Area);
                    RecordCardType.Add(recordValue.CType);
                }
            }

            var user = gameInfo.ContainsKey("user") ? gameInfo.GetSFSObject("user") : null;

            if (user != null)
            {
                var userInfo = new RbwarUserInfo();
                userInfo.Parse(user);
                GetPlayer <RbwarPlayer>().Info = userInfo;
                AllUserInfos.Add(userInfo);
            }

            var users = gameInfo.ContainsKey("users")?gameInfo.GetSFSArray("users"):null;

            if (users != null)
            {
                for (int i = 0; i < users.Count; i++)
                {
                    var userInfo = new RbwarUserInfo();
                    userInfo.Parse(users.GetSFSObject(i));
                    AllUserInfos.Add(userInfo);
                }
            }
        }
示例#3
0
        protected override void OnFreshView()
        {
            var aboutAround = _gdata.PlayerRecordNum;
            var count       = _gdata.GoldRank.Count;
            var index       = 0;
            var userPos     = new System.Collections.Generic.List <int>();

            for (int i = 0; i < count; i++)
            {
                for (int j = 0; j < _gdata.AllUserInfos.Count; j++)
                {
                    if (_gdata.GoldRank[i] == _gdata.AllUserInfos[j].Seat)
                    {
                        var item = YxWindowUtils.CreateItem(RankItem, RankGrid.transform);
                        item.SetRankData(i, _gdata.AllUserInfos[j], aboutAround);
                        userPos.Add(_gdata.AllUserInfos[j].Seat);
                        index++;
                    }
                }
            }

            RbwarUserInfo[] infos = new RbwarUserInfo[_gdata.AllUserInfos.Count];
            _gdata.AllUserInfos.CopyTo(infos);
            var userInfos = infos.ToList();

//            Debug.LogError("userInfos----------------"+ userInfos.Count);
            if (userInfos.Count > count)
            {
                for (int i = 0; i < userPos.Count - 1; i++)
                {
                    for (int j = 0; j < userInfos.Count - 1; j++)
                    {
                        if (userPos[i] == userInfos[j].Seat)
                        {
                            userInfos.RemoveAt(j);
                        }
                    }
//                    Debug.LogError("userPos.Count"+ userPos.Count + "userPos[i]"+ userPos[i]+"i-------"+i);
                }

                for (int i = 0; i < userInfos.Count - 1; i++)
                {
                    var item = YxWindowUtils.CreateItem(RankItem, RankGrid.transform);
                    item.SetRankData(index, userInfos[i], aboutAround);
                    index++;
                }
            }

            RankGrid.repositionNow = true;
        }
示例#4
0
        public void SetRankData(int rankNum, RbwarUserInfo userInfo, int aboutAround)
        {
            if (rankNum <= 1)
            {
                SpecialBg.SetActive(true);
            }
            else
            {
                NormalBg.SetActive(true);
            }

            if (rankNum < 9)
            {
                UserRankSpecial.gameObject.SetActive(true);
                UserRankSpecial.spriteName = string.Format("coinNum{0}", rankNum);
                UserRankSpecial.MakePixelPerfect();
            }
            else
            {
                if (rankNum == 9)
                {
                    UserRankNomalNo.gameObject.SetActive(true);
                    UserRankNomalS.gameObject.SetActive(true);
                    UserRankNomalS.spriteName = "num9";
                }
                else
                {
                    UserRankNomalNo.gameObject.SetActive(true);
                    UserRankNomalS.gameObject.SetActive(true);
                    UserRankNomalG.gameObject.SetActive(true);

                    var sNum = rankNum / 10 % 10;
                    UserRankNomalS.spriteName = string.Format("num{0}", sNum);

                    var gNum = rankNum % 10;
                    UserRankNomalG.spriteName = string.Format("num{0}", gNum);
                }
            }
            PortraitDb.SetPortrait(userInfo.AvatarX, UserHead, userInfo.SexI);
            UserName.text = userInfo.NickM;
            UserGold.text = YxUtiles.ReduceNumber(userInfo.CoinA);

            AboutAround.text = string.Format("近{0}局", aboutAround);

            BetGold.text   = YxUtiles.ReduceNumber(userInfo.TwentyBet);
            WinAround.text = userInfo.TwentyWin.ToString();
        }