Esempio n. 1
0
    private void VSWithSelf(BaseManager_Stand compare, BaseManager_Stand compared, string compareName, string comparedName)
    {
        transform.DOScale(Vector3.one, 0.3f).OnComplete(() => { StartCoroutine(Delay()); });


        m_ComparePlayer.img_Lose.gameObject.SetActive(false);
        m_ComparePlayer.img_Win.gameObject.SetActive(false);
        m_ComparedPlayer.img_Lose.gameObject.SetActive(false);
        m_ComparedPlayer.img_Win.gameObject.SetActive(false);

        m_ComparePlayer.txt_Name.text  = compareName;
        m_ComparedPlayer.txt_Name.text = comparedName;

        for (int i = 0; i < compare.m_CardList.Count; i++)
        {
            string cardName = "card_" + compare.m_CardList[i].Color + "_" + compare.m_CardList[i].Weight;
            m_ComparePlayer.cardsArr[i].sprite = ResourcesManager.LoadCardSprite(cardName);
        }
        for (int i = 0; i < compared.m_CardList.Count; i++)
        {
            string cardName = "card_" + compared.m_CardList[i].Color + "_" + compared.m_CardList[i].Weight;
            m_ComparedPlayer.cardsArr[i].sprite = ResourcesManager.LoadCardSprite(cardName);
        }
        CompareCard(compare, compared);
    }
Esempio n. 2
0
 private void CompareCardWhenMin(BaseManager_Stand compare, BaseManager_Stand compareD)
 {
     if (compare.m_CardList[0].Weight > compareD.m_CardList[0].Weight)
     {
         //比较者胜利
         StartCoroutine(CompareWin());
         m_ComparePlayer.img_Win.gameObject.SetActive(true);
         m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
     }
     else if (compare.m_CardList[0].Weight == compareD.m_CardList[0].Weight)
     {
         if (compare.m_CardList[1].Weight > compareD.m_CardList[1].Weight)
         {
             //比较者胜利
             StartCoroutine(CompareWin());
             m_ComparePlayer.img_Win.gameObject.SetActive(true);
             m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
         }
         else if (compare.m_CardList[1].Weight == compareD.m_CardList[1].Weight)
         {
             if ((compare.m_CardList[2].Weight > compareD.m_CardList[2].Weight))
             {
                 //比较者胜利
                 StartCoroutine(CompareWin());
                 m_ComparePlayer.img_Win.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
             }
             else
             {
                 //比较者失败
                 StartCoroutine(CompareLose());
                 m_ComparePlayer.img_Lose.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Win.gameObject.SetActive(true);
             }
         }
         else
         {
             //比较者失败
             StartCoroutine(CompareLose());
             m_ComparePlayer.img_Lose.gameObject.SetActive(true);
             m_ComparedPlayer.img_Win.gameObject.SetActive(true);
         }
     }
     else
     {
         //比较者失败
         StartCoroutine(CompareLose());
         m_ComparePlayer.img_Lose.gameObject.SetActive(true);
         m_ComparedPlayer.img_Win.gameObject.SetActive(true);
     }
 }
Esempio n. 3
0
 private void CompareDanCard(BaseManager_Stand compare, BaseManager_Stand compared)
 {
     if (compare.m_CardList[0].Weight > compared.m_CardList[0].Weight)
     {
         StartCoroutine(CompareWin());//比较者胜利
         m_ComparePlayer.img_Win.gameObject.SetActive(true);
         m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
     }
     else if (compare.m_CardList[0].Weight == compared.m_CardList[0].Weight)
     {
         if (compare.m_CardList[1].Weight > compared.m_CardList[1].Weight)
         {
             StartCoroutine(CompareWin());//比较者胜利
             m_ComparePlayer.img_Win.gameObject.SetActive(true);
             m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
         }
         else if (compare.m_CardList[1].Weight == compared.m_CardList[1].Weight)
         {
             if (compare.m_CardList[2].Weight > compared.m_CardList[2].Weight)
             {
                 StartCoroutine(CompareWin());//比较者胜利
                 m_ComparePlayer.img_Win.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
             }
             else if (compare.m_CardList[2].Weight == compared.m_CardList[2].Weight)
             {
                 StartCoroutine(CompareLose());//比较者失败
                 m_ComparePlayer.img_Lose.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Win.gameObject.SetActive(true);
             }
             else
             {
                 StartCoroutine(CompareLose());//比较者失败
                 m_ComparePlayer.img_Lose.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Win.gameObject.SetActive(true);
             }
         }
         else
         {
             StartCoroutine(CompareLose());//比较者失败
             m_ComparePlayer.img_Lose.gameObject.SetActive(true);
             m_ComparedPlayer.img_Win.gameObject.SetActive(true);
         }
     }
     else
     {
         StartCoroutine(CompareLose());//比较者失败
         m_ComparePlayer.img_Lose.gameObject.SetActive(true);
         m_ComparedPlayer.img_Win.gameObject.SetActive(true);
     }
 }
Esempio n. 4
0
 //比牌的逻辑算法
 private void CompareCard(BaseManager_Stand compare, BaseManager_Stand compareD)
 {
     this.compare  = compare;
     this.compared = compareD;
     if (compare.m_CardType > compareD.m_CardType)
     {
         //比较者胜利
         StartCoroutine(CompareWin());
         m_ComparePlayer.img_Win.gameObject.SetActive(true);
         m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
     }
     else if (compare.m_CardType == compareD.m_CardType)
     {
         if (compare.m_CardType == CardType.Min)
         {
             CompareCardWhenMin(compare, compareD);
         }
         //662 663 766 866
         if (compare.m_CardType == CardType.Duizi)
         {
             int compareDuiziValue = 0, compareDanValue = 0, compareDduiziValue = 0, compareDdanValue = 0;
             //比较者
             if (compare.m_CardList[0].Weight == compare.m_CardList[1].Weight)
             {
                 compareDuiziValue = compare.m_CardList[0].Weight;
                 compareDanValue   = compare.m_CardList[2].Weight;
             }
             if (compare.m_CardList[1].Weight == compare.m_CardList[2].Weight)
             {
                 compareDuiziValue = compare.m_CardList[1].Weight;
                 compareDanValue   = compare.m_CardList[0].Weight;
             }
             //被比较者
             if (compareD.m_CardList[0].Weight == compareD.m_CardList[1].Weight)
             {
                 compareDduiziValue = compareD.m_CardList[0].Weight;
                 compareDdanValue   = compareD.m_CardList[2].Weight;
             }
             if (compareD.m_CardList[1].Weight == compareD.m_CardList[2].Weight)
             {
                 compareDduiziValue = compareD.m_CardList[1].Weight;
                 compareDdanValue   = compareD.m_CardList[0].Weight;
             }
             if (compareDuiziValue > compareDduiziValue)
             {
                 //比较者胜利
                 StartCoroutine(CompareWin());
                 m_ComparePlayer.img_Win.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
             }
             else if (compareDuiziValue == compareDduiziValue)
             {
                 if (compareDanValue > compareDdanValue)
                 {
                     //比较者胜利
                     StartCoroutine(CompareWin());
                     m_ComparePlayer.img_Win.gameObject.SetActive(true);
                     m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
                 }
                 else
                 {
                     //比较者失败
                     StartCoroutine(CompareLose());
                     m_ComparePlayer.img_Lose.gameObject.SetActive(true);
                     m_ComparedPlayer.img_Win.gameObject.SetActive(true);
                 }
             }
             else
             {
                 //比较者失败
                 StartCoroutine(CompareLose());
                 m_ComparePlayer.img_Lose.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Win.gameObject.SetActive(true);
             }
         }
         if (compare.m_CardType == CardType.Shunzi || compare.m_CardType == CardType.Shunjin ||
             compare.m_CardType == CardType.Baozi)
         {
             int compareSum = 0, compareDSum = 0;
             for (int i = 0; i < compare.m_CardList.Count; i++)
             {
                 compareSum += compare.m_CardList[i].Weight;
             }
             for (int i = 0; i < compareD.m_CardList.Count; i++)
             {
                 compareDSum += compareD.m_CardList[i].Weight;
             }
             if (compareSum > compareDSum)
             {
                 //比较者胜利
                 StartCoroutine(CompareWin());
                 m_ComparePlayer.img_Win.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Lose.gameObject.SetActive(true);
             }
             else
             {
                 //比较者失败
                 StartCoroutine(CompareLose());
                 m_ComparePlayer.img_Lose.gameObject.SetActive(true);
                 m_ComparedPlayer.img_Win.gameObject.SetActive(true);
             }
         }
         if (compare.m_CardType == CardType.Jinhua)
         {
             CompareCardWhenMin(compare, compareD);
         }
         if (compare.m_CardType == CardType.Max)
         {
             //比较者失败
             StartCoroutine(CompareLose());
             m_ComparePlayer.img_Lose.gameObject.SetActive(true);
             m_ComparedPlayer.img_Win.gameObject.SetActive(true);
         }
     }
     else
     {
         //比较者失败
         StartCoroutine(CompareLose());
         m_ComparePlayer.img_Lose.gameObject.SetActive(true);
         m_ComparedPlayer.img_Win.gameObject.SetActive(true);
     }
 }