浏览代码

Merge pull request #4 from Unity-Technologies/add-sample

Add sample
/main
GitHub 4 年前
当前提交
25e64082
共有 469 个文件被更改,包括 6651 次插入0 次删除
  1. 3
      .yamato/upm-ci.yml
  2. 14
      add_sample.sh
  3. 43
      Samples/UIWidgetsSamples_2019_4/Packages/manifest.json
  4. 19
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/AudioManager.asset
  5. 6
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/ClusterInputManager.asset
  6. 34
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/DynamicsManager.asset
  7. 8
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/EditorBuildSettings.asset
  8. 35
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/EditorSettings.asset
  9. 63
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/GraphicsSettings.asset
  10. 295
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/InputManager.asset
  11. 91
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/NavMeshAreas.asset
  12. 56
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/Physics2DSettings.asset
  13. 7
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/PresetManager.asset
  14. 670
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/ProjectSettings.asset
  15. 2
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/ProjectVersion.txt
  16. 232
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/QualitySettings.asset
  17. 43
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/TagManager.asset
  18. 9
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/TimeManager.asset
  19. 34
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/UnityConnectSettings.asset
  20. 12
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/VFXManager.asset
  21. 10
      Samples/UIWidgetsSamples_2019_4/ProjectSettings/XRSettings.asset
  22. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta
  23. 617
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/CanvasAndLayers.cs
  24. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/CanvasAndLayers.cs.meta
  25. 66
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/CupertinoSampleWidget.cs
  26. 3
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/CupertinoSampleWidget.cs.meta
  27. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop.meta
  28. 374
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/CustomInspectorSample.cs
  29. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/CustomInspectorSample.cs.meta
  30. 171
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/UnityObjectDetectorSample.cs
  31. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/UnityObjectDetectorSample.cs.meta
  32. 80
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditableTextWiget.cs
  33. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditableTextWiget.cs.meta
  34. 19
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorExampleTest.cs
  35. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorExampleTest.cs.meta
  36. 31
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/GalleryMainEditor.cs
  37. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/GalleryMainEditor.cs.meta
  38. 98
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Gestures.cs
  39. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Gestures.cs.meta
  40. 47
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Menu.cs
  41. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Menu.cs.meta
  42. 96
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/MouseHover.cs
  43. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/MouseHover.cs.meta
  44. 235
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Paragraph.cs
  45. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Paragraph.cs.meta
  46. 153
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderBoxes.cs
  47. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderBoxes.cs.meta
  48. 197
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderEditable.cs
  49. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderEditable.cs.meta
  50. 165
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/SceneViewTests.cs
  51. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/SceneViewTests.cs.meta
  52. 22
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/UIWidgetsSample.Editor.asmdef
  53. 7
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/UIWidgetsSample.Editor.asmdef.meta
  54. 919
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs
  55. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs.meta
  56. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts.meta
  57. 149
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/bar.cs
  58. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/bar.cs.meta
  59. 38
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/color_palette.cs
  60. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/color_palette.cs.meta
  61. 67
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/main.cs
  62. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/main.cs.meta
  63. 41
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/tween.cs
  64. 11
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/tween.cs.meta
  65. 8
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta
  66. 45
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs
  67. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs.meta
  68. 92
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs
  69. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs.meta
  70. 204
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs
  71. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs.meta
  72. 73
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs
  73. 3
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs.meta
  74. 55
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs
  75. 3
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta
  76. 85
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs
  77. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta
  78. 60
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs
  79. 3
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta
  80. 97
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs
  81. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta
  82. 86
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs
  83. 3
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta
  84. 82
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs
  85. 11
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs.meta
  86. 51
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs
  87. 3
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta
  88. 56
      Samples/UIWidgetsSamples_2019_4/Assets/README-ZH.md
  89. 7
      Samples/UIWidgetsSamples_2019_4/Assets/README-ZH.md.meta
  90. 59
      Samples/UIWidgetsSamples_2019_4/Assets/README.md
  91. 7
      Samples/UIWidgetsSamples_2019_4/Assets/README.md.meta

3
.yamato/upm-ci.yml


test_editors:
- version: 2018.4
- version: 2019.1
- version: 2019.2
- version: 2019.4

commands:
- chmod +x ./prepare_package.sh
- ./prepare_package.sh
- chmod +x ./add_sample.sh
- ./add_sample.sh
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci package pack --package-path ./com.unity.uiwidgets
artifacts:

14
add_sample.sh


#!/usr/bin/env bash
#set -xeuo pipefail
#set -x
printf "Preparing samples:\n"
cd com.unity.uiwidgets
mkdir Samples
cd Samples
cp -r ../../Samples/UIWidgetsSamples_2019_4/Assets UIWidgetsSamples
echo "Finished the sample preparation."

43
Samples/UIWidgetsSamples_2019_4/Packages/manifest.json


{
"dependencies": {
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.1",
"com.unity.uiwidgets": "file:../../../com.unity.uiwidgets",
"com.unity.test-framework": "1.1.14",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.15",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
}

19
Samples/UIWidgetsSamples_2019_4/ProjectSettings/AudioManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!11 &1
AudioManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Volume: 1
Rolloff Scale: 1
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 0
m_DSPBufferSize: 1024
m_VirtualVoiceCount: 512
m_RealVoiceCount: 32
m_SpatializerPlugin:
m_AmbisonicDecoderPlugin:
m_DisableAudio: 0
m_VirtualizeEffects: 1
m_RequestedDSPBufferSize: 1024

6
Samples/UIWidgetsSamples_2019_4/ProjectSettings/ClusterInputManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!236 &1
ClusterInputManager:
m_ObjectHideFlags: 0
m_Inputs: []

34
Samples/UIWidgetsSamples_2019_4/ProjectSettings/DynamicsManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 11
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6
m_DefaultSolverVelocityIterations: 1
m_QueriesHitBackfaces: 0
m_QueriesHitTriggers: 1
m_EnableAdaptiveForce: 0
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 250, y: 250, z: 250}
m_WorldSubdivisions: 8
m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngluarSpeed: 7

8
Samples/UIWidgetsSamples_2019_4/ProjectSettings/EditorBuildSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1045 &1
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_configObjects: {}

35
Samples/UIWidgetsSamples_2019_4/ProjectSettings/EditorSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_ExternalVersionControlSupport: Visible Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 0
m_DefaultBehaviorMode: 0
m_PrefabRegularEnvironment: {fileID: 0}
m_PrefabUIEnvironment: {fileID: 0}
m_SpritePackerMode: 0
m_SpritePackerPaddingPower: 1
m_EtcTextureCompressorBehavior: 1
m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref
m_ProjectGenerationRootNamespace:
m_CollabEditorSettings:
inProgressEnabled: 1
m_EnableTextureStreamingInEditMode: 1
m_EnableTextureStreamingInPlayMode: 1
m_AsyncShaderCompilation: 1
m_EnterPlayModeOptionsEnabled: 0
m_EnterPlayModeOptions: 3
m_ShowLightmapResolutionOverlay: 1
m_UseLegacyProbeSampleCount: 0
m_AssetPipelineMode: 1
m_CacheServerMode: 0
m_CacheServerEndpoint:
m_CacheServerNamespacePrefix: default
m_CacheServerEnableDownload: 1
m_CacheServerEnableUpload: 1

63
Samples/UIWidgetsSamples_2019_4/ProjectSettings/GraphicsSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
m_DeferredReflections:
m_Mode: 1
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
m_ScreenSpaceShadows:
m_Mode: 1
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
m_LegacyDeferred:
m_Mode: 1
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
m_DepthNormals:
m_Mode: 1
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
m_MotionVectors:
m_Mode: 1
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
m_LightHalo:
m_Mode: 1
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
m_LensFlare:
m_Mode: 1
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
m_AlwaysIncludedShaders:
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_CustomRenderPipeline: {fileID: 0}
m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1}
m_DefaultRenderingPath: 1
m_DefaultMobileRenderingPath: 1
m_TierSettings: []
m_LightmapStripping: 0
m_FogStripping: 0
m_InstancingStripping: 0
m_LightmapKeepPlain: 1
m_LightmapKeepDirCombined: 1
m_LightmapKeepDynamicPlain: 1
m_LightmapKeepDynamicDirCombined: 1
m_LightmapKeepShadowMask: 1
m_LightmapKeepSubtractive: 1
m_FogKeepLinear: 1
m_FogKeepExp: 1
m_FogKeepExp2: 1
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0
m_LogWhenShaderIsCompiled: 0
m_AllowEnlightenSupportForUpgradedProject: 0

295
Samples/UIWidgetsSamples_2019_4/ProjectSettings/InputManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!13 &1
InputManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Axes:
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton: left
positiveButton: right
altNegativeButton: a
altPositiveButton: d
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton: down
positiveButton: up
altNegativeButton: s
altPositiveButton: w
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left ctrl
altNegativeButton:
altPositiveButton: mouse 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left alt
altNegativeButton:
altPositiveButton: mouse 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left shift
altNegativeButton:
altPositiveButton: mouse 2
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: space
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse X
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Mouse Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Mouse ScrollWheel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 2
joyNum: 0
- serializedVersion: 3
m_Name: Horizontal
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.19
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 0
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire2
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 1
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire3
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 2
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Jump
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 3
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: return
altNegativeButton:
altPositiveButton: joystick button 0
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Submit
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: enter
altNegativeButton:
altPositiveButton: space
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Cancel
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: escape
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0

91
Samples/UIWidgetsSamples_2019_4/ProjectSettings/NavMeshAreas.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!126 &1
NavMeshProjectSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
areas:
- name: Walkable
cost: 1
- name: Not Walkable
cost: 1
- name: Jump
cost: 2
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
- name:
cost: 1
m_LastAgentTypeID: -887442657
m_Settings:
- serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.75
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_SettingNames:
- Humanoid

56
Samples/UIWidgetsSamples_2019_4/ProjectSettings/Physics2DSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!19 &1
Physics2DSettings:
m_ObjectHideFlags: 0
serializedVersion: 4
m_Gravity: {x: 0, y: -9.81}
m_DefaultMaterial: {fileID: 0}
m_VelocityIterations: 8
m_PositionIterations: 3
m_VelocityThreshold: 1
m_MaxLinearCorrection: 0.2
m_MaxAngularCorrection: 8
m_MaxTranslationSpeed: 100
m_MaxRotationSpeed: 360
m_BaumgarteScale: 0.2
m_BaumgarteTimeOfImpactScale: 0.75
m_TimeToSleep: 0.5
m_LinearSleepTolerance: 0.01
m_AngularSleepTolerance: 2
m_DefaultContactOffset: 0.01
m_JobOptions:
serializedVersion: 2
useMultithreading: 0
useConsistencySorting: 0
m_InterpolationPosesPerJob: 100
m_NewContactsPerJob: 30
m_CollideContactsPerJob: 100
m_ClearFlagsPerJob: 200
m_ClearBodyForcesPerJob: 200
m_SyncDiscreteFixturesPerJob: 50
m_SyncContinuousFixturesPerJob: 50
m_FindNearestContactsPerJob: 100
m_UpdateTriggerContactsPerJob: 100
m_IslandSolverCostThreshold: 100
m_IslandSolverBodyCostScale: 1
m_IslandSolverContactCostScale: 10
m_IslandSolverJointCostScale: 10
m_IslandSolverBodiesPerJob: 50
m_IslandSolverContactsPerJob: 50
m_AutoSimulation: 1
m_QueriesHitTriggers: 1
m_QueriesStartInColliders: 1
m_CallbacksOnDisable: 1
m_ReuseCollisionCallbacks: 1
m_AutoSyncTransforms: 0
m_AlwaysShowColliders: 0
m_ShowColliderSleep: 1
m_ShowColliderContacts: 0
m_ShowColliderAABB: 0
m_ContactArrowScale: 0.2
m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

7
Samples/UIWidgetsSamples_2019_4/ProjectSettings/PresetManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1386491679 &1
PresetManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_DefaultPresets: {}

670
Samples/UIWidgetsSamples_2019_4/ProjectSettings/ProjectSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 20
productGUID: a8857699d36841a41931eb077ba9d68d
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
AndroidEnableSustainedPerformanceMode: 0
defaultScreenOrientation: 4
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: UIWidgetsSamples
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
m_SplashScreenAnimation: 1
m_SplashScreenLogoStyle: 1
m_SplashScreenDrawMode: 0
m_SplashScreenBackgroundAnimationZoom: 1
m_SplashScreenLogoAnimationZoom: 1
m_SplashScreenBackgroundLandscapeAspect: 1
m_SplashScreenBackgroundPortraitAspect: 1
m_SplashScreenBackgroundLandscapeUvs:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_SplashScreenBackgroundPortraitUvs:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
m_ShowUnitySplashAds: 0
m_AdsAndroidGameId:
m_AdsIosGameId:
m_ShowSplashAdsSlogan: 0
m_SloganImage: {fileID: 0}
m_SloganHeight: 150
m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024
defaultScreenHeight: 768
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
m_MTRendering: 1
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosUseCustomAppBackgroundBehavior: 0
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
allowedAutorotateToLandscapeRight: 1
allowedAutorotateToLandscapeLeft: 1
useOSAutorotation: 1
use32BitDisplayBuffer: 1
preserveFramebufferAlpha: 0
disableDepthAndStencilBuffers: 0
androidStartInFullscreen: 1
androidRenderOutsideSafeArea: 1
androidUseSwappy: 0
androidBlitType: 0
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 1
captureSingleScreen: 0
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
deferSystemGesturesMode: 0
hideHomeButton: 0
submitAnalytics: 1
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
resizableWindow: 0
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 1
xboxPIXTextureCapture: 0
xboxEnableAvatar: 0
xboxEnableKinect: 0
xboxEnableKinectAutoTracking: 0
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
xboxEnablePIXSampling: 0
metalFramebufferOnly: 0
xboxOneResolution: 0
xboxOneSResolution: 0
xboxOneXResolution: 3
xboxOneMonoLoggingLevel: 0
xboxOneLoggingLevel: 1
xboxOneDisableEsram: 0
xboxOneEnableTypeOptimization: 0
xboxOnePresentImmediateThreshold: 0
switchQueueCommandMemory: 0
switchQueueControlMemory: 16384
switchQueueComputeMemory: 262144
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
stadiaPresentMode: 0
stadiaTargetFramerate: 0
vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0
useSecurityBuild: 0
m_SupportedAspectRatios:
4:3: 1
5:4: 1
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.1
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 1
xboxOneEnable7thCore: 1
vrSettings:
cardboard:
depthFormat: 0
enableTransitionView: 0
daydream:
depthFormat: 0
useSustainedPerformanceMode: 0
enableVideoLayer: 0
useProtectedVideoMemory: 0
minimumSupportedHeadTracking: 0
maximumSupportedHeadTracking: 1
hololens:
depthFormat: 1
depthBufferSharingEnabled: 1
lumin:
depthFormat: 0
frameTiming: 2
enableGLCache: 0
glCacheMaxBlobSize: 524288
glCacheMaxFileSize: 8388608
oculus:
sharedDepthBuffer: 1
dashSupport: 1
lowOverheadMode: 0
protectedContext: 0
v2Signing: 1
enable360StereoCapture: 0
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
D3DHDRBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
buildNumber: {}
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 19
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
stripEngineCode: 1
iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0
ForceSDCardPermission: 0
CreateWallpaper: 0
APKExpansionFiles: 0
keepLoadedShadersAlive: 0
StripUnusedMeshComponents: 1
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
iOSTargetOSVersionString: 10.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 10.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
uIStatusBarHidden: 1
uIExitOnSuspend: 0
uIStatusBarStyle: 0
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
tvOSSmallIconLayers2x: []
tvOSLargeIconLayers: []
tvOSLargeIconLayers2x: []
tvOSTopShelfImageLayers: []
tvOSTopShelfImageLayers2x: []
tvOSTopShelfImageWideLayers: []
tvOSTopShelfImageWideLayers2x: []
iOSLaunchScreenType: 0
iOSLaunchScreenPortrait: {fileID: 0}
iOSLaunchScreenLandscape: {fileID: 0}
iOSLaunchScreenBackgroundColor:
serializedVersion: 2
rgba: 0
iOSLaunchScreenFillPct: 100
iOSLaunchScreenSize: 100
iOSLaunchScreenCustomXibPath:
iOSLaunchScreeniPadType: 0
iOSLaunchScreeniPadImage: {fileID: 0}
iOSLaunchScreeniPadBackgroundColor:
serializedVersion: 2
rgba: 0
iOSLaunchScreeniPadFillPct: 100
iOSLaunchScreeniPadSize: 100
iOSLaunchScreeniPadCustomXibPath:
iOSUseLaunchScreenStoryboard: 0
iOSLaunchScreenCustomStoryboardPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0
metalEditorSupport: 1
metalAPIValidation: 1
iOSRenderExtraFrameOnPause: 0
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
appleEnableProMotion: 0
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
templatePackageId: com.unity.template.3d@4.2.8
templateDefaultScene: Assets/Scenes/SampleScene.unity
AndroidTargetArchitectures: 1
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0
AndroidIsGame: 1
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0
m_AndroidBanners:
- width: 320
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: []
m_BuildTargetPlatformIcons: []
m_BuildTargetBatching:
- m_BuildTarget: Standalone
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: tvOS
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: Android
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: iPhone
m_StaticBatching: 1
m_DynamicBatching: 0
- m_BuildTarget: WebGL
m_StaticBatching: 0
m_DynamicBatching: 0
m_BuildTargetEncrypting: []
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 0
- m_BuildTarget: Switch
m_GraphicsJobs: 1
- m_BuildTarget: MetroSupport
m_GraphicsJobs: 1
- m_BuildTarget: AppleTVSupport
m_GraphicsJobs: 0
- m_BuildTarget: BJMSupport
m_GraphicsJobs: 1
- m_BuildTarget: LinuxStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: PS4Player
m_GraphicsJobs: 1
- m_BuildTarget: iOSSupport
m_GraphicsJobs: 0
- m_BuildTarget: WindowsStandaloneSupport
m_GraphicsJobs: 1
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobs: 1
- m_BuildTarget: LuminSupport
m_GraphicsJobs: 0
- m_BuildTarget: AndroidPlayer
m_GraphicsJobs: 0
- m_BuildTarget: WebGLSupport
m_GraphicsJobs: 0
m_BuildTargetGraphicsJobMode:
- m_BuildTarget: PS4Player
m_GraphicsJobMode: 0
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobMode: 0
m_BuildTargetGraphicsAPIs:
- m_BuildTarget: AndroidPlayer
m_APIs: 150000000b000000
m_Automatic: 0
- m_BuildTarget: iOSSupport
m_APIs: 10000000
m_Automatic: 1
- m_BuildTarget: AppleTVSupport
m_APIs: 10000000
m_Automatic: 0
- m_BuildTarget: WebGLSupport
m_APIs: 0b000000
m_Automatic: 1
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 0
m_Devices:
- Oculus
- OpenVR
openGLRequireES31: 0
openGLRequireES31AEP: 0
openGLRequireES32: 0
m_TemplateCustomTags: {}
mobileMTRendering:
Android: 1
iPhone: 1
tvOS: 1
m_BuildTargetGroupLightmapEncodingQuality: []
m_BuildTargetGroupLightmapSettings: []
playModeTestRunnerEnabled: 0
runPlayModeTestAsEditModeTest: 0
actionOnDotNetUnhandledException: 1
enableInternalProfiler: 0
logObjCUncaughtExceptions: 1
enableCrashReportAPI: 0
cameraUsageDescription:
locationUsageDescription:
microphoneUsageDescription:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
switchSocketAllocatorPoolSize: 128
switchSocketConcurrencyLimit: 14
switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
switchApplicationID: 0x01004b9000490000
switchNSODependencies:
switchTitleNames_0:
switchTitleNames_1:
switchTitleNames_2:
switchTitleNames_3:
switchTitleNames_4:
switchTitleNames_5:
switchTitleNames_6:
switchTitleNames_7:
switchTitleNames_8:
switchTitleNames_9:
switchTitleNames_10:
switchTitleNames_11:
switchTitleNames_12:
switchTitleNames_13:
switchTitleNames_14:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:
switchPublisherNames_3:
switchPublisherNames_4:
switchPublisherNames_5:
switchPublisherNames_6:
switchPublisherNames_7:
switchPublisherNames_8:
switchPublisherNames_9:
switchPublisherNames_10:
switchPublisherNames_11:
switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
switchIcons_3: {fileID: 0}
switchIcons_4: {fileID: 0}
switchIcons_5: {fileID: 0}
switchIcons_6: {fileID: 0}
switchIcons_7: {fileID: 0}
switchIcons_8: {fileID: 0}
switchIcons_9: {fileID: 0}
switchIcons_10: {fileID: 0}
switchIcons_11: {fileID: 0}
switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
switchSmallIcons_3: {fileID: 0}
switchSmallIcons_4: {fileID: 0}
switchSmallIcons_5: {fileID: 0}
switchSmallIcons_6: {fileID: 0}
switchSmallIcons_7: {fileID: 0}
switchSmallIcons_8: {fileID: 0}
switchSmallIcons_9: {fileID: 0}
switchSmallIcons_10: {fileID: 0}
switchSmallIcons_11: {fileID: 0}
switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
switchMainThreadStackSize: 1048576
switchPresenceGroupId:
switchLogoHandling: 0
switchReleaseVersion: 0
switchDisplayVersion: 1.0.0
switchStartupUserAccount: 0
switchTouchScreenUsage: 0
switchSupportedLanguagesMask: 0
switchLogoType: 0
switchApplicationErrorCodeCategory:
switchUserAccountSaveDataSize: 0
switchUserAccountSaveDataJournalSize: 0
switchApplicationAttribute: 0
switchCardSpecSize: -1
switchCardSpecClock: -1
switchRatingsMask: 0
switchRatingsInt_0: 0
switchRatingsInt_1: 0
switchRatingsInt_2: 0
switchRatingsInt_3: 0
switchRatingsInt_4: 0
switchRatingsInt_5: 0
switchRatingsInt_6: 0
switchRatingsInt_7: 0
switchRatingsInt_8: 0
switchRatingsInt_9: 0
switchRatingsInt_10: 0
switchRatingsInt_11: 0
switchRatingsInt_12: 0
switchLocalCommunicationIds_0:
switchLocalCommunicationIds_1:
switchLocalCommunicationIds_2:
switchLocalCommunicationIds_3:
switchLocalCommunicationIds_4:
switchLocalCommunicationIds_5:
switchLocalCommunicationIds_6:
switchLocalCommunicationIds_7:
switchParentalControl: 0
switchAllowsScreenshot: 1
switchAllowsVideoCapturing: 1
switchAllowsRuntimeAddOnContentInstall: 0
switchDataLossConfirmation: 0
switchUserAccountLockEnabled: 0
switchSystemResourceMemory: 16777216
switchSupportedNpadStyles: 22
switchNativeFsCacheSize: 32
switchIsHoldTypeHorizontal: 0
switchSupportedNpadCount: 8
switchSocketConfigEnabled: 0
switchTcpInitialSendBufferSize: 32
switchTcpInitialReceiveBufferSize: 64
switchTcpAutoSendBufferSizeMax: 256
switchTcpAutoReceiveBufferSizeMax: 256
switchUdpSendBufferSize: 9
switchUdpReceiveBufferSize: 42
switchSocketBufferEfficiency: 4
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
ps4ParentalLevel: 11
ps4ContentID: ED1633-NPXX51362_00-0000000000000000
ps4Category: 0
ps4MasterVersion: 01.00
ps4AppVersion: 01.00
ps4AppType: 0
ps4ParamSfxPath:
ps4VideoOutPixelFormat: 0
ps4VideoOutInitialWidth: 1920
ps4VideoOutBaseModeInitialWidth: 1920
ps4VideoOutReprojectionRate: 60
ps4PronunciationXMLPath:
ps4PronunciationSIGPath:
ps4BackgroundImagePath:
ps4StartupImagePath:
ps4StartupImagesFolder:
ps4IconImagesFolder:
ps4SaveDataImagePath:
ps4SdkOverride:
ps4BGMPath:
ps4ShareFilePath:
ps4ShareOverlayImagePath:
ps4PrivacyGuardImagePath:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:
ps4PlayTogetherPlayerCount: 0
ps4EnterButtonAssignment: 1
ps4ApplicationParam1: 0
ps4ApplicationParam2: 0
ps4ApplicationParam3: 0
ps4ApplicationParam4: 0
ps4DownloadDataSize: 0
ps4GarlicHeapSize: 2048
ps4ProGarlicHeapSize: 2560
playerPrefsMaxSize: 32768
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4pnSessions: 1
ps4pnPresence: 1
ps4pnFriends: 1
ps4pnGameCustomData: 1
playerPrefsSupport: 0
enableApplicationExit: 0
resetTempFolder: 1
restrictedAudioUsageRights: 0
ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0
ps4UseAudio3dBackend: 0
ps4UseLowGarlicFragmentationMode: 1
ps4SocialScreenEnabled: 0
ps4ScriptOptimizationLevel: 0
ps4Audio3dVirtualSpeakerCount: 14
ps4attribCpuUsage: 0
ps4PatchPkgPath:
ps4PatchLatestPkgPath:
ps4PatchChangeinfoPath:
ps4PatchDayOne: 0
ps4attribUserManagement: 0
ps4attribMoveSupport: 0
ps4attrib3DSupport: 0
ps4attribShareSupport: 0
ps4attribExclusiveVR: 0
ps4disableAutoHideSplash: 0
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
ps4attribVROutputEnabled: 0
monoEnv:
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
blurSplashScreenBackground: 1
spritePackerPolicy:
webGLMemorySize: 16
webGLExceptionSupport: 1
webGLNameFilesAsHashes: 0
webGLDataCaching: 1
webGLDebugSymbols: 0
webGLEmscriptenArgs:
webGLModulesDirectory:
webGLTemplate: APPLICATION:Default
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLCompressionFormat: 1
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLWasmStreaming: 0
scriptingDefineSymbols: {}
platformArchitecture: {}
scriptingBackend: {}
il2cppCompilerConfiguration: {}
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
allowUnsafeCode: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0
gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
m_MobileRenderingPath: 1
metroPackageName: Template_3D
metroPackageVersion:
metroCertificatePath:
metroCertificatePassword:
metroCertificateSubject:
metroCertificateIssuer:
metroCertificateNotAfter: 0000000000000000
metroApplicationDescription: Template_3D
wsaImages: {}
metroTileShortName:
metroTileShowName: 0
metroMediumTileShowName: 0
metroLargeTileShowName: 0
metroWideTileShowName: 0
metroSupportStreamingInstall: 0
metroLastRequiredScene: 0
metroDefaultTileSize: 1
metroTileForegroundText: 2
metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
a: 1}
metroSplashScreenUseBackgroundColor: 0
platformCapabilities: {}
metroTargetDeviceFamilies: {}
metroFTAName:
metroFTAFileTypes: []
metroProtocolName:
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
XboxOneContentId:
XboxOneTitleId:
XboxOneSCId:
XboxOneGameOsOverridePath:
XboxOnePackagingOverridePath:
XboxOneAppManifestOverridePath:
XboxOneVersion: 1.0.0.0
XboxOnePackageEncryption: 0
XboxOnePackageUpdateGranularity: 2
XboxOneDescription:
XboxOneLanguage:
- enus
XboxOneCapability: []
XboxOneGameRating: {}
XboxOneIsContentPackage: 0
XboxOneEnableGPUVariability: 1
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
XboxOneXTitleMemory: 8
XboxOneOverrideIdentityName:
XboxOneOverrideIdentityPublisher:
vrEditorSettings:
daydream:
daydreamIconForeground: {fileID: 0}
daydreamIconBackground: {fileID: 0}
cloudServicesEnabled:
UNet: 1
luminIcon:
m_Name:
m_ModelFolderPath:
m_PortalFolderPath:
luminCert:
m_CertPath:
m_SignPackage: 1
luminIsChannelApp: 0
luminVersion:
m_VersionCode: 1
m_VersionName:
apiCompatibilityLevel: 6
cloudProjectId:
framebufferDepthMemorylessMode: 0
projectName:
organizationId:
cloudEnabled: 0
enableNativePlatformBackendsForNewInputSystem: 0
disableOldInputManagerSupport: 0
legacyClampBlendShapeWeights: 0

2
Samples/UIWidgetsSamples_2019_4/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.4.2f1
m_EditorVersionWithRevision: 2019.4.2f1 (f997fc5c673b)

232
Samples/UIWidgetsSamples_2019_4/ProjectSettings/QualitySettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!47 &1
QualitySettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_CurrentQuality: 5
m_QualitySettings:
- serializedVersion: 2
name: Very Low
pixelLightCount: 0
shadows: 0
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 15
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 1
textureQuality: 1
anisotropicTextures: 0
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 0
lodBias: 0.3
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Low
pixelLightCount: 0
shadows: 0
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 20
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
textureQuality: 0
anisotropicTextures: 0
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 0
lodBias: 0.4
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 16
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Medium
pixelLightCount: 1
shadows: 1
shadowResolution: 0
shadowProjection: 1
shadowCascades: 1
shadowDistance: 20
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
blendWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
softParticles: 0
softVegetation: 0
realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0
vSyncCount: 1
lodBias: 0.7
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 64
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: High
pixelLightCount: 2
shadows: 2
shadowResolution: 1
shadowProjection: 1
shadowCascades: 2
shadowDistance: 40
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 0
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 1
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 256
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Very High
pixelLightCount: 3
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowCascades: 2
shadowDistance: 70
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 1.5
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 1024
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
- serializedVersion: 2
name: Ultra
pixelLightCount: 4
shadows: 2
shadowResolution: 2
shadowProjection: 1
shadowCascades: 4
shadowDistance: 150
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1
blendWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 2
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 1
lodBias: 2
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4096
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
excludedTargetPlatforms: []
m_PerPlatformDefaultQuality:
Android: 2
Lumin: 5
Nintendo 3DS: 5
Nintendo Switch: 5
PS4: 5
PSP2: 2
Stadia: 5
Standalone: 5
WebGL: 3
Windows Store Apps: 5
XboxOne: 5
iPhone: 2
tvOS: 2

43
Samples/UIWidgetsSamples_2019_4/ProjectSettings/TagManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
layers:
- Default
- TransparentFX
- Ignore Raycast
-
- Water
- UI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
m_SortingLayers:
- name: Default
uniqueID: 0
locked: 0

9
Samples/UIWidgetsSamples_2019_4/ProjectSettings/TimeManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!5 &1
TimeManager:
m_ObjectHideFlags: 0
Fixed Timestep: 0.02
Maximum Allowed Timestep: 0.33333334
m_TimeScale: 1
Maximum Particle Timestep: 0.03

34
Samples/UIWidgetsSamples_2019_4/ProjectSettings/UnityConnectSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!310 &1
UnityConnectSettings:
m_ObjectHideFlags: 0
serializedVersion: 1
m_Enabled: 0
m_TestMode: 0
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
m_ConfigUrl: https://config.uca.cloud.unity3d.com
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity.cn
m_Enabled: 0
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0
m_TestMode: 0
UnityAnalyticsSettings:
m_Enabled: 0
m_TestMode: 0
m_InitializeOnStartup: 1
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_IosGameId:
m_AndroidGameId:
m_GameIds: {}
m_GameId:
PerformanceReportingSettings:
m_Enabled: 0

12
Samples/UIWidgetsSamples_2019_4/ProjectSettings/VFXManager.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!937362698 &1
VFXManager:
m_ObjectHideFlags: 0
m_IndirectShader: {fileID: 0}
m_CopyBufferShader: {fileID: 0}
m_SortShader: {fileID: 0}
m_StripUpdateShader: {fileID: 0}
m_RenderPipeSettingsPath:
m_FixedTimeStep: 0.016666668
m_MaxDeltaTime: 0.05

10
Samples/UIWidgetsSamples_2019_4/ProjectSettings/XRSettings.asset


{
"m_SettingKeys": [
"VR Device Disabled",
"VR Device User Alert"
],
"m_SettingValues": [
"False",
"False"
]
}

8
Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta


fileFormatVersion: 2
guid: 0ae90c343ee0e4f7daf768fe6383340f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

617
Samples/UIWidgetsSamples_2019_4/Assets/Editor/CanvasAndLayers.cs


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();
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/CanvasAndLayers.cs.meta


fileFormatVersion: 2
guid: 82dd60611380c41ff89590fc49800e97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

66
Samples/UIWidgetsSamples_2019_4/Assets/Editor/CupertinoSampleWidget.cs


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
)
)
);
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/Editor/CupertinoSampleWidget.cs.meta


fileFormatVersion: 2
guid: 92aa3442134248a38d03c2a24a8a9962
timeCreated: 1566545424

8
Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop.meta


fileFormatVersion: 2
guid: 087f4b1b8d7aa4e93bca841df8a1d603
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

374
Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/CustomInspectorSample.cs


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))
}
)
)
),
}
)
)
)
}
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/CustomInspectorSample.cs.meta


fileFormatVersion: 2
guid: 5978da8ac1ccd4638bfe3d8425443807
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

171
Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/UnityObjectDetectorSample.cs


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
));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/DragNDrop/UnityObjectDetectorSample.cs.meta


fileFormatVersion: 2
guid: 2948179a390a944a9a44b7f86cfa3c57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

80
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditableTextWiget.cs


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;
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditableTextWiget.cs.meta


fileFormatVersion: 2
guid: be0c47c771a534e24a6a27e7fcc0f97e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

19
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorExampleTest.cs


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;
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorExampleTest.cs.meta


fileFormatVersion: 2
guid: 296bb7110a92448c1bc8659719a3c33c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Samples/UIWidgetsSamples_2019_4/Assets/Editor/GalleryMainEditor.cs


using UIWidgetsGallery.gallery;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEditor;
using UnityEngine;
namespace UIWidgetsGallery {
public class GalleryMainEditor : UIWidgetsEditorWindow {
[MenuItem("UIWidgetsTests/Gallery")]
public static void gallery() {
EditorWindow.GetWindow<GalleryMainEditor>();
}
protected override Widget createWidget() {
return new GalleryApp();
}
protected override void 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();
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/GalleryMainEditor.cs.meta


fileFormatVersion: 2
guid: 98f11153c8c804448abe7a050222da98
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

98
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Gestures.cs


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)
)
))
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Gestures.cs.meta


fileFormatVersion: 2
guid: a7710fcdc94c940438ce640043508690
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

47
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Menu.cs


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();
}*/
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Menu.cs.meta


fileFormatVersion: 2
guid: 07a2dca2a47d240e8aa2ce8d1f334972
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

96
Samples/UIWidgetsSamples_2019_4/Assets/Editor/MouseHover.cs


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; });
}
}
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/MouseHover.cs.meta


fileFormatVersion: 2
guid: b9842186b0d0f4bcf9f8db188333094f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

235
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Paragraph.cs


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);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Paragraph.cs.meta


fileFormatVersion: 2
guid: 3a2cc1e9b7e804b2e9f0a580b686488f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

153
Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderBoxes.cs


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;
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderBoxes.cs.meta


fileFormatVersion: 2
guid: 5bfb809078f1b448e970bf4ba4dadef2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

197
Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderEditable.cs


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) { }
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/RenderEditable.cs.meta


fileFormatVersion: 2
guid: 9b0441fd0240f4a1fa3f3df24ba9f0fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

165
Samples/UIWidgetsSamples_2019_4/Assets/Editor/SceneViewTests.cs


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;
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/SceneViewTests.cs.meta


fileFormatVersion: 2
guid: 1f47e7bb2c0184a3aa2246fa0d8a89e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Samples/UIWidgetsSamples_2019_4/Assets/Editor/UIWidgetsSample.Editor.asmdef


{
"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": []
}

7
Samples/UIWidgetsSamples_2019_4/Assets/Editor/UIWidgetsSample.Editor.asmdef.meta


fileFormatVersion: 2
guid: 68e123732d7044a35864388f0a17b907
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

919
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs


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);
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/Widgets.cs.meta


fileFormatVersion: 2
guid: f4edd5c1fb7ca444cb61994b2f961ae0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts.meta


fileFormatVersion: 2
guid: 670043f1cb7b9420287d473e7d464b5f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

149
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/bar.cs


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;
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/bar.cs.meta


fileFormatVersion: 2
guid: 86c1af2bfb2264482886e1dfc4421ca8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

38
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/color_palette.cs


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)];
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/color_palette.cs.meta


fileFormatVersion: 2
guid: 239b4d72aabd9409896ae59d43657685
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

67
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/main.cs


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
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/main.cs.meta


fileFormatVersion: 2
guid: f0f7155374ba841a68342496dca556d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

41
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/tween.cs


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();
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/Editor/demo_charts/tween.cs.meta


fileFormatVersion: 2
guid: b7cfb33e7825b49f1ad2d0bb356eb831
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta


fileFormatVersion: 2
guid: 611706478d8aa410983272ad601895d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

45
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs


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: () => { })
})));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/BottomAppBarSample.cs.meta


fileFormatVersion: 2
guid: 8ba2c65db2f2848d3a3fa5eb0890abe5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

92
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs


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")
)
)
}
)
}
)
)
);
}
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/DividerAndButton.cs.meta


fileFormatVersion: 2
guid: 7d02ebc8543484a84b26e073e5ec501f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

204
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs


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);
})
}
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialAppBarSample.cs.meta


fileFormatVersion: 2
guid: 684439e8285b14ebc894b328936d06dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

73
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs


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()
}
);
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialButtonSample.cs.meta


fileFormatVersion: 2
guid: 347e0378e419f46f2af69e1214f1ae5b
timeCreated: 1573031753

55
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs


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"); }
)
)
)
);
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialInkWellSample.cs.meta


fileFormatVersion: 2
guid: 1a03d2251d4fb4ef08021dcb11b0dc68
timeCreated: 1573031753

85
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs


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; }); }
)
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialNavigationBarSample.cs.meta


fileFormatVersion: 2
guid: 19405b76532fc44ae91d3c0996408a3e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

60
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs


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))
)
}
)
);
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialSliderSample.cs.meta


fileFormatVersion: 2
guid: a403bd4bc6da446f1bb8cc0424f2fb85
timeCreated: 1573031753

97
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs


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
));
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialTabBarSample.cs.meta


fileFormatVersion: 2
guid: 0cbd2174900054317b93e50e058cd61b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

86
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs


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: () => { })
})
)
)
);
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/MaterialThemeSample.cs.meta


fileFormatVersion: 2
guid: f5061bd7b85f4179a65c68ac289a4a58
timeCreated: 1556597371

82
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs


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);
});
}
)
)
);
}
}
}

11
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/ReorderableListSample.cs.meta


fileFormatVersion: 2
guid: 4743f6dbc9049447eaae87cc7519406b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

51
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs


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));
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/TableSample.cs.meta


fileFormatVersion: 2
guid: 07e8ae972d9945faaef3326486f3a4bf
timeCreated: 1573031753

56
Samples/UIWidgetsSamples_2019_4/Assets/README-ZH.md


# 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**文件夹中。

7
Samples/UIWidgetsSamples_2019_4/Assets/README-ZH.md.meta


fileFormatVersion: 2
guid: 91a591ae2fb1e4a09977ec731aa7167f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

59
Samples/UIWidgetsSamples_2019_4/Assets/README.md


# 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.

7
Samples/UIWidgetsSamples_2019_4/Assets/README.md.meta


fileFormatVersion: 2
guid: f85cf1881c16b468a82659012c8b6db0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存