Beispiel #1
0
 private void BuXi(MaJiangCtrl majiang)
 {
     if (Combination == null)
     {
         return;
     }
     majiang.gameObject.SetLayer("Table");
     for (int i = 0; i < Combination.PokerList.Count; ++i)
     {
         if (majiang.Poker.color == Combination.PokerList[i].Poker.color && majiang.Poker.size == Combination.PokerList[i].Poker.size)
         {
             if (!m_XiCount.ContainsKey(Combination.PokerList[i]))
             {
                 m_XiCount[Combination.PokerList[i]] = 0;
             }
             ++m_XiCount[Combination.PokerList[i]];
             if (i == 3)
             {
                 majiang.gameObject.SetParent(m_Containers[4]);
                 majiang.transform.position = m_Containers[4].position + new Vector3(0, m_XiCount[Combination.PokerList[i]] * 4.5f, 0);
             }
             else
             {
                 majiang.gameObject.SetParent(m_Containers[i]);
                 majiang.transform.position = m_Containers[i].position + new Vector3(0, m_XiCount[Combination.PokerList[i]] * 4.5f, 0);
             }
             return;
         }
     }
 }
Beispiel #2
0
        public void Show(MaJiangCtrl ctrl, List <Poker> lst)
        {
#if IS_HONGHU || IS_LEPING
            return;
#endif
#if IS_TAILAI
            if (!RoomMaJiangProxy.Instance.PlayerSeat.IsTing)
            {
                return;
            }
#endif
            if (RoomMaJiangProxy.Instance.CurrentRoom.Status == RoomEntity.RoomStatus.Ready)
            {
                return;
            }
            if (RoomMaJiangProxy.Instance.CurrentRoom.isReplay)
            {
                return;
            }
            if (RoomMaJiangProxy.Instance.CurrentRoom.Status == RoomEntity.RoomStatus.Settle)
            {
                return;
            }
            if (RoomMaJiangProxy.Instance.CurrentRoom.CurrentOperator != RoomMaJiangProxy.Instance.PlayerSeat && ctrl != null)
            {
                return;
            }
            if (RoomMaJiangProxy.Instance.CurrentState == MahjongGameState.PlayPoker && ctrl != null)
            {
                return;
            }
            if (lst == null || lst.Count == 0)
            {
                Close();
                return;
            }
            gameObject.SetActive(true);
            MahJongHelper.SimpleSort(lst);
            for (int i = 0; i < m_HuList.Count; ++i)
            {
                m_HuList[i].SetActive(false);
            }
            if (lst.Count < SHOW_ALL_HU)
            {
                m_ImageAllHu.gameObject.SetActive(false);
                m_ImageHu.gameObject.SetActive(true);
                for (int i = 0; i < lst.Count; ++i)
                {
                    GameObject go = null;

                    if (i < m_HuList.Count)
                    {
                        go = m_HuList[i];
                        go.SetActive(true);
                    }
                    else
                    {
                        go = new GameObject();
                        m_HuList.Add(go);
                        go.SetParent(m_Container);
                    }
                    Image img = go.GetOrCreatComponent <Image>();
                    img.overrideSprite = MahJongManager.Instance.LoadPokerSprite(lst[i], false);
                    img.SetNativeSize();

                    //AssetBundleManager.Instance.LoadSpriteAsync(path, imgName,(Sprite sprite)=>
                    //{
                    //    img.overrideSprite = sprite;
                    //    img.SetNativeSize();
                    //});
                }
                m_BG.SafeSetActive(true);
                m_BG.rectTransform.sizeDelta = new Vector2(lst.Count * 100 + 100, m_BG.rectTransform.sizeDelta.y);
            }
            else
            {
                m_ImageAllHu.gameObject.SetActive(true);
                m_ImageHu.gameObject.SetActive(false);
                m_BG.SafeSetActive(false);
            }
        }