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