private void SubmitPurchaseToken() { TacoManager.OpenMessage(TacoConfig.Processing); Action <string> success = (string data) => { TacoManager.CloseMessage(); GeneralResult r = JsonUtility.FromJson <GeneralResult>(data); string notice; string header; if (r.success) { TacoManager.UpdateFundsWithToken(r.cash, r.token.ToString(), r.ticket.ToString()); moneyValue.text = TacoManager.FormatGTokens(double.Parse(TacoManager.User.gToken)); TournamentManager.Instance.SetMoneytext(); header = TacoConfig.SuccessHeader; notice = r.msg; } else { header = TacoConfig.ErrorHeader; notice = r.err; } TacoManager.OpenModalGeneralResultPanel(r.success, header, notice); }; Action <string, string> fail = (string data, string error) => { TacoManager.CloseMessage(); TacoManager.OpenModalConnectionErrorPanel(error); }; string currency = exchangedCurrencyIcon.sprite == TacoConfig.currencySprites[0] ? "0" : "2"; StartCoroutine(ApiManager.Instance.BuyToken(currency, exchangedNumber, success, fail)); }
public void Init(int currencyType) { fromMainMenu = !TacoManager.TacoTournamentsCanvas.activeSelf; if (fromMainMenu) { TacoManager.TacoTournamentsCanvas.SetActive(true); } Container.gameObject.SetActive(true); moneyIcon.sprite = TacoConfig.currencySprites[currencyType]; if (currencyType == 0) { title.text = TacoConfig.YourFundsHeader; FundPanel.SetActive(true); moneyValue.text = TacoManager.FormatMoney(TacoManager.User.TotalCash, currencyType); } else if (currencyType == 1) { title.text = TacoConfig.YourTokensHeader; TokenPanel.SetActive(true); moneyValue.text = TacoManager.FormatGTokens(double.Parse(TacoManager.User.gToken)); ResetTacoInput(); } else if (currencyType == 2) { title.text = TacoConfig.PrizesHeader; PointPanel.SetActive(true); moneyValue.text = TacoManager.FormatRP(TacoManager.User.ticket); if (!alreadyLoadPrize) { GetPrizesList(); } } }
public void TappedJoinFromList(Tournament t) { // TODO : move tournament Target to this class TacoManager.SetTarget(t); TacoConfig.print("join"); TacoConfig.print(t); TacoConfig.print(t.typeCurrency); Double prize = t.prize; Double entryFee = t.entryFee; int typeCurrency = t.typeCurrency; string players = t.size.ToString() + " " + TacoConfig.Players; TacoManager.OpenModalWithPreFab(TacoConfig.TacoSureJoinModalHeader, TournamentDetailsPrefab, TacoConfig.JoinSprite, ModalFunctions.JoinTournament, TacoConfig.CloseSprite, null); TournamentDetails tournamentDetails = TacoModalPanel.Instance.GetPreFab().GetComponent <TournamentDetails> (); if (typeCurrency == 0) { string replacedString = TacoConfig.TacoSureJoinModalBody.Replace("&entryFee", TacoManager.FormatMoney(entryFee)); replacedString = replacedString.Replace("&prize", TacoManager.FormatMoney(prize)); tournamentDetails.UpdateDetails(replacedString, players, TacoManager.FormatMoney(prize)); } else { string replacedString = TacoConfig.TacoSureJoinModalBody.Replace("&entryFee", TacoManager.FormatGTokens(entryFee)); replacedString = replacedString.Replace("&prize", TacoManager.FormatGTokens(prize)); tournamentDetails.UpdateDetails(replacedString, players, TacoManager.FormatGTokens(prize)); } }
public void Reload(List <Tournament> tournaments) { this.ListView.SuspendLayout(); this.ListView.Items.Clear(); Items = tournaments; for (int i = 0; i < Items.Count(); i++) { var t = Items [i]; string fee = string.Empty; string prize = string.Empty; string players = t.memberIds.Length + "/" + t.size; if (t.typeCurrency == 0) { fee = TacoManager.FormatCash(t.entryFee); prize = TacoManager.FormatCash(t.prize); } else { fee = TacoManager.FormatGTokens(t.entryFee); prize = TacoManager.FormatGTokens(t.prize); } AddListViewItem(t.name, fee, prize, t.prize_structure.ToString(), players, t, i % 2 == 0); } if (tournaments.Count == 0) { AddListViewItem(TacoConfig.NoResults, string.Empty, string.Empty, string.Empty); } this.ListView.ResumeLayout(); // fix columns panel does not show vertical handle transform.Find("ColumnsPanel").GetComponent <RectTransform> ().offsetMax = new Vector2(-20, 0); }
private void UpdateUI(ClaimInfo r) { moneyValue.text = TacoManager.FormatGTokens(double.Parse(TacoManager.User.gToken)); tokenClaim.text = "+" + r.nextToken.ToString(); tokenPopupClaim.text = tokenClaim.text; ToggleClaimButton(false); SetRemainingValue(r.remainingClaim, r.nextToken); }
public void SetDefaultMoneytext() { for (int i = 0; i < CreateTournamentTacoTexts.Count; i++) { CreateTournamentTacoTexts [i].text = TacoManager.FormatGTokens(0); } for (int i = 0; i < CreateTournamentCashTexts.Count; i++) { CreateTournamentCashTexts [i].text = TacoManager.FormatCash(0); } for (int i = 0; i < CreateTournamentRPTexts.Count; i++) { CreateTournamentRPTexts [i].text = TacoManager.FormatRP(0); } }
public void Reload(List <Tournament> tournaments) { this.ListView.SuspendLayout(); this.ListView.Items.Clear(); Items = tournaments; for (int i = 0; i < Items.Count(); i++) { var t = Items[i]; string fee = string.Empty; string prize = string.Empty; string players = t.memberIds.Length + "/" + t.size; if (t.typeCurrency == 0) { fee = TacoManager.FormatCash(t.entryFee); prize = TacoManager.FormatCash(t.prize); } else { fee = TacoManager.FormatGTokens(t.entryFee); prize = TacoManager.FormatGTokens(t.prize); } AddListViewItem(fee, prize, t.prize_structure.ToString(), players, t, i % 2 == 0); } // if there are any results - make a row to tell that if (tournaments.Count == 0) { SetNotice(TacoConfig.NoResults); } else { SetNotice(); } // used to set selected to first row /*if( this.ListView.Items.Count > 0 ){ * * this.ListView.SelectedIndices.Add (0); * } */ this.ListView.ResumeLayout(); }
public void convertFundsToGTokens(int fee) { AddGTokensText.GetComponent <Text>().text = TacoConfig.AddGTokensAdding; AddGTokensButton.GetComponent <Button>().interactable = false; Action <string> success = (string data) => { TacoConfig.print("Purchase GTokens complete - " + data); var r = JsonUtility.FromJson <AddGTokesResult>(data); if (r.success) { TacoManager.UpdateFundsWithToken(r.funds, r.gTokens); string returnMessage = TacoConfig.AddFundsSuccessMessage + TacoManager.FormatGTokens(double.Parse(r.gTokens)); AddGTokensText.GetComponent <Text>().text = ""; // show a dialog to indicate success : then return to tournaments TacoManager.OpenModal(TacoConfig.AddGTokensTitleSuccessMessage, returnMessage, null, ModalFunctions.ReturnToTournaments, null, null, false); } else { AddGTokensText.GetComponent <Text>().text = TacoConfig.Error + " : " + r.message; } AddGTokensButton.GetComponent <Button>().interactable = true; }; Action <string, string> fail = (string data, string error) => { if (!string.IsNullOrEmpty(error)) { TacoConfig.print("Error : " + error); } TacoManager.CloseMessage(); string msg = data + (string.IsNullOrEmpty(error) ? "" : " : " + error); TacoConfig.print("Error adding gTokens : " + msg); if (!string.IsNullOrEmpty(data)) { ErrorResult errorResult = JsonUtility.FromJson <ErrorResult>(data); if (!errorResult.success) { msg = errorResult.message; } } AddGTokensText.GetComponent <Text>().text = TacoConfig.Error + " : " + msg; AddGTokensButton.GetComponent <Button>().interactable = true; //TacoManager.OpenModal(TacoConfig.TacoLoginErrorHeader, msg); }; StartCoroutine(ApiManager.Instance.AddGTokens(fee, fee * TacoConfig.gTokenExchange, success, fail)); }
public void SetMoneytext() { for (int i = 0; i < CreateTournamentTacoTexts.Count; i++) { CreateTournamentTacoTexts [i].text = TacoManager.FormatGTokens(double.Parse(TacoManager.User.gToken)); } for (int i = 0; i < CreateTournamentCashTexts.Count; i++) { CreateTournamentCashTexts [i].text = TacoManager.FormatCash(TacoManager.User.TotalCash); } for (int i = 0; i < CreateTournamentRPTexts.Count; i++) { CreateTournamentRPTexts [i].text = TacoManager.FormatRP(TacoManager.User.ticket); } TacoSetup.Instance.SetMoneyValueForButtons(); }
public void Reload(List <Tournament> tournaments) { this.ListView.SuspendLayout(); this.ListView.Items.Clear(); Items = tournaments; foreach (var t in tournaments) { //TacoConfig.print("Tournament Name = " + t.name + " status = " + t.status + " entryFee = " + t.entryFee + " prize = " + t.prize); string fee = string.Empty; string prize = string.Empty; if (t.typeCurrency == 0) { fee = TacoManager.FormatMoney(t.entryFee); prize = TacoManager.FormatMoney(t.prize); } else { fee = TacoManager.FormatGTokens(t.entryFee); prize = TacoManager.FormatGTokens(t.prize); } AddListViewItem(t.name, fee, prize, t.prize_structure.ToString(), t); } // if there are any results - make a row to tell that if (tournaments.Count == 0) { AddListViewItem(TacoConfig.NoResults, "", "", ""); } // used to set selected to first row /*if( this.ListView.Items.Count > 0 ){ * * this.ListView.SelectedIndices.Add (0); * } */ this.ListView.ResumeLayout(); }
public void Reload(List <Prize> prizesList) { this.ListView.SuspendLayout(); this.ListView.Items.Clear(); Items = prizesList; //Items.AddRange(endedList); foreach (var t in GetItems()) { string fee = string.Empty; string prize = string.Empty; if (t.typeCurrency == 0) { fee = TacoManager.FormatMoney(t.entryFee); prize = TacoManager.FormatMoney(t.prize); } else { fee = TacoManager.FormatGTokens(t.entryFee); prize = TacoManager.FormatGTokens(t.prize); } AddListViewItem(fee, prize, t.prize_structure.ToString(), t); } // if there are any results - make a row to tell thxat if (prizesList.Count == 0) { AddListViewItem(TacoConfig.NoResults, "", "", ""); } // used to set selected to first row /*if( this.ListView.Items.Count > 0 ){ * * this.ListView.SelectedIndices.Add (0); * } */ this.ListView.ResumeLayout(); }
public void Reload(List <Tournament> tournaments) { this.ListView.SuspendLayout(); this.ListView.Items.Clear(); Items = tournaments; for (int i = 0; i < Items.Count(); i++) { var t = Items [i]; string fee = string.Empty; string prize = string.Empty; t.played = true; if (t.typeCurrency == 0) { fee = TacoManager.FormatCash(t.entryFee); prize = TacoManager.FormatCash(t.prize); } else { fee = TacoManager.FormatGTokens(t.entryFee); prize = TacoManager.FormatGTokens(t.prize); } AddListViewItem(fee, prize, t.prize_structure.ToString(), t, i % 2 == 0); } if (tournaments.Count == 0) { SetNotice(TacoConfig.NoResults); } else { SetNotice(); } this.ListView.ResumeLayout(); }
public void TappedJoinFromList(Tournament t) { TacoManager.SetTarget(t); double entryFee = t.entryFee; int typeCurrency = t.typeCurrency; string replacedString = string.Empty; if (t.IsWarningTime()) { TacoManager.OpenModalWarningTimePanel(t); } else { string formatFee = string.Empty; replacedString = "To enter this <b>'" + TacoSetup.Instance.gameName + " &tournamentType'</b> the &tournamentFee will be debited from your account."; if (typeCurrency == 0) { replacedString = replacedString.Replace("&tournamentFee", "Cash Entry Fee"); formatFee = TacoManager.FormatCash(entryFee); } else { replacedString = replacedString.Replace("&tournamentFee", "Taco Token Entry Fee"); formatFee = TacoManager.FormatGTokens(entryFee); } if (CurrentSubPanel == PanelNames.MyPublicPanel) { replacedString = replacedString.Replace("&tournamentType", "Public Tournament"); } else { replacedString = replacedString.Replace("&tournamentType", "Private Tournament"); } TacoManager.OpenModalEnterTournamentPanel(replacedString, formatFee, typeCurrency); } }
public void LoadLeaderboard(Tournament t) { Action <string> success = (string data) => { LeaderboardResult r = JsonUtility.FromJson <LeaderboardResult>(data); Double prize = Double.Parse(r.tournament.prize.ToString()); Double entryFee = Double.Parse(r.tournament.entryFee.ToString()); string details; if (r.tournament.typeCurrency == 0) { details = TacoConfig.LeaderboardResults.Replace("&prize", TacoManager.FormatMoney(prize)); details = details.Replace("&name", r.tournament.name); details = details.Replace("&fee", TacoManager.FormatMoney(entryFee)); } else { details = TacoConfig.LeaderboardResults.Replace("&prize", TacoManager.FormatGTokens(prize)); details = details.Replace("&name", r.tournament.name); details = details.Replace("&fee", TacoManager.FormatGTokens(entryFee)); } TacoConfig.print(details); tournamentDetailsText.text = details; this.Reload(r.leaderboard); }; Action <string, string> fail = (string data, string error) => { TacoManager.OpenModal(TacoConfig.Error, TacoConfig.TacoTournamentError + " | " + error + " | " + data); }; var url = "api/tournament/leaderboard/" + TacoConfig.SiteId + "/" + t.id; StartCoroutine(ApiManager.Instance.GetWithToken(url, success, fail)); }
public void StartCreate( ) { string bodyString = TacoConfig.TournamentCreateModalBody; //GetCurrentFeeFromToggles //string feeString = GetFeeAmount(); int typeCurrencyOption = TacoManager.GetTogglActiveName(typeCurrencyToggle.GetComponent <ToggleGroup> ()); Double feeString = 0; string replacedString = string.Empty; if (typeCurrencyOption == 0) { feeString = double.Parse(GetFeeAmount()); replacedString = bodyString.Replace("&fee", TacoManager.FormatMoney(feeString)); } else { feeString = GetCurrentGTokenFromToggles() * TacoConfig.gTokenExchange; replacedString = bodyString.Replace("&fee", TacoManager.FormatGTokens(feeString)); } // pop a dialog to make sure they want to create the tournament TacoManager.OpenModal(TacoConfig.TournamentCreateModalHeader, replacedString, TacoConfig.PlaySprite, ModalFunctions.TournamentSubmit); }
private void UpdateUIValue(LeaderboardResult r) { Tournament t = r.tournament; string tournamentType = t.Type; double prizePool = t.PrizePool; double entryFee = double.Parse(t.entryFee.ToString()); LeaderboardRow currentUserRank = r.leaderboard.First(x => x.userId == TacoManager.User.userId); string infos = string.Empty; string details; double moneyValue = 0; int winnerNb = r.winner.Length; prizeIcon.sprite = TacoConfig.currencySprites [t.typeCurrency]; tournamentTypeText.text = TacoConfig.LeaderboardTournamentType.Replace("&type", tournamentType).Replace("&gameName", TacoSetup.Instance.gameName); details = TacoConfig.LeaderboardResultDetails.Replace("&player", t.size.ToString()).Replace("&winner", TacoConfig.Pluralize(t.prize_structure, "Winner")); if (!string.IsNullOrEmpty(t.endDate)) { FinishedButtons.SetActive(true); endedLeaderboardFooter.SetActive(true); rankIcon.transform.parent.gameObject.SetActive(true); int userRank = int.Parse(currentUserRank.rank); if (userRank < 4) { rankIcon.gameObject.SetActive(true); rankIcon.sprite = imageList.Images [currentUserRank.rank]; } else { rankText.transform.parent.gameObject.SetActive(true); rankText.text = TacoConfig.ToShortOrdinal(userRank); } string formatedDay = t.endDate.Substring(5, 2) + "-" + t.endDate.Substring(8, 2) + "-" + t.endDate.Substring(0, 4); infos += TacoConfig.LeaderboardResultEndOn.Replace("&day", formatedDay); if (userRank <= t.prize_structure) { resultStatus.text = "You Won!"; prizeAmount.text = "+ "; moneyValue = t.PrizePool / winnerNb; int rpModifier = 0; if (t.typeCurrency == 0) { rpModifier = 50; } else { rpModifier = 5; } redeemAmount.text = "+ " + TacoManager.FormatRP(Mathf.RoundToInt((float)(moneyValue * rpModifier))); } else { resultStatus.text = "You Lost!"; prizeAmount.text = "+ "; moneyValue = 0; redeemAmount.text = "+ " + TacoManager.FormatRP(0); } } else { resultStatus.text = "Beautiful Job!"; playingLeaderboardFooter.SetActive(true); /*if (currentUserRank.playable) * { * FinishedButtons.SetActive(true); * } * else * { * UnfinishedButtons.SetActive(true); * }*/ rankIcon.transform.parent.gameObject.SetActive(false); countdownTime = Mathf.Max((float)t.RemainingTimeSpan.TotalSeconds, -1); if (countdownTime < 0) { remainingTime.text = "00:00:00"; } } if (t.typeCurrency == 0) { prizePoolText.text = TacoManager.FormatCash(prizePool); entryFeeText.text = TacoManager.FormatCash(entryFee); prizeAmount.text += TacoManager.FormatCash(moneyValue); } else { prizePoolText.text = TacoManager.FormatGTokens(prizePool); entryFeeText.text = TacoManager.FormatGTokens(entryFee); prizeAmount.text += TacoManager.FormatGTokens(moneyValue); } for (int i = 0; i < LeaderBoardMoneyTypeImages.Count; i++) { LeaderBoardMoneyTypeImages [i].sprite = TacoConfig.currencySprites [t.typeCurrency]; } infos += TacoConfig.LeaderboardResultTournamentID.Replace("&id", t.id.ToString()); resultScore.text = "Score: " + currentUserRank.score.ToString(); tournamentDetailsText0.text = infos; tournamentDetailsText1.text = details; /*playAgain.onClick.RemoveAllListeners(); * playAgain.onClick.AddListener (() => { * TacoManager.OpenModalReEnterPanel ( * TacoConfig.ReEnterNotice.Replace ("&type", tournamentType).Replace("&gameName", t.accessType == "public" ? "Public" : "Private"), * entryFeeText.text); * });*/ Reload(r.leaderboard, !string.IsNullOrEmpty(t.endDate)); }
protected void AddListViewItem(string fee, string prize, string prize_structure, Tournament tag, bool isEven) { string winLoss; string prizeResult = TacoConfig.HidedNumber; string placement = string.Empty; string prizePool = string.Empty; string winLossKey; string placementKey = string.Empty; if (TacoSetup.Instance.TournamentCategory == TournamentCate.Cash) { prizePool = TacoManager.FormatCash(tag.PrizePool); } else { prizePool = TacoManager.FormatGTokens(tag.PrizePool); } if (string.IsNullOrEmpty(tag.endDate)) { winLoss = "Ends in\n" + tag.RemainingTimeString(false); winLossKey = "Remaining"; placement = "N/A"; } else { if (tag.rank <= tag.prize_structure) { winLoss = "<color=#ccff66>WIN</color>"; winLossKey = "win"; if (TacoSetup.Instance.TournamentCategory == TournamentCate.Cash) { prizeResult = TacoManager.FormatCash(tag.prize); } else { prizeResult = TacoManager.FormatGTokens(tag.prize); } } else { winLoss = "<color=#ff6666>LOSS</color>"; winLossKey = "loss"; } if (tag.rank < 4) { placement = string.Empty; placementKey = tag.rank.ToString(); } else { placement = tag.rank.ToString(); } } string[] subItemTexts = new string[] { tag.PlayedDayFormat, winLoss, placement, prizePool, prizeResult, string.Empty }; ListViewItem listViewItem = new ListViewItem(subItemTexts); listViewItem.Tag = tag; listViewItem.UseItemStyleForSubItems = false; listViewItem.SubItems [ColumnNames.IndexOf("WIN/LOSS")].ImageKey = winLossKey; listViewItem.SubItems [ColumnNames.IndexOf("PLACEMENT")].ImageKey = placementKey; var backgroundColor = TacoConfig.ListViewOddRow; if (isEven) { backgroundColor = TacoConfig.ListViewEvenRow; } for (int i = 0; i < listViewItem.SubItems.Count; i++) { listViewItem.SubItems [i].BackColor = backgroundColor; } this.ListView.Items.Add(listViewItem); }
private void UpdateUIValue(ManageTournamentResult data) { tournament = data.tournament; List <string> joinedPlayers = new List <string>() { TacoManager.User.email }; List <string> notJoinedPlayers = new List <string>(); invitedEmails = new List <string>() { TacoManager.User.email }; for (int i = 0; i < tournament.friendEmails.Length; i++) { if (tournament.friendStatuses[i] == "invited") { if (!notJoinedPlayers.Contains(tournament.friendEmails[i])) { notJoinedPlayers.Add(tournament.friendEmails[i]); } if (!invitedEmails.Contains(tournament.friendEmails[i])) { invitedEmails.Add(tournament.friendEmails[i]); } } else if (tournament.friendStatuses[i] == "accepted") { if (!joinedPlayers.Contains(tournament.friendEmails[i])) { joinedPlayers.Add(tournament.friendEmails[i]); } if (!invitedEmails.Contains(tournament.friendEmails[i])) { invitedEmails.Add(tournament.friendEmails[i]); } } } string infos = string.Empty; for (int i = 0; i < MoneyTypeImages.Count; i++) { MoneyTypeImages[i].sprite = TacoConfig.currencySprites[tournament.typeCurrency]; } string createdTime = TacoManager.FormatDate(tournament.createdAt); infos += TacoConfig.ManageTournamentCreatedOn.Replace("&day", createdTime); infos += TacoConfig.LeaderboardResultTournamentID.Replace("&id", tournament.id.ToString()); if (tournament.typeCurrency == 0) { prizePoolText.text = TacoManager.FormatCash(tournament.prize); entryFeeText.text = TacoManager.FormatCash(tournament.entryFee); } else { prizePoolText.text = TacoManager.FormatGTokens(tournament.prize); entryFeeText.text = TacoManager.FormatGTokens(tournament.entryFee); } winnerText.text = TacoConfig.Pluralize(tournament.prize_structure, "Winner"); playeredJoinedText.text = tournament.memberIds.Length + "/" + tournament.size + " Players Joined"; tournamentDetailsText.text = infos; countdownTime = (double)Mathf.Max((float)tournament.RemainingTimeSpan.TotalSeconds, -1); if (countdownTime < 0) { remainingTime.text = "00:00:00"; } seeResultButton.interactable = tournament.entryIds.Contains(TacoManager.User.userId); //destroy old email fields float contentWidth = contentPanel.rect.width; for (int i = 1; i < emailsPanel.childCount; i++) { Destroy(emailsPanel.GetChild(i).gameObject); } //generate new email fields float spacing = 35; float width = (contentPanel.rect.width - spacing); float height = 150; inviteEmailTexts = new List <TournamentInvite>(); for (int i = 0; i < notJoinedPlayers.Count; i++) { GameObject ob = Instantiate(TacoConfig.NotJoinedPlayerPrefab, Vector3.zero, Quaternion.identity, emailsPanel) as GameObject; Text inviteeEmailText = ob.transform.Find("EmailInput/NameInput").GetComponent <Text>(); inviteeEmailText.text = notJoinedPlayers[i]; RectTransform r = ob.GetComponent <RectTransform>(); r.localPosition = new Vector3(0, height * (-0.5f - i) - spacing); r.sizeDelta = new Vector2(width - spacing * 5, height - spacing); ob.transform.Find("EmailInput/Send").GetComponent <Button>().onClick.AddListener(() => { ob.transform.Find("EmailInput/Send").gameObject.SetActive(false); Debug.Log("send reminder"); TournamentManager.Instance.InviteFriend(inviteeEmailText.text); if (!invitedEmails.Contains(inviteeEmailText.text)) { invitedEmails.Add(inviteeEmailText.text); } }); AddRemoveEmailEvent(ob, r, inviteeEmailText.text); } float offset = height * (-notJoinedPlayers.Count); int newEmailCount = tournament.size - joinedPlayers.Count - notJoinedPlayers.Count; for (int i = 0; i < newEmailCount; i++) { GameObject ob = Instantiate(TacoConfig.InviteInputPrefab, Vector3.zero, Quaternion.identity, emailsPanel) as GameObject; RectTransform r = ob.GetComponent <RectTransform>(); r.localPosition = new Vector3(0, height * (-0.5f - i) - spacing + offset); r.sizeDelta = new Vector2(width - spacing * 5, height - spacing); TournamentInvite invite = ob.GetComponent <TournamentInvite>(); invite.reservedEmails = invitedEmails; invite.isInManage = true; if (i > 0) { inviteEmailTexts[i - 1].next = invite; invite.prev = inviteEmailTexts[i - 1]; invite.SetInteractable(false); } if (i == 0) { invite.SetFocus(); } inviteEmailTexts.Add(invite); } //fix if invite more people than tournament size offset = height * (-0.5f - Mathf.Max((notJoinedPlayers.Count + newEmailCount), notJoinedPlayers.Count)); Vector3 linePos = new Vector3(0, offset); //joined players for (int i = 0; i < joinedPlayers.Count; i++) { GameObject ob = Instantiate(joinedPlayerPrefab, Vector3.zero, Quaternion.identity, emailsPanel) as GameObject; ob.transform.Find("EmailInput/NameInput").GetComponent <Text>().text = joinedPlayers[i]; RectTransform r = ob.GetComponent <RectTransform>(); r.localPosition = new Vector3(0, height * (-1.5f - i) - spacing + offset); r.sizeDelta = new Vector2(width - spacing * 5, height - spacing); } contentPanel.sizeDelta = new Vector2(contentPanel.sizeDelta.x, Mathf.Max(5 * height, (int)(Mathf.Max(tournament.size, notJoinedPlayers.Count + joinedPlayers.Count) + 4.5f) * height + spacing)); contentPanel.localPosition = new Vector3(contentPanel.localPosition.x, 0); line.localPosition = linePos; }
public void TappedGameFromList(Tournament t) { TacoManager.SetTarget(t); if (t.played) { TournamentManager.Instance.ShowTournamentPanel(PanelNames.MyLeaderboardPanel); } else { Double prize = t.prize; int typeCurrency = t.typeCurrency; string replacedString = string.Empty; if (typeCurrency == 0) { replacedString = TacoConfig.TacoSurePlayModalBody.Replace("&prize", TacoManager.FormatMoney(prize)); } else { replacedString = TacoConfig.TacoSurePlayModalBody.Replace("&prize", TacoManager.FormatGTokens(prize)); } TacoManager.OpenModal(TacoConfig.TacoSurePlayModalHeader, replacedString, TacoConfig.PlaySprite, ModalFunctions.StartPlay, TacoConfig.CloseSprite, null); } }