Ejemplo n.º 1
0
 /// <summary>
 /// 设置庄标记的显示
 /// </summary>
 /// <param name="userInfo"></param>
 private void SetBankerMarkActive(HistoryUserInfo userInfo)
 {
     if (_bankerMark != null)
     {
         _bankerMark.SetActive(userInfo.IsBanker);
     }
 }
Ejemplo n.º 2
0
 private void SetGetShootTime(List <HistoryUserInfo> users)
 {
     for (int i = 0; i < users.Count; i++)
     {
         HistoryUserInfo user       = users[i];
         var             shootTargs = user.ShootInfo.ShootTargs;
         if (shootTargs == null || shootTargs.Length < 1)
         {
             continue;
         }
         for (int k = 0; k < shootTargs.Length; k++)
         {
             for (int j = 0; j < users.Count; j++)
             {
                 var getShootUser = users[j];
                 if (shootTargs[k] == getShootUser.SssUserInfo.Seat)
                 {
                     getShootUser.GetShootTime++;
                     users[j] = getShootUser;
                     break;
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 特殊牌型
 /// </summary>
 /// <param name="userInfo"></param>
 void SetSpecialSprite(HistoryUserInfo userInfo)
 {
     _specialSprite.spriteName = ((CardType)userInfo.Sprcial).ToString();
     _specialSprite.MakePixelPerfect();
     _specialSprite.gameObject.SetActive(true);
     _dunInfoParent.SetActive(false);
 }
Ejemplo n.º 4
0
        private void SetShootInfo(HistoryUserInfo userInfo)
        {
            int shootTime = userInfo.ShootInfo.ShootCount;

            _shootTime.text    = shootTime.ToString();
            _getShootTime.text = userInfo.GetShootTime.ToString();
            _swatMark.SetActive(shootTime > 2);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置每道信息
 /// </summary>
 /// <param name="userInfo"></param>
 void SetDunInfo(HistoryUserInfo userInfo)
 {
     SetDunScore(userInfo);
     SetDunType(userInfo);
     SetShootInfo(userInfo);
     _dunInfoParent.SetActive(true);
     _specialSprite.gameObject.SetActive(false);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 设置玩家信息
        /// </summary>
        /// <param name="userInfo"></param>
        private void SetUserInfo(HistoryUserInfo userInfo)
        {
            SssUserInfo sssUser = userInfo.SssUserInfo;

            PortraitDb.SetPortrait(sssUser.AvatarX, _icon, sssUser.SexI);
            _nameLabel.text = sssUser.NickM;
            SetTotalScoreLabel(_scoreLabel, userInfo.Score);     //设置总分
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 设置每道得分
 /// </summary>
 /// <param name="userInfo"></param>
 void SetDunScore(HistoryUserInfo userInfo)
 {
     for (int i = 0; i < _normalLabels.Length; i++)
     {
         SetLineScoreLabel(_normalLabels[i], userInfo.NormalScore[i]);
         SetLineScoreLabel(_addLabels[i], userInfo.AddScore[i], true);
         _addLabels[i].transform.parent.gameObject.SetActive(true);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 显示玩家手牌
 /// </summary>
 /// <param name="userInfo"></param>
 private void SetUserCardPokerInfo(HistoryUserInfo userInfo)
 {
     int[] pokers = userInfo.Pokers;
     for (int i = 0; i < pokers.Length; i++)
     {
         _pokers[i].SetCardId(pokers[i]);
         _pokers[i].SetCardFront();
         _pokers[i].SetCardDepth(i * 2);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 设置每道牌型
 /// </summary>
 /// <param name="userInfo"></param>
 void SetDunType(HistoryUserInfo userInfo)
 {
     int[] dunTypes = userInfo.DunType;
     if (_dunTypeSprites == null || dunTypes.Length > _dunTypeSprites.Length)
     {
         return;
     }
     for (int i = 0; i < dunTypes.Length; i++)
     {
         var spr = _dunTypeSprites[i];
         spr.spriteName = GetSpriteName(dunTypes[i], i);
         spr.MakePixelPerfect();
     }
 }
Ejemplo n.º 10
0
        public void GetHistoryInfo(List <UserMatchInfo> matchInfos)
        {
            var             gdata       = App.GetGameData <SssGameData>();
            HistoryItemInfo historyInfo = new HistoryItemInfo
            {
                Users    = new List <HistoryUserInfo>(),
                RoundVal = gdata.CurRound,
            };

            int bankerSeat = gdata.BankerSeat;

            foreach (UserMatchInfo info in matchInfos)
            {
                SssPlayer user = gdata.GetPlayer <SssPlayer>(info.Seat, true);
                if (user.Info == null)
                {
                    continue;
                }

                HistoryUserInfo userInfo = new HistoryUserInfo();
                userInfo.SssUserInfo = user.GetInfo <SssUserInfo>();
                userInfo.Seat        = user.Info.Seat;
                userInfo.Pokers      = info.Cards.ToArray();
                userInfo.AddScore    = info.AddScore.ToArray();
                userInfo.NormalScore = info.NormalScores.ToArray();
                userInfo.Score       = info.TtScore;
                userInfo.DunType     = info.DunTypeList.ToArray();
                userInfo.Sprcial     = info.Special;
                userInfo.ShootInfo   = info.Shoot;
                userInfo.IsBanker    = gdata.IsBankerModel && bankerSeat == user.Info.Seat;
                historyInfo.Users.Add(userInfo);
            }

            SetGetShootTime(historyInfo.Users);
            HistoryList.Add(historyInfo);

            if (MaxCount == 0)   //如果是0,则不限制个数
            {
                return;
            }

            while (HistoryList.Count > MaxCount)
            {
                HistoryList.Remove(HistoryList[0]);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 初始化玩家信息
        /// </summary>
        /// <param name="userInfo"></param>
        public void InitUser(HistoryUserInfo userInfo)
        {
            SetUserInfo(userInfo);

            SetUserCardPokerInfo(userInfo);

            SetBankerMarkActive(userInfo);

            if (userInfo.Sprcial > (int)CardType.none)
            {
                SetSpecialSprite(userInfo);
            }
            else
            {
                SetDunInfo(userInfo);
            }
            gameObject.SetActive(true);
        }
Ejemplo n.º 12
0
        ///// <summary>
        ///// 将数据加入到战绩中
        ///// </summary>
        ///// <param name="data">传入的数据</param>
        //public void GetHistoryInfo(ISFSObject data)
        //{

        //    //解析人物牌信息
        //    ISFSArray dataArray = data.GetSFSArray("playerinfo");
        //    foreach (ISFSObject item in dataArray)
        //    {
        //        int seat = item.GetInt("seat");
        //        SssPlayer sssUser = main.UserSeatSort[main.ToLocalSeat(seat)];
        //        if (sssUser.CurSssUserInfo != null)
        //        {
        //            //存入玩家信息
        //            HistoryUserInfo sssUserInfo = new HistoryUserInfo
        //            {
        //                SssUserInfo = sssUser.CurSssUserInfo,
        //                Seat = seat,
        //            };

        //            //存入扑克信息
        //            List<int> cards = new List<int>();
        //            ISFSArray dunsInfo = item.GetSFSArray("duninfo");

        //            foreach (ISFSObject dun in dunsInfo)
        //            {
        //                int[] tempArrey = dun.GetIntArray("cards");
        //                foreach (int card in tempArrey)
        //                {
        //                    cards.Add(card);
        //                }
        //            }

        //            //把信息处理完的玩家加入列表
        //            sssUserInfo.Pokers = cards.ToArray();
        //            historyInfo.Users.Add(sssUserInfo);
        //        }
        //    }
        //    HistoryList.Add(historyInfo);

        //    if (MaxCount == 0)   //如果是0,则不限制个数
        //        return;


        //    while(HistoryList.Count > MaxCount)
        //    {
        //        HistoryList.Remove(HistoryList[0]);
        //    }

        //}

        public void AddHistoryInfo(ISFSObject data)
        {
            HistoryItemInfo        curItem   = HistoryList[HistoryList.Count - 1];
            List <HistoryUserInfo> usersInfo = curItem.Users;

            if (usersInfo == null || usersInfo.Count == 0)
            {
                YxDebug.LogError("HistoryItem init error,the HistoryUserInfo.users is NULL or EMPTY !!!!");
                return;
            }

            if (data.ContainsKey("st"))
            {
                curItem.Time = data.GetLong("st");
            }

            ISFSArray scoreArray = data.GetSFSArray("score");

            foreach (ISFSObject scoreItem in scoreArray)
            {
                int scoreSeat = scoreItem.GetInt("seat");

                for (int i = 0; i < usersInfo.Count; i++)
                {
                    HistoryUserInfo info = usersInfo[i];
                    if (info.Seat != scoreSeat)
                    {
                        continue;
                    }

                    info.Score   = scoreItem.GetInt("score");
                    usersInfo[i] = info;        //由于是值类型,需要重新赋值
                }
            }
            HistoryList[HistoryList.Count - 1] = curItem;
        }