Exemple #1
0
    /*private void getInfo() {
     *  getProfileRequest req = new getProfileRequest(email, Global.getToken(), "viewProfile");
     *  string json = JsonConvert.SerializeObject(req);
     *  Byte[] data = System.Text.Encoding.ASCII.GetBytes(json);
     *  Global.stream.Write(data, 0, data.Length);
     *  data = new Byte[1024];
     *  string responseData = string.Empty;
     *  Int32 bytes = Global.stream.Read(data, 0, data.Length);
     *  responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
     *
     *  string[] info = responseData.Split(',');
     *
     *  returnedAvatar = info[0].Split('-')[1];
     *  returnedUsername = info[2].Split('-')[1];
     * }*/

    #endregion

    #region Place Cards
    // Called at the beginning of every turn
    private void drawCard()
    {
        if (deckList.Count > 0)
        {
            Card b = DuelFunctions.DrawCard(ref myState);
            myState.inHand.Add(b);
            GameObject c = (GameObject)Instantiate(myCard);
            c.GetComponent <Image>().sprite   = null;
            c.GetComponent <Image>().material = b.CardImage;
            c.name = b.CardName;
            c.transform.SetParent(handAreaPanel.transform, false); // Add card to my play area
            handList.Add(c);                                       // Add card to my play list
        }
    }
Exemple #2
0
    // Called at start of game to fill hand to 6 cards from deck
    IEnumerator initalDraw()
    {
        int handCount = 1;

        while (handCount <= 6) // To add 6 cards to hand
        {
            Card b = DuelFunctions.DrawCard(ref myState);
            if (b == null)
            {
                break;
            }
            GameObject c = (GameObject)Instantiate(myCard);
            c.GetComponent <Image>().sprite   = null;
            c.GetComponent <Image>().material = b.CardImage;
            c.name = b.CardName;
            c.transform.SetParent(handAreaPanel.transform, false); // Add card to hand
            myState.inHand.Add(b);
            handList.Add(c);                                       // Add card to hand list
            handCount++;
            yield return(new WaitForSeconds(0.5f));
        }
    }