Ejemplo n.º 1
0
    void UpdateNewTournament(TournamentObject tournament)
    {
        if (!gameObject.activeInHierarchy || !gameObject.activeSelf)
        {
            return;
        }
        var item = Array.Find(sceduleItemsList.ToArray(), view => view.CurrentTournament.Equals(tournament));

        if (item == null)
        {
            if (tournament.State == ChainTypes.TournamentState.Concluded ||
                tournament.State == ChainTypes.TournamentState.RegistrationPeriodExpired)
            {
                return;
            }
            StartCoroutine(GetItem().UpdateItem(tournament));
        }
        else
        {
            if (tournament.State == ChainTypes.TournamentState.Concluded ||
                tournament.State == ChainTypes.TournamentState.RegistrationPeriodExpired)
            {
                sceduleItemsList.Remove(item);
                Destroy(item.gameObject);
                return;
            }
            item.UpdateTournament(tournament);
        }
    }
Ejemplo n.º 2
0
 public void SetTournamentInformation(TournamentObject tournament)
 {
     gameObject.SetActive(true);
     messagePopupView.HideAll();
     currentTournament = tournament;
     currentDateTime   = tournament.StartTime.Value;
 }
Ejemplo n.º 3
0
 public override void UpdateTournament(TournamentObject tournament)
 {
     if (!gameObject.activeInHierarchy || !gameObject.activeSelf)
     {
         return;
     }
     StartCoroutine(UpdateItem(tournament));
 }
Ejemplo n.º 4
0
 public void AddAwaitingStartTournaments(TournamentObject tournament)
 {
     if (awaitingStartTournaments.Contains(tournament) || ((tournament.StartTime.Value - DateTime.UtcNow).TotalMinutes <= 2.0))
     {
         return;
     }
     awaitingStartTournaments.Add(tournament);
 }
Ejemplo n.º 5
0
    public Promise UpdateMetches(TournamentObject info)
    {
        return(new Promise((action, exeption) => {
            SetCurrentTournament(info.Id);

            TournamentManager.Instance.GetDetailsTournamentObject(info.TournamentDetails.Id)
            .Then(detail => {
                ApiManager.Instance.Database.GetMatches(Array.ConvertAll(detail.Matches, match => match.Id))
                .Then(matches => {
                    var myMatch = Array.Find(matches, match => match.State.Equals(ChainTypes.MatchState.InProgress) && match.Players.Contains(me.Id));
                    ApiManager.Instance.Database.GetGames(Array.ConvertAll(myMatch.Games, game => game.Id))
                    .Then(games => {
                        var existTournament = IsTournamentExist(myMatch.Tournament);
                        var existMatch = existTournament && myTournaments[myMatch.Tournament].StartedMatches.Contains(myMatch.Id);
                        if (!existTournament)
                        {
                            myTournaments[myMatch.Tournament] = new TournamentContainer(match => OnNewMatch.Invoke(match), match => OnMatchComplete.Invoke(match));
                        }
                        myTournaments[myMatch.Tournament].UpdateTournamentInfo(info, detail);
                        var opponent = Array.Find(myMatch.Players, account => !me.Id.Equals(account));
                        Repository.GetInPromise(opponent, () => ApiManager.Instance.Database.GetAccount(opponent.Id))
                        .Then(account => {
                            if (!existMatch)
                            {
                                myTournaments[myMatch.Tournament]
                                .NewMatch(myMatch, me, account,
                                          (match, game) => OnNewGame.Invoke(match, game),
                                          (match, game) => OnGameComplete.Invoke(match, game),
                                          (match, game) => OnGameExpectedMove.Invoke(match, game));
                            }
                            var completedGames = myTournaments[myMatch.Tournament].CurrentMatch.CompletedGames;
                            foreach (var game in games)
                            {
                                if (!completedGames.ContainsKey(game.Id))
                                {
                                    if (game.State.Equals(ChainTypes.GameState.Complete))
                                    {
                                        (completedGames[game.Id] = new GameContainer(completedGames.Count + 1, game, me, account))
                                        .CheckState();
                                    }
                                    else
                                    {
                                        myTournaments[myMatch.Tournament].CurrentMatch.NewGame(game).CheckState();
                                    }
                                }
                            }
                            action();
                        });
                    });
                });
            });
        }));
    }
Ejemplo n.º 6
0
    public void SetUp(TournamentObject tournament)
    {
        ApiManager.Instance.Database
        .GetAccountBalances(AuthorizationManager.Instance.UserData.FullAccount.Account.Id.Id, Array.ConvertAll(AuthorizationManager.Instance.UserData.FullAccount.Balances,
                                                                                                               balance => balance.AssetType.Id))
        .Then(accountBalances => {
            AssetData asset = null;
            foreach (var balance in accountBalances)
            {
                if (balance.Asset.Equals(tournament.Options.BuyIn.Asset))
                {
                    asset = balance;
                }
            }
            var feeAsset = SpaceTypeId.CreateOne(SpaceType.GlobalProperties);

            Repository.GetInPromise <GlobalPropertiesObject>(feeAsset)
            .Then(result => {
                TournamentJoinOperationFeeParametersData myFee = null;
                foreach (var fee in result.Parameters.CurrentFees.Parameters)
                {
                    if (fee != null && fee.Type == ChainTypes.FeeParameters.TournamentJoinOperation)
                    {
                        myFee = fee as TournamentJoinOperationFeeParametersData;
                    }
                }
                currentAccountBalanceObject = asset;
                currentFee = (long)myFee.Fee;

                Repository.GetInPromise <AssetObject>(asset.Asset)
                .Then(assetObject => {
                    buyinText.text = tournament.Options.BuyIn.Amount / Math.Pow(10, assetObject.Precision) + assetObject.Symbol;
                    feeText.text   = myFee.Fee / Math.Pow(10, assetObject.Precision) + assetObject.Symbol;

                    ApiManager.Instance.Database.GetAccount(tournament.Creator.Id)
                    .Then(creator => {
                        creatorNameText.text          = Utils.GetFormatedString(creator.Name);
                        var data                      = new JoinToTournamentData();
                        data.tournament               = tournament;
                        data.account                  = AuthorizationManager.Instance.UserData.FullAccount.Account.Id;
                        currentData                   = data;
                        gameTitleText.text            = "ROCK, PAPER, SCISSORS";
                        numberOfPlayersText.text      = data.tournament.Options.NumberOfPlayers.ToString();
                        winsAmountText.text           = data.tournament.Options.NumberOfWins.ToString();
                        registrationDeadlineText.text = data.tournament.Options.RegistrationDeadline.ToString("MMMM dd, yyyy hh:mmtt (z)").ToUpper();
                        Show();
                    });
                });
            });
        });
    }
    public void SetUp(TournamentObject tournament)
    {
        ApiManager.Instance.Database
        .GetAccountBalances(AuthorizationManager.Instance.UserData.FullAccount.Account.Id.Id, Array.ConvertAll(AuthorizationManager.Instance.UserData.FullAccount.Balances, balance => balance.AssetType.Id))
        .Then(accountBalances => {
            var data        = new LeaveFromTournamentData();
            data.tournament = tournament;
            data.account    = AuthorizationManager.Instance.UserData.FullAccount.Account.Id;
            currentData     = data;
            AssetData asset = null;
            foreach (var balance in accountBalances)
            {
                if (balance.Asset.Equals(currentData.tournament.Options.BuyIn.Asset))
                {
                    asset = balance;
                }
            }

            TournamentTransactionService.GenerateLeaveFromTournamentOperation(currentData)
            .Then(operation => {
                var feeAsset = SpaceTypeId.CreateOne(SpaceType.Asset);

                ApiManager.Instance.Database.GetRequiredFee(operation, feeAsset.Id)
                .Then(feeResult => {
                    Repository.GetInPromise <AssetObject>(feeResult.Asset)
                    .Then(assetData => {
                        buyinText.text              = tournament.Options.BuyIn.Amount / Math.Pow(10, assetData.Precision) + assetData.Symbol;
                        feeText.text                = feeResult.Amount / Math.Pow(10, assetData.Precision) + assetData.Symbol;
                        currentFee                  = feeResult.Amount;
                        currentOperation            = operation;
                        currentAccountBalanceObject = asset;

                        ApiManager.Instance.Database.GetAccount(tournament.Creator.Id)
                        .Then(creator => {
                            gameTitleText.text            = "ROCK, PAPER, SCISSORS";
                            creatorNameText.text          = Utils.GetFormatedString(creator.Name);
                            numberOfPlayersText.text      = data.tournament.Options.NumberOfPlayers.ToString();
                            winsAmountText.text           = data.tournament.Options.NumberOfWins.ToString();
                            registrationDeadlineText.text = data.tournament.Options.RegistrationDeadline.ToString("MMMM dd, yyyy hh:mmtt (z)").ToUpper();
                            Show();
                        });
                    })
                    .Catch(exception => OperationOnDone("There was a mistake during leaving of a tournament!", false));
                })
                .Catch(exception => OperationOnDone("There was a mistake during leaving of a tournament!", false));
            })
            .Catch(exception => OperationOnDone("There was a mistake during leaving of a tournament!", false));
        });
    }
Ejemplo n.º 8
0
    void UpdateTournaments(TournamentObject tournament)
    {
        if (OnTournamentChanged != null)
        {
            OnTournamentChanged(tournament);
        }
        ApiManager.Instance.Database.GetTournamentDetails(tournament.Id.Id)
        .Then(tournamentDetails => {
            var me = AuthorizationManager.Instance.UserData.FullAccount.Account;
            if (!AuthorizationManager.Instance.IsAuthorized ||
                !tournamentDetails.RegisteredPlayers.Contains(me.Id))
            {
                return;
            }

            if (tournament.State.Equals(ChainTypes.TournamentState.AwaitingStart))
            {
                if (tournament.StartTime.HasValue &&
                    ((tournament.StartTime.Value - DateTime.UtcNow).TotalMinutes <=
                     2.0) || tournament.Options.StartDelay.HasValue)
                {
                    awaitingStartTournaments.Remove(tournament);
                    UIController.Instance.HidePopups();
                    UIController.Instance.UpdateStartGamePreview(tournament);
                }
            }

            if (tournament.State.Equals(ChainTypes.TournamentState.InProgress))
            {
                ApiManager.Instance.Database.GetMatches(Array.ConvertAll(tournamentDetails.Matches, matche => matche.Id))
                .Then(matches => {
                    var myMatches = Array.Find(matches, match => match.State.Equals(ChainTypes.MatchState.InProgress) && match.Players.Contains(me.Id));
                    if (myMatches != null && PlayerPrefs.GetInt(tournament.Id.Id.ToString()) == 0)
                    {
                        PlayerPrefs.SetInt(tournament.Id.ToString(), 1);
                        if (UIManager.Instance.CurrentState != UIManager.ScreenState.Game)
                        {
                            UIController.Instance.UpdateTournamentInProgress(tournament);
                        }
                    }
                });
            }
        });
    }
Ejemplo n.º 9
0
    public void ShowWaitingGameView(TournamentObject tournament)
    {
        Refresh();

        if (PlayerPrefs.GetInt(tournament.Id.ToString()) == 0)
        {
            AudioManager.Instance.PlayNoticeSound();
            PlayerPrefs.SetInt(tournament.Id.ToString(), (int)tournament.Id.Id);
        }
        gameRoundOverView.Hide();
        waitObject.SetActive(false);
        gameStartPreview.SetTournamentInformation(tournament);
        var me = AuthorizationManager.Instance.UserData;

        TournamentManager.Instance.GetDetailsTournamentObject(tournament.Id.Id)
        .Then(details => {
            TournamentManager.Instance.GetAssetObject(tournament.Options.BuyIn.Asset.Id)
            .Then(asset => {
                jackpoText.text = Utils.GetFormatedDecimaNumber((tournament.PrizePool / Math.Pow(10, asset.Precision)).ToString()) + " " + asset.Symbol;
                if (tournament.RegisteredPlayers == 2)
                {
                    ApiManager.Instance.Database.GetAccounts(Array.ConvertAll(details.RegisteredPlayers, player => player.Id))
                    .Then(accounts => {
                        var opponent = Array.Find(accounts, account => !account.Id.Equals(me.FullAccount.Account.Id)).Name;
                        UpdateUsernameText(me.UserName, opponent);
                        opponentNicknameWaitingView.text = opponent;
                        winsToWinTournament = 5;
                    });
                }
                else
                {
                    UpdateUsernameText(me.UserName, "UNDEFINED");
                    winsToWinTournament = (int)Math.Log(tournament.Options.NumberOfPlayers, 2) * 5 - (5 - winsToWinGame);
                }
                base.Show();
                UIController.Instance.CloseNotGamingPanels();
            });
            winsToWinGame                 = 5;
            gamesToWinRoundText.text      = winsToWinGame.ToString();
            gamesToWinTournamentText.text = winsToWinTournament < 0 ? "0" : winsToWinTournament.ToString();
        });
    }
Ejemplo n.º 10
0
    public IEnumerator UpdateItemView(TournamentObject tournament)
    {
        var asset = new AssetObject();

        asset = null;
        TournamentManager.Instance.GetAssetObject(tournament.Options.BuyIn.Asset.Id)
        .Then(assetResult => asset = assetResult);
        while (asset.IsNull())
        {
            yield return(null);
        }

        tournamentIdText.text               = "#RPS" + tournament.Id;
        tournamentGameText.text             = "RPS";
        tournamentnumberOfPlayersText.text  = tournament.RegisteredPlayers.ToString();
        tournamentStartTimeText.text        = tournament.StartTime.Value.ToString("dd MMM, yyyy. hh:mm");
        tournamentRegisterDeadlineText.text = tournament.Options.RegistrationDeadline.ToString("dd MMM, yyyy. hh:mm");
        tournamentBuyinText.text            = tournament.Options.BuyIn.Amount / Mathf.Pow(10, asset.Precision) + asset.Symbol;
        tournamentJackpotText.text          = tournament.PrizePool / Mathf.Pow(10, asset.Precision) + asset.Symbol;
        liveMessage.SetActive(tournament.State.Equals(ChainTypes.TournamentState.InProgress));
    }
Ejemplo n.º 11
0
    public void ShowTournamentInfo(TournamentObject info)
    {
        if (info.IsNull())
        {
            return;
        }
        detailsView.SetActive(false);
        currenTournament = info;
        infoPanel.SetActive(true);
        UpdateTournament(currenTournament);
        TournamentManager.Instance.GetDetailsTournamentObject(info.Id.Id)
        .Then(detailResult => {
            ApiManager.Instance.Database.GetMatches(Array.ConvertAll(detailResult.Matches, matche => matche.Id))
            .Then(matchesResult => {
                var playersCount = detailResult.RegisteredPlayers.Length;
                var matchesCount = playersCount - 1;

                var roundsCount      = 0;
                var tempMatchesCount = playersCount;
                if (matchesCount > 1)
                {
                    while (tempMatchesCount / 2 > 0)
                    {
                        roundsCount++;
                        tempMatchesCount /= 2;
                    }
                }
                else
                {
                    roundsCount = 1;
                }
                UpdateRoundsView(roundsCount, playersCount);
                detailsView.SetActive(true);
                for (int i = 0; i < matchesResult.Length; i++)
                {
                    StartCoroutine(tournamentMatcheViews[i].UpdatePlayers(matchesResult[i], matchesResult));
                }
            });
        });
    }
Ejemplo n.º 12
0
    bool IsTournamentContains(TournamentObject tournament, AssetObject asset, string searchText, AccountObject account)
    {
        var search           = searchText.ToLower();
        var tournamentId     = tournament.Id.ToString().ToLower().Contains(search);
        var buyIn            = ((tournament.Options.BuyIn.Amount / Math.Pow(10, asset.Precision)) + asset.Symbol).ToLower().Contains(search);
        var jackpot          = ((tournament.Options.BuyIn.Amount / Math.Pow(10, asset.Precision) * tournament.Options.NumberOfPlayers) + asset.Symbol).ToLower().Contains(search);
        var time             = tournament.Options.RegistrationDeadline - DateTime.UtcNow;
        var registerDeadline = false;

        registerDeadline = ("Register: <" + (time.TotalDays < 1 ? 1 : (int)Math.Round(time.TotalDays)) + "d").Contains(searchText);
        var startDelay = "2 minutes after full".Contains(search);
        var gameName   = ("#rps" + tournament.Id).Contains(search);

        if (tournament.State.Equals(ChainTypes.TournamentState.Concluded))
        {
            var result = account.Id.Equals(AuthorizationManager.Instance.UserData.FullAccount.Account.Id)
                ? ((tournament.Options.BuyIn.Amount / Math.Pow(10, asset.Precision) * (tournament.Options.NumberOfPlayers - 1)) + asset.Symbol).ToLower().Contains(search)
                : ("-" + (tournament.Options.BuyIn.Amount / Math.Pow(10, asset.Precision)) + asset.Symbol).ToLower().Contains(search);
            var winner = account.Name.ToLower().Contains(search);
            return(buyIn || gameName || tournamentId || winner || result);
        }
        return(buyIn || jackpot || registerDeadline || gameName || tournamentId || startDelay);
    }
Ejemplo n.º 13
0
    public virtual IEnumerator UpdateItem(TournamentObject info)
    {
        if (gameObject.activeSelf && gameObject.activeInHierarchy)
        {
            CurrentTournament = info;

            if (tournamentDetailsObject.IsNull() || !tournamentDetailsObject.Tournament.Equals(info.Id))
            {
                var detailsObject = new List <TournamentDetailsObject>();
                yield return(TournamentManager.Instance.GetTournamentDetailsObject(info.Id.Id, detailsObject));

                tournamentDetailsObject = detailsObject[0];
            }

            ID = "#RPS" + info.Id;
            PlayerRegistered = info.RegisteredPlayers.ToString();
            MaxPlayers       = info.Options.NumberOfPlayers.ToString();

            if (currentAsset.IsNull() || !currentAsset.Id.Equals(currentTournament.Options.BuyIn.Asset))
            {
                AssetObject asset = null;
                TournamentManager.Instance.GetAssetObject(currentTournament.Options.BuyIn.Asset.Id)
                .Then(assetResult => asset = assetResult);
                while (asset.IsNull())
                {
                    yield return(null);
                }
                currentAsset = asset;
            }

            var buyIn = Decimal.Parse((info.Options.BuyIn.Amount / Math.Pow(10, currentAsset.Precision)).ToString(), NumberStyles.Float);

            BuyIn   = buyIn + currentAsset.Symbol;
            Jackpot = buyIn * info.Options.NumberOfPlayers + currentAsset.Symbol;
            UpdateStartTime();
        }
    }
    public override IEnumerator UpdateItem(TournamentObject info)
    {
        var winnerAccounts = new List <AccountObject>();

        yield return(StartCoroutine(base.UpdateItem(info)));


        if (winnerAccount.IsNull())
        {
            yield return(TournamentManager.Instance.GetMatcheWinnerAccountsObjects(tournamentDetailsObject, winnerAccounts));
        }
        if (winnerAccounts[0].Name == AuthorizationManager.Instance.UserData.UserName)
        {
            winnerText.font = thisPlayerWinnerFont;
            resultText.text = Utils.GetFormatedDecimaNumber(((info.PrizePool - info.Options.BuyIn.Amount) / Math.Pow(10, currentAsset.Precision)).ToString()) + currentAsset.Symbol;
        }
        else
        {
            winnerText.font = anotherPlayerWinnerFont;
            resultText.text = "-" + buyInText.text;
        }
        Winner = Utils.GetFormatedString(winnerAccounts[0].Name, 7);
        yield return(footerView.SetUp(currentTournament, tournamentDetailsObject));
    }
Ejemplo n.º 15
0
    public void UpdateFooter(TournamentObject tournament, TournamentDetailsObject details, bool isHover)
    {
        if (isHover)
        {
            footerTargetImage.color = hoverColor;
            itemBgColor.color       = myTournamentsItemBgColor;
            startTimeText.color     = myTournamentsItemBgColor;
            UpdateButtonColor(joinButton, ButtonViewState.Alternative);
            UpdateButtonColor(activePlayButton, ButtonViewState.Alternative);
        }
        else
        {
            footerTargetImage.color = currenTournamentViewState.Equals(TournamentViewState.PlayerInTournament) ? playerInTournamentColor : otherTournamentsColor;
            itemBgColor.color       = currenTournamentViewState.Equals(TournamentViewState.PlayerInTournament) ? myTournamentsItemBgColor : otherTournamentsItemBgColor;
            startTimeText.color     = normalTextColor;
            UpdateButtonColor(joinButton, ButtonViewState.Normal);
            UpdateButtonColor(activePlayButton, ButtonViewState.Normal);
        }

        switch (tournament.State)
        {
        case ChainTypes.TournamentState.InProgress:
            break;

        case ChainTypes.TournamentState.AcceptingRegistrations:
            if (!IsPlayerJoined(details))
            {
                joinButton.gameObject.SetActive(isHover);
                registerTimeText.gameObject.SetActive(!isHover);
            }
            break;

        case ChainTypes.TournamentState.AwaitingStart:
            break;
        }
    }
Ejemplo n.º 16
0
 public void UpdateTournamentDetails(TournamentObject info)
 {
     currenTournamentObject = info;
 }
Ejemplo n.º 17
0
 public void UpdateStartGamePreview(TournamentObject tournament)
 {
     UIManager.Instance.CurrentState = UIManager.ScreenState.GameStartPreview;
     gameScreenView.ShowWaitingGameView(tournament);
 }
Ejemplo n.º 18
0
 void UpdateTournament(TournamentObject info)
 {
     StartCoroutine(tournamentItemView.UpdateItemView(info));
 }
Ejemplo n.º 19
0
    public override IEnumerator UpdateItem(TournamentObject info)
    {
        yield return(StartCoroutine(base.UpdateItem(info)));

        yield return(footerView.SetUp(currentTournament, tournamentDetailsObject));
    }
Ejemplo n.º 20
0
 public void UpdateDetails(TournamentObject tournament)
 {
     StartCoroutine(UpdateItem(tournament));
 }
Ejemplo n.º 21
0
 public virtual void UpdateTournament(TournamentObject tournament)
 {
 }
Ejemplo n.º 22
0
 public void UpdateTournamentInfo(TournamentObject tournament, TournamentDetailsObject tournamentDetails)
 {
     this.tournament        = tournament;
     this.tournamentDetails = tournamentDetails;
 }
Ejemplo n.º 23
0
 public void UpdateTournamentInProgress(TournamentObject info)
 {
     TournamentManager.Instance.CurrentTournament = info;
     GameManager.Instance.UpdateMetches(info);
     UIManager.Instance.CurrentState = UIManager.ScreenState.Game;
 }
Ejemplo n.º 24
0
    public IEnumerator SetUp(TournamentObject tournament, TournamentDetailsObject details)
    {
        currenTournamentObject        = tournament;
        currenTournamentDetailsObject = details;
        var me = AuthorizationManager.Instance.UserData;

        activePlayButton.gameObject.SetActive(false);
        inActivePlayButton.gameObject.SetActive(false);
        joinButton.gameObject.SetActive(false);
        cancelButton.gameObject.SetActive(false);
        startTimeText.gameObject.SetActive(false);
        registerTimeText.gameObject.SetActive(false);
        opponentText.gameObject.SetActive(false);
        liveMessage.gameObject.SetActive(false);
        headerItemView.gameObject.SetActive(false);

        if (IsPlayerJoined(details))
        {
            currenTournamentViewState = TournamentViewState.PlayerInTournament;
            footerTargetImage.color   = playerInTournamentColor;
            itemBgColor.color         = myTournamentsItemBgColor;
        }
        else
        {
            footerTargetImage.color   = otherTournamentsColor;
            itemBgColor.color         = otherTournamentsItemBgColor;
            currenTournamentViewState = TournamentViewState.OtherTournament;
        }
        switch (tournament.State)
        {
        case ChainTypes.TournamentState.Concluded:
            break;

        case ChainTypes.TournamentState.InProgress:
            if (!IsPlayerJoined(details))
            {
                liveMessage.SetActive(true);
            }
            else
            {
                var matchesList = new List <MatchObject>();
                yield return(TournamentManager.Instance.GetMatcheObjects(Array.ConvertAll(details.Matches, matche => matche.Id), matchesList));

                var matchesInProgress = Array.FindAll(matchesList.ToArray(), match => match.State.Equals(ChainTypes.MatchState.InProgress));
                var playerInMatches   = Array.Find(matchesInProgress, match => match.Players.Contains(me.FullAccount.Account.Id));

                if (playerInMatches == null)
                {
                    inActivePlayButton.gameObject.SetActive(true);
                    headerItemView.gameObject.SetActive(true);
                    headerItemView.color = awaitingColor;
                }
                else
                {
                    opponentText.gameObject.SetActive(true);
                    activePlayButton.gameObject.SetActive(true);
                    headerItemView.gameObject.SetActive(true);
                    headerItemView.color = playColor;
                    var opponentAccount = new List <AccountObject>();
                    yield return(TournamentManager.Instance.GetAccount(Array.Find(playerInMatches.Players, opponent => !opponent.Id.Equals(me.FullAccount.Account.Id.Id)), opponentAccount));

                    opponentText.text = Utils.GetFormatedString(opponentAccount[0].Name);
                }
            }
            break;

        case ChainTypes.TournamentState.AcceptingRegistrations:
            startTimeText.gameObject.SetActive(true);
            UpdateStartTime(tournament.Options.StartTime);

            if (IsPlayerJoined(details))
            {
                cancelButton.gameObject.SetActive(true);
            }
            else
            {
                registerTimeText.gameObject.SetActive(true);
                UpdateRegisterTime(tournament.Options.RegistrationDeadline);
            }

            break;

        case ChainTypes.TournamentState.AwaitingStart:
            if (IsPlayerJoined(details))
            {
                headerItemView.gameObject.SetActive(true);
                headerItemView.color = awaitingColor;
                if ((tournament.StartTime.Value - DateTime.UtcNow).TotalMinutes <= 2)
                {
                    activePlayButton.gameObject.SetActive(true);
                }
                else
                {
                    inActivePlayButton.gameObject.SetActive(true);
                    TournamentManager.Instance.AddAwaitingStartTournaments(tournament);
                }
            }

            break;
        }
    }