From 6d3ce603510848d6fc810edcfd37a6a3b9cec5a2 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Wed, 3 Nov 2021 00:25:38 -0500 Subject: [PATCH 1/6] Add TypeMapper, can't test yet so just hoping it works --- API.csproj | 2 + Plugin.cs | 116 ++------------------------------------------------ TypeMapper.cs | 99 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 112 deletions(-) create mode 100644 TypeMapper.cs diff --git a/API.csproj b/API.csproj index bb92b764..bf448e40 100644 --- a/API.csproj +++ b/API.csproj @@ -22,9 +22,11 @@ lib\Assembly-CSharp.dll + False lib\Sirenix.Serialization.dll + False diff --git a/Plugin.cs b/Plugin.cs index 2ee55653..84e701db 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -56,9 +56,12 @@ public class CustomCard public bool? flipPortraitForStrafe; public bool? onePerDeck; public List appearanceBehaviour; + [IgnoreMapping] public Texture2D tex; + [IgnoreMapping] public Texture2D altTex; public Texture titleGraphic; + [IgnoreMapping] public Texture2D pixelTex; public GameObject animatedPortrait; public List decals; @@ -107,106 +110,7 @@ public CustomCard(string name, List metaCategories = null, Car public CardInfo AdjustCard(CardInfo card) { - if (this.metaCategories is not null) - { - card.metaCategories = this.metaCategories; - } - if (this.cardComplexity is not null) - { - card.cardComplexity = (CardComplexity)this.cardComplexity; - } - if (this.temple is not null) - { - card.temple = (CardTemple)this.temple; - } - if (!String.IsNullOrEmpty(displayedName)) - { - card.displayedName = displayedName; - } - if (this.baseAttack is not null) - { - card.baseAttack = baseAttack.Value; - } - if (this.baseHealth is not null) - { - card.baseHealth = baseHealth.Value; - } - if (!String.IsNullOrEmpty(description)) - { - card.description = this.description; - } - if (this.cost is not null) - { - card.cost = cost.Value; - } - if (this.bonesCost is not null) - { - card.bonesCost = bonesCost.Value; - } - if (this.energyCost is not null) - { - card.energyCost = energyCost.Value; - } - if (this.gemsCost is not null) - { - card.gemsCost = gemsCost; - } - if (this.specialStatIcon is not null) - { - card.specialStatIcon = specialStatIcon.Value; - } - if (this.tribes is not null) - { - card.tribes = this.tribes; - } - if (this.traits is not null) - { - card.traits = this.traits; - } - if (this.specialAbilities is not null) - { - card.specialAbilities = specialAbilities; - } - if (this.abilities is not null) - { - card.abilities = abilities; - } - if (evolveParams is not null) - { - card.evolveParams = evolveParams; - } - if (evolveParams is not null) - { - card.evolveParams = evolveParams; - } - if (!String.IsNullOrEmpty(defaultEvolutionName)) - { - card.defaultEvolutionName = defaultEvolutionName; - } - if (tailParams is not null) - { - card.tailParams = tailParams; - } - if (iceCubeParams is not null) - { - card.iceCubeParams = iceCubeParams; - } - if (this.appearanceBehaviour is not null) - { - card.appearanceBehaviour = this.appearanceBehaviour; - } - if (this.flipPortraitForStrafe is not null) - { - card.flipPortraitForStrafe = (bool)this.flipPortraitForStrafe; - } - if (this.onePerDeck is not null) - { - card.onePerDeck = (bool)this.onePerDeck; - } - if (this.hideAttackAndHealth is not null) - { - card.hideAttackAndHealth = (bool)this.hideAttackAndHealth; - } + TypeMapper.Convert(this, card); if (this.tex is not null) { tex.name = "portrait_" + name; @@ -221,10 +125,6 @@ public CardInfo AdjustCard(CardInfo card) card.alternatePortrait = Sprite.Create(altTex, new Rect(0.0f, 0.0f, 114.0f, 94.0f), new Vector2(0.5f, 0.5f)); card.alternatePortrait.name = "portrait_" + name; } - if (this.titleGraphic is not null) - { - card.titleGraphic = this.titleGraphic; - } if (this.pixelTex is not null) { pixelTex.name = "portrait_" + name; @@ -232,14 +132,6 @@ public CardInfo AdjustCard(CardInfo card) card.pixelPortrait = Sprite.Create(pixelTex, new Rect(0.0f, 0.0f, 114.0f, 94.0f), new Vector2(0.5f, 0.5f)); card.pixelPortrait.name = "portrait_" + name; } - if (animatedPortrait is not null) - { - card.animatedPortrait = animatedPortrait; - } - if (decals is not null) - { - card.decals = decals; - } Plugin.Log.LogInfo($"Adjusted default card {name}!"); return card; } diff --git a/TypeMapper.cs b/TypeMapper.cs new file mode 100644 index 00000000..1cc7935c --- /dev/null +++ b/TypeMapper.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using HarmonyLib; +using Mono.Cecil.Cil; +using MonoMod.Utils; + +namespace CardLoaderPlugin +{ + [AttributeUsage(AttributeTargets.Field)] + public class IgnoreMappingAttribute : Attribute {} + public static unsafe class TypeMapper where S : class where D : class, new() + { + private struct GetFieldDelegate + { + public delegate* Del; + } + + private struct SetFieldDelegate + { + public delegate* Del; + } + + private static Dictionary _accessors = null; + private static Dictionary FieldAccessors + { + get + { + if (_accessors is null) + { + _accessors = new(); + + foreach (var field in AccessTools.GetDeclaredFields(typeof(S)).Where(x => !x.GetCustomAttributes(typeof(IgnoreMappingAttribute), false).Any())) + { + var accessor = new DynamicMethodDefinition("get_" + field.Name, typeof(object), new Type[] { typeof(S) }); + var il = accessor.GetILProcessor(); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldfld, accessor.Module.ImportReference(field)); + if (field.FieldType.IsValueType) + il.Emit(OpCodes.Box); + il.Emit(OpCodes.Ret); + _accessors.Add(field.Name, new GetFieldDelegate { Del = (delegate*)accessor.Generate().MethodHandle.GetFunctionPointer() }); + } + } + return _accessors; + } + } + + private static Dictionary _setters = null; + private static Dictionary FieldSetters + { + get + { + if (_setters == null) + { + _setters = new(); + + foreach (var field in AccessTools.GetDeclaredFields(typeof(D))) + { + var fieldType = field.FieldType; + var setter = new DynamicMethodDefinition("set_" + field.Name, typeof(void), new Type[] { typeof(D), typeof(object) }); + var il = setter.GetILProcessor(); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); + if (field.FieldType.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + il.Emit(OpCodes.Call, AccessTools.DeclaredPropertyGetter(fieldType, "Value")); + fieldType = fieldType.GetGenericArguments()[0]; + } + else if (fieldType.IsValueType) + il.Emit(OpCodes.Unbox, setter.Module.ImportReference(field.FieldType)); + else + il.Emit(OpCodes.Castclass, setter.Module.ImportReference(field.FieldType)); + il.Emit(OpCodes.Stfld, setter.Module.ImportReference(field)); + il.Emit(OpCodes.Ret); + _setters.Add(field.Name, new SetFieldDelegate { Del = (delegate*)setter.Generate().MethodHandle.GetFunctionPointer() }); + } + } + return _setters; + } + } + + public static D Convert(S source, D destination = null) + { + destination ??= new(); + + foreach (var field in FieldAccessors) + { + object val = field.Value.Del(source); + if (val is not null) + { + FieldSetters[field.Key].Del(destination, val); + } + } + + return destination; + } + } +} From 1d38a0eac13d6bc4e0ba8e2740155d613f9d09f4 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Wed, 3 Nov 2021 00:35:37 -0500 Subject: [PATCH 2/6] Determine if source is nullable, not destination --- TypeMapper.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/TypeMapper.cs b/TypeMapper.cs index 1cc7935c..2e1633b6 100644 --- a/TypeMapper.cs +++ b/TypeMapper.cs @@ -14,11 +14,13 @@ public class IgnoreMappingAttribute : Attribute {} private struct GetFieldDelegate { public delegate* Del; + public Type FieldType; } private struct SetFieldDelegate { public delegate* Del; + public Type FieldType; } private static Dictionary _accessors = null; @@ -39,7 +41,11 @@ private static Dictionary FieldAccessors if (field.FieldType.IsValueType) il.Emit(OpCodes.Box); il.Emit(OpCodes.Ret); - _accessors.Add(field.Name, new GetFieldDelegate { Del = (delegate*)accessor.Generate().MethodHandle.GetFunctionPointer() }); + _accessors.Add(field.Name, new GetFieldDelegate + { + Del = (delegate*)accessor.Generate().MethodHandle.GetFunctionPointer(), + FieldType = field.FieldType + }); } } return _accessors; @@ -62,10 +68,10 @@ private static Dictionary FieldSetters var il = setter.GetILProcessor(); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_1); - if (field.FieldType.GetGenericTypeDefinition() == typeof(Nullable<>)) + if (FieldAccessors.TryGetValue(field.Name, out var getter) && getter.FieldType.GetGenericTypeDefinition() == typeof(Nullable<>) && getter.FieldType.GetGenericArguments()[0] == field.FieldType) { il.Emit(OpCodes.Call, AccessTools.DeclaredPropertyGetter(fieldType, "Value")); - fieldType = fieldType.GetGenericArguments()[0]; + fieldType = getter.FieldType.GetGenericArguments()[0]; } else if (fieldType.IsValueType) il.Emit(OpCodes.Unbox, setter.Module.ImportReference(field.FieldType)); @@ -73,7 +79,11 @@ private static Dictionary FieldSetters il.Emit(OpCodes.Castclass, setter.Module.ImportReference(field.FieldType)); il.Emit(OpCodes.Stfld, setter.Module.ImportReference(field)); il.Emit(OpCodes.Ret); - _setters.Add(field.Name, new SetFieldDelegate { Del = (delegate*)setter.Generate().MethodHandle.GetFunctionPointer() }); + _setters.Add(field.Name, new SetFieldDelegate + { + Del = (delegate*)setter.Generate().MethodHandle.GetFunctionPointer(), + FieldType = field.FieldType + }); } } return _setters; From 4885299a5cc43e498fe8b05b4c8768a29c9a448c Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Wed, 3 Nov 2021 01:26:48 -0500 Subject: [PATCH 3/6] Also use TypeMapper with CustomRegion --- Plugin.cs | 98 +------------------------------------------------------ 1 file changed, 1 insertion(+), 97 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index 84e701db..d7ccff31 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -323,103 +323,7 @@ public CustomRegion(string name, int? tier = null, List terrainCards = public RegionData AdjustRegion(RegionData region) { - region.name = this.name; - if (this.terrainCards is not null) - { - region.terrainCards = this.terrainCards; - } - if (this.consumableItems is not null) - { - region.consumableItems = this.consumableItems; - } - if (this.encounters is not null) - { - region.encounters = this.encounters; - } - if (this.bosses is not null) - { - region.bosses = this.bosses; - } - if (this.likelyCards is not null) - { - region.likelyCards = this.likelyCards; - } - if (this.dominantTribes is not null) - { - region.dominantTribes = this.dominantTribes; - } - if (this.predefinedNodes is not null) - { - region.predefinedNodes = this.predefinedNodes; - } - if (this.bossPrepEncounter is not null) - { - region.bossPrepEncounter = this.bossPrepEncounter; - } - if (this.bossPrepCondition is not null) - { - region.bossPrepCondition = this.bossPrepCondition; - } - if (this.scarceScenery is not null) - { - region.scarceScenery = this.scarceScenery; - } - if (this.fillerScenery is not null) - { - region.fillerScenery = this.fillerScenery; - } - if (this.predefinedScenery is not null) - { - region.predefinedScenery = this.predefinedScenery; - } - if (!String.IsNullOrEmpty(this.ambientLoopId)) - { - region.ambientLoopId = this.ambientLoopId; - } - if (this.silenceCabinAmbience is not null) - { - region.silenceCabinAmbience = (bool)this.silenceCabinAmbience; - } - if (this.boardLightColor is not null) - { - region.boardLightColor = (Color)this.boardLightColor; - } - if (this.cardsLightColor is not null) - { - region.cardsLightColor = (Color)this.cardsLightColor; - } - if (this.dustParticlesDisabled is not null) - { - region.dustParticlesDisabled = (bool)this.dustParticlesDisabled; - } - if (this.fogEnabled is not null) - { - region.fogEnabled = (bool)this.fogEnabled; - } - if (this.fogProfile is not null) - { - region.fogProfile = this.fogProfile; - } - if (this.fogAlpha is not null) - { - region.fogAlpha = (float)this.fogAlpha; - } - if (this.mapAlbedo is not null) - { - region.mapAlbedo = this.mapAlbedo; - } - if (this.mapEmission is not null) - { - region.mapEmission = this.mapEmission; - } - if (this.mapEmissionColor is not null) - { - region.mapEmissionColor = (Color)this.mapEmissionColor; - } - if (this.mapParticlesPrefabs is not null) - { - region.mapParticlesPrefabs = this.mapParticlesPrefabs; - } + TypeMapper.Convert(this, region); Plugin.Log.LogInfo($"Adjusted default region {name}!"); return region; } From 4ae51acff2d44ef3906b71e2f36fb50cf2454c96 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Wed, 3 Nov 2021 13:55:02 +0000 Subject: [PATCH 4/6] Changed to API for compatability --- TypeMapper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TypeMapper.cs b/TypeMapper.cs index 2e1633b6..ad5564b8 100644 --- a/TypeMapper.cs +++ b/TypeMapper.cs @@ -5,7 +5,7 @@ using Mono.Cecil.Cil; using MonoMod.Utils; -namespace CardLoaderPlugin +namespace APIPlugin { [AttributeUsage(AttributeTargets.Field)] public class IgnoreMappingAttribute : Attribute {} @@ -93,7 +93,7 @@ private static Dictionary FieldSetters public static D Convert(S source, D destination = null) { destination ??= new(); - + foreach (var field in FieldAccessors) { object val = field.Value.Del(source); From a4ff63e3da31ae092cb7b7b3c6d510aebc9e1ff6 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 6 Nov 2021 19:22:50 -0500 Subject: [PATCH 5/6] Fix TypeMapper --- TypeMapper.cs | 58 +++++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/TypeMapper.cs b/TypeMapper.cs index ad5564b8..e2732f82 100644 --- a/TypeMapper.cs +++ b/TypeMapper.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using HarmonyLib; using Mono.Cecil.Cil; using MonoMod.Utils; @@ -9,22 +10,10 @@ namespace APIPlugin { [AttributeUsage(AttributeTargets.Field)] public class IgnoreMappingAttribute : Attribute {} - public static unsafe class TypeMapper where S : class where D : class, new() + public static class TypeMapper where S : class where D : class { - private struct GetFieldDelegate - { - public delegate* Del; - public Type FieldType; - } - - private struct SetFieldDelegate - { - public delegate* Del; - public Type FieldType; - } - - private static Dictionary _accessors = null; - private static Dictionary FieldAccessors + private static Dictionary _accessors = null; + private static Dictionary FieldAccessors { get { @@ -39,21 +28,17 @@ private static Dictionary FieldAccessors il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldfld, accessor.Module.ImportReference(field)); if (field.FieldType.IsValueType) - il.Emit(OpCodes.Box); + il.Emit(OpCodes.Box, field.FieldType); il.Emit(OpCodes.Ret); - _accessors.Add(field.Name, new GetFieldDelegate - { - Del = (delegate*)accessor.Generate().MethodHandle.GetFunctionPointer(), - FieldType = field.FieldType - }); + _accessors.Add(field.Name, accessor.Generate()); } } return _accessors; } } - private static Dictionary _setters = null; - private static Dictionary FieldSetters + private static Dictionary _setters = null; + private static Dictionary FieldSetters { get { @@ -63,43 +48,28 @@ private static Dictionary FieldSetters foreach (var field in AccessTools.GetDeclaredFields(typeof(D))) { - var fieldType = field.FieldType; var setter = new DynamicMethodDefinition("set_" + field.Name, typeof(void), new Type[] { typeof(D), typeof(object) }); var il = setter.GetILProcessor(); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_1); - if (FieldAccessors.TryGetValue(field.Name, out var getter) && getter.FieldType.GetGenericTypeDefinition() == typeof(Nullable<>) && getter.FieldType.GetGenericArguments()[0] == field.FieldType) - { - il.Emit(OpCodes.Call, AccessTools.DeclaredPropertyGetter(fieldType, "Value")); - fieldType = getter.FieldType.GetGenericArguments()[0]; - } - else if (fieldType.IsValueType) - il.Emit(OpCodes.Unbox, setter.Module.ImportReference(field.FieldType)); - else - il.Emit(OpCodes.Castclass, setter.Module.ImportReference(field.FieldType)); + il.Emit(OpCodes.Unbox_Any, setter.Module.ImportReference(field.FieldType)); il.Emit(OpCodes.Stfld, setter.Module.ImportReference(field)); il.Emit(OpCodes.Ret); - _setters.Add(field.Name, new SetFieldDelegate - { - Del = (delegate*)setter.Generate().MethodHandle.GetFunctionPointer(), - FieldType = field.FieldType - }); + _setters.Add(field.Name, setter.Generate()); } } return _setters; } } - public static D Convert(S source, D destination = null) + public static D Convert(S source, D destination) { - destination ??= new(); - foreach (var field in FieldAccessors) { - object val = field.Value.Del(source); - if (val is not null) + object val = field.Value.Invoke(null, new object[] {source}); + if (val is not null && FieldSetters.ContainsKey(field.Key)) { - FieldSetters[field.Key].Del(destination, val); + FieldSetters[field.Key].Invoke(null, new object[] {destination, val}); } } From 865afde647db331f14d767c2cd397a84230366f6 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 6 Nov 2021 19:23:07 -0500 Subject: [PATCH 6/6] Make NewCard static --- .gitignore | 1 + Plugin.cs | 82 ++++++------------------------------------------------ 2 files changed, 10 insertions(+), 73 deletions(-) diff --git a/.gitignore b/.gitignore index 0c7e126e..fdbe7196 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ bin/ .idea/ .vs/ .vscode/ +*.user diff --git a/Plugin.cs b/Plugin.cs index d7ccff31..fe37a1bb 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -6,6 +6,7 @@ using UnityEngine; using DiskCardGame; using HarmonyLib; +#pragma warning disable 169 namespace APIPlugin { @@ -66,51 +67,16 @@ public class CustomCard public GameObject animatedPortrait; public List decals; - public CustomCard(string name, List metaCategories = null, CardComplexity? cardComplexity = null, CardTemple? temple = null, string displayedName = "", - int? baseAttack = null, int? baseHealth = null, string description = "", bool? hideAttackAndHealth = null, int? cost = null, int? bonesCost = null, - int? energyCost = null, List gemsCost = null, SpecialStatIcon? specialStatIcon = null, List tribes = null, List traits = null, - List specialAbilities = null, List abilities = null, EvolveParams evolveParams = null, string defaultEvolutionName = "", - TailParams tailParams = null, IceCubeParams iceCubeParams = null, bool? flipPortraitForStrafe = null, bool? onePerDeck = null, - List appearanceBehaviour = null, Texture2D tex = null, Texture2D altTex = null, Texture titleGraphic = null, - Texture2D pixelTex = null, GameObject animatedPortrait = null, List decals = null) + public CustomCard(string name) { this.name = name; - this.metaCategories = metaCategories; - this.cardComplexity = cardComplexity; - this.temple = temple; - this.displayedName = displayedName; - this.baseAttack = baseAttack; - this.baseHealth = baseHealth; - this.description = description; - this.hideAttackAndHealth = hideAttackAndHealth; - this.cost = cost; - this.bonesCost = bonesCost; - this.energyCost = energyCost; - this.gemsCost = gemsCost; - this.specialStatIcon = specialStatIcon; - this.tribes = tribes; - this.traits = traits; - this.specialAbilities = specialAbilities; - this.abilities = abilities; - this.evolveParams = evolveParams; - this.defaultEvolutionName = defaultEvolutionName; - this.tailParams = tailParams; - this.iceCubeParams = iceCubeParams; - this.flipPortraitForStrafe = flipPortraitForStrafe; - this.onePerDeck = onePerDeck; - this.appearanceBehaviour = appearanceBehaviour; - this.tex = tex; - this.altTex = altTex; - this.titleGraphic = titleGraphic; - this.pixelTex = pixelTex; - this.animatedPortrait = animatedPortrait; - this.decals = decals; CustomCard.cards.Add(this); } public CardInfo AdjustCard(CardInfo card) { TypeMapper.Convert(this, card); + if (this.tex is not null) { tex.name = "portrait_" + name; @@ -137,11 +103,11 @@ public CardInfo AdjustCard(CardInfo card) } } - public class NewCard + public static class NewCard { public static List cards = new List(); - public NewCard(CardInfo card) + public static void Add(CardInfo card) { NewCard.cards.Add(card); Plugin.Log.LogInfo($"Loaded custom card {card.name}!"); @@ -150,11 +116,11 @@ public NewCard(CardInfo card) // TODO Implement a handler for custom appearanceBehaviour - in particular custom card backs // TODO Change parameter order, and function setter call order to make more sense // TODO Rename parameters to be more user friendly - public NewCard(string name, List metaCategories, CardComplexity cardComplexity, CardTemple temple, string displayedName, int baseAttack, int baseHealth, - string description = "", + public static void Add(string name, List metaCategories, CardComplexity cardComplexity, CardTemple temple, string displayedName, int baseAttack, int baseHealth, + string description = null, bool hideAttackAndHealth = false, int cost = 0, int bonesCost = 0, int energyCost = 0, List gemsCost = null, SpecialStatIcon specialStatIcon = SpecialStatIcon.None, List tribes = null, List traits = null, List specialAbilities = null, List abilities = null, EvolveParams evolveParams = null, - string defaultEvolutionName = "", TailParams tailParams = null, IceCubeParams iceCubeParams = null, bool flipPortraitForStrafe = false, bool onePerDeck = false, + string defaultEvolutionName = null, TailParams tailParams = null, IceCubeParams iceCubeParams = null, bool flipPortraitForStrafe = false, bool onePerDeck = false, List appearanceBehaviour = null, Texture2D tex = null, Texture2D altTex = null, Texture titleGraphic = null, Texture2D pixelTex = null, GameObject animatedPortrait = null, List decals = null) { @@ -285,39 +251,9 @@ public class CustomRegion private Color? mapEmissionColor; private List mapParticlesPrefabs; - public CustomRegion(string name, int? tier = null, List terrainCards = null, List consumableItems = null, List encounters = null, - List bosses = null, List likelyCards = null, List dominantTribes = null, PredefinedNodes predefinedNodes = null, - EncounterBlueprintData bossPrepEncounter = null, StoryEventCondition bossPrepCondition = null, List scarceScenery = null, - List fillerScenery = null, PredefinedScenery predefinedScenery = null, string ambientLoopId = "", bool? silenceCabinAmbience = null, - Color? boardLightColor = null, Color? cardsLightColor = null, bool? dustParticlesDisabled = null, bool? fogEnabled = null, VolumetricFogAndMist.VolumetricFogProfile fogProfile = null, - float? fogAlpha = null, Texture mapAlbedo = null, Texture mapEmission = null, Color? mapEmissionColor = null, List mapParticlesPrefabs = null) + public CustomRegion(string name) { this.name = name; - this.tier = tier; - this.terrainCards = terrainCards; - this.consumableItems = consumableItems; - this.encounters = encounters; - this.bosses = bosses; - this.likelyCards = likelyCards; - this.dominantTribes = dominantTribes; - this.predefinedNodes = predefinedNodes; - this.bossPrepEncounter = bossPrepEncounter; - this.bossPrepCondition = bossPrepCondition; - this.scarceScenery = scarceScenery; - this.fillerScenery = fillerScenery; - this.predefinedScenery = predefinedScenery; - this.ambientLoopId = ambientLoopId; - this.silenceCabinAmbience = silenceCabinAmbience; - this.boardLightColor = boardLightColor; - this.cardsLightColor = cardsLightColor; - this.dustParticlesDisabled = dustParticlesDisabled; - this.fogEnabled = fogEnabled; - this.fogProfile = fogProfile; - this.fogAlpha = fogAlpha; - this.mapAlbedo = mapAlbedo; - this.mapEmission = mapEmission; - this.mapEmissionColor = mapEmissionColor; - this.mapParticlesPrefabs = mapParticlesPrefabs; CustomRegion.regions.Add(this); }