您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
808 B
33 行
808 B
using UnityEngine;
|
|
|
|
namespace UIWidgets.ui {
|
|
public class Image {
|
|
public Image(byte[] raw = null, Texture2D texture = null) {
|
|
this.rawData = raw ?? new byte[0];
|
|
this._texture = texture;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|