浏览代码

modify size

/add_hero_sample
siyao 3 年前
当前提交
19439a31
共有 3 个文件被更改,包括 63 次插入12 次删除
  1. 3
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/GameObjectManager.cs
  2. 6
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/RaycastableSceneConfig.cs
  3. 66
      AwesomeUIWidgets/Assets/Scripts/RaycastableScene/SceneBoard.cs

3
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/GameObjectManager.cs


var dif = cameraPosition.Value - camera.transform.position;
if (dif.sqrMagnitude > RaycastableSceneConfig.delta)
{
camera.transform.position = dif.normalized * Time.deltaTime + camera.transform.position;
camera.transform.position = dif.normalized * (RaycastableSceneConfig.cameraSpeed * Time.deltaTime)
+ camera.transform.position;
}
}

6
AwesomeUIWidgets/Assets/Scripts/RaycastableScene/RaycastableSceneConfig.cs


public const int height = 50;
public static readonly Color mainColor = Color.fromARGB(transparent, 100, 100, 100);
public const string LightSwitchName = "Light Switcher";
public const string LightSliderName = "Color Slider";
public const string LightOn = "Light On";
public const string LightOff = "Light Off";
public const string LightSliderName = "Light Color:";
public const string cubeName = "cube";
public const int cubeCount = 4;

public const int scaterScale = 2;
public const float delta = 0.2f;
public const float cameraSpeed = 2;
public const float scaleSceneBoard = 0.4f;
public static readonly Vector3 far = new Vector3(1000, 0, 0);
}
}

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


using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Color = Unity.UIWidgets.ui.Color;

return new Container(
height: RaycastableSceneConfig.height,
color: RaycastableSceneConfig.mainColor,
child: new Row(
child:
new Row(
new ActionBox(
name: RaycastableSceneConfig.LightSwitchName,
onChange: value =>
{
LightController.SwitchLight(value);
}),
new LightSlider()
Transform.scale(
alignment: Alignment.centerLeft,
scale: RaycastableSceneConfig.scaleSceneBoard,
child: new ActionBox(
name: RaycastableSceneConfig.LightSwitchName,
onChange: value =>
{
LightController.SwitchLight(value);
})
),
new ColorPicker(100),
// new LightSlider()
);
}
}

return new Row(
children: new List<Widget>()
{
new Text(
value? RaycastableSceneConfig.LightOn : RaycastableSceneConfig.LightOff,
style: RaycastableSceneConfig.fontStyle
),
new CupertinoSwitch(
value: value,
onChanged: valueIn =>

});
}
),
new Text(widget.name, style: RaycastableSceneConfig.fontStyle)
}
);
}

return new Row(
children: new List<Widget>()
{
new Text(RaycastableSceneConfig.LightSliderName, style: RaycastableSceneConfig.fontStyle),
new Slider(
value: _currentSliderValue,
min: 0,

});
}
),
new Text(RaycastableSceneConfig.LightSliderName, style: RaycastableSceneConfig.fontStyle)
}
);
}

}
);
}
}
class _SliderIndicatorPainter : CustomPainter {
readonly float position;
_SliderIndicatorPainter(float position)
{
this.position = position;
}
public void paint(Canvas canvas, Size size) {
canvas.drawCircle(
new Offset(position, size.height / 2), 12, new Paint(){color = Colors.black});
}
public bool shouldRepaint(CustomPainter oldDelegate)
{
return true;
}
public bool? hitTest(Offset position)
{
throw new NotImplementedException();
}
public void addListener(VoidCallback listener)
{
throw new NotImplementedException();
}
public void removeListener(VoidCallback listener)
{
throw new NotImplementedException();
}
}
正在加载...
取消
保存