Forgot to separate lethal config from dungeon .dll
This commit is contained in:
parent
9c23e125ce
commit
53240d3569
@ -62,6 +62,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Patch.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
37
DungeonBasement/DungeonBasement/Patch.cs
Normal file
37
DungeonBasement/DungeonBasement/Patch.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DungeonBasement
|
||||
{
|
||||
public class Patch {
|
||||
public static void Activate(){
|
||||
// the entire purpose this plugin is so I have a unique assembly for Lethal Config
|
||||
var assemblyPath = Assembly.GetExecutingAssembly().Location;
|
||||
var path = Path.Combine(Path.GetDirectoryName(assemblyPath), "basement.png");
|
||||
var texture2D = LoadTexture(path);
|
||||
var icon = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.zero);
|
||||
|
||||
LethalConfig.LethalConfigManager.SetModIcon(icon);
|
||||
LethalConfig.LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Basement dungeon variant.");
|
||||
}
|
||||
|
||||
static Texture2D LoadTexture(string FilePath) {
|
||||
Texture2D Tex2D;
|
||||
byte[] FileData;
|
||||
|
||||
if (File.Exists(FilePath)){
|
||||
FileData = File.ReadAllBytes(FilePath);
|
||||
Tex2D = new Texture2D(2, 2);
|
||||
Tex2D.LoadImage(FileData);
|
||||
return Tex2D;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,16 +10,23 @@ using UnityEngine;
|
||||
using System.Reflection;
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib.Tools;
|
||||
using BepInEx.Bootstrap;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace DungeonBasement {
|
||||
[BepInDependency("ainavt.lc.lethalconfig", "1.4.2")]
|
||||
|
||||
[BepInPlugin(modGUID, modName, modVersion)]
|
||||
[BepInDependency(targetModGUID, BepInDependency.DependencyFlags.SoftDependency)]
|
||||
public class Plugin : BaseUnityPlugin {
|
||||
|
||||
public const string modGUID = "dev.ladyalice.scarletmansion.basement";
|
||||
private const string modName = "Scarlet Basement";
|
||||
private const string modVersion = "1.0.0";
|
||||
|
||||
public const string targetModGUID = "ainavt.lc.lethalconfig";
|
||||
public const string targetModVersion = "1.4.2";
|
||||
|
||||
public readonly Harmony harmony = new Harmony(modGUID);
|
||||
public static ManualLogSource logger { get; internal set; }
|
||||
|
||||
void Awake(){
|
||||
@ -27,27 +34,23 @@ namespace DungeonBasement {
|
||||
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
|
||||
logger.LogInfo($"Plugin {modName} has been added!");
|
||||
|
||||
// the entire purpose this plugin is so I have a unique assembly for Lethal Config
|
||||
var assemblyPath = Assembly.GetExecutingAssembly().Location;
|
||||
var path = Path.Combine(Path.GetDirectoryName(assemblyPath), "basement.png");
|
||||
var texture2D = LoadTexture(path);
|
||||
var icon = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.zero);
|
||||
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
|
||||
if (!modLoaded) return;
|
||||
|
||||
LethalConfig.LethalConfigManager.SetModIcon(icon);
|
||||
LethalConfig.LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Basement dungeon variant.");
|
||||
}
|
||||
|
||||
Texture2D LoadTexture(string FilePath) {
|
||||
Texture2D Tex2D;
|
||||
byte[] FileData;
|
||||
|
||||
if (File.Exists(FilePath)){
|
||||
FileData = File.ReadAllBytes(FilePath);
|
||||
Tex2D = new Texture2D(2, 2);
|
||||
Tex2D.LoadImage(FileData);
|
||||
return Tex2D;
|
||||
bool validVersion;
|
||||
var pluginInfo = Chainloader.PluginInfos[targetModGUID];
|
||||
var loadedVersion = pluginInfo.Metadata.Version;
|
||||
if (string.IsNullOrWhiteSpace(targetModVersion)){
|
||||
validVersion = true;
|
||||
} else {
|
||||
var requiredVersion = new Version(targetModVersion);
|
||||
validVersion = loadedVersion >= requiredVersion;
|
||||
}
|
||||
|
||||
if (validVersion){
|
||||
logger.LogInfo($"Lethal config compability patch added!");
|
||||
Patch.Activate();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -63,6 +63,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Patch.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
37
DungeonFoyer/DungeonFoyer/Patch.cs
Normal file
37
DungeonFoyer/DungeonFoyer/Patch.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DungeonFoyer
|
||||
{
|
||||
public class Patch {
|
||||
public static void Activate(){
|
||||
// the entire purpose this plugin is so I have a unique assembly for Lethal Config
|
||||
var assemblyPath = Assembly.GetExecutingAssembly().Location;
|
||||
var path = Path.Combine(Path.GetDirectoryName(assemblyPath), "foyer.png");
|
||||
var texture2D = LoadTexture(path);
|
||||
var icon = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.zero);
|
||||
|
||||
LethalConfig.LethalConfigManager.SetModIcon(icon);
|
||||
LethalConfig.LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Foyer dungeon variant.");
|
||||
}
|
||||
|
||||
static Texture2D LoadTexture(string FilePath) {
|
||||
Texture2D Tex2D;
|
||||
byte[] FileData;
|
||||
|
||||
if (File.Exists(FilePath)){
|
||||
FileData = File.ReadAllBytes(FilePath);
|
||||
Tex2D = new Texture2D(2, 2);
|
||||
Tex2D.LoadImage(FileData);
|
||||
return Tex2D;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,17 +10,23 @@ using UnityEngine;
|
||||
using System.Reflection;
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib.Tools;
|
||||
using HarmonyLib;
|
||||
using BepInEx.Bootstrap;
|
||||
|
||||
namespace DungeonFoyer {
|
||||
|
||||
[BepInDependency("ainavt.lc.lethalconfig", "1.4.2")]
|
||||
[BepInPlugin(modGUID, modName, modVersion)]
|
||||
[BepInDependency(targetModGUID, BepInDependency.DependencyFlags.SoftDependency)]
|
||||
public class Plugin : BaseUnityPlugin {
|
||||
|
||||
public const string modGUID = "dev.ladyalice.scarletmansion.foyer";
|
||||
private const string modName = "Scarlet Foyer";
|
||||
private const string modVersion = "1.0.0";
|
||||
|
||||
public const string targetModGUID = "ainavt.lc.lethalconfig";
|
||||
public const string targetModVersion = "1.4.2";
|
||||
|
||||
public readonly Harmony harmony = new Harmony(modGUID);
|
||||
public static ManualLogSource logger { get; internal set; }
|
||||
|
||||
void Awake(){
|
||||
@ -28,28 +34,26 @@ namespace DungeonFoyer {
|
||||
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
|
||||
logger.LogInfo($"Plugin {modName} has been added!");
|
||||
|
||||
// the entire purpose this plugin is so I have a unique assembly for Lethal Config
|
||||
var assemblyPath = Assembly.GetExecutingAssembly().Location;
|
||||
var path = Path.Combine(Path.GetDirectoryName(assemblyPath), "foyer.png");
|
||||
var texture2D = LoadTexture(path);
|
||||
var icon = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.zero);
|
||||
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
|
||||
if (!modLoaded) return;
|
||||
|
||||
LethalConfig.LethalConfigManager.SetModIcon(icon);
|
||||
LethalConfig.LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Foyer dungeon variant.");
|
||||
}
|
||||
|
||||
Texture2D LoadTexture(string FilePath) {
|
||||
Texture2D Tex2D;
|
||||
byte[] FileData;
|
||||
|
||||
if (File.Exists(FilePath)){
|
||||
FileData = File.ReadAllBytes(FilePath);
|
||||
Tex2D = new Texture2D(2, 2);
|
||||
Tex2D.LoadImage(FileData);
|
||||
return Tex2D;
|
||||
bool validVersion;
|
||||
var pluginInfo = Chainloader.PluginInfos[targetModGUID];
|
||||
var loadedVersion = pluginInfo.Metadata.Version;
|
||||
if (string.IsNullOrWhiteSpace(targetModVersion)){
|
||||
validVersion = true;
|
||||
} else {
|
||||
var requiredVersion = new Version(targetModVersion);
|
||||
validVersion = loadedVersion >= requiredVersion;
|
||||
}
|
||||
|
||||
if (validVersion){
|
||||
logger.LogInfo($"Lethal config compability patch added!");
|
||||
Patch.Activate();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace ScarletMansionMimicsPatch {
|
||||
|
||||
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
|
||||
|
||||
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
|
||||
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
|
||||
if (!modLoaded) return;
|
||||
|
||||
bool validVersion;
|
||||
|
Loading…
x
Reference in New Issue
Block a user