浏览代码

Merge remote-tracking branch 'origin/master' into debugger

# Conflicts:
#	Assets/UIWidgets/Tests/EditableTextWiget.cs
#	Assets/UIWidgets/Tests/Gestures.cs
#	Assets/UIWidgets/Tests/Paragraph.cs
#	Assets/UIWidgets/Tests/RenderBoxes.cs
#	Assets/UIWidgets/Tests/RenderEditable.cs
#	Assets/UIWidgets/Tests/Widgets.cs
#	Assets/UIWidgets/editor/editor_window.cs
#	Assets/UIWidgets/ui/painting/canvas_impl.cs
#	Assets/UIWidgets/ui/window.cs
/main
fzhangtj 6 年前
当前提交
d384d3a2
共有 12 个文件被更改,包括 150 次插入54 次删除
  1. 3
      Assets/UIWidgets/Tests/CanvasAndLayers.cs
  2. 2
      Assets/UIWidgets/Tests/EditableTextWiget.cs
  3. 2
      Assets/UIWidgets/Tests/Gestures.cs
  4. 2
      Assets/UIWidgets/Tests/Paragraph.cs
  5. 2
      Assets/UIWidgets/Tests/RenderBoxes.cs
  6. 2
      Assets/UIWidgets/Tests/RenderEditable.cs
  7. 8
      Assets/UIWidgets/Tests/Widgets.cs
  8. 118
      Assets/UIWidgets/editor/editor_window.cs
  9. 28
      Assets/UIWidgets/engine/WidgetCanvas.cs
  10. 29
      Assets/UIWidgets/engine/canvas_window.cs
  11. 6
      Packages/manifest.json
  12. 2
      ProjectSettings/ProjectVersion.txt

3
Assets/UIWidgets/Tests/CanvasAndLayers.cs


using Rect = UIWidgets.ui.Rect;
namespace UIWidgets.Tests {
public class CanvasAndLayers : EditorWindow {
static Material _guiTextureMat;

}
private void OnEnable() {
this._windowAdapter = new WindowAdapter(this);
this._windowAdapter = new EditorWindowAdapter(this);
this._windowAdapter.OnEnable();
this._paintingBinding = new PaintingBinding(this._windowAdapter);

2
Assets/UIWidgets/Tests/EditableTextWiget.cs


private void OnEnable() {
this.paintingBinding = new PaintingBinding(null);
paintingBinding.initInstances();
this.windowAdapter = new WindowAdapter(this);
this.windowAdapter = new EditorWindowAdapter(this);
this.windowAdapter.OnEnable();
this.root = new widgets.Container(
width: 200,

2
Assets/UIWidgets/Tests/Gestures.cs


}
private void OnEnable() {
this.windowAdapter = new WindowAdapter(this);
this.windowAdapter = new EditorWindowAdapter(this);
this.windowAdapter.OnEnable();
this._tapRecognizer = new TapGestureRecognizer();

2
Assets/UIWidgets/Tests/Paragraph.cs


}
private void OnEnable() {
this.windowAdapter = new WindowAdapter(this);
this.windowAdapter = new EditorWindowAdapter(this);
this.windowAdapter.OnEnable();
}

2
Assets/UIWidgets/Tests/RenderBoxes.cs


}
private void OnEnable() {
this.windowAdapter = new WindowAdapter(this);
this.windowAdapter = new EditorWindowAdapter(this);
this.windowAdapter.OnEnable();
}

2
Assets/UIWidgets/Tests/RenderEditable.cs


}
private void OnEnable() {
this.windowAdapter = new WindowAdapter(this);
this.windowAdapter = new EditorWindowAdapter(this);
this.windowAdapter.OnEnable();
}

8
Assets/UIWidgets/Tests/Widgets.cs


using TextStyle = UIWidgets.painting.TextStyle;
namespace UIWidgets.Tests {
public class Widgets : EditorWindow {
private WindowAdapter windowAdapter;

[NonSerialized] private bool hasInvoked = false;
public Widgets() {
public Widgets()
{
this.wantsMouseEnterLeaveWindow = true;
this.wantsMouseMove = true;
this._options = new Func<Widget>[] {
this.localImage,
this.container,

private void OnEnable() {
this.paintingBinding = new PaintingBinding(null);
paintingBinding.initInstances();
this.windowAdapter = new WindowAdapter(this);
this.windowAdapter = new EditorWindowAdapter(this);
this.windowAdapter.OnEnable();
}

118
Assets/UIWidgets/editor/editor_window.cs


using UIWidgets.rendering;
using UIWidgets.ui;
using UIWidgets.widgets;
using UnityEditor;
#if UNITY_EDITOR
using UnityEditor;
public UIWidgetsEditorWindow()
{
wantsMouseMove = true;
wantsMouseEnterLeaveWindow = true;
}
this._windowAdapter = new WindowAdapter(this);
this._windowAdapter = new EditorWindowAdapter(this);
}
this._windowAdapter.OnEnable();

}
protected abstract Widget rootWidget();
public Vector2 size
{
get
{
return position.size;
}
}
public double devicePixelRatio
{
get { return EditorGUIUtility.pixelsPerPoint; }
}
public void scheduleFrame()
{
Repaint();
}
public class WindowAdapter : Window {
public class EditorWindowAdapter : WindowAdapter
{
public readonly EditorWindow editorWindow;
public EditorWindowAdapter(EditorWindow editorWindow)
{
this.editorWindow = editorWindow;
}
static readonly List<WindowAdapter> _windowAdapters = new List<WindowAdapter>();
public static IEnumerable<WindowAdapter> windowAdapters {
get { return _windowAdapters; }
public override void scheduleFrame(bool regenerateLayerTree = true) {
base.scheduleFrame(regenerateLayerTree);
editorWindow.Repaint();
public WindowAdapter(EditorWindow editorWindow)
public override GUIContent titleContent
this.editorWindow = editorWindow;
this.editorWindow.wantsMouseMove = true;
this.editorWindow.wantsMouseEnterLeaveWindow = true;
get { return editorWindow.titleContent; }
}
protected override double queryDevicePixelRatio()
{
return EditorGUIUtility.pixelsPerPoint;
}
protected override Vector2 queryWindowSize()
{
return editorWindow.position.size;
}
public readonly EditorWindow editorWindow;
#endif
public abstract class WindowAdapter : Window {
static readonly List<WindowAdapter> _windowAdapters = new List<WindowAdapter>();
public static IEnumerable<WindowAdapter> windowAdapters {
get { return _windowAdapters; }
}
public WidgetInspectorService widgetInspectorService
{

Surface _surface;
bool _alive;
public bool alive
{

public void OnEnable() {
this._devicePixelRatio = EditorGUIUtility.pixelsPerPoint;
this._lastWindowWidth = this.editorWindow.position.width;
this._lastWindowHeight = this.editorWindow.position.height;
this._devicePixelRatio = queryDevicePixelRatio();
var size = queryWindowSize();
this._lastWindowWidth = size.x;
this._lastWindowHeight =size.y;
this._physicalSize = new Size(
this._lastWindowWidth * this._devicePixelRatio,
this._lastWindowHeight * this._devicePixelRatio);

}
}
public void PostPointerEvent(List<PointerData> data)
{
WithBinding(() =>
{
this.onPointerEvent(new PointerDataPacket(data));
});
}
public void PostPointerEvent(PointerData data)
{
PostPointerEvent(new List<PointerData>(){data});
}
public void WithBinding(Action fn) {
using (this.getScope()) {
fn();

dirty = true;
}
if (this._lastWindowWidth != this.editorWindow.position.width
|| this._lastWindowHeight != this.editorWindow.position.height) {
var size = queryWindowSize();
if (this._lastWindowWidth != size.x
|| this._lastWindowHeight != size.y) {
this._devicePixelRatio = EditorGUIUtility.pixelsPerPoint;
this._lastWindowWidth = this.editorWindow.position.width;
this._lastWindowHeight = this.editorWindow.position.height;
this._devicePixelRatio = queryDevicePixelRatio();
this._lastWindowWidth = size.x;
this._lastWindowHeight = size.y;
this._physicalSize = new Size(
this._lastWindowWidth * this._devicePixelRatio,
this._lastWindowHeight * this._devicePixelRatio);

}
}
public virtual GUIContent titleContent
{
get { return null; }
}
protected abstract double queryDevicePixelRatio();
protected abstract Vector2 queryWindowSize();
void _beginFrame() {
if (this.onBeginFrame != null) {
this.onBeginFrame(new DateTime(Stopwatch.GetTimestamp()) - this._epoch);

public override void scheduleFrame(bool regenerateLayerTree = true) {
if (regenerateLayerTree) {
this._regenerateLayerTree = true;
}
if (this.editorWindow != null) {
this.editorWindow.Repaint();
}
}

28
Assets/UIWidgets/engine/WidgetCanvas.cs


{
this._paintingBinding = new PaintingBinding(null);
_paintingBinding.initInstances();
_windowAdapter = new CanvasWindowAdapter(new Rect(0, 0, getCanvasWidth(), getCanvasHeight()),
EditorGUIUtility.pixelsPerPoint, gameObject);
_windowAdapter = new CanvasWindowAdapter(this);
var root = new WidgetsApp(null, getWidget());
_windowAdapter.attachRootWidget(root);
}

private int getCanvasHeight()
{
return _canvasHeight;
}
public Vector2 size
{
get
{
return new Vector2(_canvasWidth, _canvasHeight);
}
}
public double devicePixelRatio
{
get { return 1; }
}
public void scheduleFrame()
{
}
public GUIContent titleContent
{
get
{
return new GUIContent(gameObject.name);
}
}
}
}

29
Assets/UIWidgets/engine/canvas_window.cs


using UIWidgets.editor;
using UIWidgets.ui;
using UnityEngine;
using UIWidgets.ui;
using UnityEditor;
using UnityEngine;
private GameObject gameObject;
public CanvasWindowAdapter(Rect position, double devicePixelRatio, GameObject gameObject): base(position, devicePixelRatio)
private WidgetCanvas canvas;
public CanvasWindowAdapter(WidgetCanvas canvas)
this._position = position;
this.__devicePixelRatio = devicePixelRatio;
this.gameObject = gameObject;
}
public override void scheduleFrame()
{
this.canvas = canvas;
}
public override GUIContent titleContent

return new GUIContent(gameObject.name);
return new GUIContent(canvas.gameObject.name);
protected override void getWindowMetrics(out double devicePixelRatio, out Rect position)
protected override double queryDevicePixelRatio()
devicePixelRatio = this.__devicePixelRatio;
position = this._position;
return canvas.devicePixelRatio;
protected override Vector2d convertPointerPosition(Vector2 postion)
protected override Vector2 queryWindowSize()
throw new NotImplementedException("pointer event should not be handled by this class");
return canvas.size;
}
}

6
Packages/manifest.json


"dependencies": {
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.0.9",
"com.unity.collab-proxy": "1.2.6",
"com.unity.package-manager-ui": "2.0.0-preview.6",
"com.unity.collab-proxy": "1.2.9",
"com.unity.package-manager-ui": "2.0.1",
"com.unity.textmeshpro": "1.2.4",
"com.unity.textmeshpro": "1.3.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",

2
ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2018.3.0a9
m_EditorVersion: 2018.3.0b5
正在加载...
取消
保存