private string GetSceneNameString(string[] sceneAssetNames)
        {
            if (sceneAssetNames == null || sceneAssetNames.Length <= 0)
            {
                return("<Empty>");
            }

            string sceneNameString = string.Empty;

            foreach (string sceneAssetName in sceneAssetNames)
            {
                if (!string.IsNullOrEmpty(sceneNameString))
                {
                    sceneNameString += ", ";
                }

                sceneNameString += ScenarioManager.GetSceneName(sceneAssetName);
            }

            return(sceneNameString);
        }
Exemple #2
0
        IEnumerator Start()
        {
            //默认不销毁
            DontDestroyOnLoad(gameObject);

            #region Module
            Event           = GameFrameworkMode.GetModule <EventManager>();
            State           = GameFrameworkMode.GetModule <GameStateManager>();
            Node            = GameFrameworkMode.GetModule <NodeManager>();
            DataTable       = GameFrameworkMode.GetModule <DataTableManager>();
            Resource        = GameFrameworkMode.GetModule <ResourceManager>();
            Scene           = GameFrameworkMode.GetModule <ScenarioManager>();
            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>();
            Coroutines      = GameFrameworkMode.GetModule <CoroutineManager>();
            HotFixLua       = GameFrameworkMode.GetModule <HotFixLuaManager>();
            HotFixILRuntime = GameFrameworkMode.GetModule <HotFixILRuntimeManager>();
            #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 UI
            // 如果没有主动绑定UI节点,那么就自动寻找当前场景Canvas组件
            if (UIRoot == null)
            {
                UIRoot = FindObjectOfType <Canvas>().gameObject;
            }
            if (UIRoot != null)
            {
                UI.InitUIRoot(UIRoot);
            }
            #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 Coroutine
            GameObject coroutineRoot = new GameObject("CoroutineRoot");
            coroutineRoot.transform.SetParent(transform);
            Coroutines.Initialize(coroutineRoot);
            #endregion

            #region Setting

            /*Transform debugT = transform.Find("[Graphy]");
             * if (debugT != null)
             * {
             *  GameObject debugHelper = debugT.gameObject;
             *  Setting.SetDebuger(debugHelper);
             *  Setting.DebugEnable = DebugEnable;
             * }*/
            GameObject debugHelper = new GameObject("DebugHelper");
            debugHelper.transform.SetParent(transform);
            Setting.SetDebuger(debugHelper.AddComponent <DebugHelper>().gameObject);
            Setting.DebugEnable = DebugEnable;
            // 帧率
            FrameRate = m_FrameRate;
            #endregion

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

            State.SetStateStart();
            #endregion
        }