- 引入 UnityGameFramework
- 使用 Luban 替代原来的 UGF 的数据表
This commit is contained in:
@@ -0,0 +1,319 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(BaseComponent))]
|
||||
internal sealed class BaseComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private const string NoneOptionName = "<None>";
|
||||
private static readonly float[] GameSpeed = new float[] { 0f, 0.01f, 0.1f, 0.25f, 0.5f, 1f, 1.5f, 2f, 4f, 8f };
|
||||
private static readonly string[] GameSpeedForDisplay = new string[] { "0x", "0.01x", "0.1x", "0.25x", "0.5x", "1x", "1.5x", "2x", "4x", "8x" };
|
||||
|
||||
private SerializedProperty m_EditorResourceMode = null;
|
||||
private SerializedProperty m_EditorLanguage = null;
|
||||
private SerializedProperty m_TextHelperTypeName = null;
|
||||
private SerializedProperty m_VersionHelperTypeName = null;
|
||||
private SerializedProperty m_LogHelperTypeName = null;
|
||||
private SerializedProperty m_CompressionHelperTypeName = null;
|
||||
private SerializedProperty m_JsonHelperTypeName = null;
|
||||
private SerializedProperty m_FrameRate = null;
|
||||
private SerializedProperty m_GameSpeed = null;
|
||||
private SerializedProperty m_RunInBackground = null;
|
||||
private SerializedProperty m_NeverSleep = null;
|
||||
|
||||
private string[] m_TextHelperTypeNames = null;
|
||||
private int m_TextHelperTypeNameIndex = 0;
|
||||
private string[] m_VersionHelperTypeNames = null;
|
||||
private int m_VersionHelperTypeNameIndex = 0;
|
||||
private string[] m_LogHelperTypeNames = null;
|
||||
private int m_LogHelperTypeNameIndex = 0;
|
||||
private string[] m_CompressionHelperTypeNames = null;
|
||||
private int m_CompressionHelperTypeNameIndex = 0;
|
||||
private string[] m_JsonHelperTypeNames = null;
|
||||
private int m_JsonHelperTypeNameIndex = 0;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
BaseComponent t = (BaseComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
m_EditorResourceMode.boolValue = EditorGUILayout.BeginToggleGroup("Editor Resource Mode", m_EditorResourceMode.boolValue);
|
||||
{
|
||||
EditorGUILayout.HelpBox("Editor resource mode option is only for editor mode. Game Framework will use editor resource files, which you should validate first.", MessageType.Warning);
|
||||
EditorGUILayout.PropertyField(m_EditorLanguage);
|
||||
EditorGUILayout.HelpBox("Editor language option is only use for localization test in editor mode.", MessageType.Info);
|
||||
}
|
||||
EditorGUILayout.EndToggleGroup();
|
||||
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
EditorGUILayout.LabelField("Global Helpers", EditorStyles.boldLabel);
|
||||
|
||||
int textHelperSelectedIndex = EditorGUILayout.Popup("Text Helper", m_TextHelperTypeNameIndex, m_TextHelperTypeNames);
|
||||
if (textHelperSelectedIndex != m_TextHelperTypeNameIndex)
|
||||
{
|
||||
m_TextHelperTypeNameIndex = textHelperSelectedIndex;
|
||||
m_TextHelperTypeName.stringValue = textHelperSelectedIndex <= 0 ? null : m_TextHelperTypeNames[textHelperSelectedIndex];
|
||||
}
|
||||
|
||||
int versionHelperSelectedIndex = EditorGUILayout.Popup("Version Helper", m_VersionHelperTypeNameIndex, m_VersionHelperTypeNames);
|
||||
if (versionHelperSelectedIndex != m_VersionHelperTypeNameIndex)
|
||||
{
|
||||
m_VersionHelperTypeNameIndex = versionHelperSelectedIndex;
|
||||
m_VersionHelperTypeName.stringValue = versionHelperSelectedIndex <= 0 ? null : m_VersionHelperTypeNames[versionHelperSelectedIndex];
|
||||
}
|
||||
|
||||
int logHelperSelectedIndex = EditorGUILayout.Popup("Log Helper", m_LogHelperTypeNameIndex, m_LogHelperTypeNames);
|
||||
if (logHelperSelectedIndex != m_LogHelperTypeNameIndex)
|
||||
{
|
||||
m_LogHelperTypeNameIndex = logHelperSelectedIndex;
|
||||
m_LogHelperTypeName.stringValue = logHelperSelectedIndex <= 0 ? null : m_LogHelperTypeNames[logHelperSelectedIndex];
|
||||
}
|
||||
|
||||
int compressionHelperSelectedIndex = EditorGUILayout.Popup("Compression Helper", m_CompressionHelperTypeNameIndex, m_CompressionHelperTypeNames);
|
||||
if (compressionHelperSelectedIndex != m_CompressionHelperTypeNameIndex)
|
||||
{
|
||||
m_CompressionHelperTypeNameIndex = compressionHelperSelectedIndex;
|
||||
m_CompressionHelperTypeName.stringValue = compressionHelperSelectedIndex <= 0 ? null : m_CompressionHelperTypeNames[compressionHelperSelectedIndex];
|
||||
}
|
||||
|
||||
int jsonHelperSelectedIndex = EditorGUILayout.Popup("JSON Helper", m_JsonHelperTypeNameIndex, m_JsonHelperTypeNames);
|
||||
if (jsonHelperSelectedIndex != m_JsonHelperTypeNameIndex)
|
||||
{
|
||||
m_JsonHelperTypeNameIndex = jsonHelperSelectedIndex;
|
||||
m_JsonHelperTypeName.stringValue = jsonHelperSelectedIndex <= 0 ? null : m_JsonHelperTypeNames[jsonHelperSelectedIndex];
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
int frameRate = EditorGUILayout.IntSlider("Frame Rate", m_FrameRate.intValue, 1, 120);
|
||||
if (frameRate != m_FrameRate.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.FrameRate = frameRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FrameRate.intValue = frameRate;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
float gameSpeed = EditorGUILayout.Slider("Game Speed", m_GameSpeed.floatValue, 0f, 8f);
|
||||
int selectedGameSpeed = GUILayout.SelectionGrid(GetSelectedGameSpeed(gameSpeed), GameSpeedForDisplay, 5);
|
||||
if (selectedGameSpeed >= 0)
|
||||
{
|
||||
gameSpeed = GetGameSpeed(selectedGameSpeed);
|
||||
}
|
||||
|
||||
if (gameSpeed != m_GameSpeed.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.GameSpeed = gameSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_GameSpeed.floatValue = gameSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
bool runInBackground = EditorGUILayout.Toggle("Run in Background", m_RunInBackground.boolValue);
|
||||
if (runInBackground != m_RunInBackground.boolValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.RunInBackground = runInBackground;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RunInBackground.boolValue = runInBackground;
|
||||
}
|
||||
}
|
||||
|
||||
bool neverSleep = EditorGUILayout.Toggle("Never Sleep", m_NeverSleep.boolValue);
|
||||
if (neverSleep != m_NeverSleep.boolValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.NeverSleep = neverSleep;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NeverSleep.boolValue = neverSleep;
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EditorResourceMode = serializedObject.FindProperty("m_EditorResourceMode");
|
||||
m_EditorLanguage = serializedObject.FindProperty("m_EditorLanguage");
|
||||
m_TextHelperTypeName = serializedObject.FindProperty("m_TextHelperTypeName");
|
||||
m_VersionHelperTypeName = serializedObject.FindProperty("m_VersionHelperTypeName");
|
||||
m_LogHelperTypeName = serializedObject.FindProperty("m_LogHelperTypeName");
|
||||
m_CompressionHelperTypeName = serializedObject.FindProperty("m_CompressionHelperTypeName");
|
||||
m_JsonHelperTypeName = serializedObject.FindProperty("m_JsonHelperTypeName");
|
||||
m_FrameRate = serializedObject.FindProperty("m_FrameRate");
|
||||
m_GameSpeed = serializedObject.FindProperty("m_GameSpeed");
|
||||
m_RunInBackground = serializedObject.FindProperty("m_RunInBackground");
|
||||
m_NeverSleep = serializedObject.FindProperty("m_NeverSleep");
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
List<string> textHelperTypeNames = new List<string>
|
||||
{
|
||||
NoneOptionName
|
||||
};
|
||||
|
||||
textHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Text.ITextHelper)));
|
||||
m_TextHelperTypeNames = textHelperTypeNames.ToArray();
|
||||
m_TextHelperTypeNameIndex = 0;
|
||||
if (!string.IsNullOrEmpty(m_TextHelperTypeName.stringValue))
|
||||
{
|
||||
m_TextHelperTypeNameIndex = textHelperTypeNames.IndexOf(m_TextHelperTypeName.stringValue);
|
||||
if (m_TextHelperTypeNameIndex <= 0)
|
||||
{
|
||||
m_TextHelperTypeNameIndex = 0;
|
||||
m_TextHelperTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> versionHelperTypeNames = new List<string>
|
||||
{
|
||||
NoneOptionName
|
||||
};
|
||||
|
||||
versionHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Version.IVersionHelper)));
|
||||
m_VersionHelperTypeNames = versionHelperTypeNames.ToArray();
|
||||
m_VersionHelperTypeNameIndex = 0;
|
||||
if (!string.IsNullOrEmpty(m_VersionHelperTypeName.stringValue))
|
||||
{
|
||||
m_VersionHelperTypeNameIndex = versionHelperTypeNames.IndexOf(m_VersionHelperTypeName.stringValue);
|
||||
if (m_VersionHelperTypeNameIndex <= 0)
|
||||
{
|
||||
m_VersionHelperTypeNameIndex = 0;
|
||||
m_VersionHelperTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> logHelperTypeNames = new List<string>
|
||||
{
|
||||
NoneOptionName
|
||||
};
|
||||
|
||||
logHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(GameFrameworkLog.ILogHelper)));
|
||||
m_LogHelperTypeNames = logHelperTypeNames.ToArray();
|
||||
m_LogHelperTypeNameIndex = 0;
|
||||
if (!string.IsNullOrEmpty(m_LogHelperTypeName.stringValue))
|
||||
{
|
||||
m_LogHelperTypeNameIndex = logHelperTypeNames.IndexOf(m_LogHelperTypeName.stringValue);
|
||||
if (m_LogHelperTypeNameIndex <= 0)
|
||||
{
|
||||
m_LogHelperTypeNameIndex = 0;
|
||||
m_LogHelperTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> compressionHelperTypeNames = new List<string>
|
||||
{
|
||||
NoneOptionName
|
||||
};
|
||||
|
||||
compressionHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Compression.ICompressionHelper)));
|
||||
m_CompressionHelperTypeNames = compressionHelperTypeNames.ToArray();
|
||||
m_CompressionHelperTypeNameIndex = 0;
|
||||
if (!string.IsNullOrEmpty(m_CompressionHelperTypeName.stringValue))
|
||||
{
|
||||
m_CompressionHelperTypeNameIndex = compressionHelperTypeNames.IndexOf(m_CompressionHelperTypeName.stringValue);
|
||||
if (m_CompressionHelperTypeNameIndex <= 0)
|
||||
{
|
||||
m_CompressionHelperTypeNameIndex = 0;
|
||||
m_CompressionHelperTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> jsonHelperTypeNames = new List<string>
|
||||
{
|
||||
NoneOptionName
|
||||
};
|
||||
|
||||
jsonHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Json.IJsonHelper)));
|
||||
m_JsonHelperTypeNames = jsonHelperTypeNames.ToArray();
|
||||
m_JsonHelperTypeNameIndex = 0;
|
||||
if (!string.IsNullOrEmpty(m_JsonHelperTypeName.stringValue))
|
||||
{
|
||||
m_JsonHelperTypeNameIndex = jsonHelperTypeNames.IndexOf(m_JsonHelperTypeName.stringValue);
|
||||
if (m_JsonHelperTypeNameIndex <= 0)
|
||||
{
|
||||
m_JsonHelperTypeNameIndex = 0;
|
||||
m_JsonHelperTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private float GetGameSpeed(int selectedGameSpeed)
|
||||
{
|
||||
if (selectedGameSpeed < 0)
|
||||
{
|
||||
return GameSpeed[0];
|
||||
}
|
||||
|
||||
if (selectedGameSpeed >= GameSpeed.Length)
|
||||
{
|
||||
return GameSpeed[GameSpeed.Length - 1];
|
||||
}
|
||||
|
||||
return GameSpeed[selectedGameSpeed];
|
||||
}
|
||||
|
||||
private int GetSelectedGameSpeed(float gameSpeed)
|
||||
{
|
||||
for (int i = 0; i < GameSpeed.Length; i++)
|
||||
{
|
||||
if (gameSpeed == GameSpeed[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55195676d06c1cd418e6f3201eae7176
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ConfigComponent))]
|
||||
internal sealed class ConfigComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableLoadConfigUpdateEvent = null;
|
||||
private SerializedProperty m_EnableLoadConfigDependencyAssetEvent = null;
|
||||
private SerializedProperty m_CachedBytesSize = null;
|
||||
|
||||
private HelperInfo<ConfigHelperBase> m_ConfigHelperInfo = new HelperInfo<ConfigHelperBase>("Config");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
ConfigComponent t = (ConfigComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableLoadConfigUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableLoadConfigDependencyAssetEvent);
|
||||
m_ConfigHelperInfo.Draw();
|
||||
EditorGUILayout.PropertyField(m_CachedBytesSize);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Config Count", t.Count.ToString());
|
||||
EditorGUILayout.LabelField("Cached Bytes Size", t.CachedBytesSize.ToString());
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableLoadConfigUpdateEvent = serializedObject.FindProperty("m_EnableLoadConfigUpdateEvent");
|
||||
m_EnableLoadConfigDependencyAssetEvent = serializedObject.FindProperty("m_EnableLoadConfigDependencyAssetEvent");
|
||||
m_CachedBytesSize = serializedObject.FindProperty("m_CachedBytesSize");
|
||||
|
||||
m_ConfigHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_ConfigHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e450812c22c29141a8930ae4c8b7fe6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework.DataNode;
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(DataNodeComponent))]
|
||||
internal sealed class DataNodeComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
DataNodeComponent t = (DataNodeComponent)target;
|
||||
|
||||
if (IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
DrawDataNode(t.Root);
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawDataNode(IDataNode dataNode)
|
||||
{
|
||||
EditorGUILayout.LabelField(dataNode.FullName, dataNode.ToDataString());
|
||||
IDataNode[] child = dataNode.GetAllChild();
|
||||
foreach (IDataNode c in child)
|
||||
{
|
||||
DrawDataNode(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ce0d352bae82974e86bfe9010a4bdfd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.DataTable;
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(DataTableComponent))]
|
||||
internal sealed class DataTableComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableLoadDataTableUpdateEvent = null;
|
||||
private SerializedProperty m_EnableLoadDataTableDependencyAssetEvent = null;
|
||||
private SerializedProperty m_CachedBytesSize = null;
|
||||
|
||||
private HelperInfo<DataTableHelperBase> m_DataTableHelperInfo = new HelperInfo<DataTableHelperBase>("DataTable");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
DataTableComponent t = (DataTableComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableLoadDataTableUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableLoadDataTableDependencyAssetEvent);
|
||||
m_DataTableHelperInfo.Draw();
|
||||
EditorGUILayout.PropertyField(m_CachedBytesSize);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Data Table Count", t.Count.ToString());
|
||||
EditorGUILayout.LabelField("Cached Bytes Size", t.CachedBytesSize.ToString());
|
||||
|
||||
DataTableBase[] dataTables = t.GetAllDataTables();
|
||||
foreach (DataTableBase dataTable in dataTables)
|
||||
{
|
||||
DrawDataTable(dataTable);
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableLoadDataTableUpdateEvent = serializedObject.FindProperty("m_EnableLoadDataTableUpdateEvent");
|
||||
m_EnableLoadDataTableDependencyAssetEvent = serializedObject.FindProperty("m_EnableLoadDataTableDependencyAssetEvent");
|
||||
m_CachedBytesSize = serializedObject.FindProperty("m_CachedBytesSize");
|
||||
|
||||
m_DataTableHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void DrawDataTable(DataTableBase dataTable)
|
||||
{
|
||||
EditorGUILayout.LabelField(dataTable.FullName, Utility.Text.Format("{0} Rows", dataTable.Count));
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_DataTableHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75e2902c828fd8a4cb81e6d743351074
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(DebuggerComponent))]
|
||||
internal sealed class DebuggerComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_Skin = null;
|
||||
private SerializedProperty m_ActiveWindow = null;
|
||||
private SerializedProperty m_ShowFullWindow = null;
|
||||
private SerializedProperty m_ConsoleWindow = null;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
DebuggerComponent t = (DebuggerComponent)target;
|
||||
|
||||
EditorGUILayout.PropertyField(m_Skin);
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
bool activeWindow = EditorGUILayout.Toggle("Active Window", t.ActiveWindow);
|
||||
if (activeWindow != t.ActiveWindow)
|
||||
{
|
||||
t.ActiveWindow = activeWindow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_ActiveWindow);
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(m_ShowFullWindow);
|
||||
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
if (GUILayout.Button("Reset Layout"))
|
||||
{
|
||||
t.ResetLayout();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(m_ConsoleWindow, true);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_Skin = serializedObject.FindProperty("m_Skin");
|
||||
m_ActiveWindow = serializedObject.FindProperty("m_ActiveWindow");
|
||||
m_ShowFullWindow = serializedObject.FindProperty("m_ShowFullWindow");
|
||||
m_ConsoleWindow = serializedObject.FindProperty("m_ConsoleWindow");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 482ae76a43c942249953b4c30ec4859b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,156 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(DownloadComponent))]
|
||||
internal sealed class DownloadComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_InstanceRoot = null;
|
||||
private SerializedProperty m_DownloadAgentHelperCount = null;
|
||||
private SerializedProperty m_Timeout = null;
|
||||
private SerializedProperty m_FlushSize = null;
|
||||
|
||||
private HelperInfo<DownloadAgentHelperBase> m_DownloadAgentHelperInfo = new HelperInfo<DownloadAgentHelperBase>("DownloadAgent");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
DownloadComponent t = (DownloadComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_InstanceRoot);
|
||||
m_DownloadAgentHelperInfo.Draw();
|
||||
m_DownloadAgentHelperCount.intValue = EditorGUILayout.IntSlider("Download Agent Helper Count", m_DownloadAgentHelperCount.intValue, 1, 16);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
float timeout = EditorGUILayout.Slider("Timeout", m_Timeout.floatValue, 0f, 120f);
|
||||
if (timeout != m_Timeout.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.Timeout = timeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Timeout.floatValue = timeout;
|
||||
}
|
||||
}
|
||||
|
||||
int flushSize = EditorGUILayout.DelayedIntField("Flush Size", m_FlushSize.intValue);
|
||||
if (flushSize != m_FlushSize.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.FlushSize = flushSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FlushSize.intValue = flushSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Paused", t.Paused.ToString());
|
||||
EditorGUILayout.LabelField("Total Agent Count", t.TotalAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Free Agent Count", t.FreeAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Working Agent Count", t.WorkingAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Waiting Agent Count", t.WaitingTaskCount.ToString());
|
||||
EditorGUILayout.LabelField("Current Speed", t.CurrentSpeed.ToString());
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
TaskInfo[] downloadInfos = t.GetAllDownloadInfos();
|
||||
if (downloadInfos.Length > 0)
|
||||
{
|
||||
foreach (TaskInfo downloadInfo in downloadInfos)
|
||||
{
|
||||
DrawDownloadInfo(downloadInfo);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Export CSV Data"))
|
||||
{
|
||||
string exportFileName = EditorUtility.SaveFilePanel("Export CSV Data", string.Empty, "Download Task Data.csv", string.Empty);
|
||||
if (!string.IsNullOrEmpty(exportFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
int index = 0;
|
||||
string[] data = new string[downloadInfos.Length + 1];
|
||||
data[index++] = "Download Path,Serial Id,Tag,Priority,Status";
|
||||
foreach (TaskInfo downloadInfo in downloadInfos)
|
||||
{
|
||||
data[index++] = Utility.Text.Format("{0},{1},{2},{3},{4}", downloadInfo.Description, downloadInfo.SerialId, downloadInfo.Tag ?? string.Empty, downloadInfo.Priority, downloadInfo.Status);
|
||||
}
|
||||
|
||||
File.WriteAllLines(exportFileName, data, Encoding.UTF8);
|
||||
Debug.Log(Utility.Text.Format("Export download task CSV data to '{0}' success.", exportFileName));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError(Utility.Text.Format("Export download task CSV data to '{0}' failure, exception is '{1}'.", exportFileName, exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("Download Task is Empty ...");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
|
||||
m_DownloadAgentHelperCount = serializedObject.FindProperty("m_DownloadAgentHelperCount");
|
||||
m_Timeout = serializedObject.FindProperty("m_Timeout");
|
||||
m_FlushSize = serializedObject.FindProperty("m_FlushSize");
|
||||
|
||||
m_DownloadAgentHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void DrawDownloadInfo(TaskInfo downloadInfo)
|
||||
{
|
||||
EditorGUILayout.LabelField(downloadInfo.Description, Utility.Text.Format("[SerialId]{0} [Tag]{1} [Priority]{2} [Status]{3}", downloadInfo.SerialId, downloadInfo.Tag ?? "<None>", downloadInfo.Priority, downloadInfo.Status));
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_DownloadAgentHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e008c434c24c414cbee0f9e5191702e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(EditorResourceComponent))]
|
||||
internal sealed class EditorResourceComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableCachedAssets = null;
|
||||
private SerializedProperty m_LoadAssetCountPerFrame = null;
|
||||
private SerializedProperty m_MinLoadAssetRandomDelaySeconds = null;
|
||||
private SerializedProperty m_MaxLoadAssetRandomDelaySeconds = null;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
EditorResourceComponent t = (EditorResourceComponent)target;
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Load Waiting Asset Count", t.LoadWaitingAssetCount.ToString());
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(m_EnableCachedAssets);
|
||||
EditorGUILayout.PropertyField(m_LoadAssetCountPerFrame);
|
||||
EditorGUILayout.PropertyField(m_MinLoadAssetRandomDelaySeconds);
|
||||
EditorGUILayout.PropertyField(m_MaxLoadAssetRandomDelaySeconds);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableCachedAssets = serializedObject.FindProperty("m_EnableCachedAssets");
|
||||
m_LoadAssetCountPerFrame = serializedObject.FindProperty("m_LoadAssetCountPerFrame");
|
||||
m_MinLoadAssetRandomDelaySeconds = serializedObject.FindProperty("m_MinLoadAssetRandomDelaySeconds");
|
||||
m_MaxLoadAssetRandomDelaySeconds = serializedObject.FindProperty("m_MaxLoadAssetRandomDelaySeconds");
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e657cda935f6f7409a2486383dd3208
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,88 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Entity;
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(EntityComponent))]
|
||||
internal sealed class EntityComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableShowEntityUpdateEvent = null;
|
||||
private SerializedProperty m_EnableShowEntityDependencyAssetEvent = null;
|
||||
private SerializedProperty m_InstanceRoot = null;
|
||||
private SerializedProperty m_EntityGroups = null;
|
||||
|
||||
private HelperInfo<EntityHelperBase> m_EntityHelperInfo = new HelperInfo<EntityHelperBase>("Entity");
|
||||
private HelperInfo<EntityGroupHelperBase> m_EntityGroupHelperInfo = new HelperInfo<EntityGroupHelperBase>("EntityGroup");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
EntityComponent t = (EntityComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableShowEntityUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableShowEntityDependencyAssetEvent);
|
||||
EditorGUILayout.PropertyField(m_InstanceRoot);
|
||||
m_EntityHelperInfo.Draw();
|
||||
m_EntityGroupHelperInfo.Draw();
|
||||
EditorGUILayout.PropertyField(m_EntityGroups, true);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Entity Group Count", t.EntityGroupCount.ToString());
|
||||
EditorGUILayout.LabelField("Entity Count (Total)", t.EntityCount.ToString());
|
||||
IEntityGroup[] entityGroups = t.GetAllEntityGroups();
|
||||
foreach (IEntityGroup entityGroup in entityGroups)
|
||||
{
|
||||
EditorGUILayout.LabelField(Utility.Text.Format("Entity Count ({0})", entityGroup.Name), entityGroup.EntityCount.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableShowEntityUpdateEvent = serializedObject.FindProperty("m_EnableShowEntityUpdateEvent");
|
||||
m_EnableShowEntityDependencyAssetEvent = serializedObject.FindProperty("m_EnableShowEntityDependencyAssetEvent");
|
||||
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
|
||||
m_EntityGroups = serializedObject.FindProperty("m_EntityGroups");
|
||||
|
||||
m_EntityHelperInfo.Init(serializedObject);
|
||||
m_EntityGroupHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_EntityHelperInfo.Refresh();
|
||||
m_EntityGroupHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 692b0cef6071a1342b8cc4e6ab9a2fb1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(EventComponent))]
|
||||
internal sealed class EventComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
EventComponent t = (EventComponent)target;
|
||||
|
||||
if (IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Event Handler Count", t.EventHandlerCount.ToString());
|
||||
EditorGUILayout.LabelField("Event Count", t.EventCount.ToString());
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb23c608d69039c4dab132437b577ba1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.FileSystem;
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(FileSystemComponent))]
|
||||
internal sealed class FileSystemComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private HelperInfo<FileSystemHelperBase> m_FileSystemHelperInfo = new HelperInfo<FileSystemHelperBase>("FileSystem");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
FileSystemComponent t = (FileSystemComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
m_FileSystemHelperInfo.Draw();
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("File System Count", t.Count.ToString());
|
||||
|
||||
IFileSystem[] fileSystems = t.GetAllFileSystems();
|
||||
foreach (IFileSystem fileSystem in fileSystems)
|
||||
{
|
||||
DrawFileSystem(fileSystem);
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_FileSystemHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_FileSystemHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void DrawFileSystem(IFileSystem fileSystem)
|
||||
{
|
||||
EditorGUILayout.LabelField(fileSystem.FullPath, Utility.Text.Format("{0}, {1} / {2} Files", fileSystem.Access, fileSystem.FileCount, fileSystem.MaxFileCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc83fe4d1e4c1ae41bdd9881023a44a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Fsm;
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(FsmComponent))]
|
||||
internal sealed class FsmComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
FsmComponent t = (FsmComponent)target;
|
||||
|
||||
if (IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("FSM Count", t.Count.ToString());
|
||||
|
||||
FsmBase[] fsms = t.GetAllFsms();
|
||||
foreach (FsmBase fsm in fsms)
|
||||
{
|
||||
DrawFsm(fsm);
|
||||
}
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawFsm(FsmBase fsm)
|
||||
{
|
||||
EditorGUILayout.LabelField(fsm.FullName, fsm.IsRunning ? Utility.Text.Format("{0}, {1:F1} s", fsm.CurrentStateName, fsm.CurrentStateTime) : (fsm.IsDestroyed ? "Destroyed" : "Not Running"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 581c356e8f25d484792c21435f5794aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,64 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架 Inspector 抽象类。
|
||||
/// </summary>
|
||||
public abstract class GameFrameworkInspector : UnityEditor.Editor
|
||||
{
|
||||
private bool m_IsCompiling = false;
|
||||
|
||||
/// <summary>
|
||||
/// 绘制事件。
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (m_IsCompiling && !EditorApplication.isCompiling)
|
||||
{
|
||||
m_IsCompiling = false;
|
||||
OnCompileComplete();
|
||||
}
|
||||
else if (!m_IsCompiling && EditorApplication.isCompiling)
|
||||
{
|
||||
m_IsCompiling = true;
|
||||
OnCompileStart();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编译开始事件。
|
||||
/// </summary>
|
||||
protected virtual void OnCompileStart()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编译完成事件。
|
||||
/// </summary>
|
||||
protected virtual void OnCompileComplete()
|
||||
{
|
||||
}
|
||||
|
||||
protected bool IsPrefabInHierarchy(UnityEngine.Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
return PrefabUtility.GetPrefabAssetType(obj) != PrefabAssetType.Regular;
|
||||
#else
|
||||
return PrefabUtility.GetPrefabType(obj) != PrefabType.Prefab;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5bb373d9bcd4bd45861670fa5208e05
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(LocalizationComponent))]
|
||||
internal sealed class LocalizationComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableLoadDictionaryUpdateEvent = null;
|
||||
private SerializedProperty m_EnableLoadDictionaryDependencyAssetEvent = null;
|
||||
private SerializedProperty m_CachedBytesSize = null;
|
||||
|
||||
private HelperInfo<LocalizationHelperBase> m_LocalizationHelperInfo = new HelperInfo<LocalizationHelperBase>("Localization");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
LocalizationComponent t = (LocalizationComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableLoadDictionaryUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableLoadDictionaryDependencyAssetEvent);
|
||||
m_LocalizationHelperInfo.Draw();
|
||||
EditorGUILayout.PropertyField(m_CachedBytesSize);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Language", t.Language.ToString());
|
||||
EditorGUILayout.LabelField("System Language", t.SystemLanguage.ToString());
|
||||
EditorGUILayout.LabelField("Dictionary Count", t.DictionaryCount.ToString());
|
||||
EditorGUILayout.LabelField("Cached Bytes Size", t.CachedBytesSize.ToString());
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableLoadDictionaryUpdateEvent = serializedObject.FindProperty("m_EnableLoadDictionaryUpdateEvent");
|
||||
m_EnableLoadDictionaryDependencyAssetEvent = serializedObject.FindProperty("m_EnableLoadDictionaryDependencyAssetEvent");
|
||||
m_CachedBytesSize = serializedObject.FindProperty("m_CachedBytesSize");
|
||||
|
||||
m_LocalizationHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_LocalizationHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e90ad13aae4116347b57e87e5d00c94d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.Network;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(NetworkComponent))]
|
||||
internal sealed class NetworkComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkComponent t = (NetworkComponent)target;
|
||||
|
||||
if (IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Network Channel Count", t.NetworkChannelCount.ToString());
|
||||
|
||||
INetworkChannel[] networkChannels = t.GetAllNetworkChannels();
|
||||
foreach (INetworkChannel networkChannel in networkChannels)
|
||||
{
|
||||
DrawNetworkChannel(networkChannel);
|
||||
}
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawNetworkChannel(INetworkChannel networkChannel)
|
||||
{
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
EditorGUILayout.LabelField(networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected");
|
||||
EditorGUILayout.LabelField("Service Type", networkChannel.ServiceType.ToString());
|
||||
EditorGUILayout.LabelField("Address Family", networkChannel.AddressFamily.ToString());
|
||||
EditorGUILayout.LabelField("Local Address", networkChannel.Connected ? networkChannel.Socket.LocalEndPoint.ToString() : "Unavailable");
|
||||
EditorGUILayout.LabelField("Remote Address", networkChannel.Connected ? networkChannel.Socket.RemoteEndPoint.ToString() : "Unavailable");
|
||||
EditorGUILayout.LabelField("Send Packet", Utility.Text.Format("{0} / {1}", networkChannel.SendPacketCount, networkChannel.SentPacketCount));
|
||||
EditorGUILayout.LabelField("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount, networkChannel.ReceivedPacketCount));
|
||||
EditorGUILayout.LabelField("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString());
|
||||
EditorGUILayout.LabelField("Heart Beat", Utility.Text.Format("{0:F2} / {1:F2}", networkChannel.HeartBeatElapseSeconds, networkChannel.HeartBeatInterval));
|
||||
EditorGUI.BeginDisabledGroup(!networkChannel.Connected);
|
||||
{
|
||||
if (GUILayout.Button("Disconnect"))
|
||||
{
|
||||
networkChannel.Close();
|
||||
}
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cbb7330261939244ac0b87d6798313a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,138 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework.ObjectPool;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ObjectPoolComponent))]
|
||||
internal sealed class ObjectPoolComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private readonly HashSet<string> m_OpenedItems = new HashSet<string>();
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectPoolComponent t = (ObjectPoolComponent)target;
|
||||
|
||||
if (IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Object Pool Count", t.Count.ToString());
|
||||
|
||||
ObjectPoolBase[] objectPools = t.GetAllObjectPools(true);
|
||||
foreach (ObjectPoolBase objectPool in objectPools)
|
||||
{
|
||||
DrawObjectPool(objectPool);
|
||||
}
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawObjectPool(ObjectPoolBase objectPool)
|
||||
{
|
||||
bool lastState = m_OpenedItems.Contains(objectPool.FullName);
|
||||
bool currentState = EditorGUILayout.Foldout(lastState, objectPool.FullName);
|
||||
if (currentState != lastState)
|
||||
{
|
||||
if (currentState)
|
||||
{
|
||||
m_OpenedItems.Add(objectPool.FullName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OpenedItems.Remove(objectPool.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentState)
|
||||
{
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
EditorGUILayout.LabelField("Name", objectPool.Name);
|
||||
EditorGUILayout.LabelField("Type", objectPool.ObjectType.FullName);
|
||||
EditorGUILayout.LabelField("Auto Release Interval", objectPool.AutoReleaseInterval.ToString());
|
||||
EditorGUILayout.LabelField("Capacity", objectPool.Capacity.ToString());
|
||||
EditorGUILayout.LabelField("Used Count", objectPool.Count.ToString());
|
||||
EditorGUILayout.LabelField("Can Release Count", objectPool.CanReleaseCount.ToString());
|
||||
EditorGUILayout.LabelField("Expire Time", objectPool.ExpireTime.ToString());
|
||||
EditorGUILayout.LabelField("Priority", objectPool.Priority.ToString());
|
||||
ObjectInfo[] objectInfos = objectPool.GetAllObjectInfos();
|
||||
if (objectInfos.Length > 0)
|
||||
{
|
||||
EditorGUILayout.LabelField("Name", objectPool.AllowMultiSpawn ? "Locked\tCount\tFlag\tPriority\tLast Use Time" : "Locked\tIn Use\tFlag\tPriority\tLast Use Time");
|
||||
foreach (ObjectInfo objectInfo in objectInfos)
|
||||
{
|
||||
EditorGUILayout.LabelField(string.IsNullOrEmpty(objectInfo.Name) ? "<None>" : objectInfo.Name, objectPool.AllowMultiSpawn ? Utility.Text.Format("{0}\t{1}\t{2}\t{3}\t{4:yyyy-MM-dd HH:mm:ss}", objectInfo.Locked, objectInfo.SpawnCount, objectInfo.CustomCanReleaseFlag, objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime()) : Utility.Text.Format("{0}\t{1}\t{2}\t{3}\t{4:yyyy-MM-dd HH:mm:ss}", objectInfo.Locked, objectInfo.IsInUse, objectInfo.CustomCanReleaseFlag, objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime()));
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Release"))
|
||||
{
|
||||
objectPool.Release();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Release All Unused"))
|
||||
{
|
||||
objectPool.ReleaseAllUnused();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Export CSV Data"))
|
||||
{
|
||||
string exportFileName = EditorUtility.SaveFilePanel("Export CSV Data", string.Empty, Utility.Text.Format("Object Pool Data - {0}.csv", objectPool.Name), string.Empty);
|
||||
if (!string.IsNullOrEmpty(exportFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
int index = 0;
|
||||
string[] data = new string[objectInfos.Length + 1];
|
||||
data[index++] = Utility.Text.Format("Name,Locked,{0},Custom Can Release Flag,Priority,Last Use Time", objectPool.AllowMultiSpawn ? "Count" : "In Use");
|
||||
foreach (ObjectInfo objectInfo in objectInfos)
|
||||
{
|
||||
data[index++] = objectPool.AllowMultiSpawn ? Utility.Text.Format("{0},{1},{2},{3},{4},{5:yyyy-MM-dd HH:mm:ss}", objectInfo.Name, objectInfo.Locked, objectInfo.SpawnCount, objectInfo.CustomCanReleaseFlag, objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime()) : Utility.Text.Format("{0},{1},{2},{3},{4},{5:yyyy-MM-dd HH:mm:ss}", objectInfo.Name, objectInfo.Locked, objectInfo.IsInUse, objectInfo.CustomCanReleaseFlag, objectInfo.Priority, objectInfo.LastUseTime.ToLocalTime());
|
||||
}
|
||||
|
||||
File.WriteAllLines(exportFileName, data, Encoding.UTF8);
|
||||
Debug.Log(Utility.Text.Format("Export object pool CSV data to '{0}' success.", exportFileName));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError(Utility.Text.Format("Export object pool CSV data to '{0}' failure, exception is '{1}'.", exportFileName, exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("Object Pool is Empty ...");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb0d4111d9ba0ad469b2361c7731666a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,172 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework.Procedure;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ProcedureComponent))]
|
||||
internal sealed class ProcedureComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_AvailableProcedureTypeNames = null;
|
||||
private SerializedProperty m_EntranceProcedureTypeName = null;
|
||||
|
||||
private string[] m_ProcedureTypeNames = null;
|
||||
private List<string> m_CurrentAvailableProcedureTypeNames = null;
|
||||
private int m_EntranceProcedureIndex = -1;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
ProcedureComponent t = (ProcedureComponent)target;
|
||||
|
||||
if (string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue))
|
||||
{
|
||||
EditorGUILayout.HelpBox("Entrance procedure is invalid.", MessageType.Error);
|
||||
}
|
||||
else if (EditorApplication.isPlaying)
|
||||
{
|
||||
EditorGUILayout.LabelField("Current Procedure", t.CurrentProcedure == null ? "None" : t.CurrentProcedure.GetType().ToString());
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
GUILayout.Label("Available Procedures", EditorStyles.boldLabel);
|
||||
if (m_ProcedureTypeNames.Length > 0)
|
||||
{
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
foreach (string procedureTypeName in m_ProcedureTypeNames)
|
||||
{
|
||||
bool selected = m_CurrentAvailableProcedureTypeNames.Contains(procedureTypeName);
|
||||
if (selected != EditorGUILayout.ToggleLeft(procedureTypeName, selected))
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
m_CurrentAvailableProcedureTypeNames.Add(procedureTypeName);
|
||||
WriteAvailableProcedureTypeNames();
|
||||
}
|
||||
else if (procedureTypeName != m_EntranceProcedureTypeName.stringValue)
|
||||
{
|
||||
m_CurrentAvailableProcedureTypeNames.Remove(procedureTypeName);
|
||||
WriteAvailableProcedureTypeNames();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("There is no available procedure.", MessageType.Warning);
|
||||
}
|
||||
|
||||
if (m_CurrentAvailableProcedureTypeNames.Count > 0)
|
||||
{
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
int selectedIndex = EditorGUILayout.Popup("Entrance Procedure", m_EntranceProcedureIndex, m_CurrentAvailableProcedureTypeNames.ToArray());
|
||||
if (selectedIndex != m_EntranceProcedureIndex)
|
||||
{
|
||||
m_EntranceProcedureIndex = selectedIndex;
|
||||
m_EntranceProcedureTypeName.stringValue = m_CurrentAvailableProcedureTypeNames[selectedIndex];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("Select available procedures first.", MessageType.Info);
|
||||
}
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_AvailableProcedureTypeNames = serializedObject.FindProperty("m_AvailableProcedureTypeNames");
|
||||
m_EntranceProcedureTypeName = serializedObject.FindProperty("m_EntranceProcedureTypeName");
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_ProcedureTypeNames = Type.GetRuntimeTypeNames(typeof(ProcedureBase));
|
||||
ReadAvailableProcedureTypeNames();
|
||||
int oldCount = m_CurrentAvailableProcedureTypeNames.Count;
|
||||
m_CurrentAvailableProcedureTypeNames = m_CurrentAvailableProcedureTypeNames.Where(x => m_ProcedureTypeNames.Contains(x)).ToList();
|
||||
if (m_CurrentAvailableProcedureTypeNames.Count != oldCount)
|
||||
{
|
||||
WriteAvailableProcedureTypeNames();
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue))
|
||||
{
|
||||
m_EntranceProcedureIndex = m_CurrentAvailableProcedureTypeNames.IndexOf(m_EntranceProcedureTypeName.stringValue);
|
||||
if (m_EntranceProcedureIndex < 0)
|
||||
{
|
||||
m_EntranceProcedureTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void ReadAvailableProcedureTypeNames()
|
||||
{
|
||||
m_CurrentAvailableProcedureTypeNames = new List<string>();
|
||||
int count = m_AvailableProcedureTypeNames.arraySize;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
m_CurrentAvailableProcedureTypeNames.Add(m_AvailableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteAvailableProcedureTypeNames()
|
||||
{
|
||||
m_AvailableProcedureTypeNames.ClearArray();
|
||||
if (m_CurrentAvailableProcedureTypeNames == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_CurrentAvailableProcedureTypeNames.Sort();
|
||||
int count = m_CurrentAvailableProcedureTypeNames.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
m_AvailableProcedureTypeNames.InsertArrayElementAtIndex(i);
|
||||
m_AvailableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue = m_CurrentAvailableProcedureTypeNames[i];
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue))
|
||||
{
|
||||
m_EntranceProcedureIndex = m_CurrentAvailableProcedureTypeNames.IndexOf(m_EntranceProcedureTypeName.stringValue);
|
||||
if (m_EntranceProcedureIndex < 0)
|
||||
{
|
||||
m_EntranceProcedureTypeName.stringValue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64d014b25074fd64b995dd8a458b6973
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,152 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ReferencePoolComponent))]
|
||||
internal sealed class ReferencePoolComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private readonly Dictionary<string, List<ReferencePoolInfo>> m_ReferencePoolInfos = new Dictionary<string, List<ReferencePoolInfo>>(StringComparer.Ordinal);
|
||||
private readonly HashSet<string> m_OpenedItems = new HashSet<string>();
|
||||
|
||||
private SerializedProperty m_EnableStrictCheck = null;
|
||||
|
||||
private bool m_ShowFullClassName = false;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
ReferencePoolComponent t = (ReferencePoolComponent)target;
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
bool enableStrictCheck = EditorGUILayout.Toggle("Enable Strict Check", t.EnableStrictCheck);
|
||||
if (enableStrictCheck != t.EnableStrictCheck)
|
||||
{
|
||||
t.EnableStrictCheck = enableStrictCheck;
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Reference Pool Count", ReferencePool.Count.ToString());
|
||||
m_ShowFullClassName = EditorGUILayout.Toggle("Show Full Class Name", m_ShowFullClassName);
|
||||
m_ReferencePoolInfos.Clear();
|
||||
ReferencePoolInfo[] referencePoolInfos = ReferencePool.GetAllReferencePoolInfos();
|
||||
foreach (ReferencePoolInfo referencePoolInfo in referencePoolInfos)
|
||||
{
|
||||
string assemblyName = referencePoolInfo.Type.Assembly.GetName().Name;
|
||||
List<ReferencePoolInfo> results = null;
|
||||
if (!m_ReferencePoolInfos.TryGetValue(assemblyName, out results))
|
||||
{
|
||||
results = new List<ReferencePoolInfo>();
|
||||
m_ReferencePoolInfos.Add(assemblyName, results);
|
||||
}
|
||||
|
||||
results.Add(referencePoolInfo);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, List<ReferencePoolInfo>> assemblyReferencePoolInfo in m_ReferencePoolInfos)
|
||||
{
|
||||
bool lastState = m_OpenedItems.Contains(assemblyReferencePoolInfo.Key);
|
||||
bool currentState = EditorGUILayout.Foldout(lastState, assemblyReferencePoolInfo.Key);
|
||||
if (currentState != lastState)
|
||||
{
|
||||
if (currentState)
|
||||
{
|
||||
m_OpenedItems.Add(assemblyReferencePoolInfo.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OpenedItems.Remove(assemblyReferencePoolInfo.Key);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentState)
|
||||
{
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
EditorGUILayout.LabelField(m_ShowFullClassName ? "Full Class Name" : "Class Name", "Unused\tUsing\tAcquire\tRelease\tAdd\tRemove");
|
||||
assemblyReferencePoolInfo.Value.Sort(Comparison);
|
||||
foreach (ReferencePoolInfo referencePoolInfo in assemblyReferencePoolInfo.Value)
|
||||
{
|
||||
DrawReferencePoolInfo(referencePoolInfo);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Export CSV Data"))
|
||||
{
|
||||
string exportFileName = EditorUtility.SaveFilePanel("Export CSV Data", string.Empty, Utility.Text.Format("Reference Pool Data - {0}.csv", assemblyReferencePoolInfo.Key), string.Empty);
|
||||
if (!string.IsNullOrEmpty(exportFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
int index = 0;
|
||||
string[] data = new string[assemblyReferencePoolInfo.Value.Count + 1];
|
||||
data[index++] = "Class Name,Full Class Name,Unused,Using,Acquire,Release,Add,Remove";
|
||||
foreach (ReferencePoolInfo referencePoolInfo in assemblyReferencePoolInfo.Value)
|
||||
{
|
||||
data[index++] = Utility.Text.Format("{0},{1},{2},{3},{4},{5},{6},{7}", referencePoolInfo.Type.Name, referencePoolInfo.Type.FullName, referencePoolInfo.UnusedReferenceCount, referencePoolInfo.UsingReferenceCount, referencePoolInfo.AcquireReferenceCount, referencePoolInfo.ReleaseReferenceCount, referencePoolInfo.AddReferenceCount, referencePoolInfo.RemoveReferenceCount);
|
||||
}
|
||||
|
||||
File.WriteAllLines(exportFileName, data, Encoding.UTF8);
|
||||
Debug.Log(Utility.Text.Format("Export reference pool CSV data to '{0}' success.", exportFileName));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError(Utility.Text.Format("Export reference pool CSV data to '{0}' failure, exception is '{1}'.", exportFileName, exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableStrictCheck);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableStrictCheck = serializedObject.FindProperty("m_EnableStrictCheck");
|
||||
}
|
||||
|
||||
private void DrawReferencePoolInfo(ReferencePoolInfo referencePoolInfo)
|
||||
{
|
||||
EditorGUILayout.LabelField(m_ShowFullClassName ? referencePoolInfo.Type.FullName : referencePoolInfo.Type.Name, Utility.Text.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", referencePoolInfo.UnusedReferenceCount, referencePoolInfo.UsingReferenceCount, referencePoolInfo.AcquireReferenceCount, referencePoolInfo.ReleaseReferenceCount, referencePoolInfo.AddReferenceCount, referencePoolInfo.RemoveReferenceCount));
|
||||
}
|
||||
|
||||
private int Comparison(ReferencePoolInfo a, ReferencePoolInfo b)
|
||||
{
|
||||
if (m_ShowFullClassName)
|
||||
{
|
||||
return a.Type.FullName.CompareTo(b.Type.FullName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return a.Type.Name.CompareTo(b.Type.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 705a7441224da3d4cbc6593bdc58f167
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,397 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ResourceComponent))]
|
||||
internal sealed class ResourceComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private static readonly string[] ResourceModeNames = new string[] { "Package", "Updatable", "Updatable While Playing" };
|
||||
|
||||
private SerializedProperty m_ResourceMode = null;
|
||||
private SerializedProperty m_ReadWritePathType = null;
|
||||
private SerializedProperty m_MinUnloadUnusedAssetsInterval = null;
|
||||
private SerializedProperty m_MaxUnloadUnusedAssetsInterval = null;
|
||||
private SerializedProperty m_AssetAutoReleaseInterval = null;
|
||||
private SerializedProperty m_AssetCapacity = null;
|
||||
private SerializedProperty m_AssetExpireTime = null;
|
||||
private SerializedProperty m_AssetPriority = null;
|
||||
private SerializedProperty m_ResourceAutoReleaseInterval = null;
|
||||
private SerializedProperty m_ResourceCapacity = null;
|
||||
private SerializedProperty m_ResourceExpireTime = null;
|
||||
private SerializedProperty m_ResourcePriority = null;
|
||||
private SerializedProperty m_UpdatePrefixUri = null;
|
||||
private SerializedProperty m_GenerateReadWriteVersionListLength = null;
|
||||
private SerializedProperty m_UpdateRetryCount = null;
|
||||
private SerializedProperty m_InstanceRoot = null;
|
||||
private SerializedProperty m_LoadResourceAgentHelperCount = null;
|
||||
|
||||
private FieldInfo m_EditorResourceModeFieldInfo = null;
|
||||
|
||||
private int m_ResourceModeIndex = 0;
|
||||
private HelperInfo<ResourceHelperBase> m_ResourceHelperInfo = new HelperInfo<ResourceHelperBase>("Resource");
|
||||
private HelperInfo<LoadResourceAgentHelperBase> m_LoadResourceAgentHelperInfo = new HelperInfo<LoadResourceAgentHelperBase>("LoadResourceAgent");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
ResourceComponent t = (ResourceComponent)target;
|
||||
|
||||
bool isEditorResourceMode = (bool)m_EditorResourceModeFieldInfo.GetValue(target);
|
||||
|
||||
if (isEditorResourceMode)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Editor resource mode is enabled. Some options are disabled.", MessageType.Warning);
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.EnumPopup("Resource Mode", t.ResourceMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
int selectedIndex = EditorGUILayout.Popup("Resource Mode", m_ResourceModeIndex, ResourceModeNames);
|
||||
if (selectedIndex != m_ResourceModeIndex)
|
||||
{
|
||||
m_ResourceModeIndex = selectedIndex;
|
||||
m_ResourceMode.enumValueIndex = selectedIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_ReadWritePathType.enumValueIndex = (int)(ReadWritePathType)EditorGUILayout.EnumPopup("Read-Write Path Type", t.ReadWritePathType);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
float minUnloadUnusedAssetsInterval = EditorGUILayout.Slider("Min Unload Unused Assets Interval", m_MinUnloadUnusedAssetsInterval.floatValue, 0f, 3600f);
|
||||
if (minUnloadUnusedAssetsInterval != m_MinUnloadUnusedAssetsInterval.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.MinUnloadUnusedAssetsInterval = minUnloadUnusedAssetsInterval;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MinUnloadUnusedAssetsInterval.floatValue = minUnloadUnusedAssetsInterval;
|
||||
}
|
||||
}
|
||||
|
||||
float maxUnloadUnusedAssetsInterval = EditorGUILayout.Slider("Max Unload Unused Assets Interval", m_MaxUnloadUnusedAssetsInterval.floatValue, 0f, 3600f);
|
||||
if (maxUnloadUnusedAssetsInterval != m_MaxUnloadUnusedAssetsInterval.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.MaxUnloadUnusedAssetsInterval = maxUnloadUnusedAssetsInterval;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MaxUnloadUnusedAssetsInterval.floatValue = maxUnloadUnusedAssetsInterval;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying && isEditorResourceMode);
|
||||
{
|
||||
float assetAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Asset Auto Release Interval", m_AssetAutoReleaseInterval.floatValue);
|
||||
if (assetAutoReleaseInterval != m_AssetAutoReleaseInterval.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.AssetAutoReleaseInterval = assetAutoReleaseInterval;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AssetAutoReleaseInterval.floatValue = assetAutoReleaseInterval;
|
||||
}
|
||||
}
|
||||
|
||||
int assetCapacity = EditorGUILayout.DelayedIntField("Asset Capacity", m_AssetCapacity.intValue);
|
||||
if (assetCapacity != m_AssetCapacity.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.AssetCapacity = assetCapacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AssetCapacity.intValue = assetCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
float assetExpireTime = EditorGUILayout.DelayedFloatField("Asset Expire Time", m_AssetExpireTime.floatValue);
|
||||
if (assetExpireTime != m_AssetExpireTime.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.AssetExpireTime = assetExpireTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AssetExpireTime.floatValue = assetExpireTime;
|
||||
}
|
||||
}
|
||||
|
||||
int assetPriority = EditorGUILayout.DelayedIntField("Asset Priority", m_AssetPriority.intValue);
|
||||
if (assetPriority != m_AssetPriority.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.AssetPriority = assetPriority;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AssetPriority.intValue = assetPriority;
|
||||
}
|
||||
}
|
||||
|
||||
float resourceAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Resource Auto Release Interval", m_ResourceAutoReleaseInterval.floatValue);
|
||||
if (resourceAutoReleaseInterval != m_ResourceAutoReleaseInterval.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.ResourceAutoReleaseInterval = resourceAutoReleaseInterval;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourceAutoReleaseInterval.floatValue = resourceAutoReleaseInterval;
|
||||
}
|
||||
}
|
||||
|
||||
int resourceCapacity = EditorGUILayout.DelayedIntField("Resource Capacity", m_ResourceCapacity.intValue);
|
||||
if (resourceCapacity != m_ResourceCapacity.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.ResourceCapacity = resourceCapacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourceCapacity.intValue = resourceCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
float resourceExpireTime = EditorGUILayout.DelayedFloatField("Resource Expire Time", m_ResourceExpireTime.floatValue);
|
||||
if (resourceExpireTime != m_ResourceExpireTime.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.ResourceExpireTime = resourceExpireTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourceExpireTime.floatValue = resourceExpireTime;
|
||||
}
|
||||
}
|
||||
|
||||
int resourcePriority = EditorGUILayout.DelayedIntField("Resource Priority", m_ResourcePriority.intValue);
|
||||
if (resourcePriority != m_ResourcePriority.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.ResourcePriority = resourcePriority;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ResourcePriority.intValue = resourcePriority;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ResourceModeIndex > 0)
|
||||
{
|
||||
string updatePrefixUri = EditorGUILayout.DelayedTextField("Update Prefix Uri", m_UpdatePrefixUri.stringValue);
|
||||
if (updatePrefixUri != m_UpdatePrefixUri.stringValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.UpdatePrefixUri = updatePrefixUri;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_UpdatePrefixUri.stringValue = updatePrefixUri;
|
||||
}
|
||||
}
|
||||
|
||||
int generateReadWriteVersionListLength = EditorGUILayout.DelayedIntField("Generate Read-Write Version List Length", m_GenerateReadWriteVersionListLength.intValue);
|
||||
if (generateReadWriteVersionListLength != m_GenerateReadWriteVersionListLength.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.GenerateReadWriteVersionListLength = generateReadWriteVersionListLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_GenerateReadWriteVersionListLength.intValue = generateReadWriteVersionListLength;
|
||||
}
|
||||
}
|
||||
|
||||
int updateRetryCount = EditorGUILayout.DelayedIntField("Update Retry Count", m_UpdateRetryCount.intValue);
|
||||
if (updateRetryCount != m_UpdateRetryCount.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.UpdateRetryCount = updateRetryCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_UpdateRetryCount.intValue = updateRetryCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_InstanceRoot);
|
||||
|
||||
m_ResourceHelperInfo.Draw();
|
||||
m_LoadResourceAgentHelperInfo.Draw();
|
||||
m_LoadResourceAgentHelperCount.intValue = EditorGUILayout.IntSlider("Load Resource Agent Helper Count", m_LoadResourceAgentHelperCount.intValue, 1, 128);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Unload Unused Assets", Utility.Text.Format("{0:F2} / {1:F2}", t.LastUnloadUnusedAssetsOperationElapseSeconds, t.MaxUnloadUnusedAssetsInterval));
|
||||
EditorGUILayout.LabelField("Read-Only Path", t.ReadOnlyPath.ToString());
|
||||
EditorGUILayout.LabelField("Read-Write Path", t.ReadWritePath.ToString());
|
||||
EditorGUILayout.LabelField("Current Variant", t.CurrentVariant ?? "<Unknwon>");
|
||||
EditorGUILayout.LabelField("Applicable Game Version", isEditorResourceMode ? "N/A" : t.ApplicableGameVersion ?? "<Unknwon>");
|
||||
EditorGUILayout.LabelField("Internal Resource Version", isEditorResourceMode ? "N/A" : t.InternalResourceVersion.ToString());
|
||||
EditorGUILayout.LabelField("Asset Count", isEditorResourceMode ? "N/A" : t.AssetCount.ToString());
|
||||
EditorGUILayout.LabelField("Resource Count", isEditorResourceMode ? "N/A" : t.ResourceCount.ToString());
|
||||
EditorGUILayout.LabelField("Resource Group Count", isEditorResourceMode ? "N/A" : t.ResourceGroupCount.ToString());
|
||||
if (m_ResourceModeIndex > 0)
|
||||
{
|
||||
EditorGUILayout.LabelField("Applying Resource Pack Path", isEditorResourceMode ? "N/A" : t.ApplyingResourcePackPath ?? "<Unknwon>");
|
||||
EditorGUILayout.LabelField("Apply Waiting Count", isEditorResourceMode ? "N/A" : t.ApplyWaitingCount.ToString());
|
||||
EditorGUILayout.LabelField("Updating Resource Group", isEditorResourceMode ? "N/A" : t.UpdatingResourceGroup != null ? t.UpdatingResourceGroup.Name : "<Unknwon>");
|
||||
EditorGUILayout.LabelField("Update Waiting Count", isEditorResourceMode ? "N/A" : t.UpdateWaitingCount.ToString());
|
||||
EditorGUILayout.LabelField("Update Waiting While Playing Count", isEditorResourceMode ? "N/A" : t.UpdateWaitingWhilePlayingCount.ToString());
|
||||
EditorGUILayout.LabelField("Update Candidate Count", isEditorResourceMode ? "N/A" : t.UpdateCandidateCount.ToString());
|
||||
}
|
||||
EditorGUILayout.LabelField("Load Total Agent Count", isEditorResourceMode ? "N/A" : t.LoadTotalAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Load Free Agent Count", isEditorResourceMode ? "N/A" : t.LoadFreeAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Load Working Agent Count", isEditorResourceMode ? "N/A" : t.LoadWorkingAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Load Waiting Task Count", isEditorResourceMode ? "N/A" : t.LoadWaitingTaskCount.ToString());
|
||||
if (!isEditorResourceMode)
|
||||
{
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
TaskInfo[] loadAssetInfos = t.GetAllLoadAssetInfos();
|
||||
if (loadAssetInfos.Length > 0)
|
||||
{
|
||||
foreach (TaskInfo loadAssetInfo in loadAssetInfos)
|
||||
{
|
||||
DrawLoadAssetInfo(loadAssetInfo);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Export CSV Data"))
|
||||
{
|
||||
string exportFileName = EditorUtility.SaveFilePanel("Export CSV Data", string.Empty, "Load Asset Task Data.csv", string.Empty);
|
||||
if (!string.IsNullOrEmpty(exportFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
int index = 0;
|
||||
string[] data = new string[loadAssetInfos.Length + 1];
|
||||
data[index++] = "Load Asset Name,Serial Id,Priority,Status";
|
||||
foreach (TaskInfo loadAssetInfo in loadAssetInfos)
|
||||
{
|
||||
data[index++] = Utility.Text.Format("{0},{1},{2},{3}", loadAssetInfo.Description, loadAssetInfo.SerialId, loadAssetInfo.Priority, loadAssetInfo.Status);
|
||||
}
|
||||
|
||||
File.WriteAllLines(exportFileName, data, Encoding.UTF8);
|
||||
Debug.Log(Utility.Text.Format("Export load asset task CSV data to '{0}' success.", exportFileName));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError(Utility.Text.Format("Export load asset task CSV data to '{0}' failure, exception is '{1}'.", exportFileName, exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("Load Asset Task is Empty ...");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_ResourceMode = serializedObject.FindProperty("m_ResourceMode");
|
||||
m_ReadWritePathType = serializedObject.FindProperty("m_ReadWritePathType");
|
||||
m_MinUnloadUnusedAssetsInterval = serializedObject.FindProperty("m_MinUnloadUnusedAssetsInterval");
|
||||
m_MaxUnloadUnusedAssetsInterval = serializedObject.FindProperty("m_MaxUnloadUnusedAssetsInterval");
|
||||
m_AssetAutoReleaseInterval = serializedObject.FindProperty("m_AssetAutoReleaseInterval");
|
||||
m_AssetCapacity = serializedObject.FindProperty("m_AssetCapacity");
|
||||
m_AssetExpireTime = serializedObject.FindProperty("m_AssetExpireTime");
|
||||
m_AssetPriority = serializedObject.FindProperty("m_AssetPriority");
|
||||
m_ResourceAutoReleaseInterval = serializedObject.FindProperty("m_ResourceAutoReleaseInterval");
|
||||
m_ResourceCapacity = serializedObject.FindProperty("m_ResourceCapacity");
|
||||
m_ResourceExpireTime = serializedObject.FindProperty("m_ResourceExpireTime");
|
||||
m_ResourcePriority = serializedObject.FindProperty("m_ResourcePriority");
|
||||
m_UpdatePrefixUri = serializedObject.FindProperty("m_UpdatePrefixUri");
|
||||
m_GenerateReadWriteVersionListLength = serializedObject.FindProperty("m_GenerateReadWriteVersionListLength");
|
||||
m_UpdateRetryCount = serializedObject.FindProperty("m_UpdateRetryCount");
|
||||
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
|
||||
m_LoadResourceAgentHelperCount = serializedObject.FindProperty("m_LoadResourceAgentHelperCount");
|
||||
|
||||
m_EditorResourceModeFieldInfo = target.GetType().GetField("m_EditorResourceMode", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
m_ResourceHelperInfo.Init(serializedObject);
|
||||
m_LoadResourceAgentHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshModes();
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void DrawLoadAssetInfo(TaskInfo loadAssetInfo)
|
||||
{
|
||||
EditorGUILayout.LabelField(loadAssetInfo.Description, Utility.Text.Format("[SerialId]{0} [Priority]{1} [Status]{2}", loadAssetInfo.SerialId, loadAssetInfo.Priority, loadAssetInfo.Status));
|
||||
}
|
||||
|
||||
private void RefreshModes()
|
||||
{
|
||||
m_ResourceModeIndex = m_ResourceMode.enumValueIndex > 0 ? m_ResourceMode.enumValueIndex - 1 : 0;
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_ResourceHelperInfo.Refresh();
|
||||
m_LoadResourceAgentHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ccae18b98b018e4baa1cb3063cece63
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,75 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(SceneComponent))]
|
||||
internal sealed class SceneComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableLoadSceneUpdateEvent = null;
|
||||
private SerializedProperty m_EnableLoadSceneDependencyAssetEvent = null;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
SceneComponent t = (SceneComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableLoadSceneUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableLoadSceneDependencyAssetEvent);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Loaded Scene Asset Names", GetSceneNameString(t.GetLoadedSceneAssetNames()));
|
||||
EditorGUILayout.LabelField("Loading Scene Asset Names", GetSceneNameString(t.GetLoadingSceneAssetNames()));
|
||||
EditorGUILayout.LabelField("Unloading Scene Asset Names", GetSceneNameString(t.GetUnloadingSceneAssetNames()));
|
||||
EditorGUILayout.ObjectField("Main Camera", t.MainCamera, typeof(Camera), true);
|
||||
|
||||
Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableLoadSceneUpdateEvent = serializedObject.FindProperty("m_EnableLoadSceneUpdateEvent");
|
||||
m_EnableLoadSceneDependencyAssetEvent = serializedObject.FindProperty("m_EnableLoadSceneDependencyAssetEvent");
|
||||
}
|
||||
|
||||
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 += SceneComponent.GetSceneName(sceneAssetName);
|
||||
}
|
||||
|
||||
return sceneNameString;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91ac1b5e58b58c843bcdf37998e18bcd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,81 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(SettingComponent))]
|
||||
internal sealed class SettingComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private HelperInfo<SettingHelperBase> m_SettingHelperInfo = new HelperInfo<SettingHelperBase>("Setting");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
SettingComponent t = (SettingComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
m_SettingHelperInfo.Draw();
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Setting Count", t.Count >= 0 ? t.Count.ToString() : "<Unknown>");
|
||||
if (t.Count > 0)
|
||||
{
|
||||
string[] settingNames = t.GetAllSettingNames();
|
||||
foreach (string settingName in settingNames)
|
||||
{
|
||||
EditorGUILayout.LabelField(settingName, t.GetString(settingName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
if (GUILayout.Button("Save Settings"))
|
||||
{
|
||||
t.Save();
|
||||
}
|
||||
if (GUILayout.Button("Remove All Settings"))
|
||||
{
|
||||
t.RemoveAllSettings();
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_SettingHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_SettingHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 079e17267e9ff8d489d7647323861ce8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(SoundComponent))]
|
||||
internal sealed class SoundComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnablePlaySoundUpdateEvent = null;
|
||||
private SerializedProperty m_EnablePlaySoundDependencyAssetEvent = null;
|
||||
private SerializedProperty m_InstanceRoot = null;
|
||||
private SerializedProperty m_AudioMixer = null;
|
||||
private SerializedProperty m_SoundGroups = null;
|
||||
|
||||
private HelperInfo<SoundHelperBase> m_SoundHelperInfo = new HelperInfo<SoundHelperBase>("Sound");
|
||||
private HelperInfo<SoundGroupHelperBase> m_SoundGroupHelperInfo = new HelperInfo<SoundGroupHelperBase>("SoundGroup");
|
||||
private HelperInfo<SoundAgentHelperBase> m_SoundAgentHelperInfo = new HelperInfo<SoundAgentHelperBase>("SoundAgent");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
SoundComponent t = (SoundComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnablePlaySoundUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnablePlaySoundDependencyAssetEvent);
|
||||
EditorGUILayout.PropertyField(m_InstanceRoot);
|
||||
EditorGUILayout.PropertyField(m_AudioMixer);
|
||||
m_SoundHelperInfo.Draw();
|
||||
m_SoundGroupHelperInfo.Draw();
|
||||
m_SoundAgentHelperInfo.Draw();
|
||||
EditorGUILayout.PropertyField(m_SoundGroups, true);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Sound Group Count", t.SoundGroupCount.ToString());
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnablePlaySoundUpdateEvent = serializedObject.FindProperty("m_EnablePlaySoundUpdateEvent");
|
||||
m_EnablePlaySoundDependencyAssetEvent = serializedObject.FindProperty("m_EnablePlaySoundDependencyAssetEvent");
|
||||
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
|
||||
m_AudioMixer = serializedObject.FindProperty("m_AudioMixer");
|
||||
m_SoundGroups = serializedObject.FindProperty("m_SoundGroups");
|
||||
|
||||
m_SoundHelperInfo.Init(serializedObject);
|
||||
m_SoundGroupHelperInfo.Init(serializedObject);
|
||||
m_SoundAgentHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_SoundHelperInfo.Refresh();
|
||||
m_SoundGroupHelperInfo.Refresh();
|
||||
m_SoundAgentHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cba40a4571929b14098014e7b931c2ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,154 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEditor;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(UIComponent))]
|
||||
internal sealed class UIComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_EnableOpenUIFormSuccessEvent = null;
|
||||
private SerializedProperty m_EnableOpenUIFormFailureEvent = null;
|
||||
private SerializedProperty m_EnableOpenUIFormUpdateEvent = null;
|
||||
private SerializedProperty m_EnableOpenUIFormDependencyAssetEvent = null;
|
||||
private SerializedProperty m_EnableCloseUIFormCompleteEvent = null;
|
||||
private SerializedProperty m_InstanceAutoReleaseInterval = null;
|
||||
private SerializedProperty m_InstanceCapacity = null;
|
||||
private SerializedProperty m_InstanceExpireTime = null;
|
||||
private SerializedProperty m_InstancePriority = null;
|
||||
private SerializedProperty m_InstanceRoot = null;
|
||||
private SerializedProperty m_UIGroups = null;
|
||||
|
||||
private HelperInfo<UIFormHelperBase> m_UIFormHelperInfo = new HelperInfo<UIFormHelperBase>("UIForm");
|
||||
private HelperInfo<UIGroupHelperBase> m_UIGroupHelperInfo = new HelperInfo<UIGroupHelperBase>("UIGroup");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
UIComponent t = (UIComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_EnableOpenUIFormSuccessEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableOpenUIFormFailureEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableOpenUIFormUpdateEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableOpenUIFormDependencyAssetEvent);
|
||||
EditorGUILayout.PropertyField(m_EnableCloseUIFormCompleteEvent);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
float instanceAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Instance Auto Release Interval", m_InstanceAutoReleaseInterval.floatValue);
|
||||
if (instanceAutoReleaseInterval != m_InstanceAutoReleaseInterval.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.InstanceAutoReleaseInterval = instanceAutoReleaseInterval;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_InstanceAutoReleaseInterval.floatValue = instanceAutoReleaseInterval;
|
||||
}
|
||||
}
|
||||
|
||||
int instanceCapacity = EditorGUILayout.DelayedIntField("Instance Capacity", m_InstanceCapacity.intValue);
|
||||
if (instanceCapacity != m_InstanceCapacity.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.InstanceCapacity = instanceCapacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_InstanceCapacity.intValue = instanceCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
float instanceExpireTime = EditorGUILayout.DelayedFloatField("Instance Expire Time", m_InstanceExpireTime.floatValue);
|
||||
if (instanceExpireTime != m_InstanceExpireTime.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.InstanceExpireTime = instanceExpireTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_InstanceExpireTime.floatValue = instanceExpireTime;
|
||||
}
|
||||
}
|
||||
|
||||
int instancePriority = EditorGUILayout.DelayedIntField("Instance Priority", m_InstancePriority.intValue);
|
||||
if (instancePriority != m_InstancePriority.intValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.InstancePriority = instancePriority;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_InstancePriority.intValue = instancePriority;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_InstanceRoot);
|
||||
m_UIFormHelperInfo.Draw();
|
||||
m_UIGroupHelperInfo.Draw();
|
||||
EditorGUILayout.PropertyField(m_UIGroups, true);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("UI Group Count", t.UIGroupCount.ToString());
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_EnableOpenUIFormSuccessEvent = serializedObject.FindProperty("m_EnableOpenUIFormSuccessEvent");
|
||||
m_EnableOpenUIFormFailureEvent = serializedObject.FindProperty("m_EnableOpenUIFormFailureEvent");
|
||||
m_EnableOpenUIFormUpdateEvent = serializedObject.FindProperty("m_EnableOpenUIFormUpdateEvent");
|
||||
m_EnableOpenUIFormDependencyAssetEvent = serializedObject.FindProperty("m_EnableOpenUIFormDependencyAssetEvent");
|
||||
m_EnableCloseUIFormCompleteEvent = serializedObject.FindProperty("m_EnableCloseUIFormCompleteEvent");
|
||||
m_InstanceAutoReleaseInterval = serializedObject.FindProperty("m_InstanceAutoReleaseInterval");
|
||||
m_InstanceCapacity = serializedObject.FindProperty("m_InstanceCapacity");
|
||||
m_InstanceExpireTime = serializedObject.FindProperty("m_InstanceExpireTime");
|
||||
m_InstancePriority = serializedObject.FindProperty("m_InstancePriority");
|
||||
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
|
||||
m_UIGroups = serializedObject.FindProperty("m_UIGroups");
|
||||
|
||||
m_UIFormHelperInfo.Init(serializedObject);
|
||||
m_UIGroupHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_UIFormHelperInfo.Refresh();
|
||||
m_UIGroupHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ae3c7028e65d19458efb14da7adf64b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,141 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UnityGameFramework.Editor
|
||||
{
|
||||
[CustomEditor(typeof(WebRequestComponent))]
|
||||
internal sealed class WebRequestComponentInspector : GameFrameworkInspector
|
||||
{
|
||||
private SerializedProperty m_InstanceRoot = null;
|
||||
private SerializedProperty m_WebRequestAgentHelperCount = null;
|
||||
private SerializedProperty m_Timeout = null;
|
||||
|
||||
private HelperInfo<WebRequestAgentHelperBase> m_WebRequestAgentHelperInfo = new HelperInfo<WebRequestAgentHelperBase>("WebRequestAgent");
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
WebRequestComponent t = (WebRequestComponent)target;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_InstanceRoot);
|
||||
|
||||
m_WebRequestAgentHelperInfo.Draw();
|
||||
|
||||
m_WebRequestAgentHelperCount.intValue = EditorGUILayout.IntSlider("Web Request Agent Helper Count", m_WebRequestAgentHelperCount.intValue, 1, 16);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
float timeout = EditorGUILayout.Slider("Timeout", m_Timeout.floatValue, 0f, 120f);
|
||||
if (timeout != m_Timeout.floatValue)
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
t.Timeout = timeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Timeout.floatValue = timeout;
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Total Agent Count", t.TotalAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Free Agent Count", t.FreeAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Working Agent Count", t.WorkingAgentCount.ToString());
|
||||
EditorGUILayout.LabelField("Waiting Agent Count", t.WaitingTaskCount.ToString());
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
TaskInfo[] webRequestInfos = t.GetAllWebRequestInfos();
|
||||
if (webRequestInfos.Length > 0)
|
||||
{
|
||||
foreach (TaskInfo webRequestInfo in webRequestInfos)
|
||||
{
|
||||
DrawWebRequestInfo(webRequestInfo);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Export CSV Data"))
|
||||
{
|
||||
string exportFileName = EditorUtility.SaveFilePanel("Export CSV Data", string.Empty, "WebRequest Task Data.csv", string.Empty);
|
||||
if (!string.IsNullOrEmpty(exportFileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
int index = 0;
|
||||
string[] data = new string[webRequestInfos.Length + 1];
|
||||
data[index++] = "WebRequest Uri,Serial Id,Tag,Priority,Status";
|
||||
foreach (TaskInfo webRequestInfo in webRequestInfos)
|
||||
{
|
||||
data[index++] = Utility.Text.Format("{0},{1},{2},{3},{4}", webRequestInfo.Description, webRequestInfo.SerialId, webRequestInfo.Tag ?? string.Empty, webRequestInfo.Priority, webRequestInfo.Status);
|
||||
}
|
||||
|
||||
File.WriteAllLines(exportFileName, data, Encoding.UTF8);
|
||||
Debug.Log(Utility.Text.Format("Export web request task CSV data to '{0}' success.", exportFileName));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Debug.LogError(Utility.Text.Format("Export web request task CSV data to '{0}' failure, exception is '{1}'.", exportFileName, exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("WebRequset Task is Empty ...");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void OnCompileComplete()
|
||||
{
|
||||
base.OnCompileComplete();
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
|
||||
m_WebRequestAgentHelperCount = serializedObject.FindProperty("m_WebRequestAgentHelperCount");
|
||||
m_Timeout = serializedObject.FindProperty("m_Timeout");
|
||||
|
||||
m_WebRequestAgentHelperInfo.Init(serializedObject);
|
||||
|
||||
RefreshTypeNames();
|
||||
}
|
||||
|
||||
private void DrawWebRequestInfo(TaskInfo webRequestInfo)
|
||||
{
|
||||
EditorGUILayout.LabelField(webRequestInfo.Description, Utility.Text.Format("[SerialId]{0} [Tag]{1} [Priority]{2} [Status]{3}", webRequestInfo.SerialId, webRequestInfo.Tag ?? "<None>", webRequestInfo.Priority, webRequestInfo.Status));
|
||||
}
|
||||
|
||||
private void RefreshTypeNames()
|
||||
{
|
||||
m_WebRequestAgentHelperInfo.Refresh();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbb0e62b54d44b74dab4b9a49e186d0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user