Vincent Zhang
5 年前
当前提交
303d8721
共有 470 个文件被更改,包括 7370 次插入 和 0 次删除
-
8Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta
-
617Samples/UIWidgetsSamples_2019_4/Assets/Editor/CanvasAndLayers.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/CanvasAndLayers.cs.meta
-
66Samples/UIWidgetsSamples_2019_4/Assets/Editor/CupertinoSampleWidget.cs
-
3Samples/UIWidgetsSamples_2019_4/Assets/Editor/CupertinoSampleWidget.cs.meta
-
8Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop.meta
-
374Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/CustomInspectorSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/CustomInspectorSample.cs.meta
-
171Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/UnityObjectDetectorSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/UnityObjectDetectorSample.cs.meta
-
80Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditableTextWiget.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditableTextWiget.cs.meta
-
19Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorExampleTest.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorExampleTest.cs.meta
-
31Samples/UIWidgetsSamples_2019_4/Assets/Editor/GalleryMainEditor.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/GalleryMainEditor.cs.meta
-
98Samples/UIWidgetsSamples_2019_4/Assets/Editor/Gestures.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/Gestures.cs.meta
-
47Samples/UIWidgetsSamples_2019_4/Assets/Editor/Menu.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/Menu.cs.meta
-
96Samples/UIWidgetsSamples_2019_4/Assets/Editor/MouseHover.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/MouseHover.cs.meta
-
235Samples/UIWidgetsSamples_2019_4/Assets/Editor/Paragraph.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/Paragraph.cs.meta
-
153Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderBoxes.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderBoxes.cs.meta
-
197Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderEditable.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderEditable.cs.meta
-
165Samples/UIWidgetsSamples_2019_4/Assets/Editor/SceneViewTests.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/SceneViewTests.cs.meta
-
22Samples/UIWidgetsSamples_2019_4/Assets/Editor/UIWidgetsSample.Editor.asmdef
-
7Samples/UIWidgetsSamples_2019_4/Assets/Editor/UIWidgetsSample.Editor.asmdef.meta
-
919Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs.meta
-
8Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts.meta
-
149Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/bar.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/bar.cs.meta
-
38Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/color_palette.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/color_palette.cs.meta
-
67Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/main.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/main.cs.meta
-
41Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/tween.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/tween.cs.meta
-
8Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta
-
45Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs.meta
-
92Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs.meta
-
204Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs.meta
-
73Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs
-
3Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs.meta
-
55Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs
-
3Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta
-
85Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta
-
60Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs
-
3Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta
-
97Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta
-
86Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs
-
3Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta
-
82Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs.meta
-
51Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs
-
3Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta
-
56Samples/UIWidgetsSamples_2019_4/Assets/README-ZH.md
-
7Samples/UIWidgetsSamples_2019_4/Assets/README-ZH.md.meta
-
59Samples/UIWidgetsSamples_2019_4/Assets/README.md
-
7Samples/UIWidgetsSamples_2019_4/Assets/README.md.meta
-
8Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample.meta
-
48Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/DefaultSimpleTestbedPanel.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/DefaultSimpleTestbedPanel.cs.meta
-
879Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/Raycast Simple Testbed.unity
-
7Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/Raycast Simple Testbed.unity.meta
-
757Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/Raycast Testbed.unity
-
7Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/Raycast Testbed.unity.meta
-
48Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/RaycastSimpleTestbedPanel.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/RaycastSimpleTestbedPanel.cs.meta
-
211Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/RaycastTestbedPanel.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample/RaycastTestbedPanel.cs.meta
-
8Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample.meta
-
5Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/.sample.json
-
3Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/.sample.json.meta
-
113Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/CounterAppSample.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/CounterAppSample.cs.meta
-
8Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/ObjectFinder.meta
-
25Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/ObjectFinder/FinderGameObject.cs
-
11Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/ObjectFinder/FinderGameObject.cs.meta
-
223Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample/ObjectFinder/ObjectFinderApp.cs
|
|||
fileFormatVersion: 2 |
|||
guid: 0ae90c343ee0e4f7daf768fe6383340f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using RSG; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Gradient = Unity.UIWidgets.ui.Gradient; |
|||
using Material = UnityEngine.Material; |
|||
using Rect = UnityEngine.Rect; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class CanvasAndLayers : EditorWindow { |
|||
static Material _guiTextureMat; |
|||
|
|||
internal static Material _getGUITextureMat() { |
|||
if (_guiTextureMat) { |
|||
return _guiTextureMat; |
|||
} |
|||
|
|||
var guiTextureShader = Shader.Find("UIWidgets/GUITexture"); |
|||
if (guiTextureShader == null) { |
|||
throw new Exception("UIWidgets/GUITexture not found"); |
|||
} |
|||
|
|||
_guiTextureMat = new Material(guiTextureShader); |
|||
_guiTextureMat.hideFlags = HideFlags.HideAndDontSave; |
|||
return _guiTextureMat; |
|||
} |
|||
|
|||
readonly Action[] _options; |
|||
|
|||
readonly string[] _optionStrings; |
|||
|
|||
int _selected; |
|||
|
|||
ImageStream _stream; |
|||
|
|||
RenderTexture _renderTexture; |
|||
|
|||
WindowAdapter _windowAdapter; |
|||
|
|||
MeshPool _meshPool; |
|||
|
|||
static Texture2D texture6; |
|||
|
|||
CanvasAndLayers() { |
|||
this._options = new Action[] { |
|||
this.drawPloygon4, |
|||
this.drawRect, |
|||
this.drawRectShadow, |
|||
this.drawImageRect, |
|||
this.drawPicture, |
|||
this.clipRect, |
|||
this.clipRRect, |
|||
this.saveLayer, |
|||
this.drawLine, |
|||
this.drawParagraph, |
|||
}; |
|||
this._optionStrings = this._options.Select(x => x.Method.Name).ToArray(); |
|||
this._selected = 0; |
|||
|
|||
this.titleContent = new GUIContent("CanvasAndLayers"); |
|||
} |
|||
|
|||
void OnGUI() { |
|||
this._selected = EditorGUILayout.Popup("test case", this._selected, this._optionStrings); |
|||
if (this._selected == 3) { |
|||
using (this._windowAdapter.getScope()) { |
|||
if (GUI.Button(new Rect(20, 50, 100, 20), "Image 1")) { |
|||
this.LoadImage( |
|||
"http://a.hiphotos.baidu.com/image/h%3D300/sign=10b374237f0e0cf3bff748fb3a47f23d/adaf2edda3cc7cd90df1ede83401213fb80e9127.jpg"); |
|||
} |
|||
|
|||
if (GUI.Button(new Rect(20, 150, 100, 20), "Image 2")) { |
|||
this.LoadImage( |
|||
"http://a.hiphotos.baidu.com/image/pic/item/cf1b9d16fdfaaf519b4aa960875494eef11f7a47.jpg"); |
|||
} |
|||
|
|||
if (GUI.Button(new Rect(20, 250, 100, 20), "Image 3")) { |
|||
this.LoadImage( |
|||
"http://a.hiphotos.baidu.com/image/pic/item/2f738bd4b31c8701c1e721dd2a7f9e2f0708ffbc.jpg"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
this._windowAdapter.OnGUI(); |
|||
|
|||
if (Event.current.type == EventType.Repaint || Event.current.type == EventType.MouseDown) { |
|||
this.createRenderTexture(); |
|||
|
|||
Window.instance = this._windowAdapter; |
|||
|
|||
if (Event.current.type == EventType.MouseDown) { |
|||
Promise.Delayed(new TimeSpan(0, 0, 5)).Then(() => { Debug.Log("Promise.Delayed: 5s"); }); |
|||
} |
|||
|
|||
this._options[this._selected](); |
|||
|
|||
Window.instance = null; |
|||
|
|||
Graphics.DrawTexture(new Rect(0, 0, this.position.width, this.position.height), |
|||
this._renderTexture, _getGUITextureMat()); |
|||
} |
|||
} |
|||
|
|||
void Update() { |
|||
this._windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
this._windowAdapter = new EditorWindowAdapter(this); |
|||
this._windowAdapter.OnEnable(); |
|||
this._meshPool = new MeshPool(); |
|||
|
|||
texture6 = Resources.Load<Texture2D>("6"); |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this._meshPool.Dispose(); |
|||
this._meshPool = null; |
|||
} |
|||
|
|||
void createRenderTexture() { |
|||
var width = (int) (this.position.width * EditorGUIUtility.pixelsPerPoint); |
|||
var height = (int) (this.position.height * EditorGUIUtility.pixelsPerPoint); |
|||
if (this._renderTexture == null || |
|||
this._renderTexture.width != width || |
|||
this._renderTexture.height != height) { |
|||
var desc = new RenderTextureDescriptor( |
|||
width, |
|||
height, |
|||
RenderTextureFormat.Default, 24) { |
|||
useMipMap = false, |
|||
autoGenerateMips = false, |
|||
}; |
|||
|
|||
this._renderTexture = RenderTexture.GetTemporary(desc); |
|||
} |
|||
} |
|||
|
|||
void LoadImage(string url) { |
|||
Dictionary<string, string> headers = new Dictionary<string, string>(); |
|||
NetworkImage networkImage = new NetworkImage(url, headers: headers); |
|||
ImageConfiguration imageConfig = new ImageConfiguration(); |
|||
this._stream = networkImage.resolve(imageConfig); |
|||
} |
|||
|
|||
void drawPloygon4() { |
|||
var canvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
shader = Gradient.linear(new Offset(80, 80), new Offset(180, 180), new List<Color>() { |
|||
Colors.red, Colors.black, Colors.green |
|||
}, null, TileMode.clamp) |
|||
}; |
|||
|
|||
var path = new Path(); |
|||
path.moveTo(10, 150); |
|||
path.lineTo(10, 160); |
|||
path.lineTo(140, 120); |
|||
path.lineTo(110, 180); |
|||
path.winding(PathWinding.clockwise); |
|||
path.close(); |
|||
path.addRect(Unity.UIWidgets.ui.Rect.fromLTWH(0, 100, 100, 100)); |
|||
path.addRect(Unity.UIWidgets.ui.Rect.fromLTWH(200, 0, 100, 100)); |
|||
path.addRRect(RRect.fromRectAndRadius(Unity.UIWidgets.ui.Rect.fromLTWH(150, 100, 30, 30), 10)); |
|||
path.addOval(Unity.UIWidgets.ui.Rect.fromLTWH(150, 50, 100, 100)); |
|||
path.winding(PathWinding.clockwise); |
|||
|
|||
if (Event.current.type == EventType.MouseDown) { |
|||
var pos = new Offset( |
|||
Event.current.mousePosition.x, |
|||
Event.current.mousePosition.y |
|||
); |
|||
|
|||
Debug.Log(pos + ": " + path.contains(pos)); |
|||
} |
|||
|
|||
canvas.drawPath(path, paint); |
|||
|
|||
canvas.rotate(Mathf.PI * 15 / 180); |
|||
|
|||
canvas.translate(100, 100); |
|||
|
|||
paint.shader = Gradient.radial(new Offset(80, 80), 100, new List<Color>() { |
|||
Colors.red, Colors.black, Colors.green |
|||
}, null, TileMode.clamp); |
|||
canvas.drawPath(path, paint); |
|||
|
|||
|
|||
canvas.translate(100, 100); |
|||
paint.shader = Gradient.sweep(new Offset(120, 100), new List<Color>() { |
|||
Colors.red, Colors.black, Colors.green, Colors.red, |
|||
}, null, TileMode.clamp, 10 * Mathf.PI / 180, 135 * Mathf.PI / 180); |
|||
canvas.drawPath(path, paint); |
|||
|
|||
|
|||
canvas.translate(100, 100); |
|||
//paint.maskFilter = MaskFilter.blur(BlurStyle.normal, 5);
|
|||
paint.shader = new ImageShader(new Image(texture6, true), TileMode.mirror); |
|||
canvas.drawPath(path, paint); |
|||
|
|||
canvas.flush(); |
|||
} |
|||
|
|||
void drawLine() { |
|||
var canvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
style = PaintingStyle.stroke, |
|||
strokeWidth = 10, |
|||
shader = Gradient.linear(new Offset(10, 10), new Offset(180, 180), new List<Color>() { |
|||
Colors.red, Colors.green, Colors.yellow |
|||
}, null, TileMode.clamp) |
|||
}; |
|||
|
|||
canvas.drawLine( |
|||
new Offset(10, 20), |
|||
new Offset(50, 20), |
|||
paint); |
|||
|
|||
canvas.drawLine( |
|||
new Offset(10, 10), |
|||
new Offset(100, 100), |
|||
paint); |
|||
|
|||
canvas.drawLine( |
|||
new Offset(10, 10), |
|||
new Offset(10, 50), |
|||
paint); |
|||
|
|||
canvas.drawLine( |
|||
new Offset(40, 10), |
|||
new Offset(90, 10), |
|||
paint); |
|||
|
|||
|
|||
canvas.drawArc(Unity.UIWidgets.ui.Rect.fromLTWH(200, 200, 100, 100), Mathf.PI / 4, |
|||
-Mathf.PI / 2 + Mathf.PI * 4 - 1, true, paint); |
|||
|
|||
paint.maskFilter = MaskFilter.blur(BlurStyle.normal, 1); |
|||
paint.strokeWidth = 4; |
|||
|
|||
canvas.drawLine( |
|||
new Offset(40, 20), |
|||
new Offset(120, 190), |
|||
paint); |
|||
|
|||
canvas.scale(3); |
|||
TextBlobBuilder builder = new TextBlobBuilder(); |
|||
string text = "This is a text blob"; |
|||
builder.setBounds(new Rect(-10, -20, 200, 50)); |
|||
builder.setPositionXs(new float[] { |
|||
10, 20, 30, 40, 50, 60, 70, 80, 90, 100, |
|||
110, 120, 130, 140, 150, 160, 170, 180, 190 |
|||
}); |
|||
builder.allocRunPos(new TextStyle(), text, 0, text.Length); |
|||
|
|||
var textBlob = builder.make(); |
|||
canvas.drawTextBlob(textBlob, new Offset(100, 100), new Paint { |
|||
color = Colors.black, |
|||
maskFilter = MaskFilter.blur(BlurStyle.normal, 5), |
|||
}); |
|||
canvas.drawTextBlob(textBlob, new Offset(100, 100), paint); |
|||
|
|||
canvas.drawLine( |
|||
new Offset(10, 30), |
|||
new Offset(10, 60), |
|||
new Paint() {style = PaintingStyle.stroke, strokeWidth = 0.1f}); |
|||
|
|||
canvas.drawLine( |
|||
new Offset(20, 30), |
|||
new Offset(20, 60), |
|||
new Paint() {style = PaintingStyle.stroke, strokeWidth = 0.333f}); |
|||
|
|||
canvas.flush(); |
|||
} |
|||
|
|||
void drawRect() { |
|||
var canvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
}; |
|||
|
|||
canvas.rotate(15 * Mathf.PI / 180); |
|||
var rect = Unity.UIWidgets.ui.Rect.fromLTWH(10, 10, 100, 100); |
|||
var rrect = RRect.fromRectAndCorners(rect, 0, 4, 8, 16); |
|||
|
|||
canvas.drawRRect(rrect, paint); |
|||
|
|||
paint = new Paint { |
|||
color = new Color(0xFF00FF00), |
|||
}; |
|||
|
|||
rect = Unity.UIWidgets.ui.Rect.fromLTWH(10, 150, 100, 100); |
|||
rrect = RRect.fromRectAndCorners(rect, 0, 4, 8, 16); |
|||
canvas.drawRRect(rrect, paint); |
|||
|
|||
rect = Unity.UIWidgets.ui.Rect.fromLTWH(150, 150, 100, 100); |
|||
rrect = RRect.fromRectAndCorners(rect, 10, 12, 14, 16); |
|||
var rect1 = Unity.UIWidgets.ui.Rect.fromLTWH(160, 160, 80, 80); |
|||
var rrect1 = RRect.fromRectAndCorners(rect1, 5, 6, 7, 8); |
|||
|
|||
canvas.drawDRRect(rrect, rrect1, paint); |
|||
|
|||
canvas.flush(); |
|||
} |
|||
|
|||
void drawRectShadow() { |
|||
var canvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFF00FF00), |
|||
maskFilter = MaskFilter.blur(BlurStyle.normal, 3), |
|||
}; |
|||
|
|||
canvas.clipRect(Unity.UIWidgets.ui.Rect.fromLTWH(25, 25, 300, 300)); |
|||
|
|||
canvas.rotate(-Mathf.PI / 8.0f); |
|||
|
|||
canvas.drawRect( |
|||
Unity.UIWidgets.ui.Rect.fromLTWH(10, 10, 100, 100), |
|||
paint); |
|||
|
|||
paint = new Paint { |
|||
color = new Color(0xFFFFFF00), |
|||
maskFilter = MaskFilter.blur(BlurStyle.normal, 5), |
|||
style = PaintingStyle.stroke, |
|||
strokeWidth = 55, |
|||
shader = Gradient.linear(new Offset(10, 10), new Offset(180, 180), new List<Color>() { |
|||
Colors.red, Colors.green, Colors.yellow |
|||
}, null, TileMode.clamp) |
|||
}; |
|||
|
|||
canvas.drawRect( |
|||
Unity.UIWidgets.ui.Rect.fromLTWH(10, 150, 200, 200), |
|||
paint); |
|||
|
|||
canvas.drawImage(new Image(texture6, true), |
|||
new Offset(50, 150), |
|||
paint); |
|||
|
|||
canvas.flush(); |
|||
} |
|||
|
|||
void drawPicture() { |
|||
var pictureRecorder = new PictureRecorder(); |
|||
var canvas = new RecorderCanvas(pictureRecorder); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
}; |
|||
|
|||
var path = new Path(); |
|||
path.moveTo(10, 10); |
|||
path.lineTo(10, 110); |
|||
path.lineTo(90, 110); |
|||
path.lineTo(100, 10); |
|||
path.close(); |
|||
canvas.drawPath(path, paint); |
|||
|
|||
paint = new Paint { |
|||
color = new Color(0xFFFFFF00), |
|||
}; |
|||
|
|||
var rect = Unity.UIWidgets.ui.Rect.fromLTWH(10, 150, 100, 100); |
|||
var rrect = RRect.fromRectAndCorners(rect, 0, 4, 8, 16); |
|||
var rect1 = Unity.UIWidgets.ui.Rect.fromLTWH(18, 152, 88, 92); |
|||
var rrect1 = RRect.fromRectAndCorners(rect1, 0, 4, 8, 16); |
|||
|
|||
canvas.drawDRRect(rrect, rrect1, paint); |
|||
|
|||
canvas.rotate(-45 * Mathf.PI / 180, new Offset(150, 150)); |
|||
|
|||
paint = new Paint { |
|||
color = new Color(0xFF00FFFF), |
|||
maskFilter = MaskFilter.blur(BlurStyle.normal, 3), |
|||
}; |
|||
canvas.drawRect( |
|||
Unity.UIWidgets.ui.Rect.fromLTWH(150, 150, 110, 120), |
|||
paint); |
|||
|
|||
var picture = pictureRecorder.endRecording(); |
|||
Debug.Log("picture.paintBounds: " + picture.paintBounds); |
|||
|
|||
var editorCanvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
editorCanvas.drawPicture(picture); |
|||
|
|||
editorCanvas.rotate(-15 * Mathf.PI / 180); |
|||
editorCanvas.translate(100, 100); |
|||
editorCanvas.drawPicture(picture); |
|||
editorCanvas.flush(); |
|||
} |
|||
|
|||
void drawParagraph() { |
|||
var pb = new ParagraphBuilder(new ParagraphStyle{}); |
|||
pb.addText("Hello drawParagraph"); |
|||
var paragraph = pb.build(); |
|||
paragraph.layout(new ParagraphConstraints(width:300)); |
|||
var canvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
canvas.drawParagraph(paragraph, new Offset(10f, 100f)); |
|||
canvas.flush(); |
|||
Unity.UIWidgets.ui.Paragraph.release(ref paragraph); |
|||
} |
|||
|
|||
void drawImageRect() { |
|||
if (this._stream == null || this._stream.completer == null || this._stream.completer.currentImage == null) { |
|||
return; |
|||
} |
|||
|
|||
var canvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
|
|||
var paint = new Paint { |
|||
// color = new Color(0x7FFF0000),
|
|||
shader = Gradient.linear(new Offset(100, 100), new Offset(280, 280), new List<Color>() { |
|||
Colors.red, Colors.black, Colors.green |
|||
}, null, TileMode.clamp) |
|||
}; |
|||
|
|||
canvas.drawImageRect(this._stream.completer.currentImage.image, |
|||
Unity.UIWidgets.ui.Rect.fromLTWH(100, 50, 250, 250), |
|||
paint |
|||
); |
|||
canvas.flush(); |
|||
} |
|||
|
|||
void clipRect() { |
|||
var pictureRecorder = new PictureRecorder(); |
|||
var canvas = new RecorderCanvas(pictureRecorder); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
}; |
|||
|
|||
var path = new Path(); |
|||
path.moveTo(10, 10); |
|||
path.lineTo(10, 110); |
|||
path.lineTo(90, 110); |
|||
path.lineTo(110, 10); |
|||
path.close(); |
|||
|
|||
canvas.drawPath(path, paint); |
|||
|
|||
paint = new Paint { |
|||
color = new Color(0xFFFFFF00), |
|||
}; |
|||
|
|||
var rect = Unity.UIWidgets.ui.Rect.fromLTWH(10, 150, 100, 100); |
|||
var rrect = RRect.fromRectAndCorners(rect, 0, 4, 8, 16); |
|||
var rect1 = Unity.UIWidgets.ui.Rect.fromLTWH(18, 152, 88, 92); |
|||
var rrect1 = RRect.fromRectAndCorners(rect1, 0, 4, 8, 16); |
|||
canvas.drawDRRect(rrect, rrect1, paint); |
|||
|
|||
canvas.rotate(-45 * Mathf.PI / 180.0f, new Offset(150, 150)); |
|||
|
|||
// paint = new Paint {
|
|||
// color = new Color(0xFF00FFFF),
|
|||
// blurSigma = 3,
|
|||
// };
|
|||
// canvas.drawRectShadow(
|
|||
// Rect.fromLTWH(150, 150, 110, 120),
|
|||
// paint);
|
|||
|
|||
var picture = pictureRecorder.endRecording(); |
|||
Debug.Log("picture.paintBounds: " + picture.paintBounds); |
|||
|
|||
var editorCanvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
editorCanvas.rotate(-5 * Mathf.PI / 180); |
|||
editorCanvas.clipRect(Unity.UIWidgets.ui.Rect.fromLTWH(25, 15, 250, 250)); |
|||
editorCanvas.rotate(5 * Mathf.PI / 180); |
|||
|
|||
editorCanvas.drawPicture(picture); |
|||
|
|||
editorCanvas.rotate(-15 * Mathf.PI / 180); |
|||
editorCanvas.translate(100, 100); |
|||
|
|||
editorCanvas.drawPicture(picture); |
|||
|
|||
editorCanvas.flush(); |
|||
} |
|||
|
|||
void clipRRect() { |
|||
var pictureRecorder = new PictureRecorder(); |
|||
var canvas = new RecorderCanvas(pictureRecorder); |
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
}; |
|||
|
|||
var path = new Path(); |
|||
path.moveTo(10, 10); |
|||
path.lineTo(10, 110); |
|||
path.lineTo(90, 110); |
|||
path.lineTo(110, 10); |
|||
path.close(); |
|||
|
|||
canvas.drawPath(path, paint); |
|||
|
|||
paint = new Paint { |
|||
color = new Color(0xFFFFFF00), |
|||
}; |
|||
|
|||
var rect = Unity.UIWidgets.ui.Rect.fromLTWH(10, 150, 100, 100); |
|||
var rrect = RRect.fromRectAndCorners(rect, 0, 4, 8, 16); |
|||
var rect1 = Unity.UIWidgets.ui.Rect.fromLTWH(18, 152, 88, 92); |
|||
var rrect1 = RRect.fromRectAndCorners(rect1, 0, 4, 8, 16); |
|||
canvas.drawDRRect(rrect, rrect1, paint); |
|||
|
|||
canvas.rotate(-45 * Mathf.PI / 180.0f, new Offset(150, 150)); |
|||
|
|||
// paint = new Paint {
|
|||
// color = new Color(0xFF00FFFF),
|
|||
// blurSigma = 3,
|
|||
// };
|
|||
// canvas.drawRectShadow(
|
|||
// Rect.fromLTWH(150, 150, 110, 120),
|
|||
// paint);
|
|||
|
|||
var picture = pictureRecorder.endRecording(); |
|||
Debug.Log("picture.paintBounds: " + picture.paintBounds); |
|||
|
|||
var editorCanvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
editorCanvas.rotate(-5 * Mathf.PI / 180); |
|||
editorCanvas.clipRRect(RRect.fromRectAndRadius(Unity.UIWidgets.ui.Rect.fromLTWH(25, 15, 250, 250), 50)); |
|||
editorCanvas.rotate(5 * Mathf.PI / 180); |
|||
|
|||
editorCanvas.drawPicture(picture); |
|||
|
|||
editorCanvas.rotate(-15 * Mathf.PI / 180); |
|||
editorCanvas.translate(100, 100); |
|||
|
|||
editorCanvas.drawPicture(picture); |
|||
|
|||
editorCanvas.flush(); |
|||
} |
|||
|
|||
void saveLayer() { |
|||
var pictureRecorder = new PictureRecorder(); |
|||
var canvas = new RecorderCanvas(pictureRecorder); |
|||
var paint1 = new Paint { |
|||
color = new Color(0xFFFFFFFF), |
|||
}; |
|||
|
|||
var path1 = new Path(); |
|||
path1.moveTo(0, 0); |
|||
path1.lineTo(0, 90); |
|||
path1.lineTo(90, 90); |
|||
path1.lineTo(90, 0); |
|||
path1.close(); |
|||
canvas.drawPath(path1, paint1); |
|||
|
|||
|
|||
var paint = new Paint { |
|||
color = new Color(0xFFFF0000), |
|||
}; |
|||
|
|||
var path = new Path(); |
|||
path.moveTo(20, 20); |
|||
path.lineTo(20, 70); |
|||
path.lineTo(70, 70); |
|||
path.lineTo(70, 20); |
|||
path.close(); |
|||
|
|||
canvas.drawPath(path, paint); |
|||
|
|||
var paint2 = new Paint { |
|||
color = new Color(0xFFFFFF00), |
|||
}; |
|||
|
|||
var path2 = new Path(); |
|||
path2.moveTo(30, 30); |
|||
path2.lineTo(30, 60); |
|||
path2.lineTo(60, 60); |
|||
path2.lineTo(60, 30); |
|||
path2.close(); |
|||
|
|||
canvas.drawPath(path2, paint2); |
|||
|
|||
var picture = pictureRecorder.endRecording(); |
|||
|
|||
var editorCanvas = new CommandBufferCanvas(this._renderTexture, Window.instance.devicePixelRatio, |
|||
this._meshPool); |
|||
|
|||
editorCanvas.saveLayer( |
|||
picture.paintBounds, new Paint { |
|||
color = new Color(0xFFFFFFFF), |
|||
}); |
|||
editorCanvas.drawPicture(picture); |
|||
editorCanvas.restore(); |
|||
|
|||
editorCanvas.saveLayer(Unity.UIWidgets.ui.Rect.fromLTWH(45, 45, 90, 90), new Paint { |
|||
color = new Color(0xFFFFFFFF), |
|||
backdrop = ImageFilter.blur(3f, 3f) |
|||
}); |
|||
editorCanvas.restore(); |
|||
|
|||
editorCanvas.flush(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 82dd60611380c41ff89590fc49800e97 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.cupertino; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Rect = UnityEngine.Rect; |
|||
|
|||
namespace UIWidgetsSample { |
|||
public class CupertinoSample : UIWidgetsEditorWindow { |
|||
[MenuItem("UIWidgetsTests/CupertinoSample")] |
|||
public static void gallery() { |
|||
GetWindow<CupertinoSample>(); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("CupertinoIcons"), "CupertinoIcons"); |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
Debug.Log("[Cupertino Sample] Created"); |
|||
return new CupertinoSampleApp(); |
|||
} |
|||
} |
|||
|
|||
|
|||
public class CupertinoSampleApp : StatelessWidget { |
|||
public override Widget build(BuildContext context) { |
|||
return new CupertinoApp( |
|||
theme: new CupertinoThemeData( |
|||
textTheme: new CupertinoTextThemeData( |
|||
navLargeTitleTextStyle: new TextStyle( |
|||
fontWeight: FontWeight.bold, |
|||
fontSize: 70f, |
|||
color: CupertinoColors.activeBlue |
|||
) |
|||
)), |
|||
home: new CupertinoSampleWidget() |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class CupertinoSampleWidget : StatefulWidget { |
|||
public CupertinoSampleWidget(Key key = null) : base(key) { } |
|||
|
|||
public override State createState() { |
|||
return new CupertinoSampleWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class CupertinoSampleWidgetState : State<CupertinoSampleWidget> { |
|||
public override Widget build(BuildContext context) { |
|||
return new CupertinoPageScaffold( |
|||
child: new Center( |
|||
child: new Text("Hello Cupertino", |
|||
style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 92aa3442134248a38d03c2a24a8a9962 |
|||
timeCreated: 1566545424 |
|
|||
fileFormatVersion: 2 |
|||
guid: 087f4b1b8d7aa4e93bca841df8a1d603 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Transform = UnityEngine.Transform; |
|||
|
|||
namespace UIWidgetsSample.DragNDrop { |
|||
public class CustomInspectorSample : UIWidgetsEditorWindow { |
|||
[MenuItem("UIWidgetsTests/Drag&Drop/Custom Inspector")] |
|||
public static void ShowEditorWindow() { |
|||
var window = GetWindow<CustomInspectorSample>(); |
|||
window.titleContent.text = "Custom Inspector Sample"; |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/GalleryIcons"), "GalleryIcons"); |
|||
|
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
Debug.Log("[ WIDGET RECREATED ]"); |
|||
return new MaterialApp( |
|||
home: new CustomInspectorSampleWidget(), |
|||
darkTheme: new ThemeData(primaryColor: Colors.black26) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class CustomInspectorSampleWidget : StatefulWidget { |
|||
public CustomInspectorSampleWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new CustomInspectorSampleWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class CustomInspectorSampleWidgetState : State<CustomInspectorSampleWidget> { |
|||
GameObject objectRef; |
|||
Transform transformRef; |
|||
|
|||
TextEditingController textController = new TextEditingController(); |
|||
|
|||
public override void initState() { |
|||
this.textController.addListener(() => { |
|||
var text = this.textController.text.ToLower(); |
|||
this.textController.value = this.textController.value.copyWith( |
|||
text: text, |
|||
selection: new TextSelection(baseOffset: text.Length, extentOffset: text.Length), |
|||
composing: TextRange.empty |
|||
); |
|||
}); |
|||
base.initState(); |
|||
} |
|||
|
|||
enum ETransfrom { |
|||
Position, |
|||
Rotation, |
|||
Scale |
|||
} |
|||
|
|||
// make custom control of cursor position in TextField.
|
|||
int oldCursorPosition = 0; |
|||
|
|||
// The decimal point input-and-parse exists problem.
|
|||
Widget getCardRow(ETransfrom type, bool hasRef) { |
|||
var xValue = hasRef |
|||
? type == ETransfrom.Position |
|||
? this.transformRef.position.x.ToString() |
|||
: type == ETransfrom.Rotation |
|||
? this.transformRef.localEulerAngles.x.ToString() |
|||
: this.transformRef.localScale.x.ToString() |
|||
: ""; |
|||
// Using individual TextEditingController to control TextField cursor position.
|
|||
var xValueController = TextEditingController.fromValue( |
|||
new TextEditingValue(xValue, TextSelection.collapsed(this.oldCursorPosition)) |
|||
); |
|||
|
|||
var yValue = hasRef |
|||
? type == ETransfrom.Position |
|||
? this.transformRef.position.y.ToString() |
|||
: type == ETransfrom.Rotation |
|||
? this.transformRef.localEulerAngles.y.ToString() |
|||
: this.transformRef.localScale.y.ToString() |
|||
: ""; |
|||
|
|||
var yValueController = TextEditingController.fromValue( |
|||
new TextEditingValue(yValue, TextSelection.collapsed(this.oldCursorPosition)) |
|||
); |
|||
|
|||
var zValue = hasRef |
|||
? type == ETransfrom.Position |
|||
? this.transformRef.position.z.ToString() |
|||
: type == ETransfrom.Rotation |
|||
? this.transformRef.localEulerAngles.z.ToString() |
|||
: this.transformRef.localScale.z.ToString() |
|||
: ""; |
|||
|
|||
var zValueController = TextEditingController.fromValue( |
|||
new TextEditingValue(zValue, TextSelection.collapsed(this.oldCursorPosition)) |
|||
); |
|||
|
|||
return new Column( |
|||
children: new List<Widget> { |
|||
new Container( |
|||
padding: EdgeInsets.symmetric(vertical: 8f), |
|||
child: new Align( |
|||
alignment: Alignment.centerLeft, |
|||
child: new Text( |
|||
type == ETransfrom.Position ? "Position" : |
|||
type == ETransfrom.Rotation ? "Rotation" : "Scale", |
|||
style: new TextStyle(fontSize: 16.0f) |
|||
) |
|||
) |
|||
), |
|||
new Row( |
|||
children: new List<Widget> { |
|||
new Flexible( |
|||
flex: 8, |
|||
child: new Container( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xfff5f5f5)), |
|||
child: new TextField( |
|||
decoration: new InputDecoration( |
|||
border: new UnderlineInputBorder(), |
|||
contentPadding: |
|||
EdgeInsets.symmetric( |
|||
horizontal: 10f, vertical: 5f), |
|||
labelText: "X" |
|||
), |
|||
controller: xValueController, |
|||
onChanged: hasRef |
|||
? (str) => { |
|||
// While the TextField value changed, try to parse and assign to transformRef.
|
|||
this.setState(() => { |
|||
float result = 0; |
|||
float.TryParse(str, out result); |
|||
if (str == "" || str[0] == '0') { |
|||
this.oldCursorPosition = 1; |
|||
} |
|||
else { |
|||
this.oldCursorPosition = |
|||
xValueController.selection.startPos.offset; |
|||
} |
|||
|
|||
switch (type) { |
|||
case ETransfrom.Position: |
|||
var newPos = this.transformRef.position; |
|||
newPos.x = result; |
|||
this.transformRef.position = newPos; |
|||
break; |
|||
case ETransfrom.Rotation: |
|||
var newRot = this.transformRef.localEulerAngles; |
|||
newRot.x = result; |
|||
this.transformRef.localEulerAngles = newRot; |
|||
break; |
|||
case ETransfrom.Scale: |
|||
var newScale = this.transformRef.localScale; |
|||
newScale.x = result; |
|||
this.transformRef.localScale = newScale; |
|||
break; |
|||
} |
|||
}); |
|||
} |
|||
: (ValueChanged<string>) null |
|||
) |
|||
)), |
|||
new Flexible( |
|||
child: new Container() |
|||
), |
|||
new Flexible( |
|||
flex: 8, |
|||
child: new Container( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xfff5f5f5)), |
|||
child: new TextField( |
|||
decoration: new InputDecoration( |
|||
border: new UnderlineInputBorder(), |
|||
contentPadding: |
|||
EdgeInsets.symmetric( |
|||
horizontal: 10f, vertical: 5f), |
|||
labelText: "Y" |
|||
), |
|||
controller: yValueController, |
|||
onChanged: hasRef |
|||
? (str) => { |
|||
this.setState(() => { |
|||
float result = 0; |
|||
float.TryParse(str, out result); |
|||
if (str == "" || str[0] == '0') { |
|||
this.oldCursorPosition = 1; |
|||
} |
|||
else { |
|||
this.oldCursorPosition = |
|||
yValueController.selection.startPos.offset; |
|||
} |
|||
|
|||
switch (type) { |
|||
case ETransfrom.Position: |
|||
var newPos = this.transformRef.position; |
|||
newPos.y = result; |
|||
this.transformRef.position = newPos; |
|||
break; |
|||
case ETransfrom.Rotation: |
|||
var newRot = this.transformRef.localEulerAngles; |
|||
newRot.y = result; |
|||
this.transformRef.localEulerAngles = newRot; |
|||
break; |
|||
case ETransfrom.Scale: |
|||
var newScale = this.transformRef.localScale; |
|||
newScale.y = result; |
|||
this.transformRef.localScale = newScale; |
|||
break; |
|||
} |
|||
}); |
|||
} |
|||
: (ValueChanged<string>) null |
|||
) |
|||
)), |
|||
new Flexible( |
|||
child: new Container() |
|||
), |
|||
new Flexible( |
|||
flex: 8, |
|||
child: new Container( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xfff5f5f5)), |
|||
child: new TextField( |
|||
decoration: new InputDecoration( |
|||
border: new UnderlineInputBorder(), |
|||
contentPadding: |
|||
EdgeInsets.symmetric( |
|||
horizontal: 10f, vertical: 5f), |
|||
labelText: "Z" |
|||
), |
|||
controller: zValueController, |
|||
onChanged: hasRef |
|||
? (str) => { |
|||
this.setState(() => { |
|||
float result = 0; |
|||
float.TryParse(str, out result); |
|||
if (str == "" || str[0] == '0') { |
|||
this.oldCursorPosition = 1; |
|||
} |
|||
else { |
|||
this.oldCursorPosition = |
|||
zValueController.selection.startPos.offset; |
|||
} |
|||
|
|||
switch (type) { |
|||
case ETransfrom.Position: |
|||
var newPos = this.transformRef.position; |
|||
newPos.z = result; |
|||
this.transformRef.position = newPos; |
|||
break; |
|||
case ETransfrom.Rotation: |
|||
var newRot = this.transformRef.localEulerAngles; |
|||
newRot.z = result; |
|||
this.transformRef.localEulerAngles = newRot; |
|||
break; |
|||
case ETransfrom.Scale: |
|||
var newScale = this.transformRef.localScale; |
|||
newScale.z = result; |
|||
this.transformRef.localScale = newScale; |
|||
break; |
|||
} |
|||
}); |
|||
} |
|||
: (ValueChanged<string>) null |
|||
) |
|||
)) |
|||
} |
|||
) |
|||
} |
|||
); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Theme( |
|||
data: new ThemeData( |
|||
appBarTheme: new AppBarTheme( |
|||
color: Colors.purple |
|||
), |
|||
cardTheme: new CardTheme( |
|||
color: Colors.white, |
|||
elevation: 2.0f |
|||
) |
|||
), |
|||
child: new Scaffold( |
|||
appBar: new AppBar(title: new Text("Custom Inspector")), |
|||
body: new ListView( |
|||
children: new List<Widget> { |
|||
new Card( |
|||
clipBehavior: Clip.antiAlias, |
|||
margin: EdgeInsets.all(20.0f), |
|||
shape: new RoundedRectangleBorder( |
|||
borderRadius: BorderRadius.circular(20.0f) |
|||
), |
|||
child: new Container( |
|||
padding: EdgeInsets.symmetric(vertical: 20f, horizontal: 10f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new UnityObjectDetector( |
|||
// When receiving a GameObject, get its transfrom.
|
|||
onRelease: (details) => { |
|||
this.setState(() => { |
|||
var gameObj = details.objectReferences[0] as GameObject; |
|||
if (gameObj) { |
|||
this.objectRef = gameObj; |
|||
if (this.objectRef) { |
|||
this.transformRef = this.objectRef.transform; |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
child: new ListTile( |
|||
title: new Text( |
|||
this.objectRef == null ? "Object Name" : this.objectRef.name, |
|||
style: new TextStyle(fontSize: 28.0f)), |
|||
subtitle: new Text("Drag an object here", |
|||
style: new TextStyle(fontSize: 16.0f)), |
|||
contentPadding: EdgeInsets.symmetric(horizontal: 10f) |
|||
) |
|||
), |
|||
new Card( |
|||
clipBehavior: Clip.antiAlias, |
|||
shape: new RoundedRectangleBorder( |
|||
borderRadius: BorderRadius.circular(20.0f) |
|||
), |
|||
child: new Container( |
|||
padding: EdgeInsets.symmetric(horizontal: 10.0f), |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
padding: EdgeInsets.only(top: 20f), |
|||
child: new Align( |
|||
alignment: Alignment.centerLeft, |
|||
child: new Text("Transform", |
|||
style: new TextStyle(fontSize: 20.0f)) |
|||
) |
|||
), |
|||
this.getCardRow(ETransfrom.Position, |
|||
this.objectRef != null), |
|||
this.getCardRow(ETransfrom.Rotation, |
|||
this.objectRef != null), |
|||
this.getCardRow(ETransfrom.Scale, this.objectRef != null), |
|||
new Container(padding: EdgeInsets.only(bottom: 20f)) |
|||
} |
|||
) |
|||
) |
|||
), |
|||
} |
|||
) |
|||
) |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5978da8ac1ccd4638bfe3d8425443807 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgetsSample.DragNDrop { |
|||
public class UnityObjectDetectorSample : UIWidgetsEditorWindow { |
|||
[MenuItem("UIWidgetsTests/Drag&Drop/UnityObject Detector")] |
|||
public static void ShowEditorWindow() { |
|||
var window = GetWindow<UnityObjectDetectorSample>(); |
|||
window.titleContent.text = "UnityObject Detector Sample"; |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
Debug.Log("[ WIDGET RECREATED ]"); |
|||
return new WidgetsApp( |
|||
home: new UnityObjectDetectorSampleWidget(), |
|||
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => |
|||
new PageRouteBuilder( |
|||
settings: settings, |
|||
pageBuilder: (BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation) => builder(context) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class UnityObjectDetectorSampleWidget : StatefulWidget { |
|||
public UnityObjectDetectorSampleWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new UnityObjectDetectorSampleWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class UnityObjectDetectorSampleWidgetState : State<UnityObjectDetectorSampleWidget> { |
|||
readonly Color highlightColor = Color.fromARGB(255, 88, 127, 219); |
|||
readonly Color defaultColor = Color.fromARGB(255, 211, 211, 211); |
|||
readonly List<bool> isHighlighted = new List<bool> { }; |
|||
readonly List<Object[]> objects = new List<Object[]>(); |
|||
|
|||
List<Widget> getUnityObjectDetectorList(int count) { |
|||
if (this.isHighlighted.isEmpty()) { |
|||
for (int i = 0; i < count; i++) { |
|||
this.isHighlighted.Add(false); |
|||
} |
|||
} |
|||
|
|||
if (this.objects.isEmpty()) { |
|||
for (int i = 0; i < count; i++) { |
|||
this.objects.Add(null); |
|||
} |
|||
} |
|||
|
|||
List<Widget> widgetList = new List<Widget>(); |
|||
widgetList.Add(this.getGapBox("Generated List with UnityObjectDetector")); |
|||
|
|||
for (int i = 0; i < count; i++) { |
|||
var _i = i; |
|||
|
|||
Widget widget = new Container( |
|||
decoration: this.isHighlighted[_i] |
|||
? new BoxDecoration(color: this.highlightColor) |
|||
: new BoxDecoration(color: this.defaultColor), |
|||
height: 100f, |
|||
child: new UnityObjectDetector( |
|||
onEnter: () => { |
|||
Debug.Log("Widget " + _i + " onEnter"); |
|||
this.setState(() => { this.isHighlighted[_i] = true; }); |
|||
}, |
|||
onRelease: (details) => { |
|||
Debug.Log("Widget " + _i + " onRelease"); |
|||
this.setState(() => { |
|||
this.isHighlighted[_i] = false; |
|||
this.objects[_i] = details.objectReferences; |
|||
}); |
|||
}, |
|||
onExit: () => { |
|||
Debug.Log("Widget " + _i + " onExit"); |
|||
this.setState(() => { this.isHighlighted[_i] = false; }); |
|||
}, |
|||
child: new Center( |
|||
child: new Text(this.objects[_i] != null |
|||
? this.getNameString(this.objects[_i]) |
|||
: "[Drop/Multi-Drop Here]") |
|||
) |
|||
) |
|||
); |
|||
|
|||
widgetList.Add(widget); |
|||
if (_i != count - 1) { |
|||
widgetList.Add(this.getGapBox()); |
|||
} |
|||
} |
|||
|
|||
return widgetList; |
|||
} |
|||
|
|||
string getNameString(Object[] objs) { |
|||
var str = ""; |
|||
for (int i = 0; i < objs.Length; i++) { |
|||
str += "[" + objs[i].name + "]"; |
|||
if (i != objs.Length - 1) { |
|||
str += "\n"; |
|||
} |
|||
} |
|||
|
|||
return str; |
|||
} |
|||
|
|||
Widget getGapBox(string str = "") { |
|||
return new Container( |
|||
height: 25, |
|||
child: str == "" |
|||
? null |
|||
: new Center( |
|||
child: new Text(str) |
|||
) |
|||
); |
|||
} |
|||
|
|||
bool highlight; |
|||
Object[] objRef; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
var columnList = new List<Widget>(); |
|||
|
|||
columnList.Add(this.getGapBox()); |
|||
columnList.AddRange(this.getUnityObjectDetectorList(3)); |
|||
columnList.AddRange( |
|||
new List<Widget> { |
|||
this.getGapBox("With Listener"), |
|||
new Container( |
|||
decoration: this.highlight |
|||
? new BoxDecoration(color: this.highlightColor) |
|||
: new BoxDecoration(color: this.defaultColor), |
|||
height: 100f, |
|||
child: new Listener( |
|||
onPointerDragFromEditorEnter: (evt) => { this.setState(() => { this.highlight = true; }); }, |
|||
onPointerDragFromEditorExit: (evt) => { this.setState(() => { this.highlight = false; }); }, |
|||
// onPointerDragFromEditorHover: (evt) => { },
|
|||
onPointerDragFromEditorRelease: (evt) => { |
|||
this.objRef = evt.objectReferences; |
|||
this.setState(() => { this.highlight = false; }); |
|||
}, |
|||
child: new Center( |
|||
child: new Text(this.objRef != null |
|||
? this.getNameString(this.objRef) |
|||
: "[Drop/Multi-Drop Here]") |
|||
) |
|||
) |
|||
) |
|||
} |
|||
); |
|||
|
|||
return new Container( |
|||
padding: EdgeInsets.symmetric(horizontal: 25f), |
|||
color: Colors.grey, |
|||
child: new ListView( |
|||
children: columnList |
|||
)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2948179a390a944a9a44b7f86cfa3c57 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class EditableTextWiget : EditorWindow { |
|||
WindowAdapter windowAdapter; |
|||
|
|||
Widget root; |
|||
|
|||
Widget image; |
|||
|
|||
[MenuItem("UIWidgetsTests/EditableTextWidget")] |
|||
public static void renderWidgets() { |
|||
GetWindow(typeof(EditableTextWiget)); |
|||
} |
|||
|
|||
string txt = "Hello\n" + |
|||
"This is useful when you need to check if a certain key has been pressed - possibly with modifiers. The syntax for the key string\n" + |
|||
"asfsd \n" + |
|||
"P1:\n" + |
|||
"This is useful when you need to check if a certain key has been pressed - possibly with modifiers.The syntax for the key st\n" + |
|||
"\n" + |
|||
"\n" + |
|||
"\n" + |
|||
"\n" + |
|||
" sfsafd"; |
|||
|
|||
EditableTextWiget() { |
|||
} |
|||
|
|||
void OnGUI() { |
|||
this.windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
void Update() { |
|||
this.windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
this.windowAdapter = new EditorWindowAdapter(this); |
|||
this.windowAdapter.OnEnable(); |
|||
this.root = new Container( |
|||
width: 200, |
|||
height: 200, |
|||
margin: EdgeInsets.all(30.0f), |
|||
padding: EdgeInsets.all(15.0f), |
|||
color: Color.fromARGB(255, 244, 190, 85), |
|||
child: new EditableText( |
|||
maxLines: 100, |
|||
selectionControls: MaterialUtils.materialTextSelectionControls, |
|||
controller: new TextEditingController(this.txt), |
|||
focusNode: new FocusNode(), |
|||
style: new TextStyle(), |
|||
selectionColor: Color.fromARGB(255, 255, 0, 0), |
|||
cursorColor: Color.fromARGB(255, 0, 0, 0) |
|||
) |
|||
); |
|||
this.windowAdapter.attachRootWidget(() => new WidgetsApp(home: this.root, |
|||
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => |
|||
new PageRouteBuilder( |
|||
settings: settings, |
|||
pageBuilder: (BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation) => builder(context) |
|||
))); |
|||
this.titleContent = new GUIContent("EditableTextWidget"); |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this.windowAdapter.OnDisable(); |
|||
this.windowAdapter = null; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: be0c47c771a534e24a6a27e7fcc0f97e |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using NUnit.Framework; |
|||
using UnityEngine.TestTools; |
|||
|
|||
class EditorExampleTest { |
|||
[Test] |
|||
public void EditorSampleTestSimplePasses() { |
|||
// Use the Assert class to test conditions.
|
|||
} |
|||
|
|||
// A UnityTest behaves like a coroutine in PlayMode
|
|||
// and allows you to yield null to skip a frame in EditMode
|
|||
[UnityTest] |
|||
public IEnumerator EditorSampleTestWithEnumeratorPasses() { |
|||
// Use the Assert class to test conditions.
|
|||
// yield to skip a frame
|
|||
yield return null; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 296bb7110a92448c1bc8659719a3c33c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/GalleryIcons"), "GalleryIcons"); |
|||
|
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/CupertinoIcons"), "CupertinoIcons"); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Regular"), ".SF Pro Text", FontWeight.w400); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Semibold"), ".SF Pro Text", FontWeight.w600); |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/SF-Pro-Text-Bold"), ".SF Pro Text", FontWeight.w700); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 98f11153c8c804448abe7a050222da98 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class Gestures : EditorWindow { |
|||
readonly Func<RenderBox>[] _options; |
|||
|
|||
readonly string[] _optionStrings; |
|||
|
|||
int _selected; |
|||
|
|||
Gestures() { |
|||
this._options = new Func<RenderBox>[] { |
|||
this.tap, |
|||
}; |
|||
this._optionStrings = this._options.Select(x => x.Method.Name).ToArray(); |
|||
this._selected = 0; |
|||
|
|||
this.titleContent = new GUIContent("Gestures"); |
|||
} |
|||
|
|||
WindowAdapter windowAdapter; |
|||
|
|||
[NonSerialized] bool hasInvoked = false; |
|||
|
|||
void OnGUI() { |
|||
var selected = EditorGUILayout.Popup("test case", this._selected, this._optionStrings); |
|||
if (selected != this._selected || !this.hasInvoked) { |
|||
this._selected = selected; |
|||
this.hasInvoked = true; |
|||
|
|||
var renderBox = this._options[this._selected](); |
|||
if (this.windowAdapter != null) { |
|||
this.windowAdapter.attachRootRenderBox(renderBox); |
|||
} |
|||
} |
|||
|
|||
this.windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
void Update() { |
|||
this.windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
this.windowAdapter = new EditorWindowAdapter(this); |
|||
this.windowAdapter.OnEnable(); |
|||
|
|||
this._tapRecognizer = new TapGestureRecognizer(); |
|||
this._tapRecognizer.onTap = () => { Debug.Log("tap"); }; |
|||
|
|||
this._panRecognizer = new PanGestureRecognizer(); |
|||
this._panRecognizer.onUpdate = (details) => { Debug.Log("onUpdate " + details); }; |
|||
|
|||
this._doubleTapGesture = new DoubleTapGestureRecognizer(); |
|||
this._doubleTapGesture.onDoubleTap = (detail) => { Debug.Log("onDoubleTap"); }; |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this.windowAdapter.OnDisable(); |
|||
this.windowAdapter = null; |
|||
} |
|||
|
|||
TapGestureRecognizer _tapRecognizer; |
|||
|
|||
PanGestureRecognizer _panRecognizer; |
|||
|
|||
DoubleTapGestureRecognizer _doubleTapGesture; |
|||
|
|||
void _handlePointerDown(PointerDownEvent evt) { |
|||
this._tapRecognizer.addPointer(evt); |
|||
this._panRecognizer.addPointer(evt); |
|||
this._doubleTapGesture.addPointer(evt); |
|||
} |
|||
|
|||
RenderBox tap() { |
|||
return new RenderPointerListener( |
|||
onPointerDown: this._handlePointerDown, |
|||
behavior: HitTestBehavior.opaque, |
|||
child: new RenderConstrainedBox( |
|||
additionalConstraints: BoxConstraints.tight(Size.square(100)), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF00FF00) |
|||
) |
|||
)) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a7710fcdc94c940438ce640043508690 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEditor; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public static class Menu { |
|||
[MenuItem("UIWidgetsTests/CanvasAndLayers")] |
|||
public static void canvasAndLayers() { |
|||
EditorWindow.GetWindow(typeof(CanvasAndLayers)); |
|||
} |
|||
|
|||
[MenuItem("UIWidgetsTests/RenderBoxes")] |
|||
public static void renderBoxes() { |
|||
EditorWindow.GetWindow(typeof(RenderBoxes)); |
|||
} |
|||
|
|||
[MenuItem("UIWidgetsTests/RenderParagraph")] |
|||
public static void renderRenderParagraph() { |
|||
EditorWindow.GetWindow(typeof(Paragraph)); |
|||
} |
|||
|
|||
[MenuItem("UIWidgetsTests/Gestures")] |
|||
public static void gestures() { |
|||
EditorWindow.GetWindow(typeof(Gestures)); |
|||
} |
|||
|
|||
[MenuItem("UIWidgetsTests/RenderEditable")] |
|||
public static void renderEditable() { |
|||
EditorWindow.GetWindow(typeof(RenderEditable)); |
|||
} |
|||
|
|||
[MenuItem("UIWidgetsTests/Widgets")] |
|||
public static void renderWidgets() { |
|||
EditorWindow.GetWindow(typeof(Widgets)); |
|||
} |
|||
|
|||
//These samples are not available after Unity2019.1
|
|||
/* |
|||
[MenuItem("UIWidgetsTests/Show SceneViewTests")] |
|||
public static void showSceneView() { |
|||
SceneViewTests.show(); |
|||
} |
|||
|
|||
[MenuItem("UIWidgetsTests/Hide SceneViewTests")] |
|||
public static void hideSceneView() { |
|||
SceneViewTests.hide(); |
|||
}*/ |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 07a2dca2a47d240e8aa2ce8d1f334972 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class MouseHoverWidget : StatefulWidget { |
|||
public MouseHoverWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _MouseHoverWidgetState(); |
|||
} |
|||
} |
|||
|
|||
class _MouseHoverWidgetState : State<MouseHoverWidget> { |
|||
public static Widget createRow(bool canHover = true, bool nest = false) { |
|||
Widget result = new Container(width: 200, height: 60, color: Color.fromARGB(255, 255, 0, 255)); |
|||
if (canHover) { |
|||
result = new HoverTrackWidget(null, |
|||
result, "inner"); |
|||
} |
|||
|
|||
//WARNING: nested MouseTracker is not supported by the current implementation that ported from flutter
|
|||
//refer to this issue https://github.com/flutter/flutter/issues/28407 and wait Google guys fixing it
|
|||
/* |
|||
if (nest) { |
|||
result = new Container(child: result, padding: EdgeInsets.all(40), |
|||
color: Color.fromARGB(255, 255, 0, 0)); |
|||
result = new HoverTrackWidget(null, |
|||
result, "outer"); |
|||
} |
|||
*/ |
|||
|
|||
return result; |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
//1 131231
|
|||
return new Container( |
|||
alignment: Alignment.center, color: Color.fromARGB(255, 0, 255, 0), |
|||
child: new Column( |
|||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|||
children: new List<Widget> { |
|||
createRow(), |
|||
createRow(false), |
|||
createRow(), |
|||
createRow(true, true), |
|||
})); |
|||
} |
|||
} |
|||
|
|||
public class HoverTrackWidget : StatefulWidget { |
|||
public readonly Widget child; |
|||
public readonly string name; |
|||
|
|||
public HoverTrackWidget(Key key, Widget child, string name) : base(key) { |
|||
this.child = child; |
|||
this.name = name; |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _HoverTrackWidgetState(); |
|||
} |
|||
} |
|||
|
|||
class _HoverTrackWidgetState : State<HoverTrackWidget> { |
|||
bool hover; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Listener(child: |
|||
new Container( |
|||
forgroundDecoration: this.hover |
|||
? new BoxDecoration(color: Color.fromARGB(80, 255, 255, 255)) |
|||
: null, |
|||
child: this.widget.child |
|||
), |
|||
onPointerEnter: (evt) => { |
|||
if (this.mounted) { |
|||
Debug.Log(this.widget.name + " pointer enter"); |
|||
this.setState(() => { this.hover = true; }); |
|||
} |
|||
}, |
|||
onPointerExit: (evt) => { |
|||
if (this.mounted) { |
|||
Debug.Log(this.widget.name + " pointer exit"); |
|||
this.setState(() => { this.hover = false; }); |
|||
} |
|||
} |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b9842186b0d0f4bcf9f8db188333094f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using FontStyle = Unity.UIWidgets.ui.FontStyle; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class Paragraph : EditorWindow { |
|||
readonly Func<RenderBox>[] _options; |
|||
|
|||
readonly string[] _optionStrings; |
|||
|
|||
int _selected; |
|||
|
|||
Paragraph() { |
|||
this._options = new Func<RenderBox>[] { |
|||
this.text, |
|||
this.textHeight, |
|||
this.textOverflow, |
|||
this.textAlign, |
|||
this.textDecoration, |
|||
}; |
|||
this._optionStrings = this._options.Select(x => x.Method.Name).ToArray(); |
|||
this._selected = 0; |
|||
|
|||
this.titleContent = new GUIContent("RenderParagraph"); |
|||
} |
|||
|
|||
WindowAdapter windowAdapter; |
|||
|
|||
[NonSerialized] bool hasInvoked = false; |
|||
|
|||
void OnGUI() { |
|||
var selected = EditorGUILayout.Popup("test case", this._selected, this._optionStrings); |
|||
if (selected != this._selected || !this.hasInvoked) { |
|||
this._selected = selected; |
|||
this.hasInvoked = true; |
|||
|
|||
var renderBox = this._options[this._selected](); |
|||
this.windowAdapter.attachRootRenderBox(renderBox); |
|||
} |
|||
|
|||
this.windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
void Update() { |
|||
this.windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
this.windowAdapter = new EditorWindowAdapter(this); |
|||
this.windowAdapter.OnEnable(); |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this.windowAdapter.OnDisable(); |
|||
this.windowAdapter = null; |
|||
} |
|||
|
|||
RenderBox none() { |
|||
return null; |
|||
} |
|||
|
|||
RenderBox box(RenderParagraph p, int width = 200, int height = 600) { |
|||
return new RenderConstrainedOverflowBox( |
|||
minWidth: width, |
|||
maxWidth: width, |
|||
minHeight: height, |
|||
maxHeight: height, |
|||
alignment: Alignment.center, |
|||
child: p |
|||
); |
|||
} |
|||
|
|||
RenderBox flexItemBox(RenderParagraph p, int width = 200, int height = 150) { |
|||
return new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: width, maxWidth: width, minHeight: height, |
|||
maxHeight: height), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFFFFFFFF), |
|||
borderRadius: BorderRadius.all(3), |
|||
border: Border.all(Color.fromARGB(255, 255, 0, 0), 1) |
|||
), |
|||
child: new RenderPadding(EdgeInsets.all(10), p |
|||
) |
|||
)); |
|||
} |
|||
|
|||
RenderBox text() { |
|||
return this.box( |
|||
new RenderParagraph(new TextSpan("", children: |
|||
new List<TextSpan>() { |
|||
new TextSpan("Real-time 3D revolutioni淡粉色的方式地方zes the animation pipeline ", null), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0)), |
|||
text: "for Disney Television Animation's “Baymax Dreams"), |
|||
new TextSpan(" Unity Widgets"), |
|||
new TextSpan(" Text"), |
|||
new TextSpan("Real-time 3D revolutionizes the animation pipeline "), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(125, 255, 0, 0)), |
|||
text: "Transparent Red Text\n\n"), |
|||
new TextSpan(style: new TextStyle(fontWeight: FontWeight.w700), |
|||
text: "Bold Text Test Bold Textfs Test: FontWeight.w70\n\n"), |
|||
new TextSpan(style: new TextStyle(fontStyle: FontStyle.italic), |
|||
text: "This is FontStyle.italic Text This is FontStyle.italic Text\n\n"), |
|||
new TextSpan( |
|||
style: new TextStyle(fontStyle: FontStyle.italic, fontWeight: FontWeight.w700), |
|||
text: |
|||
"This is FontStyle.italic And 发撒放豆腐sad 发生的 Bold Text This is FontStyle.italic And Bold Text\n\n"), |
|||
new TextSpan(style: new TextStyle(fontSize: 18), |
|||
text: "FontSize 18: Get a named matrix value from the shader.\n\n"), |
|||
new TextSpan(style: new TextStyle(fontSize: 24), |
|||
text: "Emoji \ud83d\ude0a\ud83d\ude0b\ud83d\ude0d\ud83d\ude0e\ud83d\ude00"), |
|||
new TextSpan(style: new TextStyle(fontSize: 14), |
|||
text: "Emoji \ud83d\ude0a\ud83d\ude0b\ud83d\ude0d\ud83d\ude0e\ud83d\ude00 Emoji"), |
|||
new TextSpan(style: new TextStyle(fontSize: 18), |
|||
text: "Emoji \ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"), |
|||
new TextSpan(style: new TextStyle(fontSize: 18), |
|||
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"), |
|||
new TextSpan(style: new TextStyle(fontSize: 18), |
|||
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"), |
|||
new TextSpan(style: new TextStyle(fontSize: 18), |
|||
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"), |
|||
new TextSpan(style: new TextStyle(fontSize: 18), |
|||
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"), |
|||
new TextSpan(style: new TextStyle(fontSize: 24), |
|||
text: "Emoji \ud83d\ude06\ud83d\ude1C\ud83d\ude18\ud83d\ude2D\ud83d\ude0C\ud83d\ude1E\n\n"), |
|||
new TextSpan(style: new TextStyle(fontSize: 14), |
|||
text: "FontSize 14"), |
|||
}))); |
|||
} |
|||
|
|||
RenderBox textDecoration() { |
|||
return this.box( |
|||
new RenderParagraph(new TextSpan(style: new TextStyle(height: 1.2f), text: "", children: |
|||
new List<TextSpan>() { |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.underline), |
|||
text: "Real-time 3D revolution\n"), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.underline, decorationStyle: TextDecorationStyle.doubleLine), |
|||
text: "Double line Real-time 3D revolution\n"), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.underline, fontSize: 24), |
|||
text: "Real-time 3D revolution\n"), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.overline), |
|||
text: "Over line Real-time 3D revolution\n"), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.overline, decorationStyle: TextDecorationStyle.doubleLine), |
|||
text: "Over line Real-time 3D revolution\n"), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.lineThrough), |
|||
text: "Line through Real-time 3D revolution\n"), |
|||
new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0), |
|||
decoration: TextDecoration.lineThrough, |
|||
decorationColor: Color.fromARGB(255, 0, 255, 0)), |
|||
text: "Color Line through Real-time 3D revolution\n"), |
|||
})), width: 400); |
|||
} |
|||
|
|||
RenderBox textAlign() { |
|||
var flexbox = new RenderFlex( |
|||
direction: Axis.vertical, |
|||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|||
crossAxisAlignment: CrossAxisAlignment.center); |
|||
var height = 120; |
|||
|
|||
flexbox.add(this.flexItemBox( |
|||
new RenderParagraph(new TextSpan(EditorGUIUtility.pixelsPerPoint.ToString() + |
|||
"Align To Left\nMaterials define how light reacts with the " + |
|||
"surface of a model, and are an essential ingredient in making " + |
|||
"believable visuals. When you’ve created a "), |
|||
textAlign: TextAlign.left), |
|||
height: height |
|||
)); |
|||
flexbox.add(this.flexItemBox( |
|||
new RenderParagraph(new TextSpan(EditorGUIUtility.pixelsPerPoint.ToString() + |
|||
"Align To Rgit\nMaterials define how light reacts with the " + |
|||
"surface of a model, and are an essential ingredient in making " + |
|||
"believable visuals. When you’ve created a "), |
|||
textAlign: TextAlign.right), |
|||
height: height |
|||
)); |
|||
flexbox.add(this.flexItemBox( |
|||
new RenderParagraph(new TextSpan(EditorGUIUtility.pixelsPerPoint.ToString() + |
|||
"Align To Center\nMaterials define how light reacts with the " + |
|||
"surface of a model, and are an essential ingredient in making " + |
|||
"believable visuals. When you’ve created a "), |
|||
textAlign: TextAlign.center), |
|||
height: height |
|||
)); |
|||
flexbox.add(this.flexItemBox( |
|||
new RenderParagraph(new TextSpan("Align To Justify\nMaterials define how light reacts with the " + |
|||
"surface of a model, and are an essential ingredient in making " + |
|||
"believable visuals. When you’ve created a "), |
|||
textAlign: TextAlign.justify), |
|||
height: height |
|||
)); |
|||
return flexbox; |
|||
} |
|||
|
|||
RenderBox textOverflow() { |
|||
return this.box( |
|||
new RenderParagraph(new TextSpan("", children: |
|||
new List<TextSpan>() { |
|||
new TextSpan( |
|||
"Real-time 3D revolutionizes:\n the animation pipeline.\n\n\nrevolutionizesn\n\nReal-time 3D revolutionizes the animation pipeline ", |
|||
null), |
|||
}), maxLines: 3), 200, 80); |
|||
} |
|||
|
|||
RenderBox textHeight() { |
|||
var text = |
|||
"Hello UIWidgets. Real-time 3D revolutionize \nReal-time 3D revolutionize\nReal-time 3D revolutionize\n\n"; |
|||
return this.box( |
|||
new RenderParagraph(new TextSpan(text: "", children: |
|||
new List<TextSpan>() { |
|||
new TextSpan(style: new TextStyle(height: 1), |
|||
text: "Height 1.0 Text:" + text), |
|||
new TextSpan(style: new TextStyle(height: 1.2f), |
|||
text: "Height 1.2 Text:" + text), |
|||
new TextSpan(style: new TextStyle(height: 1.5f), |
|||
text: "Height 1.5 Text:" + text), |
|||
})), width: 300, height: 300); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3a2cc1e9b7e804b2e9f0a580b686488f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class RenderBoxes : EditorWindow { |
|||
readonly Func<RenderBox>[] _options; |
|||
|
|||
readonly string[] _optionStrings; |
|||
|
|||
int _selected; |
|||
|
|||
RenderBoxes() { |
|||
this._options = new Func<RenderBox>[] { |
|||
this.decoratedBox, |
|||
this.decoratedShape, |
|||
this.flex, |
|||
}; |
|||
this._optionStrings = this._options.Select(x => x.Method.Name).ToArray(); |
|||
this._selected = 0; |
|||
|
|||
this.titleContent = new GUIContent("RenderBoxes"); |
|||
} |
|||
|
|||
WindowAdapter windowAdapter; |
|||
|
|||
[NonSerialized] bool hasInvoked = false; |
|||
|
|||
void OnGUI() { |
|||
var selected = EditorGUILayout.Popup("test case", this._selected, this._optionStrings); |
|||
if (selected != this._selected || !this.hasInvoked) { |
|||
this._selected = selected; |
|||
this.hasInvoked = true; |
|||
|
|||
var renderBox = this._options[this._selected](); |
|||
this.windowAdapter.attachRootRenderBox(renderBox); |
|||
} |
|||
|
|||
this.windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
void Update() { |
|||
this.windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
this.windowAdapter = new EditorWindowAdapter(this); |
|||
this.windowAdapter.OnEnable(); |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this.windowAdapter.OnDisable(); |
|||
this.windowAdapter = null; |
|||
} |
|||
|
|||
RenderBox none() { |
|||
return null; |
|||
} |
|||
|
|||
RenderBox decoratedBox() { |
|||
return new RenderConstrainedOverflowBox( |
|||
minWidth: 100, |
|||
maxWidth: 100, |
|||
minHeight: 100, |
|||
maxHeight: 100, |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFFFF00FF), |
|||
borderRadius: BorderRadius.all(15), |
|||
boxShadow: new List<BoxShadow> { |
|||
new BoxShadow( |
|||
color: new Color(0xFFFF00FF), |
|||
offset: new Offset(0, 0), |
|||
blurRadius: 3.0f, |
|||
spreadRadius: 10 |
|||
) |
|||
}, |
|||
image: new DecorationImage( |
|||
image: new NetworkImage( |
|||
url: |
|||
"https://sg.fiverrcdn.com/photos/4665137/original/39322-140411095619534.jpg?1424268945" |
|||
), |
|||
fit: BoxFit.cover) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
RenderBox decoratedShape() { |
|||
return new RenderConstrainedOverflowBox( |
|||
minWidth: 100, |
|||
maxWidth: 100, |
|||
minHeight: 100, |
|||
maxHeight: 100, |
|||
child: new RenderDecoratedBox( |
|||
decoration: new ShapeDecoration( |
|||
color: new Color(0xFFFF00FF), |
|||
shape: new BeveledRectangleBorder( |
|||
new BorderSide(width: 5, color: Color.white), |
|||
BorderRadius.circular(5)), |
|||
image: new DecorationImage( |
|||
image: new NetworkImage( |
|||
url: |
|||
"https://sg.fiverrcdn.com/photos/4665137/original/39322-140411095619534.jpg?1424268945" |
|||
), |
|||
fit: BoxFit.cover) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
|
|||
RenderBox flex() { |
|||
var flexbox = new RenderFlex( |
|||
direction: Axis.horizontal, |
|||
crossAxisAlignment: CrossAxisAlignment.center); |
|||
|
|||
flexbox.add(new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: 300, minHeight: 200), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF00FF00) |
|||
) |
|||
))); |
|||
|
|||
flexbox.add(new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: 100, minHeight: 300), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF00FFFF) |
|||
) |
|||
))); |
|||
|
|||
flexbox.add(new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: 50, minHeight: 100), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF0000FF) |
|||
) |
|||
))); |
|||
|
|||
|
|||
return flexbox; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5bfb809078f1b448e970bf4ba4dadef2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using RSG; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class RenderEditable : EditorWindow, TextSelectionDelegate { |
|||
readonly Func<RenderBox>[] _options; |
|||
|
|||
readonly string[] _optionStrings; |
|||
|
|||
int _selected; |
|||
|
|||
class _FixedViewportOffset : ViewportOffset { |
|||
internal _FixedViewportOffset(float _pixels) { |
|||
this._pixels = _pixels; |
|||
} |
|||
|
|||
internal new static _FixedViewportOffset zero() { |
|||
return new _FixedViewportOffset(0.0f); |
|||
} |
|||
|
|||
float _pixels; |
|||
|
|||
public override float pixels { |
|||
get { return this._pixels; } |
|||
} |
|||
|
|||
public override bool applyViewportDimension(float viewportDimension) { |
|||
return true; |
|||
} |
|||
|
|||
public override bool applyContentDimensions(float minScrollExtent, float maxScrollExtent) { |
|||
return true; |
|||
} |
|||
|
|||
public override void correctBy(float correction) { |
|||
this._pixels += correction; |
|||
} |
|||
|
|||
public override void jumpTo(float pixels) { } |
|||
|
|||
public override IPromise animateTo(float to, TimeSpan duration, Curve curve) { |
|||
return Promise.Resolved(); |
|||
} |
|||
|
|||
public override ScrollDirection userScrollDirection { |
|||
get { return ScrollDirection.idle; } |
|||
} |
|||
|
|||
public override bool allowImplicitScrolling { |
|||
get { return false; } |
|||
} |
|||
} |
|||
|
|||
RenderEditable() { |
|||
this._options = new Func<RenderBox>[] { |
|||
this.textEditable, |
|||
}; |
|||
this._optionStrings = this._options.Select(x => x.Method.Name).ToArray(); |
|||
this._selected = 0; |
|||
this.titleContent = new GUIContent("RenderEditable"); |
|||
} |
|||
|
|||
WindowAdapter windowAdapter; |
|||
|
|||
[NonSerialized] bool hasInvoked = false; |
|||
|
|||
void OnGUI() { |
|||
var selected = EditorGUILayout.Popup("test case", this._selected, this._optionStrings); |
|||
if (selected != this._selected || !this.hasInvoked) { |
|||
this._selected = selected; |
|||
this.hasInvoked = true; |
|||
|
|||
var renderBox = this._options[this._selected](); |
|||
this.windowAdapter.attachRootRenderBox(renderBox); |
|||
} |
|||
|
|||
this.windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
void Update() { |
|||
this.windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
this.windowAdapter = new EditorWindowAdapter(this); |
|||
this.windowAdapter.OnEnable(); |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this.windowAdapter.OnDisable(); |
|||
this.windowAdapter = null; |
|||
} |
|||
|
|||
RenderBox box(RenderBox p, int width = 400, int height = 400) { |
|||
return new RenderConstrainedOverflowBox( |
|||
minWidth: width, |
|||
maxWidth: width, |
|||
minHeight: height, |
|||
maxHeight: height, |
|||
alignment: Alignment.center, |
|||
child: p |
|||
) |
|||
; |
|||
} |
|||
|
|||
RenderBox flexItemBox(RenderBox p, int width = 200, int height = 100) { |
|||
return new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: width, maxWidth: width, minHeight: height, |
|||
maxHeight: height), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFFFFFFFF), |
|||
borderRadius: BorderRadius.all(3), |
|||
border: Border.all(Color.fromARGB(255, 255, 0, 0), 1) |
|||
), |
|||
child: new RenderPadding(EdgeInsets.all(10), p |
|||
) |
|||
)); |
|||
} |
|||
|
|||
RenderBox textEditable() { |
|||
var span = new TextSpan("", children: |
|||
new List<TextSpan> { |
|||
new TextSpan( |
|||
"Word Wrap:The ascent of the font is the distance from the baseline to the top line of the font, as defined in the font's original data file.", |
|||
null), |
|||
}, style: new TextStyle(height: 1.0f)); |
|||
|
|||
var flexbox = new RenderFlex( |
|||
direction: Axis.vertical, |
|||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|||
crossAxisAlignment: CrossAxisAlignment.center); |
|||
|
|||
flexbox.add(this.flexItemBox( |
|||
new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr, |
|||
offset: new _FixedViewportOffset(0.0f), showCursor: new ValueNotifier<bool>(true), |
|||
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0), |
|||
maxLines: 100, |
|||
selectionColor: Color.fromARGB(255, 255, 0, 0), |
|||
textSelectionDelegate: this) |
|||
)); |
|||
|
|||
span = new TextSpan("", children: |
|||
new List<TextSpan> { |
|||
new TextSpan( |
|||
"Hard Break:The ascent of the font is the distance\nfrom the baseline to the top \nline of the font,\nas defined in", |
|||
null), |
|||
}, style: new TextStyle(height: 1.0f)); |
|||
flexbox.add(this.flexItemBox( |
|||
new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr, |
|||
offset: new _FixedViewportOffset(0.0f), showCursor: new ValueNotifier<bool>(true), |
|||
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0), |
|||
maxLines: 100, |
|||
selectionColor: Color.fromARGB(255, 255, 0, 0), |
|||
textSelectionDelegate: this) |
|||
)); |
|||
|
|||
span = new TextSpan("", children: |
|||
new List<TextSpan> { |
|||
new TextSpan("Single Line:How to create mixin", null), |
|||
}, style: new TextStyle(height: 1.0f)); |
|||
flexbox.add(this.flexItemBox( |
|||
new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr, |
|||
offset: new _FixedViewportOffset(0.0f), showCursor: new ValueNotifier<bool>(true), |
|||
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0), |
|||
selectionColor: Color.fromARGB(255, 255, 0, 0), |
|||
textSelectionDelegate: this) |
|||
, width: 300)); |
|||
return flexbox; |
|||
} |
|||
|
|||
|
|||
void selectionChanged(TextSelection selection, Unity.UIWidgets.rendering.RenderEditable renderObject, |
|||
SelectionChangedCause cause) { |
|||
Debug.Log($"selection {selection}"); |
|||
renderObject.selection = selection; |
|||
} |
|||
|
|||
public TextEditingValue textEditingValue { get; set; } |
|||
|
|||
public void hideToolbar() { } |
|||
|
|||
public void bringIntoView(TextPosition textPosition) { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9b0441fd0240f4a1fa3f3df24ba9f0fd |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class SceneViewTests { |
|||
public static void show() { |
|||
onPreSceneGUIDelegate += OnPreSceneGUI; |
|||
#pragma warning disable 0618
|
|||
SceneView.onSceneGUIDelegate += OnSceneGUI; |
|||
#pragma warning restore 0618
|
|||
EditorApplication.update += Update; |
|||
|
|||
SceneView.RepaintAll(); |
|||
|
|||
_options = new Func<Widget>[] { |
|||
none, |
|||
listView, |
|||
eventsPage, |
|||
}; |
|||
_optionStrings = _options.Select(x => x.Method.Name).ToArray(); |
|||
_selected = 0; |
|||
} |
|||
|
|||
public static void hide() { |
|||
onPreSceneGUIDelegate -= OnPreSceneGUI; |
|||
#pragma warning disable 0618
|
|||
SceneView.onSceneGUIDelegate -= OnSceneGUI; |
|||
#pragma warning restore 0618
|
|||
EditorApplication.update -= Update; |
|||
SceneView.RepaintAll(); |
|||
} |
|||
|
|||
#pragma warning disable 0618
|
|||
public static SceneView.OnSceneFunc onPreSceneGUIDelegate { |
|||
get { |
|||
var field = typeof(SceneView).GetField("onPreSceneGUIDelegate", |
|||
BindingFlags.Static | BindingFlags.NonPublic); |
|||
|
|||
return (SceneView.OnSceneFunc) field.GetValue(null); |
|||
} |
|||
|
|||
set { |
|||
var field = typeof(SceneView).GetField("onPreSceneGUIDelegate", |
|||
BindingFlags.Static | BindingFlags.NonPublic); |
|||
|
|||
field.SetValue(null, value); |
|||
} |
|||
} |
|||
#pragma warning restore 0618
|
|||
|
|||
static Func<Widget>[] _options; |
|||
|
|||
static string[] _optionStrings; |
|||
|
|||
static int _selected; |
|||
|
|||
[NonSerialized] static bool hasInvoked = false; |
|||
|
|||
static EventType _lastEventType; |
|||
|
|||
static void OnPreSceneGUI(SceneView sceneView) { |
|||
_lastEventType = Event.current.rawType; |
|||
} |
|||
|
|||
static void OnSceneGUI(SceneView sceneView) { |
|||
//HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
|
|||
Handles.BeginGUI(); |
|||
|
|||
if (windowAdapter == null) { |
|||
windowAdapter = new EditorWindowAdapter(sceneView); |
|||
} |
|||
else if (windowAdapter != null && windowAdapter.editorWindow != sceneView) { |
|||
windowAdapter = new EditorWindowAdapter(sceneView); |
|||
} |
|||
|
|||
var selected = EditorGUILayout.Popup("test case", _selected, _optionStrings); |
|||
if (selected != _selected || !hasInvoked) { |
|||
_selected = selected; |
|||
hasInvoked = true; |
|||
|
|||
var widget = _options[_selected](); |
|||
windowAdapter.attachRootWidget(widget); |
|||
} |
|||
|
|||
if (Event.current.type == EventType.Used) { |
|||
Event.current.type = _lastEventType; |
|||
windowAdapter.OnGUI(); |
|||
Event.current.type = EventType.Used; |
|||
} |
|||
else { |
|||
windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
Handles.EndGUI(); |
|||
} |
|||
|
|||
static void Update() { |
|||
if (windowAdapter != null) { |
|||
windowAdapter.Update(); |
|||
} |
|||
} |
|||
|
|||
static EditorWindowAdapter windowAdapter; |
|||
|
|||
public static Widget none() { |
|||
return null; |
|||
} |
|||
|
|||
public static Widget listView() { |
|||
return ListView.builder( |
|||
itemExtent: 20.0f, |
|||
itemBuilder: (context, index) => { |
|||
return new Container( |
|||
color: Color.fromARGB(255, (index * 10) % 256, (index * 10) % 256, (index * 10) % 256) |
|||
); |
|||
} |
|||
); |
|||
} |
|||
|
|||
public static Widget eventsPage() { |
|||
return new EventsWaterfallScreen(); |
|||
} |
|||
|
|||
public static RenderBox flex() { |
|||
var flexbox = new RenderFlex( |
|||
direction: Axis.horizontal, |
|||
crossAxisAlignment: CrossAxisAlignment.center); |
|||
|
|||
flexbox.add(new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: 300, minHeight: 200), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF00FF00) |
|||
) |
|||
))); |
|||
|
|||
flexbox.add(new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: 100, minHeight: 300), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF00FFFF) |
|||
) |
|||
))); |
|||
|
|||
flexbox.add(new RenderConstrainedBox( |
|||
additionalConstraints: new BoxConstraints(minWidth: 50, minHeight: 100), |
|||
child: new RenderDecoratedBox( |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF0000FF) |
|||
) |
|||
))); |
|||
|
|||
|
|||
return flexbox; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1f47e7bb2c0184a3aa2246fa0d8a89e0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
{ |
|||
"name": "UIWidgetsSample.Editor", |
|||
"references": [ |
|||
"Unity.UIWidgets.Editor", |
|||
"Unity.UIWidgets", |
|||
"UIWidgetsSample", |
|||
"UIWidgetsGallery" |
|||
], |
|||
"optionalUnityReferences": [ |
|||
"TestAssemblies" |
|||
], |
|||
"includePlatforms": [ |
|||
"Editor" |
|||
], |
|||
"excludePlatforms": [], |
|||
"allowUnsafeCode": false, |
|||
"overrideReferences": false, |
|||
"precompiledReferences": [], |
|||
"autoReferenced": true, |
|||
"defineConstraints": [], |
|||
"versionDefines": [] |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 68e123732d7044a35864388f0a17b907 |
|||
AssemblyDefinitionImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using UIWidgets.Tests.demo_charts; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.editor; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Image = Unity.UIWidgets.widgets.Image; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
using Transform = Unity.UIWidgets.widgets.Transform; |
|||
|
|||
namespace UIWidgets.Tests { |
|||
public class Widgets : EditorWindow { |
|||
WindowAdapter windowAdapter; |
|||
|
|||
readonly Func<Widget>[] _options; |
|||
|
|||
readonly string[] _optionStrings; |
|||
|
|||
int _selected; |
|||
|
|||
string localImagePath; |
|||
|
|||
[NonSerialized] bool hasInvoked = false; |
|||
|
|||
public Widgets() { |
|||
this.wantsMouseEnterLeaveWindow = true; |
|||
this.wantsMouseMove = true; |
|||
this._options = new Func<Widget>[] { |
|||
this.localImage, |
|||
this.container, |
|||
this.flexRow, |
|||
this.flexColumn, |
|||
this.containerSimple, |
|||
this.eventsPage, |
|||
this.asPage, |
|||
this.stack, |
|||
this.mouseHover, |
|||
this.charts |
|||
}; |
|||
this._optionStrings = this._options.Select(x => x.Method.Name).ToArray(); |
|||
this._selected = 0; |
|||
|
|||
this.titleContent = new GUIContent("Widgets Test"); |
|||
} |
|||
|
|||
void OnGUI() { |
|||
var selected = EditorGUILayout.Popup("test case", this._selected, this._optionStrings); |
|||
|
|||
// if local image test
|
|||
if (selected == 0) { |
|||
this.localImagePath = EditorGUILayout.TextField(this.localImagePath); |
|||
|
|||
if (this._selected != selected) { |
|||
this._selected = selected; |
|||
this._attachRootWidget(new Container()); |
|||
} |
|||
|
|||
if (GUILayout.Button("loadLocal")) { |
|||
var rootWidget = this._options[this._selected](); |
|||
this._attachRootWidget(rootWidget); |
|||
} |
|||
|
|||
if (GUILayout.Button("loadAsset")) { |
|||
var rootWidget = this.loadAsset(); |
|||
this._attachRootWidget(rootWidget); |
|||
} |
|||
|
|||
if (GUILayout.Button("UnloadUnusedAssets")) { |
|||
Resources.UnloadUnusedAssets(); |
|||
} |
|||
} |
|||
else if (selected != this._selected || !this.hasInvoked) { |
|||
this._selected = selected; |
|||
this.hasInvoked = true; |
|||
|
|||
var rootWidget = this._options[this._selected](); |
|||
|
|||
this._attachRootWidget(rootWidget); |
|||
} |
|||
|
|||
this.windowAdapter.OnGUI(); |
|||
} |
|||
|
|||
void _attachRootWidget(Widget widget) { |
|||
this.windowAdapter.attachRootWidget(() => new WidgetsApp( |
|||
home: widget, |
|||
navigatorKey: GlobalKey<NavigatorState>.key(), |
|||
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => |
|||
new PageRouteBuilder( |
|||
settings: settings, |
|||
pageBuilder: (BuildContext context, Animation<float> animation, |
|||
Animation<float> secondaryAnimation) => builder(context) |
|||
))); |
|||
} |
|||
|
|||
void Update() { |
|||
this.windowAdapter.Update(); |
|||
} |
|||
|
|||
void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
|
|||
this.windowAdapter = new EditorWindowAdapter(this); |
|||
this.windowAdapter.OnEnable(); |
|||
} |
|||
|
|||
void OnDisable() { |
|||
this.windowAdapter.OnDisable(); |
|||
this.windowAdapter = null; |
|||
} |
|||
|
|||
Widget stack() { |
|||
var image = new Container( |
|||
width: 150, |
|||
height: 150, |
|||
child: Image.network( |
|||
"https://tse3.mm.bing.net/th?id=OIP.XOAIpvR1kh-CzISe_Nj9GgHaHs&pid=Api", |
|||
width: 100, |
|||
height: 100 |
|||
) |
|||
); |
|||
var text = new Container( |
|||
width: 150, |
|||
height: 150, |
|||
child: new Text("TTTTTTTTTTTTTTTTEST") |
|||
); |
|||
List<Widget> rowImages = new List<Widget>(); |
|||
rowImages.Add(image); |
|||
rowImages.Add(text); |
|||
return new Stack( |
|||
children: rowImages, |
|||
alignment: Alignment.center |
|||
); |
|||
} |
|||
|
|||
Widget localImage() { |
|||
var image = Image.file(this.localImagePath, |
|||
filterMode: FilterMode.Bilinear |
|||
); |
|||
|
|||
return image; |
|||
} |
|||
|
|||
Widget loadAsset() { |
|||
var image = Image.asset(this.localImagePath, |
|||
filterMode: FilterMode.Bilinear |
|||
); |
|||
|
|||
return image; |
|||
} |
|||
|
|||
Widget flexRow() { |
|||
var image = Image.network( |
|||
"https://tse3.mm.bing.net/th?id=OIP.XOAIpvR1kh-CzISe_Nj9GgHaHs&pid=Api", |
|||
width: 100, |
|||
height: 100 |
|||
); |
|||
List<Widget> rowImages = new List<Widget>(); |
|||
rowImages.Add(image); |
|||
rowImages.Add(image); |
|||
rowImages.Add(image); |
|||
rowImages.Add(image); |
|||
|
|||
var row = new Row( |
|||
textDirection: null, |
|||
textBaseline: null, |
|||
key: null, |
|||
mainAxisAlignment: MainAxisAlignment.start, |
|||
mainAxisSize: MainAxisSize.max, |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
verticalDirection: VerticalDirection.down, |
|||
children: rowImages |
|||
); |
|||
|
|||
return row; |
|||
} |
|||
|
|||
Widget flexColumn() { |
|||
var image = Image.network( |
|||
"https://tse3.mm.bing.net/th?id=OIP.XOAIpvR1kh-CzISe_Nj9GgHaHs&pid=Api", |
|||
width: 100, |
|||
height: 100 |
|||
); |
|||
List<Widget> columnImages = new List<Widget>(); |
|||
columnImages.Add(image); |
|||
columnImages.Add(image); |
|||
columnImages.Add(image); |
|||
|
|||
var column = new Column( |
|||
textDirection: null, |
|||
textBaseline: null, |
|||
key: null, |
|||
mainAxisAlignment: MainAxisAlignment.start, |
|||
mainAxisSize: MainAxisSize.max, |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
verticalDirection: VerticalDirection.down, |
|||
children: columnImages |
|||
); |
|||
|
|||
return column; |
|||
} |
|||
|
|||
Widget container() { |
|||
var image = Image.network( |
|||
"https://tse3.mm.bing.net/th?id=OIP.XOAIpvR1kh-CzISe_Nj9GgHaHs&pid=Api", |
|||
width: 100, |
|||
height: 100, |
|||
repeat: ImageRepeat.repeatX |
|||
); |
|||
var container = new Container( |
|||
width: 200, |
|||
height: 200, |
|||
margin: EdgeInsets.all(30.0f), |
|||
padding: EdgeInsets.all(15.0f), |
|||
child: image, |
|||
decoration: new BoxDecoration( |
|||
color: CLColors.white, |
|||
borderRadius: BorderRadius.all(30), |
|||
gradient: new LinearGradient(colors: new List<Color> {CLColors.blue, CLColors.red, CLColors.green}) |
|||
) |
|||
); |
|||
|
|||
return container; |
|||
} |
|||
|
|||
Widget containerSimple() { |
|||
var container = new Container( |
|||
alignment: Alignment.centerRight, |
|||
color: Color.fromARGB(255, 244, 190, 85), |
|||
child: new Container( |
|||
width: 120, |
|||
height: 120, |
|||
color: Color.fromARGB(255, 255, 0, 85) |
|||
) |
|||
); |
|||
|
|||
return container; |
|||
} |
|||
|
|||
Widget eventsPage() { |
|||
return new EventsWaterfallScreen(); |
|||
} |
|||
|
|||
Widget asPage() { |
|||
return new AsScreen(); |
|||
} |
|||
|
|||
Widget mouseHover() { |
|||
return new MouseHoverWidget(); |
|||
} |
|||
|
|||
Widget charts() { |
|||
return new ChartPage(); |
|||
} |
|||
} |
|||
|
|||
|
|||
public class AsScreen : StatefulWidget { |
|||
public AsScreen(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _AsScreenState(); |
|||
} |
|||
} |
|||
|
|||
class _AsScreenState : State<AsScreen> { |
|||
const float headerHeight = 50.0f; |
|||
|
|||
Widget _buildHeader(BuildContext context) { |
|||
var container = new Container( |
|||
padding: EdgeInsets.only(left: 16.0f, right: 8.0f), |
|||
height: headerHeight, |
|||
color: CLColors.header, |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
child: new Text( |
|||
"All Assets", |
|||
style: new TextStyle( |
|||
fontSize: 16, |
|||
color: Color.fromARGB(100, 255, 255, 0) |
|||
) |
|||
) |
|||
), |
|||
new CustomButton( |
|||
padding: EdgeInsets.only(0.0f, 0.0f, 16.0f, 0.0f), |
|||
child: new Icon( |
|||
Icons.keyboard_arrow_down, |
|||
size: 18.0f, |
|||
color: CLColors.icon2 |
|||
) |
|||
), |
|||
new Container( |
|||
decoration: new BoxDecoration( |
|||
color: CLColors.white, |
|||
borderRadius: BorderRadius.all(3) |
|||
), |
|||
width: 320, |
|||
height: 36, |
|||
padding: EdgeInsets.all(10.0f), |
|||
margin: EdgeInsets.only(right: 4), |
|||
child: new EditableText( |
|||
maxLines: 1, |
|||
selectionControls: MaterialUtils.materialTextSelectionControls, |
|||
controller: new TextEditingController("Type here to search assets"), |
|||
focusNode: new FocusNode(), |
|||
style: new TextStyle( |
|||
fontSize: 16 |
|||
), |
|||
selectionColor: Color.fromARGB(255, 255, 0, 0), |
|||
cursorColor: Color.fromARGB(255, 0, 0, 0) |
|||
) |
|||
), |
|||
new Container( |
|||
decoration: new BoxDecoration( |
|||
color: CLColors.background4, |
|||
borderRadius: BorderRadius.all(2) |
|||
), |
|||
width: 36, |
|||
height: 36, |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new CustomButton( |
|||
padding: EdgeInsets.only(8.0f, 0.0f, 8.0f, 0.0f), |
|||
child: new Icon( |
|||
Icons.search, |
|||
size: 18.0f, |
|||
color: CLColors.white |
|||
) |
|||
) |
|||
} |
|||
) |
|||
), |
|||
new Container( |
|||
margin: EdgeInsets.only(left: 16, right: 16), |
|||
child: new Text( |
|||
"Learn Game Development", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.white |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
decoration: new BoxDecoration( |
|||
border: Border.all( |
|||
color: CLColors.white |
|||
) |
|||
), |
|||
margin: EdgeInsets.only(right: 16), |
|||
padding: EdgeInsets.all(4), |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Text( |
|||
"Plus/Pro", |
|||
style: new TextStyle( |
|||
fontSize: 11, |
|||
color: CLColors.white |
|||
) |
|||
) |
|||
} |
|||
) |
|||
), |
|||
new Container( |
|||
margin: EdgeInsets.only(right: 16), |
|||
child: new Text( |
|||
"Impressive New Assets", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.white |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
child: new Text( |
|||
"Shop On Old Store", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.white |
|||
) |
|||
) |
|||
), |
|||
} |
|||
) |
|||
); |
|||
|
|||
return container; |
|||
} |
|||
|
|||
Widget _buildFooter(BuildContext context) { |
|||
return new Container( |
|||
color: CLColors.header, |
|||
margin: EdgeInsets.only(top: 50), |
|||
height: 90, |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
margin: EdgeInsets.only(right: 10), |
|||
child: new Text( |
|||
"Copyright © 2018 Unity Technologies", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.text9 |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
margin: EdgeInsets.only(right: 10), |
|||
child: new Text( |
|||
"All prices are exclusive of tax", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.text9 |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
margin: EdgeInsets.only(right: 10), |
|||
child: new Text( |
|||
"Terms of Service and EULA", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.text10 |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
child: new Text( |
|||
"Cookies", |
|||
style: new TextStyle( |
|||
fontSize: 12, |
|||
color: CLColors.text10 |
|||
) |
|||
) |
|||
), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
|
|||
Widget _buildBanner(BuildContext context) { |
|||
return new Container( |
|||
height: 450, |
|||
color: CLColors.white, |
|||
child: Image.network( |
|||
"https://assetstorev1-prd-cdn.unity3d.com/banner/9716cc07-748c-43cc-8809-10113119c97a.jpg", |
|||
fit: BoxFit.cover, |
|||
filterMode: FilterMode.Bilinear |
|||
) |
|||
); |
|||
} |
|||
|
|||
Widget _buildTopAssetsRow(BuildContext context, string title) { |
|||
var testCard = new AssetCard( |
|||
"AI Template", |
|||
"INVECTOR", |
|||
45.0f, |
|||
36.0f, |
|||
true, |
|||
"https://assetstorev1-prd-cdn.unity3d.com/key-image/76a549ae-de17-4536-bd96-4231ed20dece.jpg" |
|||
); |
|||
return new Container( |
|||
margin: EdgeInsets.only(left: 98), |
|||
child: new Column( |
|||
children: new List<Widget> { |
|||
new Container( |
|||
child: new Container( |
|||
margin: EdgeInsets.only(top: 50, bottom: 20), |
|||
child: new Row( |
|||
crossAxisAlignment: CrossAxisAlignment.baseline, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
child: new Text( |
|||
title, |
|||
style: new TextStyle( |
|||
fontSize: 24, |
|||
color: CLColors.black |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
margin: EdgeInsets.only(left: 15), |
|||
child: |
|||
new Text( |
|||
"See More", |
|||
style: new TextStyle( |
|||
fontSize: 16, |
|||
color: CLColors.text4 |
|||
) |
|||
) |
|||
) |
|||
}) |
|||
) |
|||
), |
|||
new Row( |
|||
children: new List<Widget> { |
|||
testCard, |
|||
testCard, |
|||
testCard, |
|||
testCard, |
|||
testCard, |
|||
testCard |
|||
} |
|||
) |
|||
} |
|||
)); |
|||
} |
|||
|
|||
bool _onNotification(ScrollNotification notification, BuildContext context) { |
|||
return true; |
|||
} |
|||
|
|||
Widget _buildContentList(BuildContext context) { |
|||
return new NotificationListener<ScrollNotification>( |
|||
onNotification: (ScrollNotification notification) => { |
|||
this._onNotification(notification, context); |
|||
return true; |
|||
}, |
|||
child: new Flexible( |
|||
child: new ListView( |
|||
physics: new AlwaysScrollableScrollPhysics(), |
|||
children: new List<Widget> { |
|||
this._buildBanner(context), |
|||
this._buildTopAssetsRow(context, "Recommanded For You"), |
|||
this._buildTopAssetsRow(context, "Beach Day"), |
|||
this._buildTopAssetsRow(context, "Top Free Packages"), |
|||
this._buildTopAssetsRow(context, "Top Paid Packages"), |
|||
this._buildFooter(context) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
var mediaQueryData = MediaQuery.of(context); |
|||
var px = mediaQueryData.size.width / 2; |
|||
var py = mediaQueryData.size.width / 2; |
|||
|
|||
var container = new Container( |
|||
color: CLColors.background3, |
|||
child: new Container( |
|||
color: CLColors.background3, |
|||
child: new Transform( |
|||
transform: Matrix3.makeRotate(Mathf.PI / 180 * 5, px, py), |
|||
child: |
|||
new Column( |
|||
children: new List<Widget> { |
|||
this._buildHeader(context), |
|||
this._buildContentList(context), |
|||
} |
|||
) |
|||
) |
|||
) |
|||
); |
|||
|
|||
var stack = new Stack( |
|||
children: new List<Widget> { |
|||
container, |
|||
new Positioned( |
|||
top: 50, |
|||
right: 50, |
|||
child: new BackdropFilter( |
|||
filter: ImageFilter.blur(10, 10), |
|||
child: new Container( |
|||
width: 300, height: 300, |
|||
decoration: new BoxDecoration( |
|||
color: Colors.transparent |
|||
) |
|||
) |
|||
) |
|||
) |
|||
} |
|||
); |
|||
|
|||
return stack; |
|||
} |
|||
} |
|||
|
|||
public class AssetCard : StatelessWidget { |
|||
public AssetCard( |
|||
string name, |
|||
string category, |
|||
float price, |
|||
float priceDiscount, |
|||
bool showBadge, |
|||
string imageSrc |
|||
) { |
|||
this.name = name; |
|||
this.category = category; |
|||
this.price = price; |
|||
this.priceDiscount = priceDiscount; |
|||
this.showBadge = showBadge; |
|||
this.imageSrc = imageSrc; |
|||
} |
|||
|
|||
public readonly string name; |
|||
public readonly string category; |
|||
public readonly float price; |
|||
public readonly float priceDiscount; |
|||
public readonly bool showBadge; |
|||
public readonly string imageSrc; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
var card = new Container( |
|||
margin: EdgeInsets.only(right: 45), |
|||
child: new Container( |
|||
child: new Column( |
|||
children: new List<Widget> { |
|||
new Container( |
|||
decoration: new BoxDecoration( |
|||
color: CLColors.white, |
|||
borderRadius: BorderRadius.only(topLeft: 3, topRight: 3) |
|||
), |
|||
width: 200, |
|||
height: 124, |
|||
child: Image.network( |
|||
this.imageSrc, |
|||
fit: BoxFit.fill |
|||
) |
|||
), |
|||
new Container( |
|||
color: CLColors.white, |
|||
width: 200, |
|||
height: 86, |
|||
padding: EdgeInsets.fromLTRB(14, 12, 14, 8), |
|||
child: new Column( |
|||
crossAxisAlignment: CrossAxisAlignment.baseline, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
height: 18, |
|||
padding: EdgeInsets.only(top: 3), |
|||
child: |
|||
new Text(this.category, |
|||
style: new TextStyle( |
|||
fontSize: 11, |
|||
color: CLColors.text5 |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
height: 20, |
|||
padding: EdgeInsets.only(top: 2), |
|||
child: |
|||
new Text(this.name, |
|||
style: new TextStyle( |
|||
fontSize: 14, |
|||
color: CLColors.text6 |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
height: 22, |
|||
padding: EdgeInsets.only(top: 4), |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
child: new Row( |
|||
children: new List<Widget> { |
|||
new Container( |
|||
margin: EdgeInsets.only(right: 10), |
|||
child: new Text( |
|||
"$" + this.price, |
|||
style: new TextStyle( |
|||
fontSize: 14, |
|||
color: CLColors.text7, |
|||
decoration: TextDecoration.lineThrough |
|||
) |
|||
) |
|||
), |
|||
new Container( |
|||
child: new Text( |
|||
"$" + this.priceDiscount, |
|||
style: new TextStyle( |
|||
fontSize: 14, |
|||
color: CLColors.text8 |
|||
) |
|||
) |
|||
) |
|||
}) |
|||
), |
|||
this.showBadge |
|||
? new Container( |
|||
width: 80, |
|||
height: 18, |
|||
color: CLColors.black, |
|||
child: new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Text( |
|||
"Plus/Pro", |
|||
style: new TextStyle( |
|||
fontSize: 11, |
|||
color: CLColors.white |
|||
) |
|||
) |
|||
} |
|||
) |
|||
) |
|||
: new Container() |
|||
} |
|||
) |
|||
) |
|||
} |
|||
) |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
return card; |
|||
} |
|||
} |
|||
|
|||
public class EventsWaterfallScreen : StatefulWidget { |
|||
public EventsWaterfallScreen(Key key = null) : base(key: key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _EventsWaterfallScreenState(); |
|||
} |
|||
} |
|||
|
|||
class _EventsWaterfallScreenState : State<EventsWaterfallScreen> { |
|||
const float headerHeight = 80.0f; |
|||
|
|||
float _offsetY = 0.0f; |
|||
#pragma warning disable 0414
|
|||
int _index = -1; |
|||
#pragma warning restore 0414
|
|||
|
|||
Widget _buildHeader(BuildContext context) { |
|||
return new Container( |
|||
padding: EdgeInsets.only(left: 16.0f, right: 8.0f), |
|||
// color: CLColors.blue,
|
|||
height: headerHeight - this._offsetY, |
|||
child: new Row( |
|||
children: new List<Widget> { |
|||
new Flexible( |
|||
flex: 1, |
|||
fit: FlexFit.tight, |
|||
child: new Text( |
|||
"Today", |
|||
style: new TextStyle( |
|||
fontSize: (34.0f / headerHeight) * |
|||
(headerHeight - this._offsetY), |
|||
color: CLColors.white |
|||
) |
|||
)), |
|||
new CustomButton( |
|||
padding: EdgeInsets.only(8.0f, 0.0f, 8.0f, 0.0f), |
|||
child: new Icon( |
|||
Icons.notifications, |
|||
size: 18.0f, |
|||
color: CLColors.icon2 |
|||
) |
|||
), |
|||
new CustomButton( |
|||
padding: EdgeInsets.only(8.0f, 0.0f, 16.0f, 0.0f), |
|||
child: new Icon( |
|||
Icons.account_circle, |
|||
size: 18.0f, |
|||
color: CLColors.icon2 |
|||
) |
|||
) |
|||
} |
|||
) |
|||
); |
|||
} |
|||
|
|||
bool _onNotification(ScrollNotification notification, BuildContext context) { |
|||
float pixels = notification.metrics.pixels; |
|||
if (pixels >= 0.0) { |
|||
if (pixels <= headerHeight) { |
|||
this.setState(() => { this._offsetY = pixels / 2.0f; }); |
|||
} |
|||
} |
|||
else { |
|||
if (this._offsetY != 0.0) { |
|||
this.setState(() => { this._offsetY = 0.0f; }); |
|||
} |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
Widget _buildContentList(BuildContext context) { |
|||
return new NotificationListener<ScrollNotification>( |
|||
onNotification: (ScrollNotification notification) => { |
|||
this._onNotification(notification, context); |
|||
return true; |
|||
}, |
|||
child: new Flexible( |
|||
child: new Container( |
|||
// color: CLColors.green,
|
|||
child: ListView.builder( |
|||
itemCount: 20, |
|||
itemExtent: 100, |
|||
physics: new AlwaysScrollableScrollPhysics(), |
|||
itemBuilder: (BuildContext context1, int index) => { |
|||
return new Container( |
|||
color: Color.fromARGB(255, (index * 10) % 256, (index * 20) % 256, |
|||
(index * 30) % 256) |
|||
); |
|||
} |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
var container = new Container( |
|||
// color: CLColors.background1,
|
|||
child: new Container( |
|||
// color: CLColors.background1,
|
|||
child: new Column( |
|||
children: new List<Widget> { |
|||
this._buildHeader(context), |
|||
this._buildContentList(context) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
return container; |
|||
} |
|||
} |
|||
|
|||
public class CustomButton : StatelessWidget { |
|||
public CustomButton( |
|||
Key key = null, |
|||
GestureTapCallback onPressed = null, |
|||
EdgeInsets padding = null, |
|||
Color backgroundColor = null, |
|||
Widget child = null |
|||
) : base(key: key) { |
|||
this.onPressed = onPressed; |
|||
this.padding = padding ?? EdgeInsets.all(8.0f); |
|||
this.backgroundColor = backgroundColor ?? CLColors.transparent; |
|||
this.child = child; |
|||
} |
|||
|
|||
public readonly GestureTapCallback onPressed; |
|||
public readonly EdgeInsets padding; |
|||
public readonly Widget child; |
|||
public readonly Color backgroundColor; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: this.onPressed, |
|||
child: new Container( |
|||
padding: this.padding, |
|||
color: this.backgroundColor, |
|||
child: this.child |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public static class Icons { |
|||
public static readonly IconData notifications = new IconData(0xe7f4, fontFamily: "Material Icons"); |
|||
public static readonly IconData account_circle = new IconData(0xe853, fontFamily: "Material Icons"); |
|||
public static readonly IconData search = new IconData(0xe8b6, fontFamily: "Material Icons"); |
|||
public static readonly IconData keyboard_arrow_down = new IconData(0xe313, fontFamily: "Material Icons"); |
|||
} |
|||
|
|||
public static class CLColors { |
|||
public static readonly Color primary = new Color(0xFFE91E63); |
|||
public static readonly Color secondary1 = new Color(0xFF00BCD4); |
|||
public static readonly Color secondary2 = new Color(0xFFF0513C); |
|||
public static readonly Color background1 = new Color(0xFF292929); |
|||
public static readonly Color background2 = new Color(0xFF383838); |
|||
public static readonly Color background3 = new Color(0xFFF5F5F5); |
|||
public static readonly Color background4 = new Color(0xFF00BCD4); |
|||
public static readonly Color icon1 = new Color(0xFFFFFFFF); |
|||
public static readonly Color icon2 = new Color(0xFFA4A4A4); |
|||
public static readonly Color text1 = new Color(0xFFFFFFFF); |
|||
public static readonly Color text2 = new Color(0xFFD8D8D8); |
|||
public static readonly Color text3 = new Color(0xFF959595); |
|||
public static readonly Color text4 = new Color(0xFF002835); |
|||
public static readonly Color text5 = new Color(0xFF9E9E9E); |
|||
public static readonly Color text6 = new Color(0xFF002835); |
|||
public static readonly Color text7 = new Color(0xFF5A5A5B); |
|||
public static readonly Color text8 = new Color(0xFF239988); |
|||
public static readonly Color text9 = new Color(0xFFB3B5B6); |
|||
public static readonly Color text10 = new Color(0xFF00BCD4); |
|||
public static readonly Color dividingLine1 = new Color(0xFF666666); |
|||
public static readonly Color dividingLine2 = new Color(0xFF404040); |
|||
|
|||
public static readonly Color transparent = new Color(0x00000000); |
|||
public static readonly Color white = new Color(0xFFFFFFFF); |
|||
public static readonly Color black = new Color(0xFF000000); |
|||
public static readonly Color red = new Color(0xFFFF0000); |
|||
public static readonly Color green = new Color(0xFF00FF00); |
|||
public static readonly Color blue = new Color(0xFF0000FF); |
|||
|
|||
public static readonly Color header = new Color(0xFF060B0C); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f4edd5c1fb7ca444cb61994b2f961ae0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 670043f1cb7b9420287d473e7d464b5f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Canvas = Unity.UIWidgets.ui.Canvas; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Rect = Unity.UIWidgets.ui.Rect; |
|||
|
|||
namespace UIWidgets.Tests.demo_charts { |
|||
public class BarChart { |
|||
public BarChart(List<Bar> bars) { |
|||
this.bars = bars; |
|||
} |
|||
|
|||
public static BarChart empty() { |
|||
return new BarChart(new List<Bar>()); |
|||
} |
|||
|
|||
public static BarChart random(Size size) { |
|||
var barWidthFraction = 0.75f; |
|||
var ranks = selectRanks(ColorPalette.primary.length); |
|||
var barCount = ranks.Count; |
|||
var barDistance = size.width / (1 + barCount); |
|||
var barWidth = barDistance * barWidthFraction; |
|||
var startX = barDistance - barWidth / 2; |
|||
var bars = Enumerable.Range(0, barCount).Select(i => new Bar( |
|||
ranks[i], |
|||
startX + i * barDistance, |
|||
barWidth, |
|||
Random.value * size.height, |
|||
ColorPalette.primary[ranks[i]] |
|||
)).ToList(); |
|||
return new BarChart(bars); |
|||
} |
|||
|
|||
static List<int> selectRanks(int cap) { |
|||
var ranks = new List<int>(); |
|||
var rank = 0; |
|||
while (true) { |
|||
if (Random.value < 0.2f) { |
|||
rank++; |
|||
} |
|||
if (cap <= rank) { |
|||
break; |
|||
} |
|||
ranks.Add(rank); |
|||
rank++; |
|||
} |
|||
return ranks; |
|||
} |
|||
|
|||
public readonly List<Bar> bars; |
|||
} |
|||
|
|||
public class BarChartTween : Tween<BarChart> { |
|||
readonly MergeTween<Bar> _barsTween; |
|||
|
|||
public BarChartTween(BarChart begin, BarChart end) : base(begin: begin, end: end) { |
|||
this._barsTween = new MergeTween<Bar>(begin.bars, end.bars); |
|||
} |
|||
|
|||
public override BarChart lerp(float t) { |
|||
return new BarChart(this._barsTween.lerp(t)); |
|||
} |
|||
} |
|||
|
|||
public class Bar : MergeTweenable<Bar> { |
|||
public Bar(int rank, float x, float width, float height, Color color) { |
|||
this.rank = rank; |
|||
this.x = x; |
|||
this.width = width; |
|||
this.height = height; |
|||
this.color = color; |
|||
} |
|||
|
|||
public readonly int rank; |
|||
public readonly float x; |
|||
public readonly float width; |
|||
public readonly float height; |
|||
public readonly Color color; |
|||
|
|||
public Bar empty { |
|||
get { return new Bar(this.rank, this.x, 0.0f, 0.0f, this.color); } |
|||
} |
|||
|
|||
public bool less(Bar other) { |
|||
return this.rank < other.rank; |
|||
} |
|||
|
|||
public Tween<Bar> tweenTo(Bar other) { |
|||
return new BarTween(this, other); |
|||
} |
|||
|
|||
public static Bar lerp(Bar begin, Bar end, float t) { |
|||
D.assert(begin.rank == end.rank); |
|||
return new Bar( |
|||
begin.rank, |
|||
MathUtils.lerpFloat(begin.x, end.x, t), |
|||
MathUtils.lerpFloat(begin.width, end.width, t), |
|||
MathUtils.lerpFloat(begin.height, end.height, t), |
|||
Color.lerp(begin.color, end.color, t) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class BarTween : Tween<Bar> { |
|||
public BarTween(Bar begin, Bar end) : base(begin: begin, end: end) { |
|||
D.assert(begin.rank == end.rank); |
|||
} |
|||
|
|||
public override Bar lerp(float t) { |
|||
return Bar.lerp(this.begin, this.end, t); |
|||
} |
|||
} |
|||
|
|||
public class BarChartPainter : AbstractCustomPainter { |
|||
public BarChartPainter(Animation<BarChart> animation) |
|||
: base(repaint: animation) { |
|||
this.animation = animation; |
|||
} |
|||
|
|||
public readonly Animation<BarChart> animation; |
|||
|
|||
public override void paint(Canvas canvas, Size size) { |
|||
var paint = new Paint(); |
|||
paint.style = PaintingStyle.fill; |
|||
var chart = this.animation.value; |
|||
foreach (var bar in chart.bars) { |
|||
paint.color = bar.color; |
|||
canvas.drawRect( |
|||
Rect.fromLTWH( |
|||
bar.x, |
|||
size.height - bar.height, |
|||
bar.width, |
|||
bar.height |
|||
), |
|||
paint |
|||
); |
|||
} |
|||
} |
|||
|
|||
public override bool shouldRepaint(CustomPainter old) { |
|||
return false; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 86c1af2bfb2264482886e1dfc4421ca8 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgets.Tests.demo_charts { |
|||
public class ColorPalette { |
|||
public static readonly ColorPalette primary = new ColorPalette(new List<Color> { |
|||
Colors.blue[400], |
|||
Colors.red[400], |
|||
Colors.green[400], |
|||
Colors.yellow[400], |
|||
Colors.purple[400], |
|||
Colors.orange[400], |
|||
Colors.teal[400] |
|||
}); |
|||
|
|||
public ColorPalette(List<Color> colors) { |
|||
D.assert(colors.isNotEmpty); |
|||
this._colors = colors; |
|||
} |
|||
|
|||
readonly List<Color> _colors; |
|||
|
|||
public Color this[int index] { |
|||
get { return this._colors[index % this.length]; } |
|||
} |
|||
|
|||
public int length { |
|||
get { return this._colors.Count; } |
|||
} |
|||
|
|||
public Color random() { |
|||
return this[Random.Range(0, this.length - 1)]; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 239b4d72aabd9409896ae59d43657685 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace UIWidgets.Tests.demo_charts { |
|||
/*** |
|||
* from https://github.com/mravn/charts
|
|||
*/ |
|||
public class ChartPage : StatefulWidget { |
|||
public override State createState() { |
|||
return new ChartPageState(); |
|||
} |
|||
} |
|||
|
|||
public class ChartPageState : TickerProviderStateMixin<ChartPage> { |
|||
public static readonly Size size = new Size(200.0f, 100.0f); |
|||
|
|||
AnimationController _animation; |
|||
BarChartTween _tween; |
|||
|
|||
public override |
|||
void initState() { |
|||
base.initState(); |
|||
this._animation = new AnimationController( |
|||
duration: new TimeSpan(0, 0, 0, 0, 300), |
|||
vsync: this |
|||
); |
|||
this._tween = new BarChartTween( |
|||
BarChart.empty(), |
|||
BarChart.random(size) |
|||
); |
|||
this._animation.forward(); |
|||
} |
|||
|
|||
public override void dispose() { |
|||
this._animation.dispose(); |
|||
base.dispose(); |
|||
} |
|||
|
|||
void changeData() { |
|||
this.setState(() => { |
|||
this._tween = new BarChartTween( |
|||
this._tween.evaluate(this._animation), |
|||
BarChart.random(size) |
|||
); |
|||
this._animation.forward(from: 0.0f); |
|||
}); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
body: new Center( |
|||
child: new CustomPaint( |
|||
size: size, |
|||
painter: new BarChartPainter(this._tween.animate(this._animation)) |
|||
) |
|||
), |
|||
floatingActionButton: new FloatingActionButton( |
|||
child: new Icon(Unity.UIWidgets.material.Icons.refresh), |
|||
onPressed: this.changeData |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f0f7155374ba841a68342496dca556d4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.animation; |
|||
|
|||
namespace UIWidgets.Tests.demo_charts { |
|||
public interface MergeTweenable<T> { |
|||
T empty { get; } |
|||
|
|||
Tween<T> tweenTo(T other); |
|||
|
|||
bool less(T other); |
|||
} |
|||
|
|||
public class MergeTween<T> : Tween<List<T>> where T : MergeTweenable<T> { |
|||
public MergeTween(List<T> begin, List<T> end) : base(begin: begin, end: end) { |
|||
int bMax = begin.Count; |
|||
int eMax = end.Count; |
|||
var b = 0; |
|||
var e = 0; |
|||
while (b + e < bMax + eMax) { |
|||
if (b < bMax && (e == eMax || begin[b].less(end[e]))) { |
|||
this._tweens.Add(begin[b].tweenTo(begin[b].empty)); |
|||
b++; |
|||
} else if (e < eMax && (b == bMax || end[e].less(begin[b]))) { |
|||
this._tweens.Add(end[e].empty.tweenTo(end[e])); |
|||
e++; |
|||
} else { |
|||
this._tweens.Add(begin[b].tweenTo(end[e])); |
|||
b++; |
|||
e++; |
|||
} |
|||
} |
|||
} |
|||
|
|||
readonly List<Tween<T>> _tweens = new List<Tween<T>>(); |
|||
|
|||
public override List<T> lerp(float t) { |
|||
return Enumerable.Range(0, this._tweens.Count).Select(i => this._tweens[i].lerp(t)).ToList(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b7cfb33e7825b49f1ad2d0bb356eb831 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 611706478d8aa410983272ad601895d3 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class BottomAppBarSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new BottomAppBarWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class BottomAppBarWidget : StatelessWidget { |
|||
public BottomAppBarWidget(Key key = null) : base(key) { |
|||
|
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
backgroundColor: Color.clear, |
|||
bottomNavigationBar: new BottomAppBar( |
|||
child: new Row( |
|||
mainAxisSize: MainAxisSize.max, |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: new List<Widget> { |
|||
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.menu), onPressed: () => { }), |
|||
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.account_balance), |
|||
onPressed: () => { }) |
|||
}))); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8ba2c65db2f2848d3a3fa5eb0890abe5 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample { |
|||
public class DividerAndButton : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new WidgetsApp( |
|||
home: new DividerAndButtonSample(), |
|||
pageRouteBuilder: this.pageRouteBuilder); |
|||
} |
|||
|
|||
public class DividerAndButtonSample : StatefulWidget { |
|||
public DividerAndButtonSample(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _DividerAndButtonState(); |
|||
} |
|||
} |
|||
|
|||
public class _DividerAndButtonState : State<DividerAndButtonSample> { |
|||
string title = "Hello"; |
|||
string subtitle = "World"; |
|||
TextEditingController controller = new TextEditingController(""); |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Container( |
|||
height: 200, |
|||
padding: EdgeInsets.all(10), |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFFEF1F7F), |
|||
border: Border.all(color: Color.fromARGB(255, 0xDF, 0x10, 0x70), width: 5), |
|||
borderRadius: BorderRadius.all(20) |
|||
), |
|||
child: new Center( |
|||
child: new Column( |
|||
children: new List<Widget>() { |
|||
new Text(this.title), |
|||
new Divider(), |
|||
new Text(this.subtitle), |
|||
new Divider(), |
|||
new Container( |
|||
width: 500, |
|||
decoration: new BoxDecoration(border: Border.all(new Color(0xFF00FF00), 1)), |
|||
child: new EditableText( |
|||
controller: this.controller, |
|||
focusNode: new FocusNode(), |
|||
style: new TextStyle( |
|||
fontSize: 18, |
|||
height: 1.5f, |
|||
color: new Color(0xFFFF89FD)), |
|||
cursorColor: Color.fromARGB(255, 0, 0, 0) |
|||
) |
|||
), |
|||
new Divider(), |
|||
new ButtonBar( |
|||
children: new List<Widget> { |
|||
new FlatButton( |
|||
onPressed: () => { |
|||
this.setState(() => { this.title = this.controller.text; }); |
|||
}, |
|||
padding: EdgeInsets.all(5.0f), |
|||
child: new Center( |
|||
child: new Text("Set Title") |
|||
) |
|||
), |
|||
new RaisedButton( |
|||
onPressed: () => { |
|||
this.setState(() => { this.subtitle = this.controller.text; }); |
|||
}, |
|||
padding: EdgeInsets.all(5.0f), |
|||
child: new Center( |
|||
child: new Text("Set Subtitle") |
|||
) |
|||
) |
|||
} |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7d02ebc8543484a84b26e073e5ec501f |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using RSG; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class MaterialAppBarSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialAppBarWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialAppBarWidget : StatefulWidget { |
|||
public MaterialAppBarWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new MaterialAppBarWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialAppBarWidgetState : State<MaterialAppBarWidget> { |
|||
Choice _selectedChoice = Choice.choices[0]; |
|||
|
|||
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key(); |
|||
|
|||
VoidCallback _showBottomSheetCallback; |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._showBottomSheetCallback = this._showBottomSheet; |
|||
} |
|||
|
|||
void _showBottomSheet() { |
|||
this.setState(() => { this._showBottomSheetCallback = null; }); |
|||
|
|||
this._scaffoldKey.currentState.showBottomSheet((BuildContext subContext) => { |
|||
ThemeData themeData = Theme.of(subContext); |
|||
return new Container( |
|||
decoration: new BoxDecoration( |
|||
border: new Border( |
|||
top: new BorderSide( |
|||
color: themeData.disabledColor))), |
|||
child: new Padding( |
|||
padding: EdgeInsets.all(32.0f), |
|||
child: new Text("This is a Material persistent bottom sheet. Drag downwards to dismiss it.", |
|||
textAlign: TextAlign.center, |
|||
style: new TextStyle( |
|||
color: themeData.accentColor, |
|||
fontSize: 16.0f)) |
|||
) |
|||
); |
|||
}).closed.Then((object obj) => { |
|||
if (this.mounted) { |
|||
this.setState(() => { this._showBottomSheetCallback = this._showBottomSheet; }); |
|||
} |
|||
|
|||
return new Promise(); |
|||
}); |
|||
} |
|||
|
|||
void _select(Choice choice) { |
|||
this.setState(() => { this._selectedChoice = choice; }); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
key: this._scaffoldKey, |
|||
appBar: new AppBar( |
|||
title: new Text("Basic AppBar"), |
|||
actions: new List<Widget> { |
|||
new IconButton( |
|||
icon: new Icon(Choice.choices[0].icon), |
|||
//color: Colors.blue,
|
|||
onPressed: () => { this._select((Choice.choices[0])); } |
|||
), |
|||
new IconButton( |
|||
icon: new Icon(Choice.choices[1].icon), |
|||
//color: Colors.blue,
|
|||
onPressed: () => { this._select((Choice.choices[1])); } |
|||
), |
|||
|
|||
new PopupMenuButton<Choice>( |
|||
onSelected: this._select, |
|||
itemBuilder: (BuildContext subContext) => { |
|||
List<PopupMenuEntry<Choice>> popupItems = new List<PopupMenuEntry<Choice>>(); |
|||
for (int i = 2; i < Choice.choices.Count; i++) { |
|||
popupItems.Add(new PopupMenuItem<Choice>( |
|||
value: Choice.choices[i], |
|||
child: new Text(Choice.choices[i].title))); |
|||
} |
|||
|
|||
return popupItems; |
|||
} |
|||
) |
|||
} |
|||
), |
|||
body: new Padding( |
|||
padding: EdgeInsets.all(16.0f), |
|||
child: new ChoiceCard(choice: this._selectedChoice) |
|||
), |
|||
floatingActionButton: new FloatingActionButton( |
|||
backgroundColor: Colors.redAccent, |
|||
child: new Icon(Unity.UIWidgets.material.Icons.add_alert), |
|||
onPressed: this._showBottomSheetCallback |
|||
), |
|||
drawer: new Drawer( |
|||
child: new ListView( |
|||
padding: EdgeInsets.zero, |
|||
children: new List<Widget> { |
|||
new ListTile( |
|||
leading: new Icon(Unity.UIWidgets.material.Icons.account_circle), |
|||
title: new Text("Login"), |
|||
onTap: () => { } |
|||
), |
|||
new Divider( |
|||
height: 2.0f), |
|||
new ListTile( |
|||
leading: new Icon(Unity.UIWidgets.material.Icons.account_balance_wallet), |
|||
title: new Text("Wallet"), |
|||
onTap: () => { } |
|||
), |
|||
new Divider( |
|||
height: 2.0f), |
|||
new ListTile( |
|||
leading: new Icon(Unity.UIWidgets.material.Icons.accessibility), |
|||
title: new Text("Balance"), |
|||
onTap: () => { } |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
class Choice { |
|||
public Choice(string title, IconData icon) { |
|||
this.title = title; |
|||
this.icon = icon; |
|||
} |
|||
|
|||
public readonly string title; |
|||
public readonly IconData icon; |
|||
|
|||
public static List<Choice> choices = new List<Choice> { |
|||
new Choice("Car", Unity.UIWidgets.material.Icons.directions_car), |
|||
new Choice("Bicycle", Unity.UIWidgets.material.Icons.directions_bike), |
|||
new Choice("Boat", Unity.UIWidgets.material.Icons.directions_boat), |
|||
new Choice("Bus", Unity.UIWidgets.material.Icons.directions_bus), |
|||
new Choice("Train", Unity.UIWidgets.material.Icons.directions_railway), |
|||
new Choice("Walk", Unity.UIWidgets.material.Icons.directions_walk) |
|||
}; |
|||
} |
|||
|
|||
class ChoiceCard : StatelessWidget { |
|||
public ChoiceCard(Key key = null, Choice choice = null) : base(key: key) { |
|||
this.choice = choice; |
|||
} |
|||
|
|||
public readonly Choice choice; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
TextStyle textStyle = Theme.of(context).textTheme.display1; |
|||
return new Card( |
|||
color: Colors.white, |
|||
child: new Center( |
|||
child: new Column( |
|||
mainAxisSize: MainAxisSize.min, |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Icon(this.choice.icon, size: 128.0f, color: textStyle.color), |
|||
new RaisedButton( |
|||
child: new Text(this.choice.title, style: textStyle), |
|||
onPressed: () => { |
|||
SnackBar snackBar = new SnackBar( |
|||
content: new Text(this.choice.title + " is chosen !"), |
|||
action: new SnackBarAction( |
|||
label: "Ok", |
|||
onPressed: () => { })); |
|||
|
|||
Scaffold.of(context).showSnackBar(snackBar); |
|||
}) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 684439e8285b14ebc894b328936d06dd |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Material = Unity.UIWidgets.material.Material; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class MaterialButtonSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialButtonWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialButtonWidget : StatefulWidget { |
|||
public MaterialButtonWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new MaterialButtonWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialButtonWidgetState : State<MaterialButtonWidget> { |
|||
public override Widget build(BuildContext context) { |
|||
return new Stack( |
|||
children: new List<Widget> { |
|||
new Material( |
|||
child: new Center( |
|||
child: new Column( |
|||
children: new List<Widget> { |
|||
new Padding(padding: EdgeInsets.only(top: 30f)), |
|||
new MaterialButton( |
|||
shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(20.0f)), |
|||
color: new Color(0xFF00FF00), |
|||
splashColor: new Color(0xFFFF0011), |
|||
highlightColor: new Color(0x88FF0011), |
|||
child: new Text("Click Me"), |
|||
onPressed: () => { Debug.Log("pressed flat button"); } |
|||
), |
|||
new Padding(padding: EdgeInsets.only(top: 30f)), |
|||
new MaterialButton( |
|||
shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(20.0f)), |
|||
color: new Color(0xFFFF00FF), |
|||
splashColor: new Color(0xFFFF0011), |
|||
highlightColor: new Color(0x88FF0011), |
|||
elevation: 4.0f, |
|||
child: new Text("Click Me"), |
|||
onPressed: () => { Debug.Log("pressed raised button"); } |
|||
) |
|||
} |
|||
) |
|||
) |
|||
), |
|||
new PerformanceOverlay() |
|||
} |
|||
); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 347e0378e419f46f2af69e1214f1ae5b |
|||
timeCreated: 1573031753 |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Material = Unity.UIWidgets.material.Material; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class MaterialInkWellSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialInkWellWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialInkWellWidget : StatefulWidget { |
|||
public MaterialInkWellWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new MaterialInkWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialInkWidgetState : State<MaterialInkWellWidget> { |
|||
public override Widget build(BuildContext context) { |
|||
return new Material( |
|||
//color: Colors.blue,
|
|||
child: new Center( |
|||
child: new Container( |
|||
width: 200, |
|||
height: 200, |
|||
child: new InkWell( |
|||
borderRadius: BorderRadius.circular(2.0f), |
|||
highlightColor: new Color(0xAAFF0000), |
|||
splashColor: new Color(0xAA0000FF), |
|||
onTap: () => { Debug.Log("on tap"); } |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1a03d2251d4fb4ef08021dcb11b0dc68 |
|||
timeCreated: 1573031753 |
|
|||
using System.Collections.Generic; |
|||
using RSG; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class MaterialNavigationBarSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialNavigationBarWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
class MaterialNavigationBarWidget : StatefulWidget { |
|||
public MaterialNavigationBarWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new MaterialNavigationBarWidgetState(); |
|||
} |
|||
} |
|||
|
|||
class MaterialNavigationBarWidgetState : SingleTickerProviderStateMixin<MaterialNavigationBarWidget> { |
|||
int _currentIndex = 0; |
|||
|
|||
public MaterialNavigationBarWidgetState() { |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
bottomNavigationBar: new Container( |
|||
height: 100, |
|||
color: Colors.blue, |
|||
child: new Center( |
|||
child: new BottomNavigationBar( |
|||
type: BottomNavigationBarType.shifting, |
|||
// type: BottomNavigationBarType.fix,
|
|||
items: new List<BottomNavigationBarItem> { |
|||
new BottomNavigationBarItem( |
|||
icon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 30), |
|||
title: new Text("Work"), |
|||
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 50), |
|||
backgroundColor: Colors.blue |
|||
), |
|||
new BottomNavigationBarItem( |
|||
icon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 30), |
|||
title: new Text("Home"), |
|||
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 50), |
|||
backgroundColor: Colors.blue |
|||
), |
|||
new BottomNavigationBarItem( |
|||
icon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 30), |
|||
title: new Text("Shop"), |
|||
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 50), |
|||
backgroundColor: Colors.blue |
|||
), |
|||
new BottomNavigationBarItem( |
|||
icon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 30), |
|||
title: new Text("School"), |
|||
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 50), |
|||
backgroundColor: Colors.blue |
|||
), |
|||
}, |
|||
currentIndex: this._currentIndex, |
|||
onTap: (value) => { this.setState(() => { this._currentIndex = value; }); } |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 19405b76532fc44ae91d3c0996408a3e |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class MaterialSliderSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialSliderWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialSliderWidget : StatefulWidget { |
|||
public override State createState() { |
|||
return new MaterialSliderState(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialSliderState : State<MaterialSliderWidget> { |
|||
|
|||
float _value = 0.8f; |
|||
|
|||
void onChanged(float value) { |
|||
this.setState(() => { this._value = value; }); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
appBar: new AppBar( |
|||
title: new Text("Slider and Indicators")), |
|||
body: new Column( |
|||
children: new List<Widget> { |
|||
new Padding( |
|||
padding: EdgeInsets.only(top: 100.0f), |
|||
child: new Container( |
|||
child: new Slider( |
|||
divisions: 10, |
|||
min: 0.4f, |
|||
label: "Here", |
|||
value: this._value, |
|||
onChanged: this.onChanged)) |
|||
) |
|||
} |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a403bd4bc6da446f1bb8cc0424f2fb85 |
|||
timeCreated: 1573031753 |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class MaterialTabBarSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialTabBarWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialTabBarWidget : StatefulWidget { |
|||
public MaterialTabBarWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new MaterialTabBarWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialTabBarWidgetState : SingleTickerProviderStateMixin<MaterialTabBarWidget> { |
|||
TabController _tabController; |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._tabController = new TabController(vsync: this, length: Choice.choices.Count); |
|||
} |
|||
|
|||
public override void dispose() { |
|||
this._tabController.dispose(); |
|||
base.dispose(); |
|||
} |
|||
|
|||
void _nextPage(int delta) { |
|||
int newIndex = this._tabController.index + delta; |
|||
if (newIndex < 0 || newIndex >= this._tabController.length) { |
|||
return; |
|||
} |
|||
|
|||
this._tabController.animateTo(newIndex); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
List<Widget> tapChildren = new List<Widget>(); |
|||
foreach (Choice choice in Choice.choices) { |
|||
tapChildren.Add( |
|||
new Padding( |
|||
padding: EdgeInsets.all(16.0f), |
|||
child: new ChoiceCard(choice: choice))); |
|||
} |
|||
|
|||
return new Scaffold( |
|||
appBar: new AppBar( |
|||
title: new Center( |
|||
child: new Text("AppBar Bottom Widget") |
|||
), |
|||
leading: new IconButton( |
|||
tooltip: "Previous choice", |
|||
icon: new Icon(Unity.UIWidgets.material.Icons.arrow_back), |
|||
onPressed: () => { this._nextPage(-1); } |
|||
), |
|||
actions: new List<Widget> { |
|||
new IconButton( |
|||
icon: new Icon(Unity.UIWidgets.material.Icons.arrow_forward), |
|||
tooltip: "Next choice", |
|||
onPressed: () => { this._nextPage(1); }) |
|||
}, |
|||
bottom: new PreferredSize( |
|||
preferredSize: Size.fromHeight(48.0f), |
|||
child: new Theme( |
|||
data: Theme.of(context).copyWith(accentColor: Colors.white), |
|||
child: new Container( |
|||
height: 48.0f, |
|||
alignment: Alignment.center, |
|||
child: new TabPageSelector( |
|||
controller: this._tabController)))) |
|||
), |
|||
body: new TabBarView( |
|||
controller: this._tabController, |
|||
children: tapChildren |
|||
)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0cbd2174900054317b93e50e058cd61b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.service; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Image = Unity.UIWidgets.widgets.Image; |
|||
|
|||
namespace UIWidgetsSample { |
|||
public class MaterialThemeSample: UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
home: new MaterialThemeSampleWidget(), |
|||
darkTheme: new ThemeData(primaryColor: Colors.black26) |
|||
); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class MaterialThemeSampleWidget: StatefulWidget { |
|||
public override State createState() { |
|||
return new _MaterialThemeSampleWidgetState(); |
|||
} |
|||
} |
|||
|
|||
class _MaterialThemeSampleWidgetState : State<MaterialThemeSampleWidget> { |
|||
public override Widget build(BuildContext context) { |
|||
return new Theme( |
|||
data: new ThemeData( |
|||
appBarTheme: new AppBarTheme( |
|||
color: Colors.purple |
|||
), |
|||
bottomAppBarTheme: new BottomAppBarTheme( |
|||
color: Colors.blue |
|||
), |
|||
cardTheme: new CardTheme( |
|||
color: Colors.red, |
|||
elevation: 2.0f |
|||
) |
|||
), |
|||
child: new Scaffold( |
|||
appBar: new AppBar(title: new Text("Test App Bar Theme")), |
|||
body: new Center( |
|||
child: new Card( |
|||
shape: new RoundedRectangleBorder( |
|||
borderRadius: BorderRadius.all(5.0f) |
|||
), |
|||
child: new Container( |
|||
height: 250, |
|||
child: new Column( |
|||
children: new List<Widget> { |
|||
Image.asset( |
|||
"products/backpack", |
|||
fit: BoxFit.cover, |
|||
width: 200, |
|||
height: 200 |
|||
), |
|||
new Text("Card Theme") |
|||
} |
|||
) |
|||
) |
|||
) |
|||
), |
|||
bottomNavigationBar: new BottomAppBar( |
|||
child: new Row( |
|||
mainAxisSize: MainAxisSize.max, |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: new List<Widget> { |
|||
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.menu), onPressed: () => { }), |
|||
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.account_balance), onPressed: () => { }) |
|||
}) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f5061bd7b85f4179a65c68ac289a4a58 |
|||
timeCreated: 1556597371 |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using RSG; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Material = Unity.UIWidgets.material.Material; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample { |
|||
public class ReorderableListSample : UIWidgetsSamplePanel { |
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new MaterialReorderableListViewWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
class MaterialReorderableListViewWidget : StatefulWidget { |
|||
public MaterialReorderableListViewWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new MaterialReorderableListViewWidgetState(); |
|||
} |
|||
} |
|||
|
|||
class MaterialReorderableListViewWidgetState : State<MaterialReorderableListViewWidget> { |
|||
List<string> items = new List<string> {"First", "Second", "Third"}; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
body: new Scrollbar( |
|||
child: new ReorderableListView( |
|||
header: new Text("Header of list"), |
|||
children: this.items.Select<string, Widget>((item) => { |
|||
return new Container( |
|||
key: Key.key(item), |
|||
width: 300.0f, |
|||
height: 50.0f, |
|||
decoration: new BoxDecoration( |
|||
color: Colors.blue, |
|||
border: Border.all( |
|||
color: Colors.black |
|||
) |
|||
), |
|||
child: new Center( |
|||
child: new Text( |
|||
item, |
|||
style: new TextStyle( |
|||
fontSize: 32 |
|||
) |
|||
) |
|||
) |
|||
); |
|||
}).ToList(), |
|||
onReorder: (int oldIndex, int newIndex) => { |
|||
this.setState(() => { |
|||
if (newIndex > oldIndex) { |
|||
newIndex -= 1; |
|||
} |
|||
string item = this.items[oldIndex]; |
|||
this.items.RemoveAt(oldIndex); |
|||
this.items.Insert(newIndex, item); |
|||
}); |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4743f6dbc9049447eaae87cc7519406b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgetsSample { |
|||
|
|||
public class TableSample : UIWidgetsSamplePanel { |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
showPerformanceOverlay: false, |
|||
home: new TableWidget()); |
|||
} |
|||
|
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>(path: "fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
} |
|||
|
|||
public class TableWidget : StatelessWidget { |
|||
public TableWidget(Key key = null) : base(key) { |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Scaffold( |
|||
body: new Table( |
|||
children: new List<TableRow> { |
|||
new TableRow( |
|||
decoration: new BoxDecoration(color: Colors.blue), |
|||
children: new List<Widget> { |
|||
new Text("item 1"), |
|||
new Text("item 2") |
|||
} |
|||
), |
|||
new TableRow(children: new List<Widget> { |
|||
new Text("item 3"), |
|||
new Text("item 4") |
|||
} |
|||
) |
|||
}, |
|||
defaultVerticalAlignment: TableCellVerticalAlignment.middle)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 07e8ae972d9945faaef3326486f3a4bf |
|||
timeCreated: 1573031753 |
|
|||
# UIWidgets Samples |
|||
|
|||
|
|||
## 介绍 |
|||
本项目包含了UIWidgets的所有官方开发样例,用以帮助开发者快速入门基于UIWidgets的UI开发。 |
|||
|
|||
UIWidgets是一个新的、开源、独立的Unity UI界面框架。在本项目中您将可以找到许多基于UIWidgets开发的界面样例,它们 |
|||
涵盖了该框架所提供的主要功能。您可以随意运行和测试这些样例,您也可以自行改造这些样例来制作您自己的UI作品。 |
|||
|
|||
|
|||
## 使用要求 |
|||
|
|||
#### Unity |
|||
|
|||
安装 **Unity 2018.4.10f1(LTS)** 或 **Unity 2019.1.14f1** 及其更高版本。 你可以从[https://unity3d.com/get-unity/download](https://unity3d.com/get-unity/download)下载最新的Unity。 |
|||
|
|||
#### UIWidgets包 |
|||
|
|||
访问UIWidgets的Github存储库 [https://github.com/UnityTech/UIWidgets](https://github.com/UnityTech/UIWidgets)下载最新的UIWidgets包。 |
|||
|
|||
将下载的包文件夹移动到Unity项目的Package文件夹中。 |
|||
|
|||
通常,你可以在控制台(或终端)应用程序中输入下面的代码来完成这个操作: |
|||
|
|||
```none |
|||
cd <YourProjectPath>/Packages |
|||
git clone https://github.com/UnityTech/UIWidgets.git com.unity.uiwidgets |
|||
``` |
|||
|
|||
#### 安装 |
|||
使用Unity建立一个空的新项目并将下载好的UIWidgets包移动到其Package文件夹中。接下来将本项目下载到 |
|||
您项目的**Asset**目录下即可。 |
|||
|
|||
|
|||
## 使用指南 |
|||
|
|||
#### 运行时UI界面 |
|||
在**Scenes**目录下包含了所有可用的运行时UI界面对应的场景文件。您可以打开任何一个场景来测试对应的UI界面。 |
|||
特别的,在**UIWidgetsGallery**场景中您可以运行UIWidgets Gallery范例,该范例主要移植自flutter Gallery, |
|||
它涵盖了UIWidgets的大部分功能点,您可以通过它来了解UIWidgets整体能力。 |
|||
|
|||
其次,在**UIWidgetsTheatre**场景中提供了一个可切换的UI展示Panel,在这里您可以从一系列精心挑选出来的样例界面中 |
|||
选择并展示您所感兴趣的部分。 |
|||
|
|||
最后,上述样例界面的具体实现文件可以参考以下目录: |
|||
* **MaterialSample** 包含了部分Material风格组件的样例代码 |
|||
* **ReduxSample** 包含了Redux组件相关的样例代码 |
|||
* **UIWidgetGallery** 包含了UIWidgets Gallery场景相关的代码 |
|||
* **UIWidgetsSample** 包含了部分基础Widget组件的样例代码 |
|||
* **UIWidgetsTheatre** 包含了UIWidgetsTheatre场景相关的代码 |
|||
|
|||
#### EditorWindow UI界面 |
|||
UIWidgets也可以被用来制作Unity中的EditorWindow。请点击菜单栏中的新的**UIWidgetsTests**选项卡,并 |
|||
在下拉菜单中选择打开您感兴趣的选项来显示对应的UI界面。 |
|||
|
|||
所有EditorWindow样例相关的代码均位于**Editor**文件夹中。 |
|
|||
fileFormatVersion: 2 |
|||
guid: 91a591ae2fb1e4a09977ec731aa7167f |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
# UIWidgets Samples |
|||
[中文](README-ZH.md) |
|||
|
|||
## Introduction |
|||
This project provides standard samples for UIWidgets. |
|||
|
|||
UIWidgets is an open-source, standalone and novel UI framework for Unity. You can find various UIWidgets-based |
|||
UI panels in this Repository which illustrates different features of the corresponding framework. |
|||
Please feel free to run and test these demos. You are also encouraged to modify them to meet your own |
|||
requirements and see the outcomes. |
|||
|
|||
|
|||
## Requirements |
|||
|
|||
#### Unity |
|||
|
|||
Install **Unity 2018.4.10f1 (LTS)** or **Unity 2019.1.14f1** and above. You can download the latest Unity on https://unity3d.com/get-unity/download. |
|||
|
|||
#### UIWidgets Package |
|||
Visit the Github repository https://github.com/UnityTech/UIWidgets |
|||
to download the latest UIWidgets package. |
|||
|
|||
Move the downloaded package folder into the **Package** folder of your Unity project. |
|||
|
|||
Generally, you can make it using a console (or terminal) application by just a few commands as below: |
|||
|
|||
```none |
|||
cd <YourProjectPath>/Packages |
|||
git clone https://github.com/UnityTech/UIWidgets.git com.unity.uiwidgets |
|||
``` |
|||
|
|||
#### Install |
|||
Create an empty project using Unity and copy the latest UIWidgets package into it. Then clone this |
|||
Repository to the **Asset** folder of your project. |
|||
|
|||
|
|||
## Guide |
|||
|
|||
#### Runtime UIs |
|||
In the **Scenes** folder you can find all the demo scenes which illustrate different features of UIWidgets. |
|||
More specifically, the **UIWidgetsGallery** scene contains a Gallery demo of UIWidgets. It is mainly derived from |
|||
the flutter Gallery demo and will provides you a big picture about "What UIWidgets can do". |
|||
|
|||
In the **UIWidgetsTheatre** scene you can switch between some deliberately chosen UIWidgets Panels, each |
|||
focusing on one specific feature of UIWidgets. |
|||
|
|||
The implementations of all the demo UI widgets are located in different folders. In short: |
|||
* **MaterialSample** contains sample codes of material scheme widgets |
|||
* **ReduxSample** contains samples codes for the redux framework used in UIWidgets |
|||
* **UIWidgetGallery** contains codes of the Gallery demo |
|||
* **UIWidgetsSample** contains samples codes for basic widgets |
|||
* **UIWidgetsTheatre** contains codes of the UIWidgetsTheatre |
|||
|
|||
#### EditorWindow UIs |
|||
UIWidgets can also be used to create EditorWindows in Unity. |
|||
Please click the new **UIWidgetsTests** tab on the main menu |
|||
and open one of the dropdown samples to see the corresponding EditorWindow example. |
|||
|
|||
All the codes of the EditorWindow samples are located in the **Editor** folder. |
|
|||
fileFormatVersion: 2 |
|||
guid: f85cf1881c16b468a82659012c8b6db0 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 4e70bfdbd732446138a5acef1423b347 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Material = Unity.UIWidgets.material.Material; |
|||
|
|||
namespace Unity.UIWidgets.Sample { |
|||
public class DefaultSimpleTestbedPanel : UIWidgetsPanel { |
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
home: new DefaultSimpleTestbedWidget() |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class DefaultSimpleTestbedWidget : StatefulWidget { |
|||
public DefaultSimpleTestbedWidget(Key key = null) : base(key) { } |
|||
|
|||
public override State createState() { |
|||
return new DefaultSimpleTestbedWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class DefaultSimpleTestbedWidgetState : State<DefaultSimpleTestbedWidget> { |
|||
public override Widget build(BuildContext context) { |
|||
return new Material( |
|||
color: new Color(0x44FFFF00), |
|||
child: new Center( |
|||
child: new Container( |
|||
child: new MaterialButton( |
|||
child: new Text("Material Button"), |
|||
onPressed: () => { }, |
|||
color: Colors.lightBlue |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 15ddf18357c864b1b822b471672fd391 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 9 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 3 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
|||
m_UseRadianceAmbientProbe: 0 |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 1 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 0 |
|||
m_EnableRealtimeLightmaps: 0 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 12 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_AtlasSize: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_ExtractAmbientOcclusion: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 0 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 500 |
|||
m_PVRBounces: 2 |
|||
m_PVREnvironmentSampleCount: 500 |
|||
m_PVREnvironmentReferencePointCount: 2048 |
|||
m_PVRFilteringMode: 2 |
|||
m_PVRDenoiserTypeDirect: 0 |
|||
m_PVRDenoiserTypeIndirect: 0 |
|||
m_PVRDenoiserTypeAO: 0 |
|||
m_PVRFilterTypeDirect: 0 |
|||
m_PVRFilterTypeIndirect: 0 |
|||
m_PVRFilterTypeAO: 0 |
|||
m_PVREnvironmentMIS: 0 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
|||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
|||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
|||
m_ShowResolutionOverlay: 1 |
|||
m_ExportTrainingData: 0 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &238084976 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 238084977} |
|||
- component: {fileID: 238084980} |
|||
- component: {fileID: 238084978} |
|||
m_Layer: 5 |
|||
m_Name: Panel Button With Filter |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &238084977 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 238084976} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 0, y: 0.0000076294} |
|||
m_SizeDelta: {x: 300, y: 150} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &238084978 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 238084976} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4fc8b0d34b82c4c63a41e0cde280075a, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
devicePixelRatioOverride: 0 |
|||
hardwareAntiAliasing: 0 |
|||
--- !u!222 &238084980 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 238084976} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &354633976 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 354633980} |
|||
- component: {fileID: 354633979} |
|||
- component: {fileID: 354633978} |
|||
- component: {fileID: 354633977} |
|||
- component: {fileID: 354633981} |
|||
m_Layer: 5 |
|||
m_Name: Canvas |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &354633977 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &354633978 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 0 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
m_ReferenceResolution: {x: 800, y: 600} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
--- !u!223 &354633979 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 1 |
|||
m_Camera: {fileID: 519420031} |
|||
m_PlaneDistance: 1 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!224 &354633980 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0, y: 0, z: 0} |
|||
m_Children: |
|||
- {fileID: 789225035} |
|||
- {fileID: 1371170890} |
|||
- {fileID: 238084977} |
|||
- {fileID: 409216488} |
|||
- {fileID: 2108199658} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0} |
|||
--- !u!222 &354633981 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &409216487 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 409216488} |
|||
- component: {fileID: 409216491} |
|||
- component: {fileID: 409216490} |
|||
m_Layer: 5 |
|||
m_Name: Panel Button With Filter (1) |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &409216488 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 409216487} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 3 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 0, y: -200} |
|||
m_SizeDelta: {x: 300, y: 150} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &409216490 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 409216487} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4fc8b0d34b82c4c63a41e0cde280075a, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
devicePixelRatioOverride: 0 |
|||
hardwareAntiAliasing: 0 |
|||
--- !u!222 &409216491 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 409216487} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &519420028 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 519420032} |
|||
- component: {fileID: 519420031} |
|||
- component: {fileID: 519420029} |
|||
m_Layer: 0 |
|||
m_Name: Main Camera |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &519420029 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 519420028} |
|||
m_Enabled: 1 |
|||
--- !u!20 &519420031 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 519420028} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 2 |
|||
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} |
|||
m_projectionMatrixMode: 1 |
|||
m_GateFitMode: 2 |
|||
m_FOVAxisMode: 0 |
|||
m_SensorSize: {x: 36, y: 24} |
|||
m_LensShift: {x: 0, y: 0} |
|||
m_FocalLength: 50 |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 0 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 0 |
|||
m_AllowDynamicResolution: 0 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 0 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
--- !u!4 &519420032 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 519420028} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: -10} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &789225034 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 789225035} |
|||
- component: {fileID: 789225038} |
|||
- component: {fileID: 789225037} |
|||
- component: {fileID: 789225036} |
|||
m_Layer: 5 |
|||
m_Name: Button |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &789225035 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 1097866538} |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 0.000030518, y: -0.000011444} |
|||
m_SizeDelta: {x: 400, y: 600} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &789225036 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Navigation: |
|||
m_Mode: 3 |
|||
m_SelectOnUp: {fileID: 0} |
|||
m_SelectOnDown: {fileID: 0} |
|||
m_SelectOnLeft: {fileID: 0} |
|||
m_SelectOnRight: {fileID: 0} |
|||
m_Transition: 1 |
|||
m_Colors: |
|||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} |
|||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} |
|||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} |
|||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} |
|||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} |
|||
m_ColorMultiplier: 1 |
|||
m_FadeDuration: 0.1 |
|||
m_SpriteState: |
|||
m_HighlightedSprite: {fileID: 0} |
|||
m_PressedSprite: {fileID: 0} |
|||
m_SelectedSprite: {fileID: 0} |
|||
m_DisabledSprite: {fileID: 0} |
|||
m_AnimationTriggers: |
|||
m_NormalTrigger: Normal |
|||
m_HighlightedTrigger: Highlighted |
|||
m_PressedTrigger: Pressed |
|||
m_SelectedTrigger: Selected |
|||
m_DisabledTrigger: Disabled |
|||
m_Interactable: 1 |
|||
m_TargetGraphic: {fileID: 789225037} |
|||
m_OnClick: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, |
|||
Culture=neutral, PublicKeyToken=null |
|||
--- !u!114 &789225037 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_Type: 1 |
|||
m_PreserveAspect: 0 |
|||
m_FillCenter: 1 |
|||
m_FillMethod: 4 |
|||
m_FillAmount: 1 |
|||
m_FillClockwise: 1 |
|||
m_FillOrigin: 0 |
|||
m_UseSpriteMesh: 0 |
|||
--- !u!222 &789225038 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &1097866537 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1097866538} |
|||
- component: {fileID: 1097866540} |
|||
- component: {fileID: 1097866539} |
|||
m_Layer: 5 |
|||
m_Name: Text |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1097866538 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1097866537} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 789225035} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1097866539 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1097866537} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_FontData: |
|||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_FontSize: 55 |
|||
m_FontStyle: 0 |
|||
m_BestFit: 0 |
|||
m_MinSize: 0 |
|||
m_MaxSize: 68 |
|||
m_Alignment: 4 |
|||
m_AlignByGeometry: 0 |
|||
m_RichText: 1 |
|||
m_HorizontalOverflow: 0 |
|||
m_VerticalOverflow: 0 |
|||
m_LineSpacing: 1 |
|||
m_Text: Button |
|||
--- !u!222 &1097866540 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1097866537} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &1371170889 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1371170890} |
|||
- component: {fileID: 1371170891} |
|||
- component: {fileID: 1371170892} |
|||
m_Layer: 5 |
|||
m_Name: Panel Button |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1371170890 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1371170889} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 0, y: 200} |
|||
m_SizeDelta: {x: 300, y: 150} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!222 &1371170891 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1371170889} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &1371170892 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1371170889} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 15ddf18357c864b1b822b471672fd391, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
devicePixelRatioOverride: 0 |
|||
hardwareAntiAliasing: 0 |
|||
--- !u!1 &1742152755 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1742152758} |
|||
- component: {fileID: 1742152757} |
|||
- component: {fileID: 1742152756} |
|||
m_Layer: 0 |
|||
m_Name: EventSystem |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &1742152756 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1742152755} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalAxis: Horizontal |
|||
m_VerticalAxis: Vertical |
|||
m_SubmitButton: Submit |
|||
m_CancelButton: Cancel |
|||
m_InputActionsPerSecond: 10 |
|||
m_RepeatDelay: 0.5 |
|||
m_ForceModuleActive: 0 |
|||
--- !u!114 &1742152757 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1742152755} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_FirstSelected: {fileID: 1742152755} |
|||
m_sendNavigationEvents: 1 |
|||
m_DragThreshold: 10 |
|||
--- !u!4 &1742152758 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1742152755} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &2108199657 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 2108199658} |
|||
- component: {fileID: 2108199661} |
|||
- component: {fileID: 2108199660} |
|||
m_Layer: 5 |
|||
m_Name: Panel Button With Filter (2) |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &2108199658 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2108199657} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 4 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 50, y: -240} |
|||
m_SizeDelta: {x: 300, y: 150} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &2108199660 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2108199657} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4fc8b0d34b82c4c63a41e0cde280075a, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
devicePixelRatioOverride: 0 |
|||
hardwareAntiAliasing: 0 |
|||
--- !u!222 &2108199661 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2108199657} |
|||
m_CullTransparentMesh: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: 83e4542c541b84d80ad625e366e30839 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 9 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 3 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
|||
m_UseRadianceAmbientProbe: 0 |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 1 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 0 |
|||
m_EnableRealtimeLightmaps: 0 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 12 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_AtlasSize: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_ExtractAmbientOcclusion: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 0 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 500 |
|||
m_PVRBounces: 2 |
|||
m_PVREnvironmentSampleCount: 500 |
|||
m_PVREnvironmentReferencePointCount: 2048 |
|||
m_PVRFilteringMode: 2 |
|||
m_PVRDenoiserTypeDirect: 0 |
|||
m_PVRDenoiserTypeIndirect: 0 |
|||
m_PVRDenoiserTypeAO: 0 |
|||
m_PVRFilterTypeDirect: 0 |
|||
m_PVRFilterTypeIndirect: 0 |
|||
m_PVRFilterTypeAO: 0 |
|||
m_PVREnvironmentMIS: 0 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
|||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
|||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
|||
m_ShowResolutionOverlay: 1 |
|||
m_ExportTrainingData: 0 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &354633976 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 354633980} |
|||
- component: {fileID: 354633979} |
|||
- component: {fileID: 354633978} |
|||
- component: {fileID: 354633977} |
|||
- component: {fileID: 354633981} |
|||
m_Layer: 5 |
|||
m_Name: Canvas |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &354633977 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &354633978 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 0 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
m_ReferenceResolution: {x: 800, y: 600} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
--- !u!223 &354633979 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 1 |
|||
m_Camera: {fileID: 519420031} |
|||
m_PlaneDistance: 1 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!224 &354633980 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0, y: 0, z: 0} |
|||
m_Children: |
|||
- {fileID: 789225035} |
|||
- {fileID: 657653790} |
|||
- {fileID: 1942439624} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0} |
|||
--- !u!222 &354633981 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 354633976} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &519420028 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 519420032} |
|||
- component: {fileID: 519420031} |
|||
- component: {fileID: 519420029} |
|||
m_Layer: 0 |
|||
m_Name: Main Camera |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &519420029 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 519420028} |
|||
m_Enabled: 1 |
|||
--- !u!20 &519420031 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 519420028} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 2 |
|||
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} |
|||
m_projectionMatrixMode: 1 |
|||
m_GateFitMode: 2 |
|||
m_FOVAxisMode: 0 |
|||
m_SensorSize: {x: 36, y: 24} |
|||
m_LensShift: {x: 0, y: 0} |
|||
m_FocalLength: 50 |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 0 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 0 |
|||
m_AllowDynamicResolution: 0 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 0 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
--- !u!4 &519420032 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 519420028} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: -10} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &657653789 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 657653790} |
|||
- component: {fileID: 657653792} |
|||
- component: {fileID: 657653791} |
|||
- component: {fileID: 657653793} |
|||
m_Layer: 5 |
|||
m_Name: Raycast Testbed Panel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &657653790 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 657653789} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: -203, y: 81.79999} |
|||
m_SizeDelta: {x: 1290.3, y: 471.4} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &657653791 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 657653789} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 1b02d547623984986a44973c4ba2bca0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
devicePixelRatioOverride: 0 |
|||
hardwareAntiAliasing: 0 |
|||
--- !u!222 &657653792 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 657653789} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &657653793 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 657653789} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 2455841904ff14258bae1b28c1363dc0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
reversed: 0 |
|||
--- !u!1 &789225034 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 789225035} |
|||
- component: {fileID: 789225038} |
|||
- component: {fileID: 789225037} |
|||
- component: {fileID: 789225036} |
|||
m_Layer: 5 |
|||
m_Name: Button |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &789225035 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 3, y: 3, z: 1} |
|||
m_Children: |
|||
- {fileID: 812945430} |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 0.000030518, y: -0.000011444} |
|||
m_SizeDelta: {x: 436.8, y: 81.8} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &789225036 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Navigation: |
|||
m_Mode: 3 |
|||
m_SelectOnUp: {fileID: 0} |
|||
m_SelectOnDown: {fileID: 0} |
|||
m_SelectOnLeft: {fileID: 0} |
|||
m_SelectOnRight: {fileID: 0} |
|||
m_Transition: 1 |
|||
m_Colors: |
|||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} |
|||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} |
|||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} |
|||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} |
|||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} |
|||
m_ColorMultiplier: 1 |
|||
m_FadeDuration: 0.1 |
|||
m_SpriteState: |
|||
m_HighlightedSprite: {fileID: 0} |
|||
m_PressedSprite: {fileID: 0} |
|||
m_SelectedSprite: {fileID: 0} |
|||
m_DisabledSprite: {fileID: 0} |
|||
m_AnimationTriggers: |
|||
m_NormalTrigger: Normal |
|||
m_HighlightedTrigger: Highlighted |
|||
m_PressedTrigger: Pressed |
|||
m_SelectedTrigger: Selected |
|||
m_DisabledTrigger: Disabled |
|||
m_Interactable: 1 |
|||
m_TargetGraphic: {fileID: 789225037} |
|||
m_OnClick: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, |
|||
Culture=neutral, PublicKeyToken=null |
|||
--- !u!114 &789225037 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_Type: 1 |
|||
m_PreserveAspect: 0 |
|||
m_FillCenter: 1 |
|||
m_FillMethod: 4 |
|||
m_FillAmount: 1 |
|||
m_FillClockwise: 1 |
|||
m_FillOrigin: 0 |
|||
m_UseSpriteMesh: 0 |
|||
--- !u!222 &789225038 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 789225034} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &812945429 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 812945430} |
|||
- component: {fileID: 812945432} |
|||
- component: {fileID: 812945431} |
|||
m_Layer: 5 |
|||
m_Name: Text |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &812945430 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 812945429} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 789225035} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &812945431 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 812945429} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_FontData: |
|||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_FontSize: 14 |
|||
m_FontStyle: 0 |
|||
m_BestFit: 0 |
|||
m_MinSize: 10 |
|||
m_MaxSize: 40 |
|||
m_Alignment: 4 |
|||
m_AlignByGeometry: 0 |
|||
m_RichText: 1 |
|||
m_HorizontalOverflow: 0 |
|||
m_VerticalOverflow: 0 |
|||
m_LineSpacing: 1 |
|||
m_Text: Button |
|||
--- !u!222 &812945432 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 812945429} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &1742152755 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1742152758} |
|||
- component: {fileID: 1742152757} |
|||
- component: {fileID: 1742152756} |
|||
m_Layer: 0 |
|||
m_Name: EventSystem |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &1742152756 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1742152755} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalAxis: Horizontal |
|||
m_VerticalAxis: Vertical |
|||
m_SubmitButton: Submit |
|||
m_CancelButton: Cancel |
|||
m_InputActionsPerSecond: 10 |
|||
m_RepeatDelay: 0.5 |
|||
m_ForceModuleActive: 0 |
|||
--- !u!114 &1742152757 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1742152755} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_FirstSelected: {fileID: 1742152755} |
|||
m_sendNavigationEvents: 1 |
|||
m_DragThreshold: 10 |
|||
--- !u!4 &1742152758 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1742152755} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1942439623 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1942439624} |
|||
- component: {fileID: 1942439627} |
|||
- component: {fileID: 1942439626} |
|||
- component: {fileID: 1942439625} |
|||
m_Layer: 5 |
|||
m_Name: Raycast Testbed Panel (1) |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1942439624 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1942439623} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 354633980} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 180.85, y: 42} |
|||
m_SizeDelta: {x: 1290.3, y: 471.4} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1942439625 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1942439623} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 2455841904ff14258bae1b28c1363dc0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
reversed: 0 |
|||
--- !u!114 &1942439626 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1942439623} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 1b02d547623984986a44973c4ba2bca0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, |
|||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
devicePixelRatioOverride: 0 |
|||
hardwareAntiAliasing: 0 |
|||
--- !u!222 &1942439627 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1942439623} |
|||
m_CullTransparentMesh: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: e1bac3be89f2644f6ad3a6ed1ff00617 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.engine.raycast; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Material = Unity.UIWidgets.material.Material; |
|||
|
|||
namespace Unity.UIWidgets.Sample { |
|||
public class RaycastSimpleTestbedPanel : UIWidgetsRaycastablePanel { |
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
home: new RaycastSimpleTestbedWidget() |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class RaycastSimpleTestbedWidget : StatefulWidget { |
|||
public RaycastSimpleTestbedWidget(Key key = null) : base(key) { } |
|||
|
|||
public override State createState() { |
|||
return new RaycastSimpleTestbedWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class RaycastSimpleTestbedWidgetState : State<RaycastSimpleTestbedWidget> { |
|||
public override Widget build(BuildContext context) { |
|||
return new Material( |
|||
color: new Color(0x44FFFF00), |
|||
child: new Center( |
|||
child: new RaycastableContainer( |
|||
new MaterialButton( |
|||
child: new Text("Material Button"), |
|||
onPressed: () => { }, |
|||
color: Colors.lightBlue |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4fc8b0d34b82c4c63a41e0cde280075a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.engine.raycast; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Material = Unity.UIWidgets.material.Material; |
|||
|
|||
namespace Unity.UIWidgets.Sample { |
|||
public class RaycastTestbedPanel : UIWidgetsRaycastablePanel { |
|||
protected override void OnEnable() { |
|||
FontManager.instance.addFont(Resources.Load<Font>("fonts/MaterialIcons-Regular"), "Material Icons"); |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
return new MaterialApp( |
|||
home: new RaycastTestbedWidget() |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class RaycastTestbedWidget : StatefulWidget { |
|||
public RaycastTestbedWidget(Key key = null) : base(key) { } |
|||
|
|||
public override State createState() { |
|||
return new RaycastTestbedWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class RaycastTestbedWidgetState : State<RaycastTestbedWidget> { |
|||
public bool enableState = false; |
|||
public int switchState = 0; |
|||
public int switchPosState = 0; |
|||
public bool enableState2 = false; |
|||
public int switchState2 = 0; |
|||
public int switchPosState2 = 2; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new Material( |
|||
color: Colors.transparent, |
|||
child: new Center( |
|||
child: new Column( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new RaycastableContainer(child: new MaterialButton( |
|||
child: new Text($"Enable State: {this.enableState.ToString()}"), |
|||
onPressed: () => { |
|||
this.setState( |
|||
() => { this.enableState = !this.enableState; }); |
|||
}, |
|||
color: Colors.lightBlue |
|||
) |
|||
), |
|||
new Padding(padding: EdgeInsets.symmetric(horizontal: 5f)), |
|||
new RaycastableContainer(child: new MaterialButton( |
|||
child: new Text($"Switch State: {this.switchState.ToString()}"), |
|||
onPressed: () => { |
|||
this.setState( |
|||
() => { this.switchState = (this.switchState + 1) % 3; }); |
|||
}, |
|||
color: Colors.lightBlue |
|||
)), |
|||
new Padding(padding: EdgeInsets.symmetric(horizontal: 5f)), |
|||
new RaycastableContainer(child: new MaterialButton( |
|||
child: new Text($"Switch Pos State: {this.switchPosState.ToString()}"), |
|||
onPressed: () => { |
|||
this.setState( |
|||
() => { this.switchPosState = (this.switchPosState + 1) % 2; }); |
|||
}, |
|||
color: Colors.lightBlue |
|||
)) |
|||
} |
|||
), |
|||
new Padding(padding: EdgeInsets.symmetric(5f)), |
|||
new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new RaycastableContainer(child: new MaterialButton( |
|||
child: new Text($"Enable State: {this.enableState2.ToString()}"), |
|||
onPressed: () => { |
|||
this.setState( |
|||
() => { this.enableState2 = !this.enableState2; }); |
|||
}, |
|||
color: Colors.lightBlue |
|||
)), |
|||
new Padding(padding: EdgeInsets.symmetric(horizontal: 5f)), |
|||
new RaycastableContainer(child: new MaterialButton( |
|||
child: new Text($"Switch State: {this.switchState2.ToString()}"), |
|||
onPressed: () => { |
|||
this.setState( |
|||
() => { this.switchState2 = (this.switchState2 + 1) % 3; }); |
|||
}, |
|||
color: Colors.lightBlue |
|||
)), |
|||
new Padding(padding: EdgeInsets.symmetric(horizontal: 5f)), |
|||
new RaycastableContainer(child: new MaterialButton( |
|||
child: new Text($"Switch Pos State: {this.switchPosState2.ToString()}"), |
|||
onPressed: () => { |
|||
this.setState( |
|||
() => { this.switchPosState2 = (this.switchPosState2) % 2 + 1; }); |
|||
}, |
|||
color: Colors.lightBlue |
|||
)) |
|||
} |
|||
), |
|||
new Padding(padding: EdgeInsets.symmetric(5f)), |
|||
new Stack( |
|||
children: new List<Widget> { |
|||
new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
padding: EdgeInsets.only(top: 25f * this.switchPosState, |
|||
bottom: 25f * (3 - this.switchPosState)), |
|||
child: this.enableState |
|||
? (Widget) new RaycastableContainer( |
|||
new Container( |
|||
child: new Text( |
|||
data: this.switchState == 0 |
|||
? "特殊字符串" |
|||
: this.switchState == 1 |
|||
? "特殊字符串串" |
|||
: "特殊字符串串串", |
|||
style: new TextStyle( |
|||
fontSize: 48, |
|||
fontWeight: FontWeight.bold, |
|||
decoration: TextDecoration.none, |
|||
color: Colors.red |
|||
) |
|||
), |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0x44FFFF00) |
|||
) |
|||
) |
|||
) |
|||
: new Text( |
|||
data: this.switchState == 0 |
|||
? "普通字符串" |
|||
: this.switchState == 1 |
|||
? "普通字符串串" |
|||
: "普通字符串串串", |
|||
style: new TextStyle( |
|||
fontSize: 48, |
|||
fontWeight: FontWeight.bold, |
|||
decoration: TextDecoration.none, |
|||
color: Colors.red |
|||
) |
|||
) |
|||
) |
|||
} |
|||
), |
|||
new Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: new List<Widget> { |
|||
new Container( |
|||
padding: EdgeInsets.only(top: 25f * this.switchPosState2, |
|||
bottom: 25f * (3 - this.switchPosState2)), |
|||
child: this.enableState2 |
|||
? (Widget) new RaycastableContainer( |
|||
new Container( |
|||
child: new Text( |
|||
data: this.switchState2 == 0 |
|||
? "特殊字符串" |
|||
: this.switchState2 == 1 |
|||
? "特殊字符串串" |
|||
: "特殊字符串串串", |
|||
style: new TextStyle( |
|||
fontSize: 48, |
|||
fontWeight: FontWeight.bold, |
|||
decoration: TextDecoration.none, |
|||
color: Colors.red |
|||
) |
|||
), |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0x44FFFF00) |
|||
) |
|||
) |
|||
) |
|||
: (Widget) new Text( |
|||
data: this.switchState2 == 0 |
|||
? "普通字符串" |
|||
: this.switchState2 == 1 |
|||
? "普通字符串串" |
|||
: "普通字符串串串", |
|||
style: new TextStyle( |
|||
fontSize: 48, |
|||
fontWeight: FontWeight.bold, |
|||
decoration: TextDecoration.none, |
|||
color: Colors.red |
|||
) |
|||
) |
|||
) |
|||
} |
|||
) |
|||
} |
|||
) |
|||
} |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1b02d547623984986a44973c4ba2bca0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 5d9b41f3c48f94f93b5aaf521adbe0bf |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
{ |
|||
"displayName":"Redux Sample", |
|||
"description": "Sample usage of Redux & UIWidgets", |
|||
"createSeparatePackage": false |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8cd2fcbc5aff423a928c6d54050b2935 |
|||
timeCreated: 1571627113 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.Redux; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace Unity.UIWidgets.Sample.Redux { |
|||
public class CounterAppSample : UIWidgetsSample.UIWidgetsSamplePanel { |
|||
protected override Widget createWidget() { |
|||
return new WidgetsApp( |
|||
home: new CounterApp(), |
|||
pageRouteBuilder: this.pageRouteBuilder); |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class CouterState { |
|||
public int count; |
|||
|
|||
public CouterState(int count = 0) { |
|||
this.count = count; |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class CounterIncAction { |
|||
public int amount; |
|||
} |
|||
|
|||
public class CounterApp : StatelessWidget { |
|||
public override Widget build(BuildContext context) { |
|||
var store = new Store<CouterState>(reduce, new CouterState(), |
|||
ReduxLogging.create<CouterState>()); |
|||
return new StoreProvider<CouterState>(store, this.createWidget()); |
|||
} |
|||
|
|||
public static CouterState reduce(CouterState state, object action) { |
|||
var inc = action as CounterIncAction; |
|||
if (inc == null) { |
|||
return state; |
|||
} |
|||
|
|||
return new CouterState(inc.amount + state.count); |
|||
} |
|||
|
|||
Widget createWidget() { |
|||
return new Container( |
|||
height: 200.0f, |
|||
padding: EdgeInsets.all(10), |
|||
decoration: new BoxDecoration( |
|||
color: new Color(0xFF7F7F7F), |
|||
border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5), |
|||
borderRadius: BorderRadius.all(2)), |
|||
child: new Column( |
|||
children: new List<Widget>() { |
|||
new StoreConnector<CouterState, string>( |
|||
converter: (state) => $"Count:{state.count}", |
|||
builder: (context, countText, dispatcher) => new Text(countText, style: new TextStyle( |
|||
fontSize: 20, fontWeight: FontWeight.w700 |
|||
)), |
|||
pure: true |
|||
), |
|||
new StoreConnector<CouterState, object>( |
|||
converter: (state) => null, |
|||
builder: (context, _, dispatcher) => new CustomButton( |
|||
backgroundColor: Color.fromARGB(255, 0, 204, 204), |
|||
padding: EdgeInsets.all(10), |
|||
child: new Text("Add", style: new TextStyle( |
|||
fontSize: 16, color: Color.fromARGB(255, 255, 255, 255) |
|||
)), onPressed: () => { dispatcher.dispatch(new CounterIncAction() {amount = 1}); }), |
|||
pure: true |
|||
), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class CustomButton : StatelessWidget { |
|||
public CustomButton( |
|||
Key key = null, |
|||
GestureTapCallback onPressed = null, |
|||
EdgeInsets padding = null, |
|||
Color backgroundColor = null, |
|||
Widget child = null |
|||
) : base(key: key) { |
|||
this.onPressed = onPressed; |
|||
this.padding = padding ?? EdgeInsets.all(8.0f); |
|||
this.backgroundColor = backgroundColor; |
|||
this.child = child; |
|||
} |
|||
|
|||
public readonly GestureTapCallback onPressed; |
|||
public readonly EdgeInsets padding; |
|||
public readonly Widget child; |
|||
public readonly Color backgroundColor; |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: this.onPressed, |
|||
child: new Container( |
|||
padding: this.padding, |
|||
decoration: new BoxDecoration(color: this.backgroundColor), |
|||
child: this.child |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1df7452b5a8dd478ca8988b48502efe1 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9b02ce0cc0eb64ae7bce356d7d003e6d |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
namespace Unity.UIWidgets.Sample.Redux.ObjectFinder { |
|||
public class FinderGameObject : MonoBehaviour { |
|||
// Start is called before the first frame update
|
|||
void Start() { |
|||
this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 0, 0, 1.0f); |
|||
} |
|||
|
|||
// Update is called once per frame
|
|||
void Update() { |
|||
var selectedId = StoreProvider.store.getState().selected; |
|||
if (selectedId == this.GetInstanceID()) { |
|||
this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 0, 0, 1.0f); |
|||
} |
|||
else { |
|||
this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f); |
|||
} |
|||
} |
|||
|
|||
void OnMouseDown() { |
|||
StoreProvider.store.dispatcher.dispatch(new SelectObjectAction() {id = this.GetInstanceID()}); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 969624a932ff84fe09dc38f9460223fb |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.Redux; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace Unity.UIWidgets.Sample.Redux.ObjectFinder { |
|||
public class ObjectFinderApp : UIWidgetsSample.UIWidgetsSamplePanel { |
|||
public ObjectFinderApp() { |
|||
} |
|||
|
|||
protected override Widget createWidget() { |
|||
return new WidgetsApp( |
|||
home: new StoreProvider<FinderAppState>(StoreProvider.store, this.createRootWidget()), |
|||
pageRouteBuilder: this.pageRouteBuilder); |
|||
} |
|||
|
|||
Widget createRootWidget() { |
|||
return new StoreConnector<FinderAppState, ObjectFinderAppWidgetModel>( |
|||
pure: true, |
|||
builder: (context, viewModel, dispatcher) => new ObjectFinderAppWidget( |
|||
model: viewModel, |
|||
doSearch: (text) => dispatcher.dispatch(SearchAction.create(text)), |
|||
onSelect: (id) => dispatcher.dispatch(new SelectObjectAction() {id = id}), |
|||
title: this.gameObject.name |
|||
), |
|||
converter: (state) => new ObjectFinderAppWidgetModel() { |
|||
objects = state.objects, |
|||
selected = state.selected, |
|||
} |
|||
); |
|||
} |
|||
} |
|||
|
|||
|
|||
public delegate void onFindCallback(string keyword); |
|||
|
|||
public class ObjectFinderAppWidgetModel : IEquatable<ObjectFinderAppWidgetModel> { |
|||
public int selected; |
|||
public List<GameObjectInfo> objects; |
|||
|
|||
public bool Equals(ObjectFinderAppWidgetModel other) { |
|||
if (ReferenceEquals(null, other)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(this, other)) { |
|||
return true; |
|||
} |
|||
return this.selected == other.selected && this.objects.equalsList(other.objects); |
|||
} |
|||
|
|||
public override bool Equals(object obj) { |
|||
if (ReferenceEquals(null, obj)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(this, obj)) { |
|||
return true; |
|||
} |
|||
if (obj.GetType() != this.GetType()) { |
|||
return false; |
|||
} |
|||
return this.Equals((ObjectFinderAppWidgetModel) obj); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
return (this.selected * 397) ^ this.objects.hashList(); |
|||
} |
|||
} |
|||
|
|||
public static bool operator ==(ObjectFinderAppWidgetModel left, ObjectFinderAppWidgetModel right) { |
|||
return Equals(left, right); |
|||
} |
|||
|
|||
public static bool operator !=(ObjectFinderAppWidgetModel left, ObjectFinderAppWidgetModel right) { |
|||
return !Equals(left, right); |
|||
} |
|||
} |
|||
|
|||
public class ObjectFinderAppWidget : StatefulWidget { |
|||
public readonly List<GameObjectInfo> objectInfos; |
|||
public readonly int selected; |
|||
|
|||
public readonly Action<string> doSearch; |
|||
|
|||
public readonly Action<int> onSelect; |
|||
|
|||
public readonly string title; |
|||
|
|||
public ObjectFinderAppWidget( |
|||
ObjectFinderAppWidgetModel model = null, |
|||
Action<string> doSearch = null, |
|||
Action<int> onSelect = null, |
|||
string title = null, |
|||
Key key = null) : base(key) { |
|||
this.objectInfos = model.objects; |
|||
this.selected = model.selected; |
|||
this.doSearch = doSearch; |
|||
this.onSelect = onSelect; |
|||
this.title = title; |
|||
} |
|||
|
|||
public override State createState() { |
|||
return new _ObjectFinderAppWidgetState(); |
|||
} |
|||
} |
|||
|
|||
public class _ObjectFinderAppWidgetState : State<ObjectFinderAppWidget> { |
|||
TextEditingController _controller; |
|||
|
|||
FocusNode _focusNode; |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
this._controller = new TextEditingController(""); |
|||
this._focusNode = new FocusNode(); |
|||
if (this.widget.doSearch != null) { |
|||
Window.instance.scheduleMicrotask(() => this.widget.doSearch("")); |
|||
} |
|||
|
|||
this._controller.addListener(this.textChange); |
|||
} |
|||
|
|||
public override void dispose() { |
|||
this._focusNode.dispose(); |
|||
this._controller.removeListener(this.textChange); |
|||
base.dispose(); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) { |
|||
Debug.Log("build ObjectFinderAppWidget"); |
|||
|
|||
return new Container( |
|||
padding: EdgeInsets.all(10), |
|||
decoration: new BoxDecoration(color: new Color(0x4FFFFFFF), |
|||
border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5), |
|||
borderRadius: BorderRadius.all(2)), |
|||
child: new Column( |
|||
crossAxisAlignment: CrossAxisAlignment.stretch, |
|||
children: new List<Widget>() { |
|||
this._buildTitle(), |
|||
this._buildSearchInput(), |
|||
this._buildResultCount(), |
|||
this._buildResults(), |
|||
} |
|||
) |
|||
); |
|||
} |
|||
|
|||
void textChange() { |
|||
if (this.widget.doSearch != null) { |
|||
this.widget.doSearch(this._controller.text); |
|||
} |
|||
} |
|||
|
|||
Widget _buildTitle() { |
|||
return new Text(this.widget.title, textAlign: TextAlign.center, |
|||
style: new TextStyle(fontSize: 20, height: 1.5f)); |
|||
} |
|||
|
|||
Widget _buildSearchInput() { |
|||
return new Row( |
|||
children: new List<Widget> { |
|||
new Text("Search:"), |
|||
new Flexible(child: |
|||
new Container( |
|||
margin: EdgeInsets.only(left: 8), |
|||
decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)), |
|||
padding: EdgeInsets.only(left: 8, right: 8), |
|||
child: new EditableText( |
|||
selectionControls: MaterialUtils.materialTextSelectionControls, |
|||
backgroundCursorColor: Colors.transparent, |
|||
controller: this._controller, |
|||
focusNode: this._focusNode, |
|||
style: new TextStyle( |
|||
fontSize: 18, |
|||
height: 1.5f |
|||
), |
|||
cursorColor: Color.fromARGB(255, 0, 0, 0) |
|||
) |
|||
) |
|||
) |
|||
} |
|||
); |
|||
} |
|||
|
|||
Widget _buildResultItem(GameObjectInfo obj) { |
|||
return new GestureDetector(child: |
|||
new Container( |
|||
key: new ValueKey<int>(obj.id), |
|||
child: new Text(obj.name), |
|||
padding: EdgeInsets.all(8), |
|||
color: this.widget.selected == obj.id ? new Color(0xFFFF0000) : new Color(0) |
|||
), onTap: () => { |
|||
if (this.widget.onSelect != null) { |
|||
this.widget.onSelect(obj.id); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
Widget _buildResultCount() { |
|||
return new Text($"Total Results:{this.widget.objectInfos.Count}", |
|||
style: new TextStyle(height: 3.0f, fontSize: 12)); |
|||
} |
|||
|
|||
Widget _buildResults() { |
|||
List<Widget> rows = new List<Widget>(); |
|||
this.widget.objectInfos.ForEach(obj => { rows.Add(this._buildResultItem(obj)); }); |
|||
return new Flexible( |
|||
child: new ListView( |
|||
children: rows, |
|||
physics: new AlwaysScrollableScrollPhysics()) |
|||
); |
|||
} |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue