mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 01:33:33 +08:00
Work in progress
This commit is contained in:
24
UXAssist/Common/Util.cs
Normal file
24
UXAssist/Common/Util.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user