您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
74 行
2.2 KiB
74 行
2.2 KiB
using System.Collections.Generic;
|
|
using Unity.UIWidgets.animation;
|
|
using Unity.UIWidgets.engine;
|
|
using Unity.UIWidgets.foundation;
|
|
using Unity.UIWidgets.painting;
|
|
using Unity.UIWidgets.ui;
|
|
using Unity.UIWidgets.widgets;
|
|
using UnityEngine;
|
|
using Color = Unity.UIWidgets.ui.Color;
|
|
using FontStyle = Unity.UIWidgets.ui.FontStyle;
|
|
using Image = Unity.UIWidgets.widgets.Image;
|
|
using TextStyle = Unity.UIWidgets.painting.TextStyle;
|
|
using Texture = Unity.UIWidgets.widgets.Texture;
|
|
using ui_ = Unity.UIWidgets.widgets.ui_;
|
|
|
|
namespace UIWidgetsSample
|
|
{
|
|
public class SceneTest : UIWidgetsPanel
|
|
{
|
|
protected void OnEnable()
|
|
{
|
|
base.OnEnable();
|
|
}
|
|
|
|
protected override void main()
|
|
{
|
|
ui_.runApp(new MyApp());
|
|
}
|
|
|
|
class MyApp : StatelessWidget
|
|
{
|
|
public override Widget build(BuildContext context)
|
|
{
|
|
return new WidgetsApp(
|
|
color: Color.white,
|
|
home: new ExampleApp(),
|
|
pageRouteBuilder: (settings, builder) =>
|
|
new PageRouteBuilder(
|
|
settings: settings,
|
|
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
|
|
)
|
|
);
|
|
}
|
|
}
|
|
|
|
class ExampleApp : StatefulWidget
|
|
{
|
|
public ExampleApp(Key key = null) : base(key)
|
|
{
|
|
}
|
|
|
|
public override State createState()
|
|
{
|
|
return new ExampleState();
|
|
}
|
|
}
|
|
|
|
class ExampleState : State<ExampleApp>
|
|
{
|
|
public override Widget build(BuildContext context)
|
|
{
|
|
var text = GameObject.Find("CameraTarget")?.GetComponent<UnityEngine.UI.RawImage>()?.texture;
|
|
return new Container(
|
|
child: new Column(
|
|
children: new List<Widget>
|
|
{
|
|
new Container(width: 100, height: 100, child: new Texture(texture: text)),
|
|
}
|
|
)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|