Update
This commit is contained in:
ALEXTANG
2022-05-25 19:41:20 +08:00
parent 8084f0add1
commit 9f5af4249a
11 changed files with 6 additions and 1054 deletions

View File

@@ -12,11 +12,6 @@ namespace TEngine
{
base.Awake();
#if ENABLE_GM || UNITY_EDITOR || _DEVELOPMENT_BUILD_
GMPage.CollectExecCommands();
GMPage.Active();
#endif
TLogger.LogInfo($"DevicePerformanceLevel 设备性能评级:{DevicePerformanceUtil.GetDevicePerformanceLevel()}");
InitLibImp();

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e5581e1dc10604545879c83fa6e55946
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,75 +0,0 @@
#if ENABLE_GM || UNITY_EDITOR || _DEVELOPMENT_BUILD_
using System.Collections.Generic;
using UnityEngine;
namespace TEngine
{
public class AbOnRunning : MonoBehaviour
{
private static bool hasInit = false;
private static string filterName = "";
private static int _count = 0;
private static Vector2 _vec2ScollPos = new Vector2();
private static Dictionary<string, AssetBundleData> _bundleDatasValue;
static void DoInit()
{
if (hasInit)
{
return;
}
_bundleDatasValue = new Dictionary<string, AssetBundleData>();
hasInit = true;
}
private static void ToogleScrollView1()
{
GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal("box");
GUILayout.Label("AB名:", GUILayout.MaxWidth(100));
filterName = GUILayout.TextField(filterName);
filterName = filterName.ToLower();
GUILayout.EndHorizontal();
GUIStyle curStyle = new GUIStyle("box");
curStyle.alignment = TextAnchor.MiddleLeft;
curStyle.fontSize = Screen.width / 40;
GUILayout.Label($"引用数-被引用数-AbName-当前激活数 = {_count}", curStyle);
_count = 0;
_vec2ScollPos = GUILayout.BeginScrollView(_vec2ScollPos);
foreach (var pair in _bundleDatasValue)
{
if (pair.Value.RefCount == 0 && pair.Value.DepCount == 0)
{
continue;
}
if (!string.IsNullOrEmpty(filterName) && !pair.Value.Name.Contains(filterName))
continue;
_count++;
GUILayout.Label($"{pair.Value.RefCount} {pair.Value.DepCount} {pair.Value.Name}");
}
GUILayout.EndScrollView();
GUILayout.EndVertical();
}
[CommonGMCommand("AB信息预览", "", mIsDrawer = true)]
public static void GM_ABRuntime()
{
DoInit();
ToogleScrollView1();
}
}
}
#endif

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7bb74d5789153374b94ad84f20b18685
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,70 +0,0 @@
using System;
namespace TEngine
{
public class CommonGMCommandAttribute : Attribute
{
public string mThread;
public string mPage;
public string mName;
public string mButtonName;
public bool mIsDrawer;
public Action mCustomDrawCallback;
public bool mIsEditorOnly = false;
public CommonGMCommandAttribute(string page, string name, bool isEditorOnly = false)
{
mThread = "";
mPage = page;
mName = name;
mButtonName = "Execute";
mCustomDrawCallback = null;
}
public CommonGMCommandAttribute(string page, string name, string buttonName, bool isEditorOnly = false)
{
mThread = "";
mPage = page;
mName = name;
mButtonName = buttonName;
mCustomDrawCallback = null;
}
public CommonGMCommandAttribute(string page, string name, string buttonName, string thread, bool isEditorOnly = false)
{
mThread = thread;
mPage = page;
mName = name;
mButtonName = buttonName;
mCustomDrawCallback = null;
}
public CommonGMCommandAttribute(string page, string name, string buttonName, string thread, Action customDrawCallback, bool isEditorOnly = false)
{
mThread = thread;
mPage = page;
mName = name;
mButtonName = buttonName;
mCustomDrawCallback = customDrawCallback;
}
public CommonGMCommandAttribute(string page, string name, Action customDrawCallback, bool isEditorOnly = false)
{
mThread = "";
mPage = page;
mName = name;
mButtonName = "Execute";
mCustomDrawCallback = customDrawCallback;
}
public CommonGMCommandAttribute(string page, string name, string thread, Action customDrawCallback, bool isEditorOnly = false)
{
mThread = thread;
mPage = page;
mName = name;
mButtonName = "Execute";
mCustomDrawCallback = customDrawCallback;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7d214df1549a49a2872e384af675a8e6
timeCreated: 1635737023

View File

@@ -1,607 +0,0 @@
#if ENABLE_GM || UNITY_EDITOR || _DEVELOPMENT_BUILD_
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace TEngine
{
public static class GMDrawer
{
public static int LABEL_WIDTH = 150;
public static List<GMCommandDrawer> listExecCommandDrawer = new List<GMCommandDrawer>();
public static Rect SelectWindowRect()
{
return new Rect(0, 0, Screen.width, Screen.height);
}
public static void InitStyle()
{
EnumParameterDrawer.Style.InitStyle();
}
public static GMCommandDrawer GetExecCommandDrawer(Type type, MethodInfo methodInfo, CommonGMCommandAttribute attribute)
{
GMCommandDrawer newGmCommandDrawer= new GMCommandDrawer(attribute.mThread, attribute.mPage, attribute.mName, attribute.mButtonName, type, methodInfo, attribute.mCustomDrawCallback);
listExecCommandDrawer.Add(newGmCommandDrawer);
return newGmCommandDrawer;
}
public class GMCommandDrawer
{
public string mThread;
public string mPage;
public string mName;
private bool mHasDone = false;
private object mExecReult = null;
private string mButtonName;
private Type mType;
private MethodInfo mMethodInfo;
private Action mCustomDrawCallback;
private List<ParameterDrawer> mDrawers = new List<ParameterDrawer>();
public GMCommandDrawer(string thread, string page, string name, string buttonName, Type type, MethodInfo method, Action customDrawCallback)
{
mThread = thread;
mPage = page;
mName = name;
mButtonName = buttonName;
mType = type;
mMethodInfo = method;
mCustomDrawCallback = customDrawCallback;
mExecReult = null;
if (mMethodInfo != null)
{
ParameterInfo[] parameters = mMethodInfo.GetParameters();
for (int i = 0; i < parameters.Length; i++)
{
ParameterInfo param = parameters[i];
if (null == param)
{
continue;
}
ParameterDrawer drawer = GetDrawer(param.ParameterType, param.Name);
if (param.HasDefaultValue)
{
drawer.SetValue(param.DefaultValue);
}
if (drawer != null)
{
mDrawers.Add(drawer);
}
}
}
}
public void OnGUI()
{
if (mCustomDrawCallback != null)
{
mCustomDrawCallback();
return;
}
DrawDefault();
}
public void Reset()
{
mHasDone = false;
mExecReult = null;
}
private void DrawDefault()
{
GUILayout.BeginVertical("box");
string name = string.Format("<color=#FFFF00FF>{0}</color>", mName);
GUILayout.Label(name);
for (int i = 0; i < mDrawers.Count; i++)
{
mDrawers[i].OnGUI(new Rect(200,200,500,50));
}
if (mHasDone)
{
if (mExecReult != null)
{
GUILayout.Label(" done result : " + mExecReult.ToString());
}
else
{
GUILayout.Label("done!");
}
}
if (GUILayout.Button(mButtonName ))
{
if (mMethodInfo != null)
{
List<object> ps = new List<object>();
for (int i = 0; i < mDrawers.Count; i++)
{
ps.Add(mDrawers[i].GetValue());
}
if (mThread == "MainThread")
{
mExecReult = mMethodInfo.Invoke(null, ps.ToArray());
}
else if (mThread == "LogicThread")
{
TLogger.LogError("LogicThread GM not supported by now");
}
else if (mThread == "NetThread")
{
TLogger.LogError("NetThread GM not supported by now");
}
}
mHasDone = true;
}
GUILayout.EndVertical();
}
}
public class ParameterDrawer
{
public string mName;
public ParameterDrawer(string name)
{
mName = name;
}
public virtual void OnGUI(Rect InBoundRect) { throw new NotImplementedException(); }
public virtual object GetValue() { throw new NotImplementedException(); }
public virtual void SetValue(object objValue) { }
}
public class IntParameterDrawer : ParameterDrawer
{
public int mObj;
public IntParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
int ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (int.TryParse(GUILayout.TextField(ret.ToString()), out ret))
{
mObj = ret;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (int)objValue;
}
}
public class FloatParameterDrawer : ParameterDrawer
{
private float mObj = 0.0f;
public FloatParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
float ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (float.TryParse(GUILayout.TextField(ret.ToString("#0.000")), out ret))
{
mObj = ret;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (float)objValue;
}
}
public class DoubleParameterDrawer : ParameterDrawer
{
private double mObj = 0.0;
public DoubleParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
double ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (double.TryParse(GUILayout.TextField(ret.ToString("#0.000")), out ret))
{
mObj = ret;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (double)objValue;
}
}
public class LongParameterDrawer : ParameterDrawer
{
private long mObj;
public LongParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
long ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (long.TryParse(GUILayout.TextField(ret.ToString()), out ret))
{
mObj = ret;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (long)objValue;
}
}
public class BooleanParameterDrawer : ParameterDrawer
{
private bool mObj;
public BooleanParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
mObj = GUILayout.Toggle(mObj, "",GUILayout.ExpandWidth(true));
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (bool)objValue;
}
}
public class StringParameterDrawer : ParameterDrawer
{
private string mObj = "";
public StringParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
mObj = GUILayout.TextField(mObj);
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = objValue as string;
}
}
public class EnumParameterDrawer : ParameterDrawer
{
public static class Style
{
public static float ItemHeight;
public static GUIStyle Normal;
public static GUIStyle Selected;
public static void InitStyle()
{
Normal = new GUIStyle();
Normal.normal.textColor = Color.white;
Texture2D texInit = new Texture2D(1, 1);
texInit.Apply();
texInit.SetPixel(0, 0, Color.white);
Texture2D backgroundInit = new Texture2D(1, 1);
backgroundInit.SetPixel(0, 0, new Color(0,0,0,0.5f));
backgroundInit.Apply();
Texture2D activeBgInit = new Texture2D(1, 1);
activeBgInit.SetPixel(0, 0, new Color(0, 0,1.0f));
activeBgInit.Apply();
Normal.active.background = activeBgInit;
Normal.hover.background = backgroundInit;
Normal.onHover.background = backgroundInit;
Normal.hover.textColor = Color.black;
Normal.onHover.textColor = Color.black;
Normal.padding = new RectOffset(4, 4, 4, 4);
Normal.fontSize = 30;
Selected = new GUIStyle();
Selected.normal.textColor = Color.red;
Selected.hover.background = texInit;
Selected.onHover.background = texInit;
Selected.hover.textColor = Color.red;
Selected.onHover.textColor = Color.red;
Selected.padding = new RectOffset(4, 4, 4, 4);
Selected.fontSize = 30;
ItemHeight = 30;
}
}
private int mObj;
private Type mType;
private string[] mItems;
private int mSelectedIndex;
private Rect mListBoxRect;
private bool mVisible;
public delegate void SelectionEventHandler(int InIndex);
private event SelectionEventHandler OnSelectedEvent;
private event SelectionEventHandler OnSelectedChangedEvent;
public EnumParameterDrawer(string name, Type type, SelectionEventHandler onSelected = null, SelectionEventHandler onChanged = null)
: base(name)
{
mType = type;
mItems = Enum.GetNames(type);
mVisible = false;
mSelectedIndex = 0;
OnSelectedEvent = onSelected;
OnSelectedChangedEvent = onChanged;
if (mItems != null && mItems.Length > 0)
{
mObj = (int)Enum.Parse(type, mItems[0]);
}
}
public override void OnGUI(Rect InBoundRect)
{
if (mItems == null || mItems.Length == 0)
{
return;
}
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
string selectedString = mItems[mSelectedIndex];
if (GUILayout.Button(selectedString))
{
mVisible = !mVisible;
}
InBoundRect = GUILayoutUtility.GetLastRect();
GUILayout.EndHorizontal();
if (mVisible && mItems != null)
{
mListBoxRect = new Rect(InBoundRect);
mListBoxRect.y = mListBoxRect.y + mListBoxRect.height;
mListBoxRect.height = mItems.Length * Style.ItemHeight;
GUI.Box(mListBoxRect, "");
for (int i = 0; i < mItems.Length; i++)
{
Rect ListButtonRect = new Rect(mListBoxRect);
ListButtonRect.y = ListButtonRect.y + Style.ItemHeight * i;
ListButtonRect.height = Style.ItemHeight;
GUIStyle StyleSelection = mSelectedIndex == i ? Style.Selected : Style.Normal;
if (GUI.Button(ListButtonRect,new GUIContent(mItems[i], mItems[i]),StyleSelection))
{
if (OnSelectedEvent != null)
{
OnSelectedEvent(i);
}
if (mSelectedIndex != i)
{
mSelectedIndex = i;
mObj = (int)Enum.Parse(mType, mItems[i]);
if (OnSelectedChangedEvent != null)
{
OnSelectedChangedEvent(i);
}
}
mVisible = false;
}
}
}
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (int)objValue;
}
}
public class UnityVector3ParameterDrawer : ParameterDrawer
{
protected UnityEngine.Vector3 mObj = UnityEngine.Vector3.zero;
public UnityVector3ParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
Vector3 ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (float.TryParse(GUILayout.TextField(ret.x.ToString("#0.000")), out ret.x))
{
mObj.x = ret.x;
}
if (float.TryParse(GUILayout.TextField(ret.y.ToString("#0.000")), out ret.y))
{
mObj.y = ret.y;
}
if (float.TryParse(GUILayout.TextField(ret.z.ToString("#0.000")), out ret.z))
{
mObj.z = ret.z;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (Vector3)objValue;
}
}
public class UnityVector2ParameterDrawer : ParameterDrawer
{
protected UnityEngine.Vector2 mObj = UnityEngine.Vector2.zero;
public UnityVector2ParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
Vector2 ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (float.TryParse(GUILayout.TextField(ret.x.ToString("#0.000")), out ret.x))
{
mObj.x = ret.x;
}
if (float.TryParse(GUILayout.TextField(ret.y.ToString("#0.000")), out ret.y))
{
mObj.y = ret.y;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return mObj;
}
public override void SetValue(object objValue)
{
mObj = (Vector2)objValue;
}
}
public class UnityQuaternionParameterDrawer : ParameterDrawer
{
protected UnityEngine.Vector3 mObj = UnityEngine.Vector3.zero;
public UnityQuaternionParameterDrawer(string name) : base(name)
{
}
public override void OnGUI(Rect InBoundRect)
{
Vector3 ret = mObj;
GUILayout.BeginHorizontal();
GUILayout.Label(mName, GUILayout.Width(LABEL_WIDTH), GUILayout.ExpandWidth(false));
if (float.TryParse(GUILayout.TextField(ret.x.ToString("#0.000")), out ret.x))
{
mObj.x = ret.x;
}
if (float.TryParse(GUILayout.TextField(ret.y.ToString("#0.000")), out ret.y))
{
mObj.y = ret.y;
}
if (float.TryParse(GUILayout.TextField(ret.z.ToString("#0.000")), out ret.z))
{
mObj.z = ret.z;
}
GUILayout.EndHorizontal();
}
public override object GetValue()
{
return UnityEngine.Quaternion.Euler(mObj);
}
public override void SetValue(object objValue)
{
mObj = (Vector3)objValue;
}
}
public static ParameterDrawer GetDrawer(Type type, string name)
{
if (type == typeof(int))
{
return new IntParameterDrawer(name);
}
if (type == typeof(float))
{
return new FloatParameterDrawer(name);
}
if (type == typeof(double))
{
return new DoubleParameterDrawer(name);
}
if (type == typeof(long))
{
return new LongParameterDrawer(name);
}
if (type == typeof(string))
{
return new StringParameterDrawer(name);
}
if (type == typeof(bool))
{
return new BooleanParameterDrawer(name);
}
if (type == typeof(UnityEngine.Vector2))
{
return new UnityVector2ParameterDrawer(name);
}
if (type == typeof(UnityEngine.Vector3))
{
return new UnityVector3ParameterDrawer(name);
}
if (type == typeof(UnityEngine.Quaternion))
{
return new UnityQuaternionParameterDrawer(name);
}
if (type.IsEnum)
{
return new EnumParameterDrawer(name, type);
}
return null;
}
}
}
#endif

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 85e2cfb9760645bcbd9df2d47e3c219e
timeCreated: 1635745742

View File

@@ -1,263 +0,0 @@
#if ENABLE_GM || UNITY_EDITOR || _DEVELOPMENT_BUILD_
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;
namespace TEngine
{
public class GMPage : UnitySingleton<GMPage>
{
private static List<string> mGMCommandPages = new List<string>();
private static List<GMDrawer.GMCommandDrawer> mGMCommands = new List<GMDrawer.GMCommandDrawer>();
private string mCurPage;
private bool mOpened = false;
protected override void OnLoad()
{
}
private EventSystem mDisabledEventSystem;
private int mTouchCount = 0;
private void Update()
{
int touchcount = Input.touchCount;
if (Input.GetKeyDown(KeyCode.BackQuote) || (touchcount == 4 && mTouchCount != touchcount))
{
if (IsEditor())
{
if (mOpened)
{
CLosePage();
}
else
{
OpenPage();
}
}
else
{
OpenPage();
}
}
mTouchCount = touchcount;
}
private void OpenPage()
{
GMDrawer.InitStyle();
mWindowRect = GMDrawer.SelectWindowRect();
mOpened = true;
mDisabledEventSystem = EventSystem.current;
EventSystem.current.enabled = false;
}
private void CLosePage()
{
mOpened = false;
mDisabledEventSystem.enabled = true;
}
public static bool IsTypeWithAttributeType(Type inAttributeType, Type inCurType)
{
try
{
if ((inCurType.Attributes & (TypeAttributes.Interface | TypeAttributes.HasSecurity)) != 0)
{
return false;
}
if (inCurType.IsEnum || inCurType.IsPrimitive || inCurType.IsGenericType)
{
return false;
}
MethodInfo[] methods = inCurType.GetMethods(BindingFlags.Public | BindingFlags.Static);
for (int j = 0; j < methods.Length; j++)
{
MethodInfo method = methods[j];
Attribute attr = method.GetCustomAttribute(inAttributeType);
if (attr == null)
{
continue;
}
if (attr is CommonGMCommandAttribute execCommandAttribute)
{
if (execCommandAttribute.mIsEditorOnly && IsEditor())
{
continue;
}
}
return true;
}
}
catch (Exception e)
{
TLogger.LogError(e.ToString());
}
return false;
}
public static bool IsEditor()
{
bool isEditor = false;
#if UNITY_EDITOR
isEditor = true;
#endif
return isEditor;
}
public static void CollectExecCommands()
{
Type[] types = null;
TypeUtility.GetTypesImpl(typeof(CommonGMCommandAttribute),
"", true, IsTypeWithAttributeType, out types);
if (types == null)
{
return;
}
for (int i = 0; i < types.Length; i++)
{
Type type = types[i];
MethodInfo[] methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static);
for (int j = 0; j < methods.Length; j++)
{
MethodInfo method = methods[j];
CommonGMCommandAttribute attr = method.GetCustomAttribute<CommonGMCommandAttribute>();
if (attr == null)
{
continue;
}
if (attr.mIsEditorOnly && IsEditor())
{
continue;
}
if (string.IsNullOrEmpty(attr.mThread))
{
attr.mThread = "MainThread";
}
attr.mThread = string.Intern(attr.mThread);
attr.mPage = string.Intern(attr.mPage);
attr.mName = string.Intern(attr.mName);
attr.mButtonName = string.Intern(attr.mButtonName);
if (attr.mIsDrawer)
{
attr.mCustomDrawCallback = () => method.Invoke(null, null);
}
if (!mGMCommandPages.Contains(attr.mPage))
{
mGMCommandPages.Add(attr.mPage);
}
GMDrawer.GMCommandDrawer drawer = GMDrawer.GetExecCommandDrawer(type, method, attr);
mGMCommands.Add(drawer);
}
}
}
static int InternalID = 0x00dbdbdb;
private Vector2 mGUIScroll;
public Rect mWindowRect;
private void OnGUI()
{
if (!mOpened)
{
return;
}
int CONST_SIZE = 32;
GUI.skin.verticalScrollbar.fixedWidth = Screen.width * 0.001f * CONST_SIZE;
GUI.skin.verticalScrollbarThumb.fixedWidth = Screen.width * 0.001f * CONST_SIZE;
GUI.skin.label.fontSize = CONST_SIZE;
GUI.skin.textField.fontSize = CONST_SIZE;
GUI.skin.button.fontSize = CONST_SIZE;
GUI.skin.toggle.fontSize = 64;
GUI.skin.toggle.fixedHeight = 50;
GUI.skin.toggle.fixedWidth = 50;
GUI.skin.textArea.fontSize = CONST_SIZE;
GUI.skin.textArea.richText = true;
GUILayout.Window(InternalID, mWindowRect, DrawExeCommandWindow, "GM Command");
}
void DrawExeCommandWindow(int InWindowID)
{
GUILayout.BeginVertical();
string pageName = "Current Page: " + mCurPage;
GUILayout.Label(pageName, GUILayout.ExpandWidth(true));
GUILayout.EndVertical();
mGUIScroll = GUILayout.BeginScrollView(mGUIScroll);
GUILayout.BeginHorizontal();
GUILayout.BeginVertical("box", GUILayout.Width(mWindowRect.width * 0.1f), GUILayout.ExpandHeight(true));
if (GUILayout.Button("关闭"))
{
CLosePage();
}
for (int i = mGMCommandPages.Count - 1; i >= 0; i--)
{
string str = mGMCommandPages[i];
if (GUILayout.Button(str))
{
mCurPage = str;
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical();
for (int i = 0; i < mGMCommands.Count; i++)
{
GMDrawer.GMCommandDrawer command = mGMCommands[i];
if (command.mPage == mCurPage)
{
command.OnGUI();
}
else
{
command.Reset();
}
GUILayout.Space(1.0f);
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
}
}
}
#endif

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 3d7f8f61649e4eed89f8d48cdb7f5cb4
timeCreated: 1635745668

View File

@@ -18,18 +18,18 @@ public class TEngineTest : TEngine.TEngine
protected override void StartGame()
{
UISys.Mgr.ShowWindow<TEngineUI>(true);
UISys.Mgr.ShowWindow<MsgUI>(true);
StartCoroutine(ActiveObjMgr());
StartCoroutine(Run());
}
IEnumerator ActiveObjMgr()
IEnumerator Run()
{
yield return new WaitForSeconds(2.0f);
ObjMgr.Instance.Active();
UISys.Mgr.ShowWindow<TEngineUI>(true);
UISys.Mgr.ShowWindow<MsgUI>(true);
}
}