您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
40 行
1.3 KiB
40 行
1.3 KiB
using System;
|
|
using Unity.UIWidgets.async;
|
|
using Unity.UIWidgets.engine;
|
|
using Unity.UIWidgets.foundation;
|
|
using Unity.UIWidgets.gestures;
|
|
using Unity.UIWidgets.rendering;
|
|
using Unity.UIWidgets.scheduler;
|
|
using Unity.UIWidgets.ui;
|
|
using UnityEngine;
|
|
|
|
namespace Unity.UIWidgets.widgets {
|
|
public class Texture : LeafRenderObjectWidget {
|
|
public Texture(
|
|
Key key = null,
|
|
UnityEngine.Texture texture = null,
|
|
int? textureId = null) : base(key: key) {
|
|
D.assert(textureId != null);
|
|
this.textureId = textureId;
|
|
this.texture = texture;
|
|
if (texture != null && texture.GetNativeTexturePtr() != IntPtr.Zero) {
|
|
this.textureId = UIWidgetsPanelWrapper.current.registerTexture(texture);
|
|
}
|
|
}
|
|
|
|
public readonly UnityEngine.Texture texture;
|
|
public readonly int? textureId;
|
|
|
|
public override RenderObject createRenderObject(BuildContext context) {
|
|
return new TextureBox(textureId: textureId, texture);;
|
|
}
|
|
|
|
public override bool Equals(object obj) {
|
|
return false;
|
|
}
|
|
|
|
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
|
|
((TextureBox) renderObject).textureId = textureId;
|
|
}
|
|
}
|
|
}
|