Esempio n. 1
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));
            }
        }
Esempio n. 2
0
 private void TournamentSubmitForbidden(string results)
 {
     TacoManager.CloseMessage();
     TacoManager.OpenModalTournamentCreationForbiddenPanel(results);
 }