Exemplo n.º 1
0
 public void OnSubmitFailed()
 {
     State            = LeaderboardState.Fill;
     uiDialog.Title   = Localize.Instance.SubmitError;
     uiDialog.Content = Localize.Instance.SubmitErrorDescription;
     uiDialog.FadeIn(UIDialogType.Message);
 }
Exemplo n.º 2
0
        public LeaderboardScene()
            : base(Main.Instance)
        {
            State = LeaderboardState.View;

            Leaderboard.GetRank(this);
            Leaderboard.View7(this);
            Leaderboard.ViewAll(this);
        }
Exemplo n.º 3
0
        public LeaderboardScene(int score)
            : base(Main.Instance)
        {
            State  = LeaderboardState.Fill;
            _score = score;

            _username = Leaderboard.UserName;
            if (_username.Length < 3 || _username.Length > 14)
            {
                _username = DEFAULT_NAME;
            }
        }
Exemplo n.º 4
0
        protected override void pointerReleased(int x, int y)
        {
            if (uiDialog.Visible)
            {
                UIDialogResult returnCode = uiDialog.CheckHit(x, y);
                if ((short)returnCode > -1)
                {
                    uiDialog.FadeOut();
                }
                return;
            }

            switch (State)
            {
            case LeaderboardState.Fill:
                if (State == LeaderboardState.Fill)
                {
                    btnSubmit.Active = false;
                    if (btnSubmit.CheckHit(x, y))
                    {
                        if (_username.Length < 3 || _username.Length > 14 || _username == DEFAULT_NAME)
                        {
                            uiDialog.Title   = Localize.Instance.InvalidName;
                            uiDialog.Content = Localize.Instance.InvalidNameDescription;
                            uiDialog.FadeIn(UIDialogType.Message);
                        }
                        else
                        {
                            State = LeaderboardState.Submit;
                            Leaderboard.SubmitScore(_score, _username, this);
                        }
                        return;
                    }
                }
                break;

            case LeaderboardState.View:
                if (leftTouching)
                {
                    if (vtView7.Y > 134 || view7Height < 340)
                    {
                        vTargetLeft = 134;
                    }
                    else if (vtView7.Y < 490 - view7Height)
                    {
                        vTargetLeft = 490 - view7Height;
                    }
                }
                else if (rightTouching)
                {
                    if (vtViewAll.Y > 134 || viewAllHeight < 340)
                    {
                        vTargetRight = 134;
                    }
                    else if (vtViewAll.Y < 490 - viewAllHeight)
                    {
                        vTargetRight = 490 - viewAllHeight;
                    }
                }
                leftTouching = rightTouching = false;
                break;
            }
        }
Exemplo n.º 5
0
 public new void SetErrorState(LeaderboardState state) => base.SetErrorState(state);
Exemplo n.º 6
0
    public async void SetState(Type stateType)
    {
        GameState state = null;

        if (stateType == typeof(LoginState))
        {
            GameStateModel model = GameStateFactory
                                   .Instance
                                   .CreateModel <LoginStateModel>();
            GameStateView view = await GameStateFactory
                                 .Instance
                                 .CreateViewAsync <LoginStateView>("LoginStateView");

            LoginState loginState = GameStateFactory
                                    .Instance
                                    .CreateState <LoginState>(model, view);
            state = loginState;
        }
        else if (stateType == typeof(LobbyState))
        {
            GameStateModel model = GameStateFactory
                                   .Instance
                                   .CreateModel <LobbyStateModel>();
            GameStateView view = await GameStateFactory
                                 .Instance
                                 .CreateViewAsync <LobbyStateView>("LobbyStateView");

            LobbyState lobbyState = GameStateFactory
                                    .Instance
                                    .CreateState <LobbyState>(model, view);
            state = lobbyState;
        }
        else if (stateType == typeof(InventoryState))
        {
            GameStateModel model = GameStateFactory
                                   .Instance
                                   .CreateModel <InventoryStateModel>();
            GameStateView view = await GameStateFactory
                                 .Instance
                                 .CreateViewAsync <InventoryStateView>("InventoryStateView");

            InventoryState inventoryState = GameStateFactory
                                            .Instance
                                            .CreateState <InventoryState>(model, view);
            state = inventoryState;
        }
        else if (stateType == typeof(StoreState))
        {
            GameStateModel model = GameStateFactory
                                   .Instance
                                   .CreateModel <StoreStateModel>();
            GameStateView view = await GameStateFactory
                                 .Instance
                                 .CreateViewAsync <StoreStateView>("StoreStateView");

            StoreState storeState = GameStateFactory
                                    .Instance
                                    .CreateState <StoreState>(model, view);
            state = storeState;
        }
        else if (stateType == typeof(IngameState))
        {
            GameStateModel model = GameStateFactory
                                   .Instance
                                   .CreateModel <IngameStateModel>();
            GameStateView view = await GameStateFactory
                                 .Instance
                                 .CreateViewAsync <IngameStateView>("IngameStateView");

            IngameState ingameState = GameStateFactory
                                      .Instance
                                      .CreateState <IngameState>(model, view);
            state = ingameState;
        }
        else if (stateType == typeof(LeaderboardState))
        {
            GameStateModel model = GameStateFactory
                                   .Instance
                                   .CreateModel <LeaderboardStateModel>();
            GameStateView view = await GameStateFactory
                                 .Instance
                                 .CreateViewAsync <LeaderboardStateView>("LeaderboardStateView");

            LeaderboardState leaderboardState = GameStateFactory
                                                .Instance
                                                .CreateState <LeaderboardState>(model, view);
            state = leaderboardState;
        }
        else
        {
            // do the catch
            Debug.LogError("Setting state for an unknown state type " + stateType.GetType());
        }

        if (state != null)
        {
            SwitchState(state);
        }
    }