示例#1
0
    public void Play(int n)
    {
        HandsList[n].transform.parent = Field.transform;
        GameObject miniCard = HandsList[n].transform.Find("MiniCard").gameObject;

        miniCard.SetActive(true);

        /*if (HandsList[n].GetComponent<Card>().Buf > 0)
         * {
         *  miniCard.GetComponent<Image>().sprite = miniCardSprites_i[HandsList[n].GetComponent<Card>().Buf];
         * }
         * else if (HandsList[n].GetComponent<Card>().Buf < 0)
         * {
         *  miniCard.GetComponent<Image>().sprite = miniCardSprites_d[-HandsList[n].GetComponent<Card>().Buf];
         * }
         * else
         * {*/
        if (HandsList[n].GetComponent <Card>().CalcNum < miniCardSprites.Count)
        {
            miniCard.GetComponent <Image>().sprite = miniCardSprites[HandsList[n].GetComponent <Card>().CalcNum];
        }
        else
        {
            miniCard.GetComponent <Image>().sprite = miniCardSprites[miniCardSprites.Count - 1];
        }
        //}
        int space   = 20;
        int maxMini = 5;

        if (FieldList.Count < maxMini)
        {
            miniCard.GetComponent <RectTransform>().anchoredPosition = new Vector2(-159.4f + space * FieldList.Count, 167f - 29.5f * (Num - 1));
        }
        else
        {
            int x = space * (maxMini - 1) / (FieldList.Count - 1) - space * (maxMini - 1) / FieldList.Count;
            miniCard.GetComponent <RectTransform>().anchoredPosition = new Vector2(-159.4f + space * (maxMini - 1), 167f - 29.5f * (Num - 1));
            for (int i = 0; i < FieldList.Count; i++)
            {
                RectTransform rt = FieldList[i].transform.Find("MiniCard").GetComponent <RectTransform>();
                rt.anchoredPosition -= new Vector2((float)i * x, 0);
            }
        }
        if (TurnPlayer)
        {
            HideHand(n);
        }
        FieldList.Add(HandsList[n]);
        HandsList.RemoveAt(n);
        if (TurnPlayer)
        {
            HandsAnimeStart();
        }
        else
        {
            HandsUpdate();
        }

        EndThisTurn = true;
    }
示例#2
0
 public void Handeath()
 {
     if (HandsList.Count != 0)
     {
         int card = Random.Range(0, HandsList.Count);
         HandsList[card].transform.parent = Deck.transform;
         if (TurnPlayer)
         {
             HideHand(card);
         }
         DeckList.Add(HandsList[card]);
         DeckShuffle();
         HandsList.RemoveAt(card);
         if (TurnPlayer)
         {
             HandsAnimeStart();
         }
         else
         {
             HandsUpdate();
         }
     }
 }