예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="resultData"></param>
        /// <param name="huList"></param>
        /// <param name="isBaoExist">是否需要冲宝</param>
        /// <param name="isQingfengExist"></param>
        /// <returns></returns>
        public int SetResultInfo(ResultInfoData resultData, List <int> huList, bool isBaoExist = false, bool isQingfengExist = false)
        {
            #region data
            _resultData = resultData;
            if (_resultData.HuType == 2)//目前自摸情况下,会把胡的那张牌从手牌中带回来,这里删掉。目前只有一个胡牌,所以这么删,待扩展
            {
                resultData.HandList.Remove(huList[0]);
                if (isBaoExist)
                {
                    resultData.HandList.Add(huList[0]);
                }
            }
            #endregion
            #region UI
            MahjongPlayer player = Players[_resultData.UserSeat];
            LabelUserName.text = player.UserInfo.name;
            ZhuangSprite.SetActive(player.IsZhuang);
            LabelFanName.text = _resultData.FanName;
            LabelHuScore.TrySetComponentValue(YxUtiles.GetShowNumber(_resultData.HuNumber).ToString());
            LabelGangNum.TrySetComponentValue(YxUtiles.GetShowNumber(_resultData.GangNum).ToString());
            GuoDanScoreLabel.TrySetComponentValue(YxUtiles.GetShowNumber(_resultData.GuoDanSocre).ToString());
            _qingfengObj.TrySetComponentValue(isQingfengExist);
            _labelQingfeng.TrySetComponentValue(YxUtiles.GetShowNumber(_resultData.QingFengScore).ToString());
            LabelTotalScore.TrySetComponentValue(YxUtiles.GetShowNumber(_resultData.NowRoundScore).ToString());
            if (HeadTexture)
            {
                HeadTexture.mainTexture = player.CurrentInfoPanel.UserIcon.GetTexture();
            }
            player.UserInfo.Gold = _resultData.TotalGold;
            player.CurrentInfoPanel.SetGold(_resultData.TotalGold);
            HuLogo.TrySetComponentValue(IsWiner);
            _infoBg.TrySetComponentValue(IsWiner ? ConstantData.KeyWinerBg : ConstantData.KeyNormalBg);
            if (_scoreGrid)
            {
                _scoreGrid.repositionNow = true;
            }

            #endregion

            if (resultData.FenZhangCard > 0)
            {
                huList.Clear();
                huList.Add(resultData.FenZhangCard);
            }
            _resultCards.Init(_resultData.MahjongGroups, resultData.HandList, huList, _resultData.IsWiner, resultData.FenZhangCard);
            return(_resultData.HuType);
        }
예제 #2
0
        /// <summary>
        /// 显示UI
        /// </summary>
        private void InitInfoUI(List <KeyValuePair <int, int> > fenZhangData)
        {
            if (_panelItems == null || _panelItems.Length == 0)
            {
                _panelItems = new PlayerResultInfo[Manager.PlayerNumber];
                var gridGameObj = ResultGrid.gameObject;
                var prefabObj   = PanelItem.gameObject;
                if (gridGameObj && prefabObj)
                {
                    for (int i = 0; i < _panelItems.Length; i++)
                    {
                        _panelItems[i] = gridGameObj.AddChild(prefabObj).GetComponent <PlayerResultInfo>();
                    }
                }
            }
            else
            {
                for (int i = 0; i < _panelItems.Length; i++)
                {
                    _panelItems[i].ResetInfo();
                }
            }
            ResultGrid.repositionNow = true;
            int num = 0;

            for (int i = 0; i < pls.Count; i++)
            {
                ResultInfoData infoData  = new ResultInfoData(pls.GetSFSObject(i), cardsArray.GetIntArray(i).ToList());
                var            pairIndex = fenZhangData.FindIndex(keyPair => keyPair.Key == infoData.UserSeat);
                if (pairIndex > -1)
                {
                    infoData.FenZhangCard = fenZhangData[pairIndex].Value;
                    infoData.HandList.Remove(infoData.FenZhangCard);
                }
                else
                {
                    infoData.FenZhangCard = 0;
                }
                _resultNowRoundScore.Add(infoData.UserSeat, infoData.NowRoundScore);
                if (i.Equals(0))
                {
                    _resultDatas.Add(infoData);
                }
                else
                {
                    if (infoData.HuType > 0 && WinSetFirst)
                    {
                        _resultDatas.Insert(0, infoData);
                    }
                    else
                    {
                        _resultDatas.Add(infoData);
                    }
                }
            }
            for (int i = 0; pls != null && i < _panelItems.Length; i++)
            {
                _panelItems[i].SetResultInfo(
                    _resultDatas[i],
                    _huCards,
                    _isBaoExist,
                    _isQingfengExist
                    );
            }
            DealTitleAndGirl();
            DealOtherCards();
        }