mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 21:33:28 +08:00
24 lines
649 B
C#
24 lines
649 B
C#
using System.IO;
|
|
using System.Reflection;
|
|
using UnityEngine;
|
|
|
|
namespace UXAssist.Common;
|
|
|
|
public static class Util
|
|
{
|
|
public static Texture2D LoadTexture(string path)
|
|
{
|
|
var fileData = System.IO.File.ReadAllBytes(path);
|
|
var tex = new Texture2D(2, 2);
|
|
tex.LoadImage(fileData);
|
|
return tex;
|
|
}
|
|
|
|
public static Sprite LoadSprite(string path)
|
|
{
|
|
var tex = LoadTexture(path);
|
|
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
|
}
|
|
|
|
public static string PluginFolder => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
|
} |