private ResourceComponent m_ResourceComponent = null; //资源组件 private void Start() { m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>(); if (m_ResourceComponent == null) { Log.Fatal("[DefaultEntityHelper.Start] Resource component is invalid."); return; } }
private void Start() { m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>(); if (m_ResourceComponent == null) { Log.Fatal("[DefaultLocalizationHelper.Start] Resource component is invalid."); return; } m_LocalizationManager = GameFrameworkEntry.GetModule <ILocalizationManager>(); if (m_LocalizationManager == null) { Log.Fatal("[DefaultLocalizationHelper.Start] Localization manager is invalid."); return; } }
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; } }
//低内存回调 private void OnLowMemory() { Log.Info("[BaseComponent.OnLowMemory] Low memory reported..."); ObjectPoolComponent objectPoolComponent = GameEntry.GetComponent <ObjectPoolComponent>(); if (objectPoolComponent != null) { objectPoolComponent.ReleaseAllUnused(); //释放所有未使用的对象 } ResourceComponent resourceCompoent = GameEntry.GetComponent <ResourceComponent>(); if (resourceCompoent != null) { resourceCompoent.ForceUnloadUnusedAssets(true); //强制卸载未使用的资源 } }
private IConfigManager m_ConfigManager = null; //配置管理器 private void Start() { //获取资源组件 m_ResourceComponent = GameEntry.GetComponent <ResourceComponent>(); if (m_ResourceComponent == null) { Log.Fatal("[DefaultConfigHelper.Start] Resource component is invalid."); return; } //获取配置管理器模块 m_ConfigManager = GameFrameworkEntry.GetModule <IConfigManager>(); if (m_ConfigManager == null) { Log.Fatal("[DefaultConfigHelper.Start] Config manager is invalid."); return; } }