mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
重置2.0.0(beta)
重置2.0.0(beta)
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 454f812e3f7fc7c469cc878382e5cf00
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,58 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace TEngine.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架 Inspector 抽象类。
|
||||
/// </summary>
|
||||
public abstract class TEngineInspector : 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05b15d046064d604d8cbdb1c30c2617b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TEngine.Editor
|
||||
{
|
||||
[CustomEditor(typeof(MemPoolComponent))]
|
||||
internal sealed class MemPoolInspector : TEngineInspector
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
MemPoolComponent t = (MemPoolComponent)target;
|
||||
|
||||
if (IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.LabelField("Object Pool Count", t.Count.ToString());
|
||||
|
||||
var objectPools = t.GetAllObjectPools();
|
||||
foreach (var objectPool in objectPools)
|
||||
{
|
||||
DrawObjectPool(objectPool);
|
||||
}
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawObjectPool(IMemPoolBase objectPool)
|
||||
{
|
||||
bool lastState = m_OpenedItems.Contains(objectPool.GetName());
|
||||
bool currentState = EditorGUILayout.Foldout(lastState, objectPool.GetName());
|
||||
if (currentState != lastState)
|
||||
{
|
||||
if (currentState)
|
||||
{
|
||||
m_OpenedItems.Add(objectPool.GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OpenedItems.Remove(objectPool.GetName());
|
||||
}
|
||||
}
|
||||
|
||||
if (currentState)
|
||||
{
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
{
|
||||
EditorGUILayout.LabelField("Name", objectPool.GetName());
|
||||
EditorGUILayout.LabelField("Type", objectPool.GetName());
|
||||
EditorGUILayout.LabelField("Capacity", objectPool.GetPoolItemCount().ToString());
|
||||
EditorGUILayout.LabelField("Used Count", objectPool.GetPoolItemCount().ToString());
|
||||
EditorGUILayout.LabelField("Can Release Count", objectPool.GetPoolItemCount().ToString());
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1793e1900fd65841aec71776ecbd91e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user