Beispiel #1
0
 public void AddBacker(Backer backer, double amount)
 {
     if(!Backers.Contains(backer))
     {
         backer.AddNewBackedFundable(this, amount);
         Backers.Add(backer);
     }
     else
     {
         Backers.Find(b => b == backer).BackedFundables[this] += amount;
     }
 }
Beispiel #2
0
        public static void AddDonation(Backer backer, Fundable fundable, string amount, string feedback, Action action)
        {
            WWWForm form = new WWWForm();
            form.AddField("firstname", backer.FirstName);
            form.AddField("lastname", backer.FamilyName);
            form.AddField("mail", backer.Mail);
            form.AddField("fundableID", fundable.Id);
            form.AddField("amount", amount);
            form.AddField("feedback", feedback);

            UnityWebRequest request = UnityWebRequest.Post(endpoint + "unityDonation", form);
            coroutineHelper.StartCoroutine(UploadDonation(request, action));
        }
Beispiel #3
0
        private static void InitBackers(UnityWebRequest request)
        {
            JSONNode backersJSON = JSON.Parse(request.downloadHandler.text);
            foreach (JSONNode backerNode in backersJSON.AsArray)
            {
                string id = backerNode["_id"].Value;
                string firstName = backerNode["firstName"].Value;
                string lastName = backerNode["lastName"].Value;
                string mail = backerNode["mail"].Value;

                Backer backer = new Backer(id, firstName, lastName, mail);
                backers.Add(backer);
            }
            requestPool.Remove(request);
        }