Ejemplo n.º 1
0
        public void OnClosePress(bool isDown)
        {
            if (!isDown)
            {
                ButtonSound("Default");
                switch (name)
                {
                case "RegisterCloseButton":

                    TacoManager.ShowPanel(PanelNames.LoginPanel);
                    break;

                case "TacoCloseButton":
                    TacoManager.CloseTaco();
                    break;

                case "TacoModalCloseButton":
                    TacoManager.CloseModal();
                    break;

                case "TournamentCloseButton":
                    TacoManager.CloseTaco();
                    break;

                case "AddFundsCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "AddGTokensCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "WithdrawFundsCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "LeaderboardCloseButton": {
                    LeaderboardList.Instance.Destroy();
                    TournamentManager.Instance.ShowTournamentPanel();
                    break;
                }

                case "CreateTournamentCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "JoinTournamentCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "OurGamesCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public void OnSkipPress(bool isDown)
        {
            if (!isDown)
            {
                ButtonSound("Default");

                switch (name)
                {
                case "LoginSkipButton":

                    TacoManager.CloseTaco();
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public void StartPlay(Tournament target)
        {
            if (target != null && target.id > 0)
            {
                TacoManager.OpenMessage(TacoConfig.TacoPlayStarting);
                //StartCoroutine(postStart());

                Action <string> success = (string data) => {
                    var r = JsonUtility.FromJson <StartGameResult>(data);
                    if (r.success)
                    {
                        TacoManager.GameToken = r.token;

                        GameManager.Instance.GetHighScore(r.highScore);

                        TacoManager.CloseMessage();

                        // delegate to your game
                        TacoSetup.Instance.StartMyGame();

                        // set the status text
                        TacoManager.StatusText.text = TacoConfig.GamePlayingMessage;

                        // close taco to play the game
                        TacoManager.CloseTaco();
                    }
                    else
                    {
                        TacoManager.CloseAllModals();
                        TacoManager.OpenModal(TacoConfig.TacoPlayError, r.message);
                    }
                };


                Action <string, string> fail = (string data, string error) => {
                    var msg = data + ((string.IsNullOrEmpty(error)) ? "" : " : " + error);
                    TacoConfig.print("Error starting game - " + msg);

                    var r = JsonUtility.FromJson <StartGameResult>(data);

                    TacoManager.CloseAllModals();
                    TacoManager.OpenModal(TacoConfig.TacoPlayError, r.message);
                };

                StartCoroutine(ApiManager.Instance.StartGame(target.id, TacoManager.User.token, success, fail));
            }
        }
Ejemplo n.º 4
0
        public void StartPlay(Tournament target)
        {
            if (target != null && target.id > 0)
            {
                TacoManager.OpenMessage(TacoConfig.TacoPlayStarting);
                Action <string> success = (string data) => {
                    var r = JsonUtility.FromJson <StartGameResult>(data);
                    if (r.success)
                    {
                        TacoManager.GameToken = r.token;
                        TacoManager.CloseMessage();
                        // delegate to your game
                        TacoSetup.Instance.StartTournamentGame();
                        TacoManager.CloseTaco();
                    }
                    else
                    {
                        TacoManager.CloseAllModals();
                        TacoManager.OpenModalGeneralResultPanel(false, TacoConfig.TacoPlayError, r.message);
                    }
                };


                Action <string, string> fail = (string data, string error) => {
                    var msg = data + ((string.IsNullOrEmpty(error)) ? string.Empty : " : " + error);
                    Debug.Log("Error starting game - " + msg);

                    var r = JsonUtility.FromJson <StartGameResult>(data);

                    TacoManager.CloseAllModals();
                    TacoManager.CloseAllModals();
                    if (r.forbidden)
                    {
                        TacoManager.OpenModalTournamentCreationForbiddenPanel(r.message);
                    }
                    else
                    {
                        TacoManager.OpenModalPlayTournamentErrorPanel(r.message);
                    }
                    //TacoManager.OpenModal(TacoConfig.TacoPlayError, r.message);
                };

                StartCoroutine(ApiManager.Instance.StartGame(target.typeCurrency, target.id, TacoManager.User.token, success, fail));
            }
        }
Ejemplo n.º 5
0
        public void OnSkipPress(bool isDown)
        {
            if (!isDown)
            {
                ButtonSound("Default");

                switch (name)
                {
                case "LoginSkipButton":

                    TacoManager.CloseTaco();
                    break;

#if UNITY_IPHONE || UNITY_ANDROID
                case "LoginWithFacebook":
                    LoginPanel.Instance.LoginWithFacebook();
                    break;
#endif
                case "LoginWithGoogle":
                    LoginPanel.Instance.LoginWithGoogle();
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public void Register()
        {
            Debug.Log("Register Pressed");

            var email    = EmailInput.text;
            var password = PasswordInput.text;
            var age      = PolicyToggle.isOn;
            var user     = UserInput.text;
            var refCode  = ReferenceCodeInput.text;

            if (validateInput())
            {
                //StartCoroutine(postRegister(email, password, age, avatar, user));

                TacoManager.OpenMessage(TacoConfig.TacoRegisteredStatusMessage00);

                Action <string> success = (string data) => {
                    Debug.Log(data);
                    LoginResult r = JsonUtility.FromJson <LoginResult>(data);

                    if (r.success)
                    {
                        TacoManager.CloseMessage();
                        // email sent, have to wait for them to verify.
                        //TacoManager.OpenModal(TacoConfig.TacoRegisteredModalTitle, r.message, null, "RegisterResult");
                        TacoManager.OpenModalRegisterPanel(string.IsNullOrEmpty(r.displayName) ? r.name : r.displayName);
                        LoginPanel.Instance.SetCredential(EmailInput.text, PasswordInput.text);
                        // clean up the registerpanel
                        Init();
                        TacoManager.CloseTaco();
                        TacoManager.TacoAuthCanvas.SetActive(true);
                        LoginPanel.Instance.gameObject.SetActive(true);
                        LoginPanel.Instance.Login();
                    }
                    else
                    {
                        TacoSetup.Instance.LogEvent("signup_failed");
                        // an error returned
                        TacoManager.CloseMessage();
                        //TacoManager.OpenModal(TacoConfig.TacoRegisteredErrorHeader, r.message);
                        TacoManager.OpenModalAccountCreationErrorPanel(TacoConfig.TacoRegisteredErrorHeader, r.message);
                    }
                };

                Action <string, string> fail = (string data, string error) => {
                    TacoSetup.Instance.LogEvent("signup_failed");
                    ErrorResult errorResult = JsonUtility.FromJson <ErrorResult>(data);
                    Debug.Log("Error on register : " + data);
                    if (!string.IsNullOrEmpty(error))
                    {
                        Debug.Log("Error : " + error);
                    }
                    TacoManager.CloseMessage();
                    string msg = data + (string.IsNullOrEmpty(error) ? string.Empty : " : " + error);
                    if (!string.IsNullOrEmpty(data))
                    {
                        if (!errorResult.success)
                        {
                            msg = errorResult.message;
                        }
                    }

                    TacoManager.OpenModalAccountCreationErrorPanel(TacoConfig.TacoRegisteredErrorHeader, msg);
                    if (errorResult.verErr)
                    {
                        TacoManager.OpenModalIncorrectVersionPanel(errorResult.message);
                    }
                };

                StartCoroutine(ApiManager.Instance.Register(user, email, password, age, refCode, success, fail));
            }
        }
Ejemplo n.º 7
0
        public void OnFoldoutPress(bool isDown)
        {
            if (!isDown)
            {
                ButtonSound("Default");
                // all buttons close the panel - even the close one ;)
                TacoManager.CloseFoldout();
                // do the other stuff they do
                switch (name)
                {
                case "SignIn":
                    TacoManager.ShowPanel(PanelNames.LoginPanel);
                    break;

                case "SignUp":
                    TacoManager.ShowPanel(PanelNames.RegisterPanel);
                    break;

                case "StartMenu":
                case "GameStart":
                    TacoSetup.Instance.ToMainMenu();
                    TacoManager.CloseTaco();
                    break;

                case "AllOurGames":
                    //TacoManager.ShowPanel(PanelNames.FeaturedGamesPanel);
                    Application.OpenURL(Constants.BaseUrl + "games");
                    break;

                case "QuitApp":
                    Application.Quit();
                    break;

                case "HowGameWorks":
                    TacoSetup.Instance.LogEvent("how_it_work");
                    TacoModalManager.Instance.ToHowToPlay0(false);
                    break;

                case "ViewProfile":
                    if (TacoManager.User != null)
                    {
                        TacoManager.ShowPanel(PanelNames.ProfilePanel);
                    }
                    break;

                case "ContactUs":
                    Application.OpenURL(Constants.BaseUrl + "contact");
                    break;

                case "LogoutButton":
                    TacoManager.AskToLogoutUser();
                    break;

                case "TournamentsButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "CreateTournamentButton":
                    TacoManager.ShowPanel(PanelNames.CreatePublicPanel);
                    break;

                case "UserFundFoldout":
                    Application.OpenURL(Constants.BaseUrl);
                    break;

                case "UserTokenFoldout":
                    Application.OpenURL(Constants.BaseUrl + "addtokens");
                    break;

                case "UserPointFoldout":
                    Application.OpenURL(Constants.BaseUrl + "prizes");
                    break;

                case "ProfileButton":
                    Application.OpenURL(Constants.BaseUrl + "account");
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        public void OnClosePress(bool isDown)
        {
            if (!isDown)
            {
                ButtonSound("Default");
                switch (name)
                {
                case "RegisterCloseButton":
                    RegisterPanel.Instance.Init();
                    TacoManager.CloseTaco();
                    break;

                case "TacoCloseButton":
                    TacoManager.CloseTaco();
                    break;

                case "TacoModalCloseButton":
                    TacoManager.CloseModal();
                    break;

                case "TournamentCloseButton":
                    TacoManager.CloseTaco();
                    break;

                case "AddFundsCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "AddGTokensCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "WithdrawFundsCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "LeaderboardCloseButton": {
                    LeaderboardList.Instance.Destroy();
                    TournamentManager.Instance.ShowTournamentPanel();
                    TacoManager.Target = null;
                    break;
                }

                case "LeaderboardReturnButton": {
                    LeaderboardList.Instance.Destroy();
                    TacoManager.MyTournamentsPanel.SetActive(true);
                    string panelName = TacoManager.Target.IsPublic ? PanelNames.MyPublicPanel : PanelNames.MyPrivatePanel;
                    GameObject.Find("MyTournamentsPanel/TournamentType/TournamentTypeDropDown").GetComponent <Dropdown>().value = TacoManager.Target.IsPublic ? 0 : 1;
                    TacoManager.ManageTournamentPanel.SetActive(false);
                    TournamentManager.Instance.ShowTournamentPanel(panelName);
                    TacoManager.Target = null;
                    break;
                }

                case "TransactionCloseButton": {
                    TransactionList.Instance.transform.parent.gameObject.SetActive(false);
                    TacoManager.ShowPanel(PanelNames.ProfilePanel);
                    break;
                }

                case "ManageTournamentCloseButton": {
                    TacoManager.ManageTournamentPanel.SetActive(false);
                    TacoManager.TacoBlockingCanvas.SetActive(true);
                    TournamentManager.Instance.ShowTournamentPanel();
                    TacoManager.Target = null;
                    break;
                }

                case "CreateTournamentCloseButton":
                    TacoManager.ReturnToTournamentBoard();
                    break;

                case "JoinTournamentCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                case "OurGamesCloseButton":
                    TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        //TODO put these strings in TacoModels
        public void ModalClicked()
        {
            if (ModalButtonEnabled)
            {
                if (Callback != null)
                {
                    switch (Callback)
                    {
                    case ModalFunctions.ReturnToGame:

                        TacoManager.CloseTaco();

                        break;


                    case ModalFunctions.TournamentGamePosted:

                        // They finished the game, after modal closed - show past tournaments
                        TacoManager.ShowPanel(PanelNames.MyPrivatePanel);

                        break;

                    case ModalFunctions.RegisterResult:

                        // when they close the modal, show login
                        TacoManager.ShowPanel(PanelNames.LoginPanel);

                        break;

                    case ModalFunctions.TournamentSubmit:

                        TournamentManager.Instance.TournamentSubmit();

                        break;

                    case ModalFunctions.TournamentSubmitComplete:

                        // close the creation panel - remove from stack
                        TacoManager.ClosePanel();

                        // refresh and show the current tournaments
                        TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);

                        break;

                    case ModalFunctions.LogoutUser:


                        TacoManager.LogoutUser();


                        break;

                    case ModalFunctions.JoinTournament:


                        TournamentManager.Instance.Join();


                        break;

                    case ModalFunctions.InviteFriends:


                        TournamentManager.Instance.InviteFriend();

                        break;

                    case ModalFunctions.InviteFriendsFromCreate:


                        TournamentManager.Instance.InviteFriendsFromCreate();

                        break;

                    case ModalFunctions.JoinPublicSuccess:

                        // close the join panel - remove from stack
                        TacoManager.ClosePanel();

                        // refresh and show the current tournaments
                        TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);


                        break;

                    case ModalFunctions.StartPlay:
                        GameManager.Instance.StartPlay(TacoManager.Target);
                        break;

                    case ModalFunctions.SawIntro:

                        TacoManager.SetPreference(UserPreferences.sawIntro, 1);
                        TacoManager.ShowPanel(PanelNames.LoginPanel);
                        break;

                    case ModalFunctions.ForfeitTournamentGame:


                        //TacoManager.Instance.ForfeitTournamentGame();


                        break;


                    case ModalFunctions.ReturnToTournaments:


                        // refresh and show the current tournaments
                        TacoManager.ShowPanel(PanelNames.MyTournamentsPanel);


                        break;

                    case ModalFunctions.ReturnToMenu:

                        TacoSetup.Instance.ReturnMenu();
                        break;

                    case ModalFunctions.TacoEndTournament: {
                        TacoSetup.Instance.TacoEndTournament();
                        break;
                    }

                    case ModalFunctions.TacoFreePlayGiftToken: {
                        TacoSetup.Instance.TacoSigninWithTokenFree();
                        break;
                    }
                    }
                }

                TacoConfig.print("DismissModals");

                DismissModal();
            }
        }