浏览代码

Merge pull request #61 from fzhangtj/text_edit

show hint message in inspector when not in debug mode
/main
GitHub 6 年前
当前提交
203a0017
共有 3 个文件被更改,包括 30 次插入3 次删除
  1. 5
      Runtime/debugger/inspector_service.cs
  2. 17
      Runtime/debugger/inspector_window.cs
  3. 11
      Runtime/foundation/debug.cs

5
Runtime/debugger/inspector_service.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.debugger {

public bool active {
get { return this.window.alive; }
}
public bool debugEnabled {
get { return D.debugEnabled; }
}
public void close() {

17
Runtime/debugger/inspector_window.cs


bool m_DebugPaintLayer;
bool m_ShowDebugPaintToggles;
GUIStyle m_MessageStyle;
readonly List<InspectorPanel> m_Panels = new List<InspectorPanel>();
Rect m_DebugPaintTogglesRect;

this.DoSelectDropDown();
bool needDebugPaintUpdate = false;
if (this.m_InspectorService != null) {
if (this.m_InspectorService != null && this.m_InspectorService.debugEnabled) {
if (GUILayout.Button("Refersh", EditorStyles.toolbarButton)) {
foreach (var panel in this.m_Panels) {
panel.MarkNeedReload();

EditorGUILayout.Space();
if (this.m_InspectorService != null) {
if (this.m_InspectorService != null && this.m_InspectorService .debugEnabled) {
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(false));
this.m_Panels.Each((pannel, index) => {
if (GUILayout.Toggle(this.m_PanelIndex == index, pannel.title, EditorStyles.toolbarButton,

if (shouldHandleGUI) {
this.m_Panels[this.m_PanelIndex].OnGUI();
}
} else if (this.m_InspectorService != null) { // debug not enabled
if (this.m_MessageStyle == null) {
this.m_MessageStyle = new GUIStyle(GUI.skin.label);
this.m_MessageStyle.fontSize = 16;
this.m_MessageStyle.alignment = TextAnchor.MiddleCenter;
this.m_MessageStyle.padding = new RectOffset(20, 20, 40, 0);
}
GUILayout.Label("You're not in UIWidgets Debug Mode.\nPlease define UIWidgets_DEBUG " +
"symbols at \"Player Settings => Scripting Define Symbols\".",
this.m_MessageStyle, GUILayout.ExpandWidth(true));
}
if (this.m_ShowDebugPaintToggles) {

11
Runtime/foundation/debug.cs


public static void logError(string message, Exception ex = null) {
Debug.LogException(new AssertionError(message, ex));
}
public static bool debugEnabled {
get {
#if UIWidgets_DEBUG
return true;
#else
return false;
#endif
}
}
[Conditional("UIWidgets_DEBUG")]
public static void assert(Func<bool> result, string message = null) {
if (!result()) {

正在加载...
取消
保存