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(); }
protected override void Awake() { base.Awake(); InitVersionHelper(); //初始化版本辅助器 InitLogHelper(); //初始化Log辅助器 Log.Info("Game Framework Version: {0}", Version.GameFrameworkVersion); Log.Info("Game Version: {0} ({1})", Version.GameVersion, Version.InternalGameVersion.ToString()); Log.Info("Unity Version: {0}", Application.unityVersion); #if UNITY_5_3_OR_NEWER InitZipHelper(); //初始化压缩辅助器 InitJsonHelper(); //初始化Json辅助器 InitProfilerHelper(); //初始化调试辅助器 Utility.Converter.ScreenDpi = Screen.dpi; if (Utility.Converter.ScreenDpi <= 0) { Utility.Converter.ScreenDpi = DefaultDpi; } m_IsEditorResourceMode &= Application.isEditor; //进一步判断是否是在Unity编辑器下 //设置资源管理器 ResourceManager = m_IsEditorResourceMode ? gameObject.AddComponent <EditorResourceManager>() : GameFrameworkEntry.GetModule <IResourceManager>(); Application.targetFrameRate = m_FrameRate; //帧率 Time.timeScale = m_GameSpeed; //设置游戏速度 Application.runInBackground = m_IsRunInBackground; //后台运行 Screen.sleepTimeout = m_NeverSleep ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting; #else //Unity5.3以前的版本不能用 Log.Error("Game Framework only applies with Unity 5.3 and above, but current Unity version is {0}.", Application.unityVersion); GameEntry.Shutdown(ShutdownType.Quit); #endif #if UNITY_5_6_OR_NEWER Application.lowMemory += OnLowMemory; #endif }