示例#1
0
        /// <summary>
        /// 生成牌
        /// </summary>
        /// <param name="seatPos">座位号</param>
        /// <param name="poker">牌</param>
        /// <param name="layer">层级</param>
        /// <returns></returns>
        public PokerCtrl SpawnPoker(int seatPos, Poker poker, string layer)
        {
            PokerCtrl ctrl = LoadPrefabPoker((poker == null || poker.color == 0) ? Poker.DefaultName : poker.ToString()).GetOrCreatComponent <PokerCtrl>();

            //ctrl.Color = m_CurrentColor;

            //SeatEntity seat = RoomMaJiangProxy.Instance.GetSeatBySeatId(seatPos);
            //bool isUniversal = false;
            //if (seat != null)
            //{
            //    isUniversal = MahJongHelper.CheckUniversal(poker, seat.UniversalList);
            //}
            ctrl.Init(poker);
            ctrl.gameObject.SetLayer(LayerMask.NameToLayer(layer));

            m_AllPoker.Add(ctrl);
            return(ctrl);
        }
示例#2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="onComplete"></param>
        public void Init()
        {
            if (m_PokerPoolParent == null)
            {
                m_PokerPoolParent = new GameObject("PDKPoker").transform;
            }
            m_PokerPoolParent.parent   = null;
            m_PokerPoolParent.position = new Vector3(0f, 5000f, 0f);

            //m_WallPool = PoolManager.Pools.Create("PDKPoker");
            //m_WallPool.Group.parent = null;
            //m_WallPool.Group.position = new Vector3(0f, 5000f, 0f);

            //InitPoker(0, 0, onComplete);

            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();

            for (int i = 3; i < 18; ++i)
            {
                for (int j = 0; j < 5; ++j)
                {
                    if (i != 0 && j == 0)
                    {
                        continue;
                    }
                    if (i > 15 && j != 1)
                    {
                        continue;
                    }
                    Poker      poker = new Poker(i, j);
                    GameObject go    = LoadPrefabPoker(poker.ToString());
                    go.GetOrCreatComponent <PokerCtrl>().Init(poker);
                    DespawnPoker(go);
                    if (i == 0)
                    {
                        break;
                    }
                }
            }
            stopWatch.Stop();
            Debug.Log("初始化一副牌耗时: " + stopWatch.Elapsed.TotalSeconds.ToString());
        }
示例#3
0
 /// <summary>
 /// 重置
 /// </summary>
 public void Reset()
 {
     m_Poker = null;
     //将抽出状态还原等s
     SetHold(false);
 }
示例#4
0
 /// <summary>
 /// Poker初始化
 /// </summary>
 /// <param name="poker"></param>
 public void Init(Poker poker)
 {
     Reset();
     m_Poker = poker;
     SetSprites();
 }