예제 #1
0
 public void ShowHupaiInfo(List <int> values, List <int> numlist, int sign)
 {
     for (int i = 0; i < values.Count; i++)
     {
         HupaiItem item = Pop(values[i], sign, Grid.transform);
         if (item != null)
         {
             item.SetTextNum(numlist[i]);
         }
     }
 }
예제 #2
0
        private void Push(int value, Transform parent)
        {
            if (!itemCache.Exists((a) => { return(a.Value == value); }))
            {
                HupaiItem item = Instantiate <HupaiItem>(ItemPrefab);

                //0是显示任意牌
                if (value == 0)
                {
                    item.AnyCard(parent);
                }
                else
                {
                    GameObject obj = D2MahjongMng.Instance.GetMj(value, EnD2MjType.Me);
                    item.NormalCard(obj, parent, value);
                }

                itemCache.Add(item);
            }
        }
예제 #3
0
        public void OnShowHulist(EventData evn)
        {
            QueryHulistData data = (QueryHulistData)evn.data1;
            Transform       card = (Transform)evn.data2;

            if (data == null || card == null || data.Cards.Count == 0)
            {
                return;
            }

            Bg.SetActive(true);
            _sgin = data.Laizi;

            //显示任意牌
            if (data.Flag == (int)MahjongIcon.Flag.Youjin || null == data.Cards)
            {
                //自适应 窗体大小
                SetPnlSize(1);
                Push(0, transform);
                HupaiItem item = Pop(0, -1, Grid.transform);
                item.SetTextNum(data.LeaveMahjongCnt);
            }
            else
            {
                //自适应 窗体大小
                SetPnlSize(data.Cards.Count);
                //生成牌
                Push(data.Cards, transform);
                //牌值s
                List <int> values = data.Cards;
                //牌数量
                List <int> numArr = data.CardsNum;
                ShowHupaiInfo(values, numArr, _sgin);
            }

            //窗体位置
            SetPnlPosition(card.position);
        }