浏览代码

update to a better sample (click on the top-right corner of the button will change the button color)

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
274d167a
共有 2 个文件被更改,包括 27 次插入27 次删除
  1. 44
      Samples/UIWidgetsSamples_2019_4/Assets/TextTest.unity
  2. 10
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsExample.cs

44
Samples/UIWidgetsSamples_2019_4/Assets/TextTest.unity


- component: {fileID: 847097469}
- component: {fileID: 847097471}
- component: {fileID: 847097470}
- component: {fileID: 847097472}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged

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: -1.3, y: 0.8}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 483, y: 399}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &847097470

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847097468}
m_Enabled: 0
m_Enabled: 1
m_Script: {fileID: 11500000, guid: db61290d6ca38264995f5749021d562c, type: 3}
m_Script: {fileID: 11500000, guid: 84eecb3d75338e24185f4fcd9d813a55, type: 3}
fonts:
- path: Roboto-BlackItalic.ttf
name: Roboto-RegularB
- path: Roboto-Italic.ttf
name: Roboto-Regular
- path: Ranchers-Regular.ttf
name: ranchers
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
fonts: []
devicePixelRatioOverride: 0
hardwareAntiAliasing: 0
--- !u!222 &847097471
CanvasRenderer:
m_ObjectHideFlags: 0

m_GameObject: {fileID: 847097468}
m_CullTransparentMesh: 0
--- !u!114 &847097472
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847097468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 169ec79ce040653478e1a7725f34bbe1, type: 3}
m_Name:
m_EditorClassIdentifier:
fonts: []
--- !u!1 &1140493537
GameObject:
m_ObjectHideFlags: 0

10
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsExample.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using FontStyle = Unity.UIWidgets.ui.FontStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;

int counter = 0;
public override Widget build(BuildContext context) {
return new Column(
return new Container(
color: Colors.green,
child: new Column(
children: new List<Widget> {
new Text("Counter: " + this.counter),
new GestureDetector(

},
child: new Container(
padding: EdgeInsets.symmetric(20, 20),
color: Colors.blue,
color: this.counter % 2 == 0 ? Colors.blue : Colors.red,
);
)
);
}
}
}
正在加载...
取消
保存