Initial commit
This commit is contained in:
commit
0afdc1d02f
93 changed files with 2453 additions and 0 deletions
20
Config/Plugin.BillTextureType.cs
Normal file
20
Config/Plugin.BillTextureType.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
namespace CurrencyChanger2
|
||||
{
|
||||
public partial class Plugin
|
||||
{
|
||||
public enum BillTextureType
|
||||
{
|
||||
USD_1_BILL, USD_5_BILL, USD_10_BILL, USD_20_BILL, USD_50_BILL,
|
||||
|
||||
EUR_1_BILL, EUR_5_BILL, EUR_10_BILL, EUR_20_BILL, EUR_50_BILL, EUR_100_BILL,
|
||||
|
||||
GBP_1_BILL, GBP_5_BILL, GBP_10_BILL, GBP_20_BILL, GBP_50_BILL,
|
||||
|
||||
CAD_1_BILL, CAD_5_BILL, CAD_10_BILL, CAD_20_BILL, CAD_50_BILL,
|
||||
|
||||
SGD_2_BILL, SGD_5_BILL, SGD_10_BILL, SGD_20_BILL, SGD_50_BILL,
|
||||
|
||||
CUSTOM
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Config/Plugin.CardTextureType.cs
Normal file
10
Config/Plugin.CardTextureType.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace CurrencyChanger2
|
||||
{
|
||||
public partial class Plugin
|
||||
{
|
||||
public enum CardTextureType
|
||||
{
|
||||
DEFAULT, CUSTOM
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Config/Plugin.CoinTextureType.cs
Normal file
20
Config/Plugin.CoinTextureType.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
namespace CurrencyChanger2
|
||||
{
|
||||
public partial class Plugin
|
||||
{
|
||||
public enum CoinTextureType
|
||||
{
|
||||
USD_1ct_COIN, USD_5ct_COIN, USD_10ct_COIN, USD_25ct_COIN, USD_50ct_COIN,
|
||||
|
||||
EUR_1ct_COIN, EUR_2ct_COIN, EUR_5ct_COIN, EUR_10ct_COIN, EUR_20ct_COIN, EUR_50ct_COIN, EUR_1_COIN, EUR_2_COIN,
|
||||
|
||||
GBP_1ct_COIN, GBP_2ct_COIN, GBP_5ct_COIN, GBP_10ct_COIN, GBP_20ct_COIN, GBP_50ct_COIN, GBP_1_COIN, GBP_2_COIN,
|
||||
|
||||
CAD_1ct_COIN, CAD_5ct_COIN, CAD_10ct_COIN, CAD_25ct_COIN, CAD_50ct_COIN, CAD_1_COIN, CAD_2_COIN,
|
||||
|
||||
SGD_1ct_COIN, SGD_5ct_COIN, SGD_10ct_COIN, SGD_20ct_COIN, SGD_50ct_COIN, SGD_1_COIN,
|
||||
|
||||
CUSTOM
|
||||
}
|
||||
}
|
||||
}
|
||||
84
Config/Plugin.ConfigComp.cs
Normal file
84
Config/Plugin.ConfigComp.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using BepInEx.Configuration;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CurrencyChanger2
|
||||
{
|
||||
public partial class Plugin
|
||||
{
|
||||
public class ConfigComp<TTexture> where TTexture : Enum
|
||||
{
|
||||
public ConfigEntry<float> Value { get; set; }
|
||||
public ConfigEntry<string> Text { get; set; }
|
||||
public ConfigEntry<TTexture> Texture { get; set; }
|
||||
public string type;
|
||||
public int number;
|
||||
public string sectionName => "Register - " + type + " Slot " + number;
|
||||
|
||||
public ConfigComp(ConfigFile Config, string type, int number, float value, string text, TTexture texture)
|
||||
{
|
||||
this.type = type;
|
||||
this.number = number;
|
||||
|
||||
Value = Config.Bind(sectionName, "Value", value, "What value this slot's " + type.ToLower() + "s should have.");
|
||||
Text = Config.Bind(sectionName, "Text", text, "What text should be shown above this slot.");
|
||||
Texture = Config.Bind(sectionName, "Texture Type", texture, "What type of texture should be applied to this slot's " + type.ToLower() + "s. If you choose \"CUSTOM\", the texture file will be loaded from BepInEx/config/ChangeCurrency/" + type + number + ".png");
|
||||
}
|
||||
public ConfigComp<TTexture> Apply(TextMeshProUGUI text)
|
||||
{
|
||||
text.text = Text.Value;
|
||||
text.enableWordWrapping = false;
|
||||
return this;
|
||||
}
|
||||
public ConfigComp<TTexture> Apply(MoneyPack pack)
|
||||
{
|
||||
pack.Value = Value.Value;
|
||||
var texture = GetTexture();
|
||||
if (texture == null) return this;
|
||||
Plugin.StaticLogger.LogWarning("Applying " + Enum.GetName(typeof(TTexture), Texture.Value) + " texture to " + pack.gameObject.name + " (MoneyPack)");
|
||||
foreach (var item in pack.gameObject.transform.GetChild(0).GetChild(0).GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
foreach (var item1 in item.sharedMaterials)
|
||||
{
|
||||
item1.mainTexture = texture;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public ConfigComp<TTexture> Apply(Money pack)
|
||||
{
|
||||
pack.Value = Value.Value;
|
||||
var texture = GetTexture();
|
||||
if (texture == null) return this;
|
||||
Plugin.StaticLogger.LogWarning("Applying " + Enum.GetName(typeof(TTexture), Texture.Value) + " texture to " + pack.gameObject.name + " (Money)");
|
||||
foreach (var item1 in pack.GetComponent<MeshRenderer>().sharedMaterials)
|
||||
{
|
||||
item1.mainTexture = texture;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public Texture2D storedTex;
|
||||
public Texture2D GetTexture()
|
||||
{
|
||||
if (Convert.ToInt32(Texture.Value) == Convert.ToInt32(Texture.DefaultValue) && number != 6 && number != 7) return null;
|
||||
if (storedTex != null) return storedTex;
|
||||
string name = Enum.GetName(typeof(TTexture), Texture.Value);
|
||||
byte[] data;
|
||||
if (name == "CUSTOM")
|
||||
{
|
||||
data = File.ReadAllBytes(Path.Combine("BepInEx", "config", "ChangeCurrency", type + number + ".png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
data = (byte[])Properties.Resources.ResourceManager.GetObject(name);
|
||||
}
|
||||
Texture2D tex = new Texture2D(1024, 1024);
|
||||
tex.LoadImage(data);
|
||||
return tex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue