Ejemplo n.º 1
0
        public static void NewLevel(SceneEnum newLevel)
        {
            GameManager obj = GetIstance();

            obj.actualLevel = newLevel;
            obj.GetLogicalComponent <SceneSystemComponent>().NewScene(newLevel);
        }
        public BaseScene CastToScene(SceneEnum caster)
        {
            switch (caster)
            {
            case SceneEnum.Bag:
                return(Bag);

            case SceneEnum.Battle:
                return(Battle);

            case SceneEnum.Evolution:
                return(Evolution);

            case SceneEnum.Party:
                return(Party);

            case SceneEnum.Pause:
                return(Pause);

            case SceneEnum.PC:
                return(Pause);

            case SceneEnum.Summary:
                return(Summary);

            case SceneEnum.Trainer:
                return(Trainer);

            case SceneEnum.Typing:
                return(Typing);

            default:
                return(new BaseScene());
            }
        }
    public IEnumerator Enter(SceneEnum target)
    {
        _processBar.localPosition = new Vector3(_startPosX, _processBar.localPosition.y, _processBar.localPosition.z);
        _processText.text         = "0%";

        yield return(SceneModel.Instance.LoadSceneAsync(target, new SingleProcessBar(_processBar, _startPosX, _endPosX, _processText)));
    }
    public void loadScene(SceneEnum scene)
    {
        _anim.SetTrigger("End");
        if (scene == SceneEnum.Lobby)
        {
            StartCoroutine(loadSceneEnumerator(1));
        }
        else if (scene == SceneEnum.InGame)
        {
            StartCoroutine(loadSceneEnumerator(3));
        }
        else if (scene == SceneEnum.MainMenu)
        {
            StartCoroutine(loadSceneEnumerator(0));
        }
        else if (scene == SceneEnum.Room)
        {
            StartCoroutine(loadSceneEnumerator(2));
        }
        else if (scene == SceneEnum.PrevScene)
        {
            StartCoroutine(loadSceneEnumerator(prevScene));
        }
        else if (scene == SceneEnum.ResultScene)
        {
            StartCoroutine(loadSceneEnumerator(4));
        }

        prevScene = SceneManager.GetActiveScene().buildIndex;
    }
Ejemplo n.º 5
0
 protected override void OnAwake()
 {
     sceneSystem  = GetLogicalComponent <SceneSystemComponent>();
     cursorSystem = GetLogicalComponent <CursorEnableComponent>();
     currentLevel = sceneSystem.ObeyReturnCurrentLevel();
     transform.Find("FrameRateUI").gameObject.SetActive(debugMode);
 }
Ejemplo n.º 6
0
    public static void LoadScene(SceneEnum state, string sceneName = "")
    {
        if (string.IsNullOrEmpty(sceneName) || sceneName.CompareTo("") == 0)
        {
            sceneName = ManagerScene.GetSceneName(state);
        }

        if (state == enteringScene)
        {
            //防止卡死,当前场景 就是目标场景 不需要切换"
            Debug.LogError("SceneState : " + state + "     enteringScene : " + enteringScene);
            return;
        }

        enteringScene = state;

        // 开始加载场景
        StartGoToScene(state);

        //AsyncOperation asyncOperation = null;
        //AssetPool.Instance.Scene.LoadScene(sceneName, out asyncOperation);
        //Game.Instance.StartCoroutine(WaitLoadScene(state, asyncOperation));

        // LoadScene(string sceneName, LoadCallBackHandler CallBack)
        AssetPool.Instance.Scene.LoadScene(sceneName, LoadSceneCallBack);
    }
Ejemplo n.º 7
0
        public IEnumerator LoadSceneAsync(SceneEnum targetScene, SingleProcessBar process)
        {
            var async = SceneManager.LoadSceneAsync(_GetSceneNameByEnum(targetScene));

            async.allowSceneActivation = false;
            var progress = 0f;

            while (!async.isDone)
            {
                progress = async.progress;
                if (progress >= 0.9f)
                {
                    process.UpdateBar(100f);
                    if (!async.allowSceneActivation)
                    {
                        async.allowSceneActivation = true;
                    }
                }
                else
                {
                    process.UpdateBar(progress * 100);
                }
                yield return(null);
            }
        }
Ejemplo n.º 8
0
 private void LoadScene(SceneEnum scene)
 {
     if (next == SceneEnum.None)
     {
         next = scene;
     }
 }
        /// <summary>
        /// Change the current game scene
        /// </summary>
        /// <param name="sceneEnum">Scene enum to change to</param>
        /// <param name="sceneParameters">Scene parameters</param>
        public void ChangeScene(SceneEnum sceneEnum, object sceneParameters = null)
        {
            Scene newScene = null;

            switch (sceneEnum)
            {
            case SceneEnum.MAIN_MENU:
                newScene = mSceneMainMenu;
                break;

            case SceneEnum.GAME:
                newScene = mSceneGame;
                break;
            }

            if (newScene != null)
            {
                if (mCurrentScene != null)
                {
                    mCurrentScene.Exit();
                }

                newScene.Enter(sceneParameters);

                mCurrentScene = newScene;
            }
        }
Ejemplo n.º 10
0
 public void Restart()
 {
     start.Play();
     currentScene = SceneEnum.ROLL1;
     image.SetActive(false);
     tweetButton.SetActive(false);
 }
Ejemplo n.º 11
0
 // Update is called once per frame
 void Update()
 {
     if (currentScene == SceneEnum.ROLL1)
     {
         int index = Random.Range(0, characters.Length);
         char1.text = characters[index].ToString();
         index      = Random.Range(0, characters.Length);
         char2.text = characters[index].ToString();
         if (Input.GetMouseButtonDown(0))
         {
             start.Play();
             currentScene = SceneEnum.ROLL2;
         }
     }
     else if (currentScene == SceneEnum.ROLL2)
     {
         int index = Random.Range(0, characters.Length);
         char2.text = characters[index].ToString();
         if (Input.GetMouseButtonDown(0))
         {
             stop.Play();
             currentScene = SceneEnum.RESULT;
         }
     }
     else if (currentScene == SceneEnum.RESULT)
     {
         image.SetActive(true);
         tweetButton.SetActive(true);
     }
 }
Ejemplo n.º 12
0
 public static void SetState(SceneEnum scene)
 {
     Console.WriteLine("[SceneManager][SetState] -> " + scene);
     CurrentScene = Scenes[scene];
     Initialize();
     LoadContent();
 }
Ejemplo n.º 13
0
    public SceneEnum GetNextScene()
    {
        SceneEnum sE = currentScene;

        sE++;

        return(sE);
    }
Ejemplo n.º 14
0
        public static void ReenableNightBGM()
        {
            // summary: there is a scene header which has a single byte that determines what plays at night, setting to 13 re-enables BGM at night

            // since scene table is only read previously on enemizer, if not loaded we have to load now
            if (RomData.SceneList == null)
            {
                ReadSceneTable();
            }

            // TODO since this is static, it can be moved
            var TargetSceneEnums = new GameObjects.Scene[]
            {
                GameObjects.Scene.TerminaField,
                GameObjects.Scene.RoadToSouthernSwamp,
                GameObjects.Scene.SouthernSwamp,
                GameObjects.Scene.SouthernSwampClear,
                GameObjects.Scene.PathToMountainVillage,
                GameObjects.Scene.MountainVillage,
                GameObjects.Scene.MountainVillageSpring,
                GameObjects.Scene.TwinIslands,
                GameObjects.Scene.TwinIslandsSpring,
                GameObjects.Scene.GoronRacetrack,
                GameObjects.Scene.GoronVillage,
                GameObjects.Scene.GoronVillageSpring,
                GameObjects.Scene.PathToSnowhead,
                GameObjects.Scene.Snowhead,
                GameObjects.Scene.MilkRoad,
                GameObjects.Scene.GreatBayCoast,
                GameObjects.Scene.PinnacleRock,
                GameObjects.Scene.ZoraCape,
                GameObjects.Scene.WaterfallRapids,
                GameObjects.Scene.RoadToIkana,
                GameObjects.Scene.IkanaCanyon,
                GameObjects.Scene.EastClockTown,
                GameObjects.Scene.WestClockTown,
                GameObjects.Scene.NorthClockTown,
                GameObjects.Scene.SouthClockTown,
                GameObjects.Scene.LaundryPool,
                GameObjects.Scene.Woodfall,
            }.ToList();

            foreach (var SceneEnum in TargetSceneEnums)
            {
                ReenableNightBGMSingle(RomData.SceneList.Find(u => u.Number == SceneEnum.Id()).File);
            }

            // Kamaro the dancing ghost in Termina Field breaks night music
            //   he calls a function that sets an unknown actor flag unk39 & 20, he calls this function per frame from multiple places
            // if we nop it his music never plays, and might music is never interupted by him
            var kamaroFID = 593; //GameObjects.Actor.En_Yb.FileListIndex();

            RomUtils.CheckCompressed(kamaroFID);
            var kamaroData = RomData.MMFileList[kamaroFID].Data;

            // null function call to func_800B9084 -> NOP
            ReadWriteUtils.Arr_WriteU32(kamaroData, 0x618, 0x00000000);
        }
Ejemplo n.º 15
0
    private IEnumerator _SwitchScene(SceneEnum target)
    {
        SceneModel.Instance.LoadScene(SceneEnum.Loading);
        yield return(null);

        var loadingView = FindObjectOfType <LoadingScenePanel>();

        yield return(loadingView.Enter(target));
    }
Ejemplo n.º 16
0
    private IEnumerator ChangeScene(SceneEnum scene)
    {
        while (isFading)
        {
            yield return(0);
        }

        SceneManager.LoadScene(PredefinedScene.GetName(scene));
    }
Ejemplo n.º 17
0
 /// <summary>
 /// 开启俯视墙
 /// </summary>
 private void TurnOnOverlookScene()
 {
     if (!_overLookWallManager.gameObject.activeSelf)
     {
         _overLookWallManager.gameObject.SetActive(true);
     }
     _waterWallManager.gameObject.SetActive(false);
     _currentScene = SceneEnum.OverlookWall;
 }
 /// <summary>
 /// Gets the name of the specified scene.
 /// </summary>
 /// <returns>Name of specified scene.</returns>
 /// <param name="gameScene">Game scene.</param>
 public string GetSceneNameOf(SceneEnum gameScene)
 {
     if (gameScene == SceneEnum.SIZE)
     {
         Debug.Log("Specified item is not a scene");
         return(null);
     }
     return(m_sceneNames[(int)gameScene]);
 }
Ejemplo n.º 19
0
 protected override void Awake()
 {
     base.Awake();
     sceneSystem  = GetLogicalComponent <SceneSystemComponent>();
     cursorSystem = GetLogicalComponent <CursorEnableComponent>();
     currentLevel = sceneSystem.ObeyReturnCurrentLevel();
     EventsManager.AddMethod <genericDelegate <SceneEnum> >(EventAction.NewScene, ReceiveCurrentLevel, this);
     transform.Find("FrameRateUI").gameObject.SetActive(debugMode);
 }
Ejemplo n.º 20
0
    public void FadeTo(SceneEnum scene)
    {
        if (isFading)
        {
            return;
        }

        FadeOut();
        StartCoroutine(ChangeScene(scene));
    }
    public static string GetName(SceneEnum scene)
    {
        PredefinedScene predefinedScene = Array.Find(MainManager.Instance.scenes, s => s.scene == scene);

        if (predefinedScene == null)
        {
            throw new NullReferenceException("Unable to find '" + scene + "' scene!");
        }

        return(predefinedScene.name);
    }
Ejemplo n.º 22
0
 public void ReloadScene(Scene actualScene)
 {
     if (File.Exists(Application.persistentDataPath + "/rbSave.bp"))
     {
         SceneManager.LoadScene(actualScene.name);
     }
     else
     {
         currentScene = SceneEnum.StoryboardN1;
         SceneManager.LoadScene(currentScene.ToString());
     }
 }
Ejemplo n.º 23
0
 /// <summary>
 /// 获取字符串类型的场景名称
 /// </summary>
 /// <param name="sceneEnum">枚举类型的场景名称</param>
 /// <returns></returns>
 public string getStrSceneByEnumScene(SceneEnum sceneEnum)
 {
     if (null != _sceneEnumDic && _sceneEnumDic.Count >= 1)
     {
         return(_sceneEnumDic[sceneEnum]);
     }
     else
     {
         Debug.LogWarning(GetType() + "getStrSceneByEnumScene()/_sceneEnumDic.Count < = 0,please check!!!");
         return(null);
     }
 }
Ejemplo n.º 24
0
    // 进入场景
    public static void EnteredScene(SceneEnum state)
    {
        currentSceneState = state;
        if (!SceneDic.ContainsKey(state))
        {
            Debug.LogError("SceneState is null : " + state);
            return;
        }

        m_CurrentScene = SceneDic[currentSceneState];
        m_CurrentScene.OnEnter();
    }
Ejemplo n.º 25
0
 public void LoadGameScene(SceneEnum scene, bool IsNeedAsy = false)
 {
     if (IsNeedAsy)
     {
         AsynLoadState = SceneManager.LoadSceneAsync((int)scene);
         StartCoroutine(LoadScene());
     }
     else
     {
         SceneManager.LoadScene((int)scene);
     }
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 得到字符串形式的场景名称
 /// </summary>
 /// <param name="sceneEnum">枚举类型的场景名称</param>
 /// <returns></returns>
 public string GetStrByEnumScene(SceneEnum sceneEnum)
 {
     if (_DicSceneEnumLib != null && _DicSceneEnumLib.Count >= 1)
     {
         return(_DicSceneEnumLib[sceneEnum]);
     }
     else
     {
         // // Debug.LogWarning(GetType() + "/GetStrByEnumScene()/_DicSceneEnumLib.Count <= 0!");
         return(null);
     }
 }
Ejemplo n.º 27
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     if (File.Exists(Application.persistentDataPath + "/rbSave.bp"))
     {
         currentScene = SaveLoad.saveGame.data.actualScene;
     }
     else
     {
         currentScene = SceneEnum.Menu;
     }
 }
Ejemplo n.º 28
0
 /// <summary>
 /// It loads the "Loading" scene but the param is saved for future uses.
 /// </summary>
 public void LoadSavedScene()
 {
     if (File.Exists(Application.persistentDataPath + "/rbSave.bp"))
     {
         currentScene = --SaveLoad.saveGame.data.actualScene;
         SceneManager.LoadScene(SceneEnum.Loading.ToString());
     }
     else
     {
         StartNewGame();
     }
 }
Ejemplo n.º 29
0
    public static void LoadSceneByID(SceneEnum targetScene)
    {
        string targetSceneName;

        if (sceneNames.TryGetValue(targetScene, out targetSceneName))
        {
            SceneManager.LoadScene(targetSceneName);
        }
        else
        {
            Debug.LogError("Scène inconnue : " + targetScene.ToString());
        }
    }
Ejemplo n.º 30
0
 /// <summary>
 /// It loads the "Loading" scene but the param is saved for future uses.
 /// </summary>
 /// <param name="sceneIndex"></param>
 public void LoadNextScene(SceneEnum sceneIndex)
 {
     if (File.Exists(Application.persistentDataPath + "/rbSave.bp"))
     {
         currentScene = sceneIndex;
         SceneManager.LoadScene(SceneEnum.Loading.ToString());
     }
     else
     {
         currentScene = SceneEnum.StoryboardN1;
         SceneManager.LoadScene(currentScene.ToString());
     }
 }
Ejemplo n.º 31
0
 public AsyncOperation LoadAsyncScene(SceneEnum scene)
 {
     //m_Scenes.Enqueue(scene);
     AsyncOperation	async = Application.LoadLevelAsync((int)scene);
     return async;
 }
Ejemplo n.º 32
0
 public void PushScene(SceneEnum scene)
 {
     m_Scenes.Enqueue(scene);
     RenderScene(scene);
 }
Ejemplo n.º 33
0
 private void RenderScene(SceneEnum scene)
 {
     Application.LoadLevel((int)scene);
 }