예제 #1
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_UIManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_UIManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            m_UIManager.SetObjectPoolManager(GameFrameworkEntry.GetModule <IObjectPoolManager>());
            m_UIManager.InstanceCapacity = m_InstanceCapacity;

            if (m_UIFormHelper == null)
            {
                m_UIFormHelper      = (new GameObject()).AddComponent <DefaultUIFormHelper>();
                m_UIFormHelper.name = string.Format("UI Form Helper");
                Transform transform = m_UIFormHelper.transform;
                transform.SetParent(this.transform);
                transform.localScale = Vector3.one;
            }

            m_UIManager.SetUIFormHelper(m_UIFormHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("UI Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
            }

            m_InstanceRoot.gameObject.layer = LayerMask.NameToLayer("UI");

            foreach (UIGroup uiGroup in m_UIGroups)
            {
                if (!AddUIGroup(uiGroup.Name, uiGroup.Depth))
                {
                    Log.Warning("Add UI group '{0}' failed.", uiGroup.Name);
                    continue;
                }
            }
        }
예제 #2
0
 private void Start()
 {
     m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>();
     if (m_ResourceComponent == null)
     {
         Log.Fatal("Resource component is invalid.");
         return;
     }
 }
 public override void Initialize(params object[] args)
 {
     m_ObjectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>();
     if (m_ObjectPoolComponent == null)
     {
         Log.Fatal("Object pool component is invalid.");
         return;
     }
 }
 public override void Initialize(params object[] args)
 {
     m_NetworkComponent = GameEntry.GetComponent <NetworkComponent>();
     if (m_NetworkComponent == null)
     {
         Log.Fatal("Network component is invalid.");
         return;
     }
 }
예제 #5
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent<BaseComponent>();
            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent<EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_EntityManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_EntityManager.SetResourceManager(GameFrameworkEntry.GetModule<IResourceManager>());
            }

            m_EntityManager.SetObjectPoolManager(GameFrameworkEntry.GetModule<IObjectPoolManager>());

            EntityHelperBase entityHelper = Helper.CreateHelper(m_EntityHelperTypeName, m_CustomEntityHelper);
            if (entityHelper == null)
            {
                Log.Error("Can not create entity helper.");
                return;
            }

            entityHelper.name = string.Format("Entity Helper");
            Transform transform = entityHelper.transform;
            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_EntityManager.SetEntityHelper(entityHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Entity Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_EntityGroups.Length; i++)
            {
                if (!AddEntityGroup(m_EntityGroups[i].Name, m_EntityGroups[i].InstanceAutoReleaseInterval, m_EntityGroups[i].InstanceCapacity, m_EntityGroups[i].InstanceExpireTime, m_EntityGroups[i].InstancePriority))
                {
                    Log.Warning("Add entity group '{0}' failure.", m_EntityGroups[i].Name);
                    continue;
                }
            }
        }
 private void Start()
 {
     m_EventComponent = GameEntry.GetComponent <EventComponent>();
     if (m_EventComponent == null)
     {
         Log.Fatal("Event component is invalid.");
         return;
     }
 }
예제 #7
0
        /// <summary>
        /// 内存不足时调用
        /// </summary>
        private void OnLowMemory()
        {
            Log.Info("Low memory reported");
            ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>();

            if (objectPoolComponent != null)
            {
                objectPoolComponent.ReleaseAllUnused();
            }
        }
예제 #8
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_SoundManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_SoundManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            m_SoundManager.SetObjectPoolManager(GameFrameworkEntry.GetModule <IObjectPoolManager>());
            m_SoundManager.AssetCapacity = m_AssetCapacity;

            if (m_SoundHelper == null)
            {
                m_SoundHelper      = (new GameObject()).AddComponent <DefaultSoundHelper>();
                m_SoundHelper.name = string.Format("Sound Helper");
                Transform transform = m_SoundHelper.transform;
                transform.SetParent(this.transform);
                transform.localScale = Vector3.one;
            }

            m_SoundManager.SetSoundHelper(m_SoundHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Sound Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
            }

            foreach (SoundGroup soundGroup in m_SoundGroups)
            {
                if (!AddSoundGroup(soundGroup.Name, soundGroup.AvoidBeingReplacedBySamePriority, soundGroup.Mute, soundGroup.Volume, soundGroup.AgentHelperCount))
                {
                    Log.Warning("Add sound group '{0}' failed.", soundGroup.Name);
                    continue;
                }
            }
        }
예제 #9
0
        /// <summary>
        /// 关闭并清理网络频道辅助器。
        /// </summary>
        public void Shutdown()
        {
            // 获取框架事件组件
            EventComponent Event = GameEntry.GetComponent <EventComponent>();

            Event.Unsubscribe(NetworkConnectedEventArgs.EventId, OnNetworkConnected);
            Event.Unsubscribe(NetworkClosedEventArgs.EventId, OnNetworkClosed);
            Event.Unsubscribe(NetworkMissHeartBeatEventArgs.EventId, OnNetworkMissHeartBeat);
            Event.Unsubscribe(NetworkErrorEventArgs.EventId, OnNetworkError);
            Event.Unsubscribe(NetworkCustomErrorEventArgs.EventId, OnNetworkCustomError);

            m_NetworkChannel = null;
        }
예제 #10
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_EntityManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_EntityManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            m_EntityManager.SetObjectPoolManager(GameFrameworkEntry.GetModule <IObjectPoolManager>());
            m_EntityManager.AssetCapacity = m_AssetCapacity;

            if (m_EntityHelper == null)
            {
                m_EntityHelper      = (new GameObject()).AddComponent <DefaultEntityHelper>();
                m_EntityHelper.name = string.Format("Entity Helper");
                Transform transform = m_EntityHelper.transform;
                transform.SetParent(this.transform);
                transform.localScale = Vector3.one;
            }

            m_EntityManager.SetEntityHelper(m_EntityHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Entity Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
            }

            foreach (EntityGroup entityGroup in m_EntityGroups)
            {
                AddEntityGroup(entityGroup.Name, entityGroup.InstanceCapacity);
            }
        }
 private IEnumerator LoadAssetIEnumerator()
 {
     m_CurFreeCoroutineNum--;
     if (GameEntry.GetComponent <BaseComponent>().EditorResourceMode)
     {
         GameEntry.GetComponent <ResourceComponent>().LoadAsset(m_NeedLoadDic[m_currentIndex], m_loadAssetCallbacks);
     }
     else
     {
         GameEntry.GetComponent <ResourceComponent>().LoadAssetBundle(m_NeedLoadDic[m_currentIndex], m_loadAssetBundleCallbacks, null);
     }
     m_currentIndex++;
     yield return(null);
 }
예제 #12
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_LocalizationManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_LocalizationManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            LocalizationHelperBase localizationHelper = Helper.CreateHelper(m_LocalizationHelperTypeName, m_CustomLocalizationHelper);

            if (localizationHelper == null)
            {
                Log.Error("Can not create localization helper.");
                return;
            }

            localizationHelper.name = "Localization Helper";
            Transform transform = localizationHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_LocalizationManager.SetDataProviderHelper(localizationHelper);
            m_LocalizationManager.SetLocalizationHelper(localizationHelper);
            m_LocalizationManager.Language = baseComponent.EditorResourceMode && baseComponent.EditorLanguage != Language.Unspecified ? baseComponent.EditorLanguage : m_LocalizationManager.SystemLanguage;
            if (m_CachedBytesSize > 0)
            {
                EnsureCachedBytesSize(m_CachedBytesSize);
            }
        }
예제 #13
0
            protected override void OnDrawScrollableWindow()
            {
                GUILayout.Label("<b>Operations</b>");
                GUILayout.BeginVertical("box");
                {
                    ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>();
                    if (objectPoolComponent != null)
                    {
                        if (GUILayout.Button("Object Pool Release", GUILayout.Height(30f)))
                        {
                            objectPoolComponent.Release();
                        }

                        if (GUILayout.Button("Object Pool Release All Unused", GUILayout.Height(30f)))
                        {
                            objectPoolComponent.ReleaseAllUnused();
                        }
                    }

                    ResourceComponent resourceCompoent = GameEntry.GetComponent <ResourceComponent>();
                    if (resourceCompoent != null)
                    {
                        if (GUILayout.Button("Unload Unused Assets", GUILayout.Height(30f)))
                        {
                            resourceCompoent.ForceUnloadUnusedAssets(false);
                        }

                        if (GUILayout.Button("Unload Unused Assets and Garbage Collect", GUILayout.Height(30f)))
                        {
                            resourceCompoent.ForceUnloadUnusedAssets(true);
                        }
                    }

                    if (GUILayout.Button("Shutdown Game Framework (None)", GUILayout.Height(30f)))
                    {
                        GameEntry.Shutdown(ShutdownType.None);
                    }
                    if (GUILayout.Button("Shutdown Game Framework (Restart)", GUILayout.Height(30f)))
                    {
                        GameEntry.Shutdown(ShutdownType.Restart);
                    }
                    if (GUILayout.Button("Shutdown Game Framework (Quit)", GUILayout.Height(30f)))
                    {
                        GameEntry.Shutdown(ShutdownType.Quit);
                    }
                }
                GUILayout.EndVertical();
            }
            public override void Initialize(params object[] args)
            {
                m_BaseComponent = GameEntry.GetComponent <BaseComponent>();
                if (m_BaseComponent == null)
                {
                    Log.Fatal("Base component is invalid.");
                    return;
                }

                m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>();
                if (m_ResourceComponent == null)
                {
                    Log.Fatal("Resource component is invalid.");
                    return;
                }
            }
예제 #15
0
        private void Start()
        {
            m_EventComponent = GameEntry.GetComponent <EventComponent>();

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Download Agent Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_DownloadAgentHelperCount; i++)
            {
                AddDownloadAgentHelper(i);
            }
        }
            public void Initialize(params object[] args)
            {
                m_SettingComponent = GameEntry.GetComponent <SettingComponent>();
                if (m_SettingComponent == null)
                {
                    Log.Fatal("Setting component is invalid.");
                    return;
                }

                Application.logMessageReceived += OnLogMessageReceived;
                m_LockScroll    = m_LastLockScroll = m_SettingComponent.GetBool("Debugger.Console.LockScroll", true);
                m_InfoFilter    = m_LastInfoFilter = m_SettingComponent.GetBool("Debugger.Console.InfoFilter", true);
                m_WarningFilter = m_LastWarningFilter = m_SettingComponent.GetBool("Debugger.Console.WarningFilter", true);
                m_ErrorFilter   = m_LastErrorFilter = m_SettingComponent.GetBool("Debugger.Console.ErrorFilter", true);
                m_FatalFilter   = m_LastFatalFilter = m_SettingComponent.GetBool("Debugger.Console.FatalFilter", true);
            }
예제 #17
0
        private void Start()
        {
            m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>();
            m_EventComponent    = GameEntry.GetComponent <EventComponent>();
            if (m_ResourceComponent == null)
            {
                Log.Error(" m_ResourceComponent is null.");
                return;
            }

            m_CacheLuaDict = new Dictionary <string, string>();
            m_LuaEnv       = new LuaEnv();
            m_LuaFileInfos = new List <LuaFileInfo>();
            //m_CacheProtoDict = new Dictionary<string, string>();
            m_CacheProtoPbDict = new Dictionary <string, byte[]>();
        }
예제 #18
0
        private void Start()
        {
            m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>();
            if (m_ResourceComponent == null)
            {
                Log.Fatal("Resource component is invalid.");
                return;
            }

            m_ConfigManager = GameFrameworkEntry.GetModule <IConfigManager>();
            if (m_ConfigManager == null)
            {
                Log.Fatal("ConfigCustom manager is invalid.");
                return;
            }
        }
예제 #19
0
        private void Start()
        {
            m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>();
            if (m_ResourceComponent == null)
            {
                Log.Fatal("Resource component is invalid.");
                return;
            }

            m_LocalizationManager = GameFrameworkEntry.GetModule <ILocalizationManager>();
            if (m_LocalizationManager == null)
            {
                Log.Fatal("Localization manager is invalid.");
                return;
            }
        }
예제 #20
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_DataTableManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_DataTableManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            DataTableHelperBase dataTableHelper = Helper.CreateHelper(m_DataTableHelperTypeName, m_CustomDataTableHelper);

            if (dataTableHelper == null)
            {
                Log.Error("Can not create data table helper.");
                return;
            }

            dataTableHelper.name = "Data Table Helper";
            Transform transform = dataTableHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_DataTableManager.SetDataProviderHelper(dataTableHelper);
            m_DataTableManager.SetDataTableHelper(dataTableHelper);
            if (m_CachedBytesSize > 0)
            {
                EnsureCachedBytesSize(m_CachedBytesSize);
            }
        }
예제 #21
0
        private void OnLowMemory()
        {
            Log.Info("Low memory reported...");

            ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>();

            if (objectPoolComponent != null)
            {
                objectPoolComponent.ReleaseAllUnused();
            }

            ResourceComponent resourceCompoent = GameEntry.GetComponent <ResourceComponent>();

            if (resourceCompoent != null)
            {
                resourceCompoent.ForceUnloadUnusedAssets(true);
            }
        }
            protected override void OnDrawScrollableWindow()
            {
                GUILayout.Label("<b>Operation Settings</b>");
                GUILayout.BeginVertical("box");
                {
                    ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>();
                    if (objectPoolComponent != null)
                    {
                        if (GUILayout.Button("Object Pool Release", GUILayout.Height(30f)))
                        {
                            objectPoolComponent.Release();
                        }

                        if (GUILayout.Button("Object Pool Release All Unused", GUILayout.Height(30f)))
                        {
                            objectPoolComponent.ReleaseAllUnused();
                        }
                    }

                    ResourceComponent resourceCompoent = GameEntry.GetComponent <ResourceComponent>();
                    if (resourceCompoent != null)
                    {
                        if (GUILayout.Button("Unload Unused Assets", GUILayout.Height(30f)))
                        {
                            resourceCompoent.UnloadUnusedAssets(false, "release from debugger");
                        }

                        if (GUILayout.Button("Unload Unused Assets and Garbage Collect", GUILayout.Height(30f)))
                        {
                            resourceCompoent.UnloadUnusedAssets(true, "release from debugger");
                        }
                    }

                    if (GUILayout.Button("Restart Game Framework", GUILayout.Height(30f)))
                    {
                        GameEntry.Restart();
                    }
                    if (GUILayout.Button("Shutdown Game Framework", GUILayout.Height(30f)))
                    {
                        GameEntry.Shutdown();
                    }
                }
                GUILayout.EndVertical();
            }
예제 #23
0
        private void Start()
        {
            ResetLayout();

            RegisterDebuggerWindow("Console", m_ConsoleWindow);
            RegisterDebuggerWindow("Information/System", m_SystemInformationWindow);
            RegisterDebuggerWindow("Information/Environment", m_EnvironmentInformationWindow);
            RegisterDebuggerWindow("Information/Screen", m_ScreenInformationWindow);
            RegisterDebuggerWindow("Information/Graphics", m_GraphicsInformationWindow);
            RegisterDebuggerWindow("Information/Input/Summary", m_InputSummaryInformationWindow);
            RegisterDebuggerWindow("Information/Input/Touch", m_InputTouchInformationWindow);
            RegisterDebuggerWindow("Information/Input/Location", m_InputLocationInformationWindow);
            RegisterDebuggerWindow("Information/Input/Acceleration", m_InputAccelerationInformationWindow);
            RegisterDebuggerWindow("Information/Input/Gyroscope", m_InputGyroscopeInformationWindow);
            RegisterDebuggerWindow("Information/Input/Compass", m_InputCompassInformationWindow);
            RegisterDebuggerWindow("Information/Other/Scene", m_SceneInformationWindow);
            RegisterDebuggerWindow("Information/Other/Path", m_PathInformationWindow);
            RegisterDebuggerWindow("Information/Other/Time", m_TimeInformationWindow);
            RegisterDebuggerWindow("Information/Other/Quality", m_QualityInformationWindow);
            RegisterDebuggerWindow("Information/Other/Web Player", m_WebPlayerInformationWindow);
            RegisterDebuggerWindow("Profiler/Summary", m_ProfilerInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/Summary", m_RuntimeMemorySummaryWindow);
            RegisterDebuggerWindow("Profiler/Memory/All", m_RuntimeMemoryAllInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/Texture", m_RuntimeMemoryTextureInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/Mesh", m_RuntimeMemoryMeshInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/Material", m_RuntimeMemoryMaterialInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/Shader", m_RuntimeMemoryShaderInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/AnimationClip", m_RuntimeMemoryAnimationClipInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/AudioClip", m_RuntimeMemoryAudioClipInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/Font", m_RuntimeMemoryFontInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/TextAsset", m_RuntimeMemoryTextAssetInformationWindow);
            RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow);
            if (GameEntry.GetComponent <ObjectPoolComponent>() != null)
            {
                RegisterDebuggerWindow("Profiler/Object Pool", m_ObjectPoolInformationWindow);
            }
            RegisterDebuggerWindow("Profiler/Reference Pool", m_ReferencePoolInformationWindow);
            if (GameEntry.GetComponent <NetworkComponent>() != null)
            {
                RegisterDebuggerWindow("Profiler/Network", m_NetworkInformationWindow);
            }
            RegisterDebuggerWindow("Other/Settings", m_SettingsWindow);
            RegisterDebuggerWindow("Other/Operations", m_OperationsWindow);
        }
예제 #24
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_ConfigManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_ConfigManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            ConfigHelperBase configHelper = Helper.CreateHelper(m_ConfigHelperTypeName, m_CustomConfigHelper);

            if (configHelper == null)
            {
                Log.Error("Can not create config helper.");
                return;
            }

            configHelper.name = "Config Helper";
            Transform transform = configHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_ConfigManager.SetDataProviderHelper(configHelper);
            m_ConfigManager.SetConfigHelper(configHelper);
        }
예제 #25
0
        private void Start()
        {
            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Download Agent Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
            }

            for (int i = 0; i < m_DownloadAgentHelperCount; i++)
            {
                AddDownloadAgentHelper(i);
            }
        }
        private void Start()
        {
            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = new GameObject("Web Request Agent Instances").transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_WebRequestAgentHelperCount; i++)
            {
                AddWebRequestAgentHelper(i);
            }
        }
        public ListLoader(LoadMode mode = LoadMode.SingleCoroutineMode, LoadAssetCallbacks loadAssetCallbacks = null)
        {
            m_mode = mode;
            m_loadAssetCallbacks = new LoadAssetCallbacks(
                loadAssetSuccessCallback : delegate(string assetName, object asset, float duration, object userData)
            {
                Log.Info("ListLoader :asset(" + assetName + ") load success");
                loadAssetCallbacks.LoadAssetSuccessCallback(assetName, asset, duration, userData);
                CallbackOneLoadFinished(true);
            },
                loadAssetFailureCallback : delegate(string assetName, LoadResourceStatus status, string errorMessage, object userData)
            {
                Log.Info("ListLoader :asset (" + assetName + ")load failure: " + errorMessage);
                CallbackOneLoadFinished(true);
            });

            m_loadAssetBundleCallbacks = new LoadAssetBundleCallbacks(
                loadAssetBundleSuccessCallback : delegate(string assetName, object asset, float duration, object userData)
            {
                Log.Info("ListLoader :asset bundle(" + assetName + ") load success");
                loadAssetCallbacks.LoadAssetSuccessCallback(assetName, asset, duration, userData);
                CallbackOneLoadFinished(true);
            },
                loadAssetBundleFailureCallback : delegate(string assetName, LoadResourceStatus status, string errorMessage, object userData)
            {
                Log.Info("ListLoader :asset bundle(" + assetName + ")load failure: " + errorMessage);
                CallbackOneLoadFinished(true);
            });

            if (m_mode == LoadMode.SingleCoroutineMode)
            {
                m_CurFreeCoroutineNum = 1;
            }
            else
            {
                m_MaxCoroutineNum     = GameEntry.GetComponent <ResourceComponent>().LoadResourceAgentHelperCount;
                m_CurFreeCoroutineNum = m_MaxCoroutineNum;
            }
            m_NeedLoadDic = new List <string>();
        }
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_LocalizationManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_LocalizationManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            if (m_LocalizationHelper == null)
            {
                m_LocalizationHelper      = (new GameObject()).AddComponent <DefaultLocalizationHelper>();
                m_LocalizationHelper.name = string.Format("Localization Helper");
                Transform transform = m_LocalizationHelper.transform;
                transform.SetParent(this.transform);
                transform.localScale = Vector3.one;
            }

            m_LocalizationManager.SetLocalizationHelper(m_LocalizationHelper);
            m_LocalizationManager.Language = (baseComponent.EditorResourceMode && baseComponent.EditorLanguage != Language.Unspecified ? baseComponent.EditorLanguage : m_LocalizationManager.SystemLanguage);
        }
예제 #29
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (baseComponent.EditorResourceMode)
            {
                m_DataTableManager.SetResourceManager(baseComponent.EditorResourceHelper);
            }
            else
            {
                m_DataTableManager.SetResourceManager(GameFrameworkEntry.GetModule <IResourceManager>());
            }

            if (m_DataTableHelper == null)
            {
                m_DataTableHelper      = (new GameObject()).AddComponent <DefaultDataTableHelper>();
                m_DataTableHelper.name = string.Format("Data Table Helper");
                Transform transform = m_DataTableHelper.transform;
                transform.SetParent(this.transform);
                transform.localScale = Vector3.one;
            }

            m_DataTableManager.SetDataTableHelper(m_DataTableHelper);
        }
예제 #30
0
        private void Start()
        {
            BaseComponent baseComponent = GameEntry.GetComponent <BaseComponent>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = GameEntry.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            m_EditorResourceMode = baseComponent.EditorResourceMode;
            m_ResourceManager    = m_EditorResourceMode ? baseComponent.EditorResourceHelper : GameFrameworkEntry.GetModule <IResourceManager>();
            if (m_ResourceManager == null)
            {
                Log.Fatal("Resource manager is invalid.");
                return;
            }

            m_ResourceManager.ResourceUpdateStart   += OnResourceUpdateStart;
            m_ResourceManager.ResourceUpdateChanged += OnResourceUpdateChanged;
            m_ResourceManager.ResourceUpdateSuccess += OnResourceUpdateSuccess;
            m_ResourceManager.ResourceUpdateFailure += OnResourceUpdateFailure;

            m_ResourceManager.SetReadOnlyPath(Application.streamingAssetsPath);
            if (m_ReadWritePathType == ReadWritePathType.TemporaryCache)
            {
                m_ResourceManager.SetReadWritePath(Application.temporaryCachePath);
            }
            else
            {
                if (m_ReadWritePathType == ReadWritePathType.Unspecified)
                {
                    m_ReadWritePathType = ReadWritePathType.PersistentData;
                }

                m_ResourceManager.SetReadWritePath(Application.persistentDataPath);
            }

            if (m_EditorResourceMode)
            {
                return;
            }

            SetResourceMode(m_ResourceMode);
            m_ResourceManager.SetDownloadManager(GameFrameworkEntry.GetModule <IDownloadManager>());
            m_ResourceManager.SetObjectPoolManager(GameFrameworkEntry.GetModule <IObjectPoolManager>());
            m_ResourceManager.AssetAutoReleaseInterval    = m_AssetAutoReleaseInterval;
            m_ResourceManager.AssetCapacity               = m_AssetCapacity;
            m_ResourceManager.AssetExpireTime             = m_AssetExpireTime;
            m_ResourceManager.AssetPriority               = m_AssetPriority;
            m_ResourceManager.ResourceAutoReleaseInterval = m_ResourceAutoReleaseInterval;
            m_ResourceManager.ResourceCapacity            = m_ResourceCapacity;
            m_ResourceManager.ResourceExpireTime          = m_ResourceExpireTime;
            m_ResourceManager.ResourcePriority            = m_ResourcePriority;
            if (m_ResourceMode == ResourceMode.Updatable)
            {
                m_ResourceManager.UpdatePrefixUri             = m_UpdatePrefixUri;
                m_ResourceManager.GenerateReadWriteListLength = m_GenerateReadWriteListLength;
                m_ResourceManager.UpdateRetryCount            = m_UpdateRetryCount;
            }

            m_ResourceHelper = Helper.CreateHelper(m_ResourceHelperTypeName, m_CustomResourceHelper);
            if (m_ResourceHelper == null)
            {
                Log.Error("Can not create resource helper.");
                return;
            }

            m_ResourceHelper.name = "Resource Helper";
            Transform transform = m_ResourceHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_ResourceManager.SetResourceHelper(m_ResourceHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Load Resource Agent Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_LoadResourceAgentHelperCount; i++)
            {
                AddLoadResourceAgentHelper(i);
            }
        }