浏览代码

attach UIWidgets to Panels under canvas + add more samples to UIWidgetsTheatre

/main
xingwei.zhu 6 年前
当前提交
7bfcfea0
共有 7 个文件被更改,包括 120 次插入196 次删除
  1. 4
      README.md
  2. 20
      Samples/UIWidgetSample/MaterialSample.cs
  3. 150
      Samples/UIWidgetSample/UIWidgetSample.unity
  4. 10
      Samples/UIWidgetsTheatre/UIWidgetsTheatre.cs
  5. 116
      Samples/UIWidgetsTheatre/UIWidgetsTheatre.unity
  6. 9
      Samples/UIWidgetsTheatre/UIWidgetsTheatre.asmdef
  7. 7
      Samples/UIWidgetsTheatre/UIWidgetsTheatre.asmdef.meta

4
README.md


## Learn
#### Samples
You can find many UIWidgets App samples in the UIWidgets package in the **Samples** folder.
You can find many UIWidgets App samples in the UIWidgets package in the **Samples** folder.
To get started, the UIWidgetsTheatre scene provides you
a list of carefully selected samples to start with.
You can also try UIWidgets-based Editor windows by clicking **UIWidgetsTest** on the main menu
and open one of the dropdown samples.

20
Samples/UIWidgetSample/MaterialSample.cs


}
}
class BottomAppBarWidget : StatelessWidget {
public class BottomAppBarWidget : StatelessWidget {
public BottomAppBarWidget(Key key = null) : base(key) {
}

}
class TableWidget : StatelessWidget {
public class TableWidget : StatelessWidget {
public TableWidget(Key key = null) : base(key) {
}

}
class MaterialTabBarWidget : StatefulWidget {
public class MaterialTabBarWidget : StatefulWidget {
public MaterialTabBarWidget(Key key = null) : base(key) {
}

}
class MaterialTabBarWidgetState : SingleTickerProviderStateMixin<MaterialTabBarWidget> {
public class MaterialTabBarWidgetState : SingleTickerProviderStateMixin<MaterialTabBarWidget> {
TabController _tabController;
public override void initState() {

}
}
class MaterialAppBarWidget : StatefulWidget {
public class MaterialAppBarWidget : StatefulWidget {
public MaterialAppBarWidget(Key key = null) : base(key) {
}

}
class MaterialAppBarWidgetState : State<MaterialAppBarWidget> {
public class MaterialAppBarWidgetState : State<MaterialAppBarWidget> {
Choice _selectedChoice = Choice.choices[0];
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();

}
}
class MaterialInkWellWidget : StatefulWidget {
public class MaterialInkWellWidget : StatefulWidget {
public MaterialInkWellWidget(Key key = null) : base(key) {
}

}
class MaterialInkWidgetState : State<MaterialInkWellWidget> {
public class MaterialInkWidgetState : State<MaterialInkWellWidget> {
public override Widget build(BuildContext context) {
return new Material(
//color: Colors.blue,

}
}
class MaterialButtonWidget : StatefulWidget {
public class MaterialButtonWidget : StatefulWidget {
public MaterialButtonWidget(Key key = null) : base(key) {
}

}
class MaterialButtonWidgetState : State<MaterialButtonWidget> {
public class MaterialButtonWidgetState : State<MaterialButtonWidget> {
public override Widget build(BuildContext context) {
return new Stack(
children: new List<Widget> {

150
Samples/UIWidgetSample/UIWidgetSample.unity


m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &304189371
MonoBehaviour:
m_ObjectHideFlags: 0

m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &552752111
RectTransform:
m_ObjectHideFlags: 0

m_Father: {fileID: 304189374}
m_RootOrder: 5
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_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_SizeDelta: {x: 100, y: 100}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &552752112
MonoBehaviour:

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 552752110}
m_CullTransparentMesh: 0
m_CullTransparentMesh: 1
--- !u!1 &554372217
GameObject:
m_ObjectHideFlags: 0

m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1148735784}
m_CullTransparentMesh: 0
--- !u!1 &1155767695
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1155767701}
- component: {fileID: 1155767700}
- component: {fileID: 1155767699}
- component: {fileID: 1155767698}
- component: {fileID: 1155767697}
- component: {fileID: 1155767696}
m_Layer: 5
m_Name: Canvas2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1155767696
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1155767695}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7c3be43dd8b94a349f26e3e7173c3f6, 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
--- !u!222 &1155767697
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1155767695}
m_CullTransparentMesh: 0
--- !u!114 &1155767698
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1155767695}
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 &1155767699
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1155767695}
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 &1155767700
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1155767695}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
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 &1155767701
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1155767695}
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: []
m_Father: {fileID: 0}
m_RootOrder: 4
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!1 &1199742531
GameObject:
m_ObjectHideFlags: 0

m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1387978527
RectTransform:
m_ObjectHideFlags: 0

10
Samples/UIWidgetsTheatre/UIWidgetsTheatre.cs


using System.Collections.Generic;
using UIWidgetsGallery.gallery;
using UIWidgetsSample;
using Unity.UIWidgets.material;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

using UnityEngine;
namespace UIWidgetsSample {
namespace UIWidgetsTheatre {
class TheatreEntry {
public string entryName;

class UIWidgetsTheatre : UIWidgetsSamplePanel {
static readonly List<TheatreEntry> entries = new List<TheatreEntry> {
new TheatreEntry{entryName = "UIWidget Gallery", entryWidget = new GalleryApp()},
new TheatreEntry{entryName = "Material Tab Bar" , entryWidget = new MaterialTabBarWidget()}
new TheatreEntry{entryName = "Material Tab Bar" , entryWidget = new MaterialTabBarWidget()},
new TheatreEntry{entryName = "Asset Store", entryWidget = new AsScreenSample.AsScreenWidget()},
new TheatreEntry{entryName = "ToDo App", entryWidget = new ToDoAppSample.ToDoListApp()}
};
public static string[] entryKeys {

protected override void Awake() {
base.Awake();
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"), "Material Icons");
FontManager.instance.addFont(Resources.Load<Font>("GalleryIcons"), "GalleryIcons");
}
}

116
Samples/UIWidgetsTheatre/UIWidgetsTheatre.unity


- component: {fileID: 314914772}
- component: {fileID: 314914771}
- component: {fileID: 314914770}
- component: {fileID: 314914775}
- component: {fileID: 314914774}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged

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: []
m_Children:
- {fileID: 1344738457}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &314914774
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 314914769}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3ace0d3c7f55946559f1497f0fbf6025, 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
testCaseId: 0
--- !u!222 &314914775
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 314914769}
m_CullTransparentMesh: 0
--- !u!1 &1040325770
GameObject:
m_ObjectHideFlags: 0

m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1344738456
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1344738457}
- component: {fileID: 1344738459}
- component: {fileID: 1344738458}
m_Layer: 5
m_Name: TheatrePanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1344738457
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1344738456}
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: 314914773}
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 &1344738458
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1344738456}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3ace0d3c7f55946559f1497f0fbf6025, 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
testCaseId: 2
--- !u!222 &1344738459
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1344738456}
m_CullTransparentMesh: 0
--- !u!1 &1814350050
GameObject:
m_ObjectHideFlags: 0

9
Samples/UIWidgetsTheatre/UIWidgetsTheatre.asmdef


{
"name": "UIWidgetsTheatre",
"references": [
"Unity.UIWidgets",
"UIWidgetsGallery",
"UIWidgetsSample"],
"includePlatforms": [],
"excludePlatforms": []
}

7
Samples/UIWidgetsTheatre/UIWidgetsTheatre.asmdef.meta


fileFormatVersion: 2
guid: ce5674c12e2e24bf6bb350c64744f227
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存