Example #1
0
    /// <summary>
    /// 로비에서 게임화면으로 전환
    /// </summary>
    /// <param name="eGameName">Name of the e game.</param>
    public void LobbyToGame(eGameList eGameName)
    {
        SOUND.I.PlayStop(DEF.SND.lobby_bgm);

        loadGame           = eGameName;
        Main.I.CurrentView = eView.Game;

        string     prefabGameName = DEF.GetGamePrefabName(loadGame);
        GameObject obj            = BUNDLE.I.LoadAsset <GameObject>(prefabGameName);

        if (obj)
        {
            GameObject go = GameObject.Instantiate(obj);
            go.name = prefabGameName;
            go.transform.SetParent(this.gameObject.transform);
            SOUND.I.LoadAssetBundleAudioClipsPackage(DEF.GetGameBundleName(loadGame));

            GameMain        = go.gameObject.GetComponent <InGame>();
            GameMain.gameId = eGameName;
            GameMain.Init();

            Main.I.AppsFlyerEvent(AFInAppEvents.GAME, AFInAppEvents.GAME_SELECT, eGameName.ToString());
        }

        if (Lobby.I != null)
        {
            Lobby.I.LobbyToGame();
        }
        Coins.LobbyToGame();
        Game.LobbyToGame();
        BroadCast.LobbyToGame();
    }
Example #2
0
    private void Awake()
    {
        if (instance != null)
        {
            throw new Exception("Only one App allowed!");
        }
        instance = this;
        inGame.Init(this);
        endOfDay.Init(this);
        stateMachine = new StateMachine <App>();
        if (SoundManager.Instance == null)
        {
            Instantiate(soundManagerPrefab);
        }

        EndOfDayActive = new BoolReactiveProperty(false);
    }
Example #3
0
    private void ChangeScene(eSceneState sceneState)
    {
        //콘솔창 메세지 색깔 바꾸기
        Debug.LogFormat("<color=red>{0}</color>", sceneState);

        switch (sceneState)
        {
        case eSceneState.App:
            break;

        case eSceneState.Title:
        {
            //LoadSceneAsync를 사용하면 Title의 OnEnable다음(start전)에서 넘어감
            //로딩 중간에 음악이나 애니메이션 실행가능

            AsyncOperation oper = SceneManager.LoadSceneAsync(sceneState.ToString());
            oper.completed += (oa) =>
            {
                Debug.Log("title로 넘어갑니다~~~~~");
                Title title = GameObject.FindObjectOfType <Title>();


                title.Init();

                title.onClickGameStart = () =>          //게임 스타트가 완료되면
                {
                    Debug.Log("start");
                    this.ChangeScene(eSceneState.InGame);           //changeScene을 실행시켜
                };
            };

            //sceneLoaded를 쓰면 먼저 넘어가고 Title의 Awake부터 호출
            //로딩 다할때까지 아무것도 재생 안됨

            //SceneManager.sceneLoaded += (Scene argo0, LoadSceneMode arg1) =>
            //{
            //    Title title = GameObject.FindObjectOfType<Title>();

            //    Debug.Log("title로 넘어갑니다~~~~~`");

            //    title.onClickGameStart = () =>  //게임 스타트가 완료되면
            //    {
            //        Debug.Log("start");
            //        this.ChangeScene(eSceneState.InGame);   //changeScene을 실행시켜
            //    };
            //    title.Init();
            //};
            //SceneManager.LoadScene(sceneState.ToString());  //Title씬으로 넘어가기
        }
        break;

        case eSceneState.InGame:
        {
            AsyncOperation oper = SceneManager.LoadSceneAsync(sceneState.ToString());
            oper.completed += (oa) =>
            {
                Debug.Log("InGame로 넘어갑니다~~~~~");

                InGame inGame = GameObject.FindObjectOfType <InGame>();
                inGame.Init();
            };
        }
        break;
        }
    }