浏览代码

Merge branch 'kgdev' into 'master'

Run Gallery in editor as well.

See merge request upm-packages/ui-widgets/com.unity.uiwidgets!168
/main
Shenhua Gu 6 年前
当前提交
b532c4a9
共有 3 个文件被更改,包括 57 次插入8 次删除
  1. 28
      Runtime/editor/editor_window.cs
  2. 26
      Samples/UIWidgetsGallery/GalleryMainEditor.cs
  3. 11
      Samples/UIWidgetsGallery/GalleryMainEditor.cs.meta

28
Runtime/editor/editor_window.cs


this.wantsMouseEnterLeaveWindow = true;
}
void OnEnable() {
protected virtual void Awake() {
}
protected virtual void OnEnable() {
if (this._windowAdapter == null) {
this._windowAdapter = new EditorWindowAdapter(this);
}

var rootRenderBox = this.rootRenderBox();
RenderBox rootRenderBox;
using (this._windowAdapter.getScope()) {
rootRenderBox = this.createRenderBox();
}
this._windowAdapter.attachRootWidget(this.rootWidget());
Widget rootWidget;
using (this._windowAdapter.getScope()) {
rootWidget = this.createWidget();
}
this._windowAdapter.attachRootWidget(rootWidget);
void OnDisable() {
protected virtual void OnDisable() {
void OnGUI() {
protected virtual void OnGUI() {
void Update() {
protected virtual void Update() {
protected virtual RenderBox rootRenderBox() {
protected virtual RenderBox createRenderBox() {
protected abstract Widget rootWidget();
protected abstract Widget createWidget();
}
public class EditorWindowAdapter : WindowAdapter {

26
Samples/UIWidgetsGallery/GalleryMainEditor.cs


using UIWidgetsGallery.gallery;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEditor;
using UnityEngine;
namespace UIWidgetsGallery {
public class GalleryMainEditor : UIWidgetsEditorWindow {
[MenuItem("UIWidgetsTests/Gallery")]
public static void gallery() {
EditorWindow.GetWindow<GalleryMainEditor>();
}
protected override Widget createWidget() {
return new GalleryApp();
}
protected override void Awake() {
base.Awake();
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"), "Material Icons");
FontManager.instance.addFont(Resources.Load<Font>("GalleryIcons"), "GalleryIcons");
}
}
}

11
Samples/UIWidgetsGallery/GalleryMainEditor.cs.meta


fileFormatVersion: 2
guid: 1a499c991275944c983bdc42598f80b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存