void JoinTournament() { loader.IsLoading = true; if (!IsPlayerInWhitelist(currentData.tournament.Options.Whitelist)) { OperationOnDone("You cant join to the tournament, because you arent in whitelist!", false); } else if (!currentAccountBalanceObject.IsNull() && currentAccountBalanceObject.Amount < currentData.tournament.Options.BuyIn.Amount + currentFee) { OperationOnDone("Failed\r\nInsufficient Funds available", false); } else { TournamentTransactionService.GenerateJoinToTournamentOperation(currentData) .Then(operaion => { TournamentTransactionService.JoinToTournament(operaion) .Then(() => { gameObject.SetActive(false); if (OnOperationSuccess != null) { OnOperationSuccess(); } OperationOnDone("You successfully joined to tournament №" + currentData.tournament.Id.Id, true); }) .Catch(exception => OperationOnDone("There was a mistake during joining of a tournament!", false)); }) .Catch(exception => OperationOnDone("There was a mistake during joining of a tournament!", false)); } }
void LeaveTournament() { loader.IsLoading = true; if (!currentAccountBalanceObject.IsNull() && currentAccountBalanceObject.Amount < currentData.tournament.Options.BuyIn.Amount + currentFee) { OperationOnDone("Failed\r\nInsufficient Funds available", false); } else { TournamentTransactionService.LeaveFromTournament(currentOperation) .Then(() => { gameObject.SetActive(false); if (OnOperationSuccess != null) { OnOperationSuccess(); } OperationOnDone("You have successfully left a tournament!", true); }) .Catch(exception => OperationOnDone("There was a mistake during leaving of a tournament!", false)); } }