Esempio n. 1
0
    public static void updateMode(Enums.ModeGame mode)
    {
        Debug.Log("updateMode: " + mode);
        //------ mode
        PlayerData.Load();
        // TODO: playing the sound.
        SoundSystems.Instance.PlaySound(Enums.SoundIndex.Press);



        // TODO: Turn off hint.
        //HintDisplay.Instance.DisableHint();



        // TODO: close the dialog with actions.
        var go = GameObject.Find("DialogNewGame(Clone)");

        if (go != null)
        {
            //gameObject.SetActive(false);
            go.GetComponent <DialogNewGame>().Close
                (() => {
                // TODO: Check the exists of GameManager.
                if (!object.ReferenceEquals(GameManager.Instance, null))
                {
                    // TODO: update the mode of game.
                    GameManager.Instance.UpdateModeGame(mode);

                    // TODO: update the state of game.
                    GameManager.Instance.UpdateState(Enums.StateGame.Start);
                }
            });
        }
        else
        {
            // TODO: Check the exists of GameManager.
            if (!object.ReferenceEquals(GameManager.Instance, null))
            {
                // TODO: update the mode of game.
                GameManager.Instance.UpdateModeGame(mode);

                // TODO: update the state of game.
                GameManager.Instance.UpdateState(Enums.StateGame.Start);
            }
        }

        /*
         * switch (GameManager.Instance.GameType) {
         *
         *  case Enums.GameScenes.Tripeaks:
         *
         *      // TODO: Create the new class.
         *      new TRIPEAKS._GamePlay().InitStart();
         *      break;
         *  case Enums.GameScenes.Spider:
         *
         *      // TODO: Create the new class.
         *
         *      new SPIDER._GamePlay().InitStart();
         *      break;
         *  case Enums.GameScenes.Klondike:
         *
         *      // TODO: Init start.
         *      new KLONDIKE._GamePlay().InitStart();
         *      break;
         * }
         */
    }
Esempio n. 2
0
 public void UpdateModeGame(Enums.ModeGame mode)
 {
     //Debug.Log("UpdateModeGame: " + mode);
     this.ModeGame = mode;
 }
Esempio n. 3
0
    public void playMode(Enums.GameScenes scene, Enums.ModeGame mode)
    {
        GameManager.Instance.UpdateModeGame(mode);
        Debug.Log("playMode: " + scene + " " + mode);
        GamePlay.magicWandDialogShown = false;
        AnalyticsController.sendEvent("StartGame", new Dictionary <string, object> {
            { "Type", GameManager.Instance.GameType }, { "Mode", GameManager.Instance.GetModeGame() }
        });

        Contains.Time = 0;
        // TODO: Check the condition null.
        if (!object.ReferenceEquals(TimerBehaviours.handleCountTiming, null))
        {
            // TODO: Kill the old process.
            MEC.Timing.KillCoroutines(TimerBehaviours.handleCountTiming);
        }


        //        if (GameManager.Instance.GameType != scene) {
        GameManager.Instance.GameType = scene;

        SoundSystems.Instance.PlaySound(Enums.SoundIndex.Press);

        // TODO: Get the scene loaded.
        Contains.GamePlayScene = Enums._GameScene[(int)GameManager.Instance.GameType];

        GameManager.Instance.UpdateModeGame(mode);
        Close();
        // TODO: Clear the handles.
        // TODO: Check if not null.

        if (!object.ReferenceEquals(GamePlay.Instance, null))
        {
            switch (GameManager.Instance.GameType)
            {
            case Enums.GameScenes.Tripeaks:

                // TODO: Create the new class.
                if (GamePlay.Instance._TGamePlay != null && GamePlay.Instance._TGamePlay.cardsGet != null)
                {
                    GamePlay.Instance.StopTimingHandle();
                }
                break;

            case Enums.GameScenes.Spider:

                // TODO: Create the new class.

                if (GamePlay.Instance._SGamePlay != null && GamePlay.Instance._SGamePlay.cardsGet != null)
                {
                    GamePlay.Instance.StopTimingHandle();
                }
                break;

            case Enums.GameScenes.Klondike:

                // TODO: Init start.
                if (GamePlay.Instance._KGamePlay != null && GamePlay.Instance._KGamePlay.cardsGet != null)
                {
                    GamePlay.Instance.StopTimingHandle();
                }
                break;
            }

            GameManager.Instance.InitStart();
            Debug.Log("InitCards");
            GameManager.Instance.InitCards();
        }
        // TODO: Show the loadings.
        LoadingBehaviour.Instance.ShowLoading(Contains.GamePlayScene, false, true);


        //       }
//        else
//           updateMode(mode);
    }