public void RegisterScene(EnumSceneType _sceneID, string _sceneName, Type _sceneType, params object[] _params) { if (_sceneType == null || _sceneType.BaseType != typeof(BaseScene)) { throw new Exception("Register scene type must not null and extends BaseScene"); } if (!dicSceneInfos.ContainsKey(_sceneID)) { SceneInfoData sceneInfo = new SceneInfoData(_sceneName, _sceneType, _params); dicSceneInfos.Add(_sceneID, sceneInfo); } }
internal BaseScene GetBaseScene(EnumSceneType _sceneType) { Debug.Log(" GetBaseScene sceneId = " + _sceneType.ToString()); SceneInfoData sceneInfo = GetSceneInfo(_sceneType); if (sceneInfo == null || sceneInfo.SceneType == null) { return(null); } BaseScene scene = System.Activator.CreateInstance(sceneInfo.SceneType) as BaseScene; return(scene); }