public static void FetchTournaments(SuccessHandler success, FriendlyErrorHandler failure) { fetchedTournamentsCallback = () => { success(); }; ArbiterBinding.FetchTournaments(FetchTournamentsSuccessHandler, failure); }
void Start() { if (accessToken.Length == 0 || gameApiKey.Length == 0) { Debug.LogWarning("Arbiter Error: Missing Access Token or Game Api Key in the Arbiter Prefab inpesctor settings."); } _accessToken = accessToken; _gameApiKey = gameApiKey; var arbiters = FindObjectsOfType(typeof(Arbiter)); if (arbiters.Length > 1) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); GameObject abGO = new GameObject("ArbiterBinding"); abGO.AddComponent <ArbiterBinding>(); GameObject.DontDestroyOnLoad(abGO); wallet = null; user = null; ErrorHandler initializeErrorHandler = (errors) => { Debug.LogError("Cannot initialize Arbiter. Resolve errors below:"); errors.ForEach(e => Debug.LogError(e)); }; ArbiterBinding.Init(_gameApiKey, _accessToken, InitializeSuccess, initializeErrorHandler); }
public static void ReportScore(string tournamentId, int score, ReportScoreCallback callback) { if (callback == null) { Debug.LogError("Must pass in a non-null handler to Arbiter.ReportScore"); } ArbiterBinding.ReportScore(tournamentId, score, callback, defaultErrorHandler); }
public static void RequestCashChallenge(Dictionary <string, string> filters, RequestCashChallengeCallback callback, FriendlyErrorHandler failure) { if (filters == null) { filters = new Dictionary <string, string>(); } ArbiterBinding.RequestCashChallenge(filters, callback, failure); }
public static void RequestTournament(string buyIn, Dictionary <string, string> filters, SuccessHandler callback, FriendlyErrorHandler failure) { if (filters == null) { filters = new Dictionary <string, string>(); } ArbiterBinding.RequestTournament(buyIn, filters, callback, failure); }
public static void ShowIncompleteTournaments(ShowIncompleteTournamentsCallback callback) { if (callback == null) { callback = (tournamentId) => {} } ; ArbiterBinding.ShowIncompleteTournaments(callback); }
public static void ShowUnviewedTournaments(SuccessHandler callback) { if (!UserExists) { Debug.LogWarning("Make sure user is logged in before showing their unviewed tournaments!"); return; } ArbiterBinding.ShowUnviewedTournaments(callback, defaultErrorHandler); }
private static void tryFetchWallet(SuccessHandler success, ErrorHandler failure) { if (!IsAuthenticated) { Debug.LogWarning("Cannot get an Arbiter Wallet without first logging in"); return; } ArbiterBinding.FetchWallet(success, failure); }
public static void JoinTournament(string buyIn, Dictionary <string, string> filters, JoinTournamentCallback success, FriendlyErrorHandler failure) { Func <Tournament, bool> isScorableByCurrentUser = (tournament) => { return((tournament.Status == Tournament.StatusType.Initializing || tournament.Status == Tournament.StatusType.InProgress) && tournament.UserCanReportScore(user.Id)); }; TournamentsCallback gotTournamentsPollHelper = (tournaments) => { List <Tournament> joinableTournaments = tournaments.Where(iTourn => isScorableByCurrentUser(iTourn)).ToList(); if (joinableTournaments.Count > 0) { tournamentPoller.Stop(); success(joinableTournaments[0]); } // Else wait for the poller to call this anon func again... }; int retries = 0; const int MAX_RETRIES = 6; Action askAgain = () => { retries++; if (retries > MAX_RETRIES) { List <string> errors = new List <string>(); errors.Add("Tournament request limit exceeded. Ceasing new requests."); List <string> descriptions = new List <string>(); descriptions.Add("The tournament timed-out. Please try again later."); failure(errors, descriptions); tournamentPoller.Stop(); } else { ArbiterBinding.FetchTournaments(gotTournamentsPollHelper, failure); } }; SuccessHandler gotRequestResponse = () => { tournamentPoller.SetAction(askAgain); }; TournamentsCallback gotTournamentsFirstTimeHelper = (tournaments) => { List <Tournament> joinableTournaments = tournaments.Where(iTourn => isScorableByCurrentUser(iTourn)).ToList(); if (joinableTournaments.Count > 0) { success(joinableTournaments[0]); } else { RequestTournament(buyIn, filters, gotRequestResponse, failure); } }; ArbiterBinding.FetchTournaments(gotTournamentsFirstTimeHelper, failure); }
/// <summary> /// This is only necessary to call if there is no cached user credentials on device. But calling it redundantly is harmless. /// </summary> public static void LoginWithDeviceId(SuccessHandler success, ErrorHandler failure) { SuccessHandler successWrapper = () => { FirePostAuthenticateActionsIfAble(); if (success != null) { success(); } }; WaitUntilInitted(() => { ArbiterBinding.LoginWithDeviceId(successWrapper, failure); }); }
/// <summary> /// A debug logger that adds the given custom data to some state in the SDK and logs in Arbiter debug servers. /// </summary> /// <param name="gameDataToInclude">Game data to include with the debug log report.</param> public static void DumpLogs(string logData) { ArbiterBinding.DumpLogs(logData); }
public static void ShowWalkThrough(string walkThroughId, SuccessHandler callback) { ArbiterBinding.ShowWalkThrough(walkThroughId, callback); }
private static void ShowNativeDialog(string title, string message) { ArbiterBinding.ShowNativeDialog(title, message, nativeDialogCallback); }
public static void ReportScoreForChallenge(string challengeId, string score, Arbiter.ReportScoreForChallengeCallback success, FriendlyErrorHandler failure) { ArbiterBinding.ReportScoreForChallenge(challengeId, score, success, failure); }
public static void ShowCashChallengeRules(string challengeId, SuccessHandler callback) { ArbiterBinding.ShowCashChallengeRules(challengeId, callback); }
public static void Logout(SuccessHandler success, ErrorHandler failure) { wallet = null; user = null; ArbiterBinding.Logout(success, failure); }
public static void RejectCashChallenge(string challengeId, SuccessHandler success) { ArbiterBinding.RejectCashChallenge(challengeId, success); }
public static void DisplayWalletDashboardOnDepositTab(SuccessHandler callback) { ArbiterBinding.ShowWalletPanelOnDepositTab(callback); walletPoller.Reset(); }
public static void AcceptCashChallengeUseNativeErrorDialogue(string challengeId, SuccessHandler success, SuccessHandler errorDialogueComplete) { nativeDialogCallback = errorDialogueComplete; ArbiterBinding.AcceptCashChallenge(challengeId, success, ShowDescriptionInNativeAlert); }
public static void LoginWithGameCenter(SuccessHandler success, ErrorHandler failure) { WaitUntilInitted(() => { ArbiterBinding.LoginWithGameCenter(success, failure); }); }
public static void SendPromoCredits(string amount, SuccessHandler success, ErrorHandler failure) { ArbiterBinding.SendPromoCredits(amount, success, failure); walletPoller.Reset(); }
public static void AcceptCashChallenge(string challengeId, SuccessHandler success, FriendlyErrorHandler failure) { ArbiterBinding.AcceptCashChallenge(challengeId, success, failure); }
public static void ShowPreviousTournaments(SuccessHandler callback) { ArbiterBinding.ShowPreviousTournaments(callback, defaultErrorHandler); }
public static void ShowTournamentDetails(string tournamentId, SuccessHandler callback) { ArbiterBinding.ShowTournamentDetailsPanel(tournamentId, callback); }
internal static void DumpLogs() { ArbiterBinding.DumpLogs(""); }
public static void AcceptCashChallenge(string challengeId, SuccessHandler success, FriendlyErrorHandler failure) { CodedErrorHandler failWrapper = (c, e, d) => { failure(e, d); }; ArbiterBinding.AcceptCashChallenge(challengeId, success, failWrapper); }
public static void Logout(SuccessHandler success, ErrorHandler failure) { teardownPollers(); ArbiterBinding.Logout(success, failure); }
public static void VerifyUser(SuccessHandler success, ErrorHandler failure) { ArbiterBinding.VerifyUser(success, failure); }