예제 #1
0
 public WebRequestManager()
 {
     _event = GameFrameworkMode.GetModule <EventManager>();
     _httpReadTextSuccess = new HttpReadTextSuccessEventArgs();
     _httpReadTextFaile   = new HttpReadTextFaileEventArgs();
     _downloadSuccess     = new DownloadSuccessEventArgs();
     _downloadFaile       = new DownloadFaileEventArgs();
     _downloadProgress    = new DownloadProgressEventArgs();
 }
 public NetworkManager()
 {
     _systemManager    = GameFrameworkMode.GetModule <SystemManager>();
     _responseCallback = new Dictionary <int, Action <object> >();
     // _kcpService = new KcpService(_port, ReceiveMessage);
     _protobufPacker = new ProtobufPacker();
     //加载message标记类
     LoadMessageAttribute();
 }
예제 #3
0
 public ResourceManager()
 {
     //获取事件管理器
     _event = GameFrameworkMode.GetModule <EventManager>();
     //资源异步加载的事件
     _resLoadAsyncSuccessEventArgs = new ResourceLoadAsyncSuccessEventArgs();
     _resLoadAsyncFailureEventArgs = new ResourceLoadAsyncFailureEventArgs();
     //场景事件
     _sceneLoadingEventArgs = new SceneLoadingEventArgs();
     _sceneLoadedEventArgs  = new SceneLoadedEventArgs();
     _sceneAsyncOperations  = new Dictionary <string, AsyncOperation>();
 }
예제 #4
0
        public UIManager()
        {
            //获取资源模块
            _resource = GameFrameworkMode.GetModule <ResourceManager>();
            //获取事件模块
            _event = GameFrameworkMode.GetModule <EventManager>();

            _uiEnterArgs  = new UIEnterEventArgs();
            _uiExitArgs   = new UIExitEventArgs();
            _uiPauseArgs  = new UIPauseEventArgs();
            _uiResumeArgs = new UIResumeEventArgs();
        }
예제 #5
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
        }
        public void AddPrefab(string assetBundleName, string assetName, PoolPrefabInfo prefabInfo)
        {
            if (_prefabs.ContainsKey(assetName))
            {
                Debug.Log("已经存在资源:" + assetName);
                return;
            }
            if (prefabInfo.Prefab == null)
            {
                //根据assetName,直接从ResourceManager里面加载
                prefabInfo.Prefab = GameFrameworkMode.GetModule <ResourceManager>().LoadAsset <GameObject>(assetBundleName, assetName);
                if (prefabInfo.Prefab == null)
                {
                    Debug.Log("预设资源为null:" + assetName);
                    return;
                }
            }
            _prefabs[assetName]  = prefabInfo;
            _spawneds[assetName] = new List <GameObject>();

            Initialization(assetName, prefabInfo);
        }
예제 #7
0
 public DataTableManager()
 {
     _allDataTabvles = new Dictionary <int, DataTableBase>();
     _resource       = GameFrameworkMode.GetModule <ResourceManager>();
 }
 public AudioManager()
 {
     _resourceManager = GameFrameworkMode.GetModule <ResourceManager>();
 }
예제 #9
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
        }
 private void SetUIText(string key)
 {
     _uiText.text = GameFrameworkMode.GetModule <LocalizationManager>().Get(key);
 }