Ejemplo n.º 1
0
    void Start()
    {
        mBackButton.onClick.AddListener(delegate {
            SceneManager.LoadSceneAsync("Boot");
        });

        List <Card> cardList = CardHelper.GetCardShuffleList();

        // 测试排序;
        //CardHelper.SortCards(cardList);

        // Demo 显示牌信息;
        for (int i = 0; i < cardList.Count; i++)
        {
            GameObject ruleItemObj = GameObject.Instantiate(mPrefabObj) as GameObject;
            if (ruleItemObj != null)
            {
                ruleItemObj.SetActive(true);

                ruleItemObj.transform.parent        = mRoot.transform;
                ruleItemObj.transform.localPosition = Vector3.zero;
                ruleItemObj.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
                ruleItemObj.name = i.ToString();

                Image image = ruleItemObj.GetComponent <Image>();
                if (image != null)
                {
                    image.sprite = ResLoad.GetCardSprite(cardList[i].CardSuits, cardList[i].CardWeight);
                }
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        mBackButton.onClick.AddListener(delegate {
            SceneManager.LoadSceneAsync("Boot");
        });

        List <Card> cardList = CardHelper.GetCardShuffleList();

        mCardList.Clear();
        mCardList.AddRange(cardList);

        // 玩家轮流发牌;
        int index = 0;

        for (int i = 0; i < 51; i++)
        {
            if (index == 3)
            {
                index = 0;
            }

            Card card = Deal();
            if (index == 0)
            {
                mHandCard1List.Add(card);
            }
            else if (index == 1)
            {
                mHandCard2List.Add(card);
            }
            else if (index == 2)
            {
                mHandCard3List.Add(card);
            }

            index++;
        }

        //发地主牌;
        for (int i = 0; i < 3; i++)
        {
            Card card = Deal();
            mHandCard4List.Add(card);
        }

        // 展示;
        CardHelper.SortCards(mHandCard1List);
        SendPoker(mRoot0, mHandCard1List);
        CardHelper.SortCards(mHandCard2List);
        SendPoker(mRoot1, mHandCard2List);
        CardHelper.SortCards(mHandCard3List);
        SendPoker(mRoot2, mHandCard3List);
        CardHelper.SortCards(mHandCard4List);
        SendPoker(mRoot3, mHandCard4List);
    }
Ejemplo n.º 3
0
    void Start()
    {
        mBackButton.onClick.AddListener(delegate {
            SceneManager.LoadSceneAsync("Boot");
        });

        List <Card> cardList = CardHelper.GetCardShuffleList(false);

        mCardList.Clear();
        mCardList.AddRange(cardList);

        // 玩家轮流发牌;
        int index = 0;

        for (int i = 0; i < 20; i++)
        {
            if (index == 4)
            {
                index = 0;
            }

            Card card = Deal();
            if (index == 0)
            {
                mHandCard1List.Add(card);
            }
            else if (index == 1)
            {
                mHandCard2List.Add(card);
            }
            else if (index == 2)
            {
                mHandCard3List.Add(card);
            }
            else if (index == 3)
            {
                mHandCard4List.Add(card);
            }

            index++;
        }

//		mHandCard1List[0].SetWeight(Weight.Eight);
//		mHandCard1List[1].SetWeight(Weight.Two);
//		mHandCard1List[2].SetWeight(Weight.Eight);
//		mHandCard1List[3].SetWeight(Weight.Five);
//		mHandCard1List[4].SetWeight(Weight.One);

        // 展示;
        CardHelper.SortCards(mHandCard1List);
        SendPoker(mRoot0, mHandCard1List);
        CheckNiu(mHandCard1List, mText0);
        CardHelper.SortCards(mHandCard2List);
        SendPoker(mRoot1, mHandCard2List);
        CheckNiu(mHandCard2List, mText1);
        CardHelper.SortCards(mHandCard3List);
        SendPoker(mRoot2, mHandCard3List);
        CheckNiu(mHandCard3List, mText2);
        CardHelper.SortCards(mHandCard4List);
        SendPoker(mRoot3, mHandCard4List);
        CheckNiu(mHandCard4List, mText3);
    }