Ejemplo n.º 1
0
 protected void ApplyCard(MCard cardObj, Vector3 pos)
 {
     cardObj.transform.position   = pos;
     cardObj.transform.localScale = new Vector3(1f, 1f, 1f);
     cardObj.transform.SetParent(trans);
     cardObj.transform.SetAsFirstSibling();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 麻将点击事件
 /// </summary>
 /// <param name="card"></param>
 private void ClickMajiang(MCard card)
 {
     if (playerClickEvent != null)
     {
         playerClickEvent(card.Card);
     }
 }
        public override void FreshCard(List <Card> list, int index)
        {
            Vector3 pos = trans.position + new Vector3(0, list.Count * -0.25f, 0);

            if (index >= 0)
            {
                MCard cardObj = GetCardObj(list[index]);
                cardObj.SetState(CardState.Right);

                pos.y += 0.4f * (index + 1);
                ApplyCard(cardObj, pos);

                return;
            }

            foreach (var item in list)
            {
                MCard cardObj = GetCardObj(item);
                cardObj.SetState(CardState.Right);

                pos.y += 0.4f;

                ApplyCard(cardObj, pos);
            }
        }
Ejemplo n.º 4
0
        public override void DrawCard(Card card)
        {
            Vector3 pos = trans.position + new Vector3(3f, 0, 0);

            MCard cardObj = GetCardObj(card);

            cardObj.SetState(CardState.N);
            ApplyCard(cardObj, pos + new Vector3(2, 0, 0));
        }
Ejemplo n.º 5
0
        //出牌
        public void DropCard(Card card)
        {
            MCard cardObj = GetCardObj(card);

            cardObj.SetState(CardState.B);

            cardObj.transform.position   = GetDropCard();
            cardObj.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
            cardObj.transform.SetParent(table);
        }
        public override void DrawCard(Card card)
        {
            MCard cardObj = GetCardObj(card);
            Vector3
                pos = trans.position + new Vector3(-2f, -3.8f, 0);

            cardObj.SetState(CardState.Left);

            ApplyCard(cardObj, pos + new Vector3(2, 0, 0));
        }
Ejemplo n.º 7
0
        public void ShowPengGang(List <Card> list)
        {
            pengPos += GetPengPosOffset();

            Vector3 pos = pengPos;

            for (int i = 0; i < list.Count; i++)
            {
                pos.x += 0.5f;

                MCard cardObj = GetCardObj(list[i]);
                cardObj.SetState(CardState.B);
                cardObj.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
                cardObj.transform.position   = pos;
                cardObj.transform.SetParent(table);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 实例化麻将
        /// </summary>
        /// <param name="list"></param>
        public void InstanceCards(List <Card> list)
        {
            //根据数据实例化麻将到桌面

            GameObject obj = WTUIPage.delegateSyncLoadUIByLocal(R.Prefab.MAJIANG) as GameObject;

            for (int i = 0; i < list.Count; i++)
            {
                GameObject o = GameObject.Instantiate(obj, new Vector3(0, 3, 0), Quaternion.identity, transform) as GameObject;
                MCard      c = o.GetComponent <MCard>();

                c.SetCardIndex(list[i].CardIndex);
                list[i].UserData = c;
                //绑定麻将点击事件
                c.AddSetSelectEvent(ClickMajiang);
            }
        }