UISprite2D spMoney;
// 钻石建造卷图标
string path = ResourcePath.Icon.money + "/" + ""; // 读取本地路径
spMoney.sprite2D = NGUITools.LoadAsset<Sprite>(path); // 将读取的路径转化成sprite格式
// 金币建造卷图标
Texture2D textureGoldBuild = Resources.Load("Icon/money/") as Texture2D; // 将读取的本地的路径转化成Texture2D类型
Sprite spriteGoldBuild = Sprite.Create(
textureGoldBuild,
new Rect(0, 0, textureGoldBuild.width, textureGoldBuild.height),
new Vector2(0.5f, 0.5f)
);
spMoney.sprite2D = spriteGoldBuild;
时间: 2024-10-06 23:32:09