コード例 #1
0
ファイル: UICardControl.cs プロジェクト: Pircs/DafuhaoProject
        //获取每组牌中最大的牌
        void MaxCardArea()
        {
            for (int i = 0; i < 5; i++)
            {
                maxCardArea[i]  = 0;
                maxCardColor[i] = 0;
                for (int k = 0; k < 5; k++)
                {
                    switch (i)
                    {
                    case 0:
                    {
                        byte cardValue = GameLogic.GetMaxCardValue(m_card_0[k]);
                        byte cardColor = GameLogic.GetCardColor(m_card_0[k]);
                        GameLogic.GetCardColor(m_card_0[k]);
                        if ((maxCardArea[0] < cardValue) || ((cardValue == maxCardArea[0]) && (GameLogic.GetCardColor(m_card_0[k]) > GameLogic.GetCardColor(m_card_0[PositiveNumber(k - 1)]))))
                        {
                            maxCardArea[0]  = cardValue;
                            maxCardColor[0] = cardColor;
                        }
                        break;
                    }

                    case 1:
                    {
                        byte cardValue = GameLogic.GetMaxCardValue(m_card_1[k]);
                        byte cardColor = GameLogic.GetCardColor(m_card_1[k]);
                        if ((maxCardArea[1] < cardValue) || ((cardValue == maxCardArea[1]) && (GameLogic.GetCardColor(m_card_1[k]) > GameLogic.GetCardColor(m_card_1[PositiveNumber(k - 1)]))))
                        {
                            maxCardArea[1]  = cardValue;
                            maxCardColor[1] = cardColor;
                        }
                        break;
                    }

                    case 2:
                    {
                        byte cardValue = GameLogic.GetMaxCardValue(m_card_2[k]);
                        byte cardColor = GameLogic.GetCardColor(m_card_2[k]);
                        if ((maxCardArea[2] < cardValue) || ((cardValue == maxCardArea[2]) && (GameLogic.GetCardColor(m_card_2[k]) > GameLogic.GetCardColor(m_card_2[PositiveNumber(k - 1)]))))
                        {
                            maxCardArea[2]  = cardValue;
                            maxCardColor[2] = cardColor;
                        }
                        break;
                    }

                    case 3:
                    {
                        byte cardValue = GameLogic.GetMaxCardValue(m_card_3[k]);
                        byte cardColor = GameLogic.GetCardColor(m_card_3[k]);
                        if ((maxCardArea[3] < cardValue) || ((cardValue == maxCardArea[3]) && (GameLogic.GetCardColor(m_card_3[k]) > GameLogic.GetCardColor(m_card_3[PositiveNumber(k - 1)]))))
                        {
                            maxCardArea[3]  = cardValue;
                            maxCardColor[3] = cardColor;
                        }
                        break;
                    }

                    case 4:
                    {
                        byte cardValue = GameLogic.GetMaxCardValue(m_card_4[k]);
                        byte cardColor = GameLogic.GetCardColor(m_card_4[k]);
                        if ((maxCardArea[4] < cardValue) || ((cardValue == maxCardArea[4]) && (GameLogic.GetCardColor(m_card_4[k]) > GameLogic.GetCardColor(m_card_4[PositiveNumber(k - 1)]))))
                        {
                            maxCardArea[4]  = cardValue;
                            maxCardColor[4] = cardColor;
                        }
                        break;
                    }
                    }
                }
            }
        }
コード例 #2
0
ファイル: UICardControl.cs プロジェクト: Pircs/DafuhaoProject
        //牌型排序
        int SortCard(string name, bool frame)
        {
            int id = 0;

            switch (name)
            {
            case "ctr_banker":
            {
                GameLogic.GetOxCard(ref m_card_0, (byte)m_card_0.Length);

                for (int i = 0; i < m_card_0.Length; i++)
                {
                    if (frame == true)
                    {
                        _cardlist[i].GetComponent <UICard>().GetCardTex = m_card_0[i];
                    }
                    else
                    {
                        _cardlist[i].GetComponent <UICard>().GetCardTex = m_card_0[Mathf.Abs(i - 4)];
                    }
                }

                id = 0;
                break;
            }

            case "ctr_tian":
            {
                GameLogic.GetOxCard(ref m_card_1, (byte)m_card_1.Length);

                for (int i = 0; i < m_card_1.Length; i++)
                {
                    if (frame == true)
                    {
                        _cardlist[i + 5].GetComponent <UICard>().GetCardTex = m_card_1[i];
                    }
                    else
                    {
                        _cardlist[i + 5].GetComponent <UICard>().GetCardTex = m_card_1[Mathf.Abs(i - 4)];
                    }
                }

                id = 1;
                break;
            }

            case "ctr_di":
            {
                GameLogic.GetOxCard(ref m_card_2, (byte)m_card_2.Length);

                for (int i = 0; i < m_card_2.Length; i++)
                {
                    if (frame == true)
                    {
                        _cardlist[i + 10].GetComponent <UICard>().GetCardTex = m_card_2[i];
                    }
                    else
                    {
                        _cardlist[i + 10].GetComponent <UICard>().GetCardTex = m_card_2[Mathf.Abs(i - 4)];
                    }
                }

                id = 2;
                break;
            }

            case "ctr_xuan":
            {
                GameLogic.GetOxCard(ref m_card_3, (byte)m_card_3.Length);

                for (int i = 0; i < m_card_3.Length; i++)
                {
                    if (frame == true)
                    {
                        _cardlist[i + 15].GetComponent <UICard>().GetCardTex = m_card_3[i];
                    }
                    else
                    {
                        _cardlist[i + 15].GetComponent <UICard>().GetCardTex = m_card_3[Mathf.Abs(i - 4)];
                    }
                }

                id = 3;
                break;
            }

            case "ctr_huang":
            {
                GameLogic.GetOxCard(ref m_card_4, (byte)m_card_4.Length);

                for (int i = 0; i < m_card_4.Length; i++)
                {
                    if (frame == true)
                    {
                        _cardlist[i + 20].GetComponent <UICard>().GetCardTex = m_card_4[i];
                    }
                    else
                    {
                        _cardlist[i + 20].GetComponent <UICard>().GetCardTex = m_card_4[Mathf.Abs(i - 4)];
                    }
                }

                id = 4;
                break;
            }
            }
            return(id);
        }