示例#1
0
    void ceckCardType()
    {
        CardPropFirstCard = CardHolder.transform.GetChild(0).GetComponent <CardProp> ();

        for (int i = 0; i < Hand1.transform.childCount; i++)
        {
            string cardType = setCard(i);
            if (cardType == CardPropFirstCard.Type)
            {
                draggble.enabled = true;
            }
            else if (cardType != CardPropFirstCard.Type)
            {
                draggble.enabled = false;
                cardImage.color  = new Color32(164, 164, 164, 255);
                Debug.Log(CardPropFirstCard.Type);
                playableCardCounter++;
            }
        }
        if (playableCardCounter >= Hand1.transform.childCount)
        {
            Debug.Log(playableCardCounter);
            for (int i = 0; i < Hand1.transform.childCount; i++)
            {
                setCard(i);
                draggble.enabled = true;
                cardImage.color  = Color.white;
            }
        }
    }
示例#2
0
 void playGround()
 {
     firstCard = targetOject.transform.GetChild(0).gameObject;
     cardProp  = firstCard.GetComponent <CardProp> ();
     cardType  = cardProp.Type;
     Debug.Log(cardType);
 }
示例#3
0
 public static void LoadData()
 {
     for (int i = 0; i < GlobalVariable.FightCards.Count; i++)
     {
         fightCardsGrids[i] = new CardProp(GlobalVariable.FightCards[i], i);
         count++;
     }
     Show();
 }
示例#4
0
 public void CancelSelect(CardProp card)
 {
     foreach (GameObject t in cardgridobjects)
     {
         if (t.GetComponent <CardSelect>().gameProp.Equal(card.index))
         {
             t.transform.Find("card-style").GetComponent <SpriteRenderer>().material   = Resources.Load <Material>("materials/Default");
             t.transform.Find("card-raw-img").GetComponent <SpriteRenderer>().material = Resources.Load <Material>("materials/Default");
         }
     }
 }
示例#5
0
    void disreputeCards()
    {
        Image randomCard;

        for (int i = 0; i < 8; i++)
        {
            do
            {
                randIndex = Random.Range(0, 51);
            }while(randomNum.Contains(randIndex));
            randomNum.Add(randIndex);
            randomCard = CardsList[randIndex];
            cardPro    = randomCard.transform.GetComponent <CardProp> ();
            if (cardPro.Type == "Diamond")
            {
                DiamondImages.Add(randomCard);
            }
            else if (cardPro.Type == "club")
            {
                ClubImages.Add(randomCard);
            }
            else if (cardPro.Type == "Heart")
            {
                HeartImages.Add(randomCard);
            }
            else if (cardPro.Type == "Spade")
            {
                SpadesImages.Add(randomCard);
            }
        }

        //oreder the card in the hand.
        for (int i = 0; i < DiamondImages.Count; i++)
        {
            DiamondImages[i].transform.SetParent(Hand1.transform);
        }
        for (int i = 0; i < ClubImages.Count; i++)
        {
            ClubImages[i].transform.SetParent(Hand1.transform);
        }
        for (int i = 0; i < HeartImages.Count; i++)
        {
            HeartImages[i].transform.SetParent(Hand1.transform);
        }
        for (int i = 0; i < SpadesImages.Count; i++)
        {
            SpadesImages[i].transform.SetParent(Hand1.transform);
        }
    }
示例#6
0
 public void LoadCard(GameProp temp, int t)
 {
     gameProp = new CardProp(temp, t);
 }
示例#7
0
 public void SetGameProp(CardProp temp)
 {
     gameProp = temp;
 }