//----------------------------------------------------------------------------------------------------------------------------------------------// public void Donate() { int fGoal = projectInfo.fundGoal / 100; int fAmount = projectInfo.currentBalance / 100; int fNeeded = fGoal - fAmount; if (balance == target) { if (balance >= donate) { if (fNeeded > donate) { t = 0; start = balance; target = balance - donate; dataGetSet.SetInfoSingle("Balance", (target * 100).ToString()); UpdateProjectBalance(donate); activityManager.SetAlertDonation(donate.ToString(), dataGetSet.currentUsername, projectInfo.projectReference, dataGetSet.currentUserID); //activityManager.Resubscribe (); AddToTotalGet(donate * 100); circlesManager.AddReferenceToAllUserCircles(dataGetSet.currentUserID, donate * 100, projectInfo.projectReference); } else { t = 0; start = balance; target = balance - fNeeded; dataGetSet.SetInfoSingle("Balance", (target * 100).ToString()); UpdateProjectBalance(fNeeded); activityManager.SetAlertDonation(fNeeded.ToString(), dataGetSet.currentUsername, projectInfo.projectReference, dataGetSet.currentUserID); //activityManager.Resubscribe (); StartCoroutine(WaitSetFunded()); AddToTotalGet(fNeeded * 100); circlesManager.AddReferenceToAllUserCircles(dataGetSet.currentUserID, fNeeded * 100, projectInfo.projectReference); } } else { if (balance > 0) { int giveAmount = balance; if (fNeeded > giveAmount) { t = 0; start = balance; target = 0; dataGetSet.SetInfoSingle("Balance", (0).ToString()); UpdateProjectBalance(giveAmount); activityManager.SetAlertDonation(giveAmount.ToString(), dataGetSet.currentUsername, projectInfo.projectReference, dataGetSet.currentUserID); //activityManager.Resubscribe (); AddToTotalGet(giveAmount * 100); circlesManager.AddReferenceToAllUserCircles(dataGetSet.currentUserID, giveAmount * 100, projectInfo.projectReference); } else { t = 0; start = balance; target = balance - fNeeded; dataGetSet.SetInfoSingle("Balance", (target * 100).ToString()); UpdateProjectBalance(fNeeded); activityManager.SetAlertDonation(fNeeded.ToString(), dataGetSet.currentUsername, projectInfo.projectReference, dataGetSet.currentUserID); //activityManager.Resubscribe (); StartCoroutine(WaitSetFunded()); AddToTotalGet(fNeeded * 100); circlesManager.AddReferenceToAllUserCircles(dataGetSet.currentUserID, fNeeded * 100, projectInfo.projectReference); } } else { // Do nothing, you have no money to give // Let the user know } } } }