浏览代码

light board

/add_hero_sample
siyao 3 年前
当前提交
62e9f931
共有 9 个文件被更改,包括 287 次插入47 次删除
  1. 2
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs.meta
  2. 2
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs.meta
  3. 2
      AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk.meta
  4. 130
      AwesomeUIWidgets/Assets/Scenes/RaycastablePickerRoom.unity
  5. 2
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/ItemPickerMainUIPanel.cs
  6. 29
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/LightController.cs
  7. 3
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/LightController.cs.meta
  8. 161
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/SceneBoard.cs
  9. 3
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/SceneBoard.cs.meta

2
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs.meta


fileFormatVersion: 2
guid: 3af8956ed28744b899a62e3b21778d83
guid: 79ebc2e04360e6b4bb9999bb48b7bfc9
timeCreated: 1626685582

2
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs.meta


fileFormatVersion: 2
guid: 146276dca5447c54db1111667c732027
guid: ace5aa3bce1603545ba74b118bcaf2a0
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk.meta


fileFormatVersion: 2
guid: cdbbb536a55f4d5da396f06ce06aa5b8
guid: 3d36e97708fbe5b4baa419ed53088850
timeCreated: 1626681945

130
AwesomeUIWidgets/Assets/Scenes/RaycastablePickerRoom.unity


m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 419179728}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!28 &429187601
Texture2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_TextureFormat: 0
m_MipCount: 1
m_IsReadable: 1
m_IgnoreMasterTextureLimit: 0
m_IsPreProcessed: 0
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_AlphaIsTransparency: 0
m_ImageCount: 0
m_TextureDimension: 2
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 0
m_WrapV: 0
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_StreamData:
offset: 0
size: 0
path:
--- !u!1 &440324268
GameObject:
m_ObjectHideFlags: 0

m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 1397584242}
m_Texture: {fileID: 429187601}
m_UVRect:
serializedVersion: 2
x: 0

m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 45, y: 72.73701, z: 0}
--- !u!28 &1397584242
Texture2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_TextureFormat: 0
m_MipCount: 1
m_IsReadable: 1
m_IgnoreMasterTextureLimit: 0
m_IsPreProcessed: 0
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_AlphaIsTransparency: 0
m_ImageCount: 0
m_TextureDimension: 2
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 0
m_WrapV: 0
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_StreamData:
offset: 0
size: 0
path:
--- !u!1 &1454060144
GameObject:
m_ObjectHideFlags: 0

serializedVersion: 2
m_Size: {x: 0.99999994, y: 0.99999994, z: 6.123233e-17}
m_Center: {x: -0.00000011920929, y: 0, z: 0}
--- !u!1 &1680392477
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1680392479}
- component: {fileID: 1680392478}
m_Layer: 0
m_Name: Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1680392478
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1680392477}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f058ef35dcaa454b8805fb2f870ef9b5, type: 3}
m_Name:
m_EditorClassIdentifier:
light: {fileID: 1327540421}
--- !u!4 &1680392479
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1680392477}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.52, y: 1.48, z: -4.749563}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1688741613
PrefabInstance:
m_ObjectHideFlags: 0

2
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/ItemPickerMainUIPanel.cs


private Widget buildTop()
{
return new RaycastableContainer(child: new Container(height: 50f, color: Colors.blue));
return new RaycastableContainer(child: new SceneBoard());
}
private Widget buildMiddle()

29
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/LightController.cs


using uiwidgets;
using UnityEngine;
namespace UIWidgetsSample.RaycastableScene
{
public class LightController : MonoBehaviour
{
public Light light;
static Light lightInstance;
void Start()
{
lightInstance = light;
}
public static void SwitchLight(bool state)
{
lightInstance.enabled = state;
}
public static void ChangeLightColor(float color)
{
lightInstance.color = Color.HSVToRGB(color, 0.3f, 0.9f);
}
}
}

3
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/LightController.cs.meta


fileFormatVersion: 2
guid: f058ef35dcaa454b8805fb2f870ef9b5
timeCreated: 1627451855

161
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/SceneBoard.cs


using System;
using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace UIWidgetsSample.RaycastableScene
{
public class SceneBoard : StatefulWidget
{
public override State createState()
{
return new SceneBoardState();
}
}
public class SceneBoardState : State<SceneBoard>
{
public override Widget build(BuildContext context)
{
return new Container(
height: 50,
color: Colors.orange,
child: new Row(
children: new List<Widget>()
{
new ActionBox(
name: "Light",
onChange: value =>
{
Debug.Log($"input ${value}");
LightController.SwitchLight(value);
}),
new LightSlider()
// new ColorPicker(300)
}
)
);
}
}
public class ActionBox : StatefulWidget
{
public string name;
public Action<bool> onChange;
public ActionBox(string name, Action<bool> onChange)
{
this.name = name;
this.onChange = onChange;
}
public override State createState()
{
return new ActionBoxState();
}
}
public class ActionBoxState : State<ActionBox>
{
private bool value = true;
public override Widget build(BuildContext context)
{
return new Row(
children: new List<Widget>()
{
new CupertinoSwitch(
value: value,
onChanged: valueIn =>
{
setState(() =>
{
value = valueIn;
widget.onChange?.Invoke(value);
});
}
),
new Text(widget.name)
}
);
}
}
class LightSlider : StatefulWidget
{
public override State createState()
{
return new LightSliderState();
}
}
internal class LightSliderState : State<LightSlider>
{
private float _currentSliderValue = 0;
public override Widget build(BuildContext context)
{
return new Slider(
value: _currentSliderValue,
min: 0,
max: 1,
onChanged: (value) => {
setState(() => {
_currentSliderValue = value;
LightController.ChangeLightColor(value);
});
}
);
}
}
class ColorPicker : StatefulWidget {
public readonly float width;
public ColorPicker(float width)
{
this.width = width;
}
public override State createState() => new _ColorPickerState();
}
class _ColorPickerState : State<ColorPicker> {
readonly List<Color> _colors = new List<Color>(){
Color.fromARGB(255, 255, 0, 0),
Color.fromARGB(255, 255, 128, 0),
Color.fromARGB(255, 255, 255, 0),
Color.fromARGB(255, 128, 255, 0),
Color.fromARGB(255, 0, 255, 0),
Color.fromARGB(255, 0, 255, 128),
Color.fromARGB(255, 0, 255, 255),
Color.fromARGB(255, 0, 128, 255),
Color.fromARGB(255, 0, 0, 255),
Color.fromARGB(255, 127, 0, 255),
Color.fromARGB(255, 255, 0, 255),
Color.fromARGB(255, 255, 0, 127),
Color.fromARGB(255, 128, 128, 128),
};
public override Widget build(BuildContext context) {
return new Column(
children: new List<Widget>{
new Center(
child: new Container(
width: widget.width,
height: 15,
decoration: new BoxDecoration(
border: Border.all(width: 2, color: Colors.grey[800]),
borderRadius: BorderRadius.circular(15),
gradient: new LinearGradient(colors: _colors)
)
)
)
}
);
}
}
}

3
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/SceneBoard.cs.meta


fileFormatVersion: 2
guid: ade70a4c7c5348c98fd35a3f70a58863
timeCreated: 1627441794
正在加载...
取消
保存