Пример #1
0
        IEnumerator Start()
        {
            DontDestroyOnLoad(gameObject);

            #region Modules
            StateMG      = GameModuleProxy.GetModule <GameStateManager>();
            EventMG      = GameModuleProxy.GetModule <EventManager>();
            ResourceMG   = GameModuleProxy.GetModule <ResourceManager>();
            HotfixMG     = GameModuleProxy.GetModule <HotfixManager>();
            WebRequestMG = GameModuleProxy.GetModule <WebRequestManager>();
            UIMG         = GameModuleProxy.GetModule <UIManager>();
            #endregion

            #region Hotfix
            //是否使用热更的方式加载代码
            HotfixMG.UseHotFix = UseHotFix;
            #endregion

            #region Resource
            ResourceMG.LocalPathType = LocalPathType;
            ResourceMG.ResUpdateType = ResUpdateType;
            ResourceMG.ResUpdatePath = ResUpdatePath;

            //添加对象池管理器
            GameObject GameObjectPoolHelper = new GameObject("IGameObjectPoolHelper");
            GameObjectPoolHelper.transform.SetParent(transform);
            ResourceMG.SetGameObjectPoolHelper(GameObjectPoolHelper.AddComponent <GameObjectPoolHelper>());
            #endregion

            #region WebRequest
            GameObject webRequestHelper = new GameObject("IWebRequestHelper");
            webRequestHelper.transform.SetParent(transform);
            GameObject webDownloadMonoHelper = new GameObject("IWebDownloadHelper");
            webDownloadMonoHelper.transform.SetParent(transform);

            WebRequestMG.SetWebRequestHelper(webRequestHelper.AddComponent <WebRequestMonoHelper>());
            WebRequestMG.SetWebDownloadHelper(webDownloadMonoHelper.AddComponent <WebDownloadMonoHelper>());
            #endregion

            #region GameState 初始化状态,开启整个流程
            Assembly = typeof(GameMain).Assembly;
            StateMG.CreateStateContext(Assembly);
            yield return(new WaitForEndOfFrame());

            StateMG.StartFirstState();
            #endregion
        }
Пример #2
0
        IEnumerator Start()
        {
            //默认不销毁
            DontDestroyOnLoad(gameObject);

            #region Module
            Event      = GameFrameworkMode.GetModule <EventManager>();
            State      = GameFrameworkMode.GetModule <GameStateManager>();
            Node       = GameFrameworkMode.GetModule <NodeManager>();
            Resource   = GameFrameworkMode.GetModule <ResourceManager>();
            UI         = GameFrameworkMode.GetModule <UIManager>();
            WebRequest = GameFrameworkMode.GetModule <WebRequestManager>();
            #endregion

            #region resource
            Resource.ResUpdateType = ResUpdateType;
            Resource.ResUpdatePath = ResUpdatePath;
            Resource.LocalPathType = LocalPathType;

            //添加对象池管理器
            GameObject gameObjectPoolHelper = new GameObject("IGameObjectPoolHelper");
            gameObjectPoolHelper.transform.SetParent(transform);
            Resource.SetGameObjectPoolHelper(gameObjectPoolHelper.AddComponent <GameObjectPoolHelper>());
            #endregion

            #region WebRequest
            //设置帮助类
            GameObject webRequestHelper = new GameObject("IWebRequestHelper");
            webRequestHelper.transform.SetParent(transform);
            GameObject webDownloadHelper = new GameObject("IWebDownloadMonoHelper");
            webDownloadHelper.transform.SetParent(transform);
            WebRequest.SetWebRequestHelper(webRequestHelper.AddComponent <WebRquestMonoHelper>());
            WebRequest.SetWebDownloadHelper(webDownloadHelper.AddComponent <WebDownloadMonoHelper>());
            #endregion

            #region state
            //开启整个项目的流程
            Assembly = typeof(GameMode).Assembly;
            State.CreateContext(Assembly);
            yield return(new WaitForEndOfFrame());

            State.SetStateStart();
            #endregion
        }
Пример #3
0
        IEnumerator Start()
        {
            //默认不销毁
            DontDestroyOnLoad(gameObject);

            #region Module
            Event        = GameFrameworkMode.GetModule <EventManager>();
            State        = GameFrameworkMode.GetModule <GameStateManager>();
            Node         = GameFrameworkMode.GetModule <NodeManager>();
            Resource     = GameFrameworkMode.GetModule <ResourceManager>();
            UI           = GameFrameworkMode.GetModule <UIManager>();
            WebRequest   = GameFrameworkMode.GetModule <WebRequestManager>();
            Audio        = GameFrameworkMode.GetModule <AudioManager>();
            Localization = GameFrameworkMode.GetModule <LocalizationManager>();
            Setting      = GameFrameworkMode.GetModule <SettingManager>();
            System       = GameFrameworkMode.GetModule <SystemManager>();
            Network      = GameFrameworkMode.GetModule <NetworkManager>();
            Pool         = GameFrameworkMode.GetModule <PoolManager>();
            #endregion

            #region resource
            Resource.ResUpdateType = ResUpdateType;
            Resource.ResUpdatePath = ResUpdatePath;
            Resource.LocalPathType = LocalPathType;

            //添加对象池管理器
            GameObject gameObjectPoolHelper = new GameObject("IGameObjectPoolHelper");
            gameObjectPoolHelper.transform.SetParent(transform);
            Resource.SetGameObjectPoolHelper(gameObjectPoolHelper.AddComponent <GameObjectPoolHelper>());
            #endregion

            #region auido
            //设置音频播放
            GameObject audioPlayer = new GameObject("AudioSourcePlayer");
            audioPlayer.transform.SetParent(transform);
            //添加AduioSource
            Audio.SetDefaultAudioSource(audioPlayer.AddComponent <AudioSource>(), audioPlayer.AddComponent <AudioSource>(),
                                        audioPlayer.AddComponent <AudioSource>());
            #endregion

            #region WebRequest
            //设置帮助类
            GameObject webRequestHelper = new GameObject("IWebRequestHelper");
            webRequestHelper.transform.SetParent(transform);
            GameObject webDownloadHelper = new GameObject("IWebDownloadMonoHelper");
            webDownloadHelper.transform.SetParent(transform);
            WebRequest.SetWebRequestHelper(webRequestHelper.AddComponent <WebRquestMonoHelper>());
            WebRequest.SetWebDownloadHelper(webDownloadHelper.AddComponent <WebDownloadMonoHelper>());
            #endregion

            #region state
            //开启整个项目的流程
            Assembly = typeof(GameMode).Assembly;
            State.CreateContext(Assembly);
            yield return(new WaitForEndOfFrame());

            State.SetStateStart();
            #endregion

            #region Setting
            GameObject debugHelper = new GameObject("DebugHelper");
            debugHelper.transform.SetParent(transform);
            Setting.SetDebugHelper(debugHelper.AddComponent <DebugHelper>());
            Setting.DebugEnable = DebugEnable;
            #endregion
        }