您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
778 B
38 行
778 B
using UnityEngine;
|
|
|
|
namespace UIWidgets.ui
|
|
{
|
|
public class Image
|
|
{
|
|
public Image(byte[] raw) {
|
|
rawData = raw;
|
|
}
|
|
|
|
public byte[] rawData;
|
|
public int height {
|
|
get {
|
|
return texture != null ? texture.height : 0;
|
|
}
|
|
}
|
|
|
|
public int width {
|
|
get {
|
|
return texture != null ? texture.width : 0;
|
|
}
|
|
}
|
|
|
|
public Texture2D texture {
|
|
get {
|
|
if (_texture == null && rawData.Length != 0) {
|
|
_texture = new Texture2D(2, 2);
|
|
_texture.LoadImage(rawData);
|
|
}
|
|
|
|
return _texture;
|
|
}
|
|
}
|
|
|
|
|
|
private Texture2D _texture;
|
|
}
|
|
}
|