Esempio n. 1
0
        public static int addDuelCredits(bool won, int turns, bool AI)
        {
            double multi = 1;

            if (!won)
            {
                multi /= 2;
            }
            if (AI)
            {
                multi /= 2;
            }
            int           credits = (int)(((turns * 5) + 50) * multi);
            CreditRequest result  = new CreditRequest("updateCredits", getID(), getToken(), credits);

            NetworkRequest(result);
            return(credits);
        }
Esempio n. 2
0
 public static void addCredits(int amount)
 {
     try
     {
         CreditRequest arc  = new CreditRequest("updateCredits", getID(), getToken(), amount);
         string        json = JsonConvert.SerializeObject(arc);
         Byte[]        data = System.Text.Encoding.ASCII.GetBytes(json);
         stream.Write(data, 0, data.Length);
         data = new Byte[100000];
         string responseData = string.Empty;
         Int32  bytes        = stream.Read(data, 0, data.Length);
         responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
     }
     catch (Exception)
     {
         Debug.Log("error");
     }
 }