mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
add TextureHelper
This commit is contained in:
parent
71419836ef
commit
e743e42537
@ -68,12 +68,9 @@ internal class QSBPrisonCellElevator : WorldObject<PrisonCellElevator>, IQSBDrop
|
||||
var projectorComponent = AUTO_SLIDE_PROJECTOR.AddComponent<CustomAutoSlideProjector>();
|
||||
projectorComponent._light = Light.GetComponent<OWLight2>();
|
||||
|
||||
var cellevator1 = QSBCore.Helper.Assets.GetTexture("Assets/cellevator1.png");
|
||||
cellevator1.wrapMode = TextureWrapMode.Clamp;
|
||||
var cellevator2 = QSBCore.Helper.Assets.GetTexture("Assets/cellevator2.png");
|
||||
cellevator2.wrapMode = TextureWrapMode.Clamp;
|
||||
var cellevator3 = QSBCore.Helper.Assets.GetTexture("Assets/cellevator3.png");
|
||||
cellevator3.wrapMode = TextureWrapMode.Clamp;
|
||||
var cellevator1 = TextureHelper.LoadTexture("Assets/cellevator1.png", TextureWrapMode.Clamp);
|
||||
var cellevator2 = TextureHelper.LoadTexture("Assets/cellevator2.png", TextureWrapMode.Clamp);
|
||||
var cellevator3 = TextureHelper.LoadTexture("Assets/cellevator3.png", TextureWrapMode.Clamp);
|
||||
|
||||
var slideCollection = new CustomSlideCollection(3);
|
||||
slideCollection.slides[0] = new CustomSlide() { _image = cellevator1 };
|
||||
|
28
QSB/Utility/TextureHelper.cs
Normal file
28
QSB/Utility/TextureHelper.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Utility;
|
||||
|
||||
public static class TextureHelper
|
||||
{
|
||||
public static Texture2D LoadTexture(string relativePath, TextureWrapMode wrapMode)
|
||||
{
|
||||
var path = QSBCore.Helper.Manifest.ModFolderPath + relativePath;
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
var tex = new Texture2D(1, 1);
|
||||
tex.LoadImage(data);
|
||||
tex.wrapMode = wrapMode;
|
||||
return tex;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user