浏览代码

stash changes

/siyaoH-1.17-PlatformMessage
Xingwei Zhu 3 年前
当前提交
b3c86083
共有 4 个文件被更改,包括 42 次插入24 次删除
  1. 2
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs
  2. 17
      com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs
  3. 29
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  4. 18
      com.unity.uiwidgets/Runtime/foundation/debug.cs

2
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs


public class EditorWindowGallery : UIWidgetsEditorPanel
{
[MenuItem("UIWidgets/EditorSample")]
[MenuItem("UIWidgets/EditorSample/GalleryMain")]
public static void CountDemo()
{
CreateWindow<EditorWindowGallery>();

17
com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs


public class UIWidgetsPanelEditor : RawImageEditor {
public override void OnInspectorGUI() {
base.OnInspectorGUI();
var pixelRatioProperty = serializedObject.FindProperty("devicePixelRatioOverride");
var antiAliasingProperty = serializedObject.FindProperty("hardwareAntiAliasing");
base.OnInspectorGUI();
EditorGUILayout.PropertyField(pixelRatioProperty);
EditorGUILayout.PropertyField(antiAliasingProperty);
UIWidgetsPanel panel = (UIWidgetsPanel)target;
UIWidgetsPanel panel = (UIWidgetsPanel)target;
panel.enableDebugAtRuntime = EditorGUILayout.Toggle(new GUIContent("Enable Debug At Runtime",
"This configuration only works in standalone players. \n\n" +
"If your scene contains multiple UIWidgets panels," +
" the DEBUG MODE is enabled for all panels if this is checked on any one panel.\n\n" +
"In editor the DEBUG MODE can be set using UIWidgets/EnableDebug."),
panel.enableDebugAtRuntime);
[MenuItem("UIWidgets/EnableDebug")]
public static void ToggleDebugMode(){
D.enableDebug = !D.enableDebug;

29
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


using System;
using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

}
public partial class UIWidgetsPanel : RawImage, IUIWidgetsWindow {
public static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();
static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();
static bool showDebugLog = false;
static void registerPanel(UIWidgetsPanel panel) {
panels.Add(panel);
showDebugLog = showDebugLog || panel.enableDebugAtRuntime;
}
static void unregisterPanel(UIWidgetsPanel panel) {
panels.Remove(panel);
}
public static bool enableDebug => showDebugLog;
static bool _ShowDebugLog;
public bool enableDebugAtRuntime = false;
DisplayMetrics _displayMetrics = new DisplayMetrics();

}
}
public static bool ShowDebugLog {
get { return _ShowDebugLog; }
set {
_ShowDebugLog = value;
}
}
protected virtual void Update() {
Input_Update();
}

#endif
base.OnEnable();
registerPanel(this);
D.assert(_wrapper == null);
_configurations = new Configurations();
_wrapper = new UIWidgetsPanelWrapper();

_configurations.Clear();
texture = _wrapper.renderTexture;
Input_OnEnable();
panels.Add(this);
}
protected override void OnDisable() {

texture = null;
Input_OnDisable();
base.OnDisable();
panels.Remove(this);
unregisterPanel(this);
}
protected virtual void OnGUI() {

18
com.unity.uiwidgets/Runtime/foundation/debug.cs


using System;
using System.Diagnostics;
using System.Linq;
using Unity.UIWidgets.engine2;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;

}
[Conditional("UNITY_ASSERTIONS")]
public static void assert(bool result, Func<string> message = null) {
if ( enableDebug && !result ) {
if ( enableDebug && !result ) {
#if UNITY_EDITOR
_enableDebug = PlayerPrefs.GetInt("UIWidgetsDebug") == 1;
_enableDebug = EditorPrefs.GetInt("UIWidgetsDebug") == 1;
}
return _enableDebug.Value;
}

}
_enableDebug = value;
PlayerPrefs.SetInt("UIWidgetsDebug",value ? 1 : 0);
EditorPrefs.SetInt("UIWidgetsDebug",value ? 1 : 0);
#else
public static bool enableDebug => UIWidgetsPanel.enableDebug;
#endif
public static void _debugDrawDoubleRect(Canvas canvas, Rect outerRect, Rect innerRect, Color color) {
var path = new Path();
path.fillType = PathFillType.evenOdd;

正在加载...
取消
保存