Esempio n. 1
0
 public void AddNewBackedFundable(Fundable fundable, double amount)
 {
     if(BackedFundables.ContainsKey(fundable))
     {
         IncreaseAmountOfFundable(fundable, amount);
     }
     else
     {
         BackedFundables.Add(fundable, amount);
     }
 }
    public void UpdateScreen(GameObject buildingComponent)
    {
        this.buildingComponent = buildingComponent;
        this.fundable = buildingComponent.GetComponent<ComponentProperties>().Fundable;

        componentTitleText.text = fundable.name;
        totalCostText.text = "Total cost: " + fundable.TotalCost;
        double fundedCost = fundable.GetFundedCost();
        fundedText.text = (int)fundedCost + " euro funded";
        fundOverviewSlider.value = (float) (fundedCost / fundable.TotalCost);
        fundedText.rectTransform.localPosition = new Vector3 ((fundOverviewSlider.value - 0.5f) * 500, -7f, 0f);
    }
Esempio n. 3
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));
        }
 public void InitScreen(GameObject buildingComponent)
 {
     this.buildingComponent = buildingComponent;
     this.fundable = buildingComponent.GetComponent<ComponentProperties>().Fundable;
     fundtitleText.text = "Fund " + fundable.name;
 }
Esempio n. 5
0
 private static void InitFudables(UnityWebRequest request)
 {
     JSONNode fundablesJSON = JSON.Parse(request.downloadHandler.text);
     foreach (JSONNode fundableNode in fundablesJSON.AsArray)
     {
         string id = fundableNode["_id"].Value;
         string name = fundableNode["name"].Value;
         string path = fundableNode["path"].Value;
         double totalCost = fundableNode["totalCost"].AsDouble;
         Fundable fundable = new Fundable(id, path, totalCost, null, (name == "") ? null : name);
         fundables.Add(fundable);
     }
     requestPool.Remove(request);
 }
Esempio n. 6
0
 public void IncreaseAmountOfFundable(Fundable fundable, double amount)
 {
     BackedFundables[fundable] += amount;
 }
Esempio n. 7
0
 public double GetAmountOfFundsForFundable(Fundable fundable)
 {
     return BackedFundables[fundable];
 }