public void getPublicTournaments(Func <Tournament, bool> filterCondition = null) { TacoManager.OpenMessage(TacoConfig.TacoRefreshing); var cate = (int)TacoSetup.Instance.TournamentCategory; Action <string> success = (string data) => { List <Tournament> publicList = new List <Tournament> (); PublicTournamentsResult r = JsonUtility.FromJson <PublicTournamentsResult> (data); foreach (Tournament item in r.tournaments) { if (item.typeCurrency == cate && item.playable) { publicList.Add(item); } else if (item.typeCurrency != cate || item.played || ((item.status == "ended" || item.status == "filled") && Array.IndexOf(item.memberIds, TacoManager.User.userId) <= -1)) { } else { publicList.Add(item); } } if (filterCondition != null) { publicList = publicList.Where(filterCondition).ToList(); } publicList = publicList.OrderBy(x => PublicTournamentsList.Instance.GetDisplayedStatus(x)).ToList(); PublicTournamentsList.Instance.Reload(publicList); TacoManager.CloseMessage(); }; Action <string, string> fail = (string data, string error) => { Debug.Log("Error getting open tournaments : " + data); if (!string.IsNullOrEmpty(error)) { Debug.Log("Error : " + error); } }; StartCoroutine(ApiManager.Instance.GetWithToken("api/tournament/public/" + TacoSetup.Instance.SiteId, success, fail)); }
// for public public void getPublicTournaments() { TacoManager.OpenMessage(TacoConfig.TacoRefreshing); Action <string> success = (string data) => { PublicTournamentsResult r = JsonUtility.FromJson <PublicTournamentsResult>(data); PublicTournamentsList.Instance.Reload(r.tournaments); TacoManager.CloseMessage(); }; Action <string, string> fail = (string data, string error) => { TacoConfig.print("Error getting open tournaments : " + data); if (!string.IsNullOrEmpty(error)) { TacoConfig.print("Error : " + error); } }; //+ TacoConfig.SiteId StartCoroutine(ApiManager.Instance.GetWithToken("api/tournament/public/" + TacoConfig.SiteId, success, fail)); }