Added config for the dev debug tools

Setup hover UI for the dev window
This commit is contained in:
LadyAliceMargatroid 2024-08-26 21:42:35 -07:00
parent e143d2ad3d
commit b7a70f56d6
15 changed files with 181 additions and 92 deletions

View File

@ -12,12 +12,16 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class MainPathProperties {
[Tooltip("The number of main paths.\n\n1 means no additional main paths\n3 means two additional main paths\netc.")]
internal const string MainPathCountTooltip = "The number of main paths.\n\n1 means no additional main paths\n3 means two additional main paths\netc.";
internal const string MainRoomTilePrefabTooltip = "The Tile prefab where the additional main paths will start from.\n\nCannot be null if MainPathCount is more than 1.";
internal const string CopyNodeBehaviourTooltip = "Defines how the nodes list is copied onto the additional main paths.\n\nCopyFromMainPathPosition: nodes will copy based on the MainRoomTilePrefab's position in the main path.\nCopyFromNodeList: nodes will copy based on the MainRoomTilePrefab's position in the node list + 1.";
[Tooltip(MainPathCountTooltip)]
[Range(1, 9)]
public int MainPathCount = 1;
[Tooltip("The Tile Prefab where the additional main paths will start from. Cannot be null if MainPathCount is more than 1.")]
[Tooltip(MainRoomTilePrefabTooltip)]
public GameObject MainRoomTilePrefab;
[Tooltip("CopyFromMainPathPosition means that nodes will copy from the MainRoomTilePrefab's position in the main path.\n\nCopyFromNodeList means that nodes will copy from the MainRoomTilePrefab's location from the node list + 1.")]
[Tooltip(CopyNodeBehaviourTooltip)]
public CopyNodeBehaviour CopyNodeBehaviour = CopyNodeBehaviour.CopyFromMainPathPosition;
internal void CopyFrom(MainPathProperties props) {
@ -36,15 +40,21 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class DungeonBoundsProperties {
[Tooltip("If enabled, restricts the dungeon's generation to the bounds described below.\n\nThis will help in condensing the dungeon, but it will increase the chance of dungeon generation failure (potentially guarantees failure if the bounds is too small).")]
internal const string UseDungeonBoundsTooltip = "If enabled, restricts the dungeon's generation to the bounds described below.\n\nThis will help in condensing the dungeon, but it will increase the chance of dungeon generation failure (potentially guarantees failure if the bounds is too small).";
internal const string SizeBaseTooltip = "The base size of the bounds.";
internal const string SizeFactorTooltip = "The factor that's multiplied with the base size AND the dungeon's size. The resulting value is added to the base size of the bounds.\n\n0 means that the bound size is not influenced by the dungeon's size and is therefore a constant.";
internal const string PositionOffsetTooltip = "The base positional offset of the bounds.";
internal const string PositionPivotTooltip = "The pivot of the bounds.";
[Tooltip(UseDungeonBoundsTooltip)]
public bool UseDungeonBounds = false;
[Tooltip("The base size of the bounds.")]
[Tooltip(SizeBaseTooltip)]
public Vector3 SizeBase = new Vector3(120f, 40f, 80f);
[Tooltip("The factor that's multiplied with the base size AND the dungeon's size. The resulting value is added to the base size of the bounds.\n\n0 means that the bound size is not influenced by the dungeon's size and is therefore a constant.")]
[Tooltip(SizeFactorTooltip)]
public Vector3 SizeFactor = new Vector3(1f, 0.5f, 1f);
[Tooltip("The base positional offset of the bounds.")]
[Tooltip(PositionOffsetTooltip)]
public Vector3 PositionOffset = Vector3.zero;
[Tooltip("The pivot of the bounds.")]
[Tooltip(PositionPivotTooltip)]
public Vector3 PositionPivot = new Vector3(0.5f, 0.5f, 0.5f);
internal void CopyFrom(DungeonBoundsProperties props) {
@ -72,7 +82,9 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class NormalNodeArchetypesProperties {
[Tooltip("If enabled, adds archetypes to the normal nodes in the DungeonFlow.\n\nBy default, nodes cannot have branching paths since they don't have archetype references. This allows nodes to have branching paths.")]
internal const string AddArchetypesToNormalNodesTooltip = "If enabled, adds archetypes to the normal nodes in the DungeonFlow.\n\nBy default, nodes cannot have branching paths since they don't have archetype references. This allows nodes to have branching paths.";
[Tooltip(AddArchetypesToNormalNodesTooltip)]
public bool AddArchetypesToNormalNodes = false;
public List<NodeArchetype> NormalNodeArchetypes = new List<NodeArchetype>();
internal Dictionary<string, NodeArchetype> _normalNodeArchetypesDictioanry;
@ -98,22 +110,21 @@ namespace DunGenPlus.Collections {
foreach (var n in NormalNodeArchetypes)
{
if (_normalNodeArchetypesDictioanry.ContainsKey(n.label))
if (_normalNodeArchetypesDictioanry.ContainsKey(n.Label))
{
Plugin.logger.LogError($"Label {n.label} already exists. Ignoring latest entry.");
Plugin.logger.LogError($"Label {n.Label} already exists. Ignoring latest entry.");
continue;
}
_normalNodeArchetypesDictioanry.Add(n.label, n);
_normalNodeArchetypesDictioanry.Add(n.Label, n);
if (string.IsNullOrWhiteSpace(n.label))
if (string.IsNullOrWhiteSpace(n.Label))
{
_defaultNodeArchetype = n;
}
}
}
internal DungeonArchetype GetRandomArchetype(string label, RandomStream randomStream)
{
internal DungeonArchetype GetRandomArchetype(string label, RandomStream randomStream) {
NodeArchetype node;
if (!_normalNodeArchetypesDictioanry.TryGetValue(label, out node))
{
@ -122,7 +133,7 @@ namespace DunGenPlus.Collections {
if (node != null)
{
var archetypes = node.archetypes;
var archetypes = node.Archetypes;
var count = archetypes.Count;
if (count == 0) return null;
@ -138,9 +149,12 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class ForcedTilesProperties {
[Tooltip("If enabled, attempts to forcefully spawn tiles from ForcedTileSets after branching paths are generated.\n\nCan only be used if MainPathCount > 1.")]
internal const string UseForcedTilesTooltip = "If enabled, attempts to forcefully spawn tiles from ForcedTileSets after branching paths are generated.\n\nCan only be used if MainPathCount > 1.";
internal const string ForcedTileSetsTooltip = "The list of tiles that will be attempted to forcefully spawn. Each entry will spawn only one tile from it's list.\n\nIf the tile cannot be forcefully spawned, the dungeon generation will not restart.";
[Tooltip(UseForcedTilesTooltip)]
public bool UseForcedTiles = false;
[Tooltip("The list of tiles that will be attempted to forcefully spawn. Each entry will spawn only one tile from it's list.\n\nIf the tile cannot be forcefully spawned, the dungeon generation will not restart.")]
[Tooltip(ForcedTileSetsTooltip)]
public List<ForcedTileSetList> ForcedTileSets = new List<ForcedTileSetList>();
internal void CopyFrom(ForcedTilesProperties props) {
@ -158,25 +172,46 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class BranchPathMultiSimulationProperties {
[Tooltip("If enabled, dungeon generation will simulate a number of branch paths for each branch path, then choose the best branch path based on its weight. The weight is decided by the following criteria. Slows down Branch Path Times by a second or two.")]
internal const string UseBranchPathMultiSimTooltip = "If enabled, dungeon generation will simulate a number of branch paths for each branch path, then choose the best branch path based on its weight. The weight is decided by the following criteria.\n\nCan slow down Branch Path Generation Times by a second or two.";
internal const string SimulationCountTooltip = "The number pf simulations per branch path.\n\nIncreasing this value can increase your chances of finding your best path, but will increase Branch Path Times and vice versa.";
internal const string LengthWeightScaleTooltip = "The weight scale for the branch path's length. The length of the branch path is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize very long branch paths.";
internal const string NormalizedLengthWeightScaleTooltip = "The weight scale for the branch path's normalized length. The normalized length (0 -> 1) of the branch path (PathLength / MaxPathLength) is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who meet their maximum path length.";
[Tooltip(UseBranchPathMultiSimTooltip)]
public bool UseBranchPathMultiSim = false;
[Tooltip("The number pf simulations per branch path.\n\nIncreasing this value can increase your chances of finding your best path, but will increase Branch Path Times and vice versa.")]
[Tooltip(SimulationCountTooltip)]
public int SimulationCount = 5;
[Tooltip("The weight scale for the branch path's length. The length of the branch path is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize very long branch paths.")]
[Space()]
[Tooltip(LengthWeightScaleTooltip)]
public float LengthWeightScale = 0.125f;
[Tooltip("The weight scale for the branch path's normalized length. The normalized length (0 -> 1) of the branch path (PathLength / MaxPathLength) is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who meet their maximum path length.")]
[Tooltip(NormalizedLengthWeightScaleTooltip)]
public float NormalizedLengthWeightScale = 1f;
[Tooltip("The weight scale for the branch path's number of connections to the same main path. The number of possible connections is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make path loops in their main path in general.")]
internal const string SamePathBaseWeightScaleTooltip = "The weight scale for the branch path's number of connections to the same main path. The number of possible connections is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make path loops in their main path in general.";
internal const string SamePathDepthWeightScaleTooltip = "The weight scale for the branch path's number of connections to the same main path. For each possible connection, the main path depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make deep path loops to their main paths";
internal const string SamePathNormalizedDepthWeightTooltip = "The weight scale for the branch path's number of connections to the same main path. For each possible connection, the main path normalized depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make generally deep path loops to their main paths";
[Space()]
[Header("Same Path")]
[Tooltip(SamePathBaseWeightScaleTooltip)]
public float SamePathBaseWeightScale = 0.125f;
[Tooltip("The weight scale for the branch path's number of connections to the same main path. For each possible connection, the main path depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make deep path loops to their main paths")]
[Tooltip(SamePathDepthWeightScaleTooltip)]
public float SamePathDepthWeightScale = 0.125f;
[Tooltip("The weight scale for the branch path's number of connections to the same main path. For each possible connection, the main path normalized depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make generally deep path loops to their main paths")]
[Tooltip(SamePathNormalizedDepthWeightTooltip)]
public float SamePathNormalizedDepthWeightScale = 1f;
[Tooltip("The weight scale for the branch path's number of connections to other main paths. The number of possible connections is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make path loops to other main paths in general.")]
internal const string DiffPathBaseWeightScaleTooltip = "The weight scale for the branch path's number of connections to other main paths. The number of possible connections is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make path loops to other main paths in general.";
internal const string DiffPathDepthWeightScaleTooltip = "The weight scale for the branch path's number of connections to other main paths. For each possible connection, the main path depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make deep path loops to other main paths.";
internal const string DiffPathNormalizedDepthWeightTooltip = "The weight scale for the branch path's number of connections to other main paths. For each possible connection, the main path normalized depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make generally deep path loops to other main paths.";
[Space()]
[Header("Different Path")]
[Tooltip(DiffPathBaseWeightScaleTooltip)]
public float DiffPathBaseWeightScale = 0.25f;
[Tooltip("The weight scale for the branch path's number of connections to other main paths. For each possible connection, the main path depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make deep path loops to other main paths.")]
[Tooltip(DiffPathDepthWeightScaleTooltip)]
public float DiffPathDepthWeightScale = 0.25f;
[Tooltip("The weight scale for the branch path's number of connections to other main paths. For each possible connection, the main path normalized depth difference is multiplied by the scale and is added to the branch path's weight.\n\nIncreasing this value will prioritize branch paths who make generally deep path loops to other main paths.")]
[Tooltip(DiffPathNormalizedDepthWeightTooltip)]
public float DiffPathNormalizedDepthWeightScale = 2f;
public float GetWeightBase(float length, float normalizedLength){
@ -223,13 +258,18 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class LineRandomizerProperties {
[Tooltip("If enabled, every archetype in LineRandomizerArchetypes will have the last LineRandomizerTakeCount tilesets replaced by a randomly selected set of tilesets from LineRandomizerTileSets. This applies for both archetype's TileSets and BranchCapTileSets.\n\nThis is designed for the scenario where dungeon generation takes a long time due to the combination of too many tiles and/or doorways in those tiles. This can reduce dungeon generation time while keeping some of the randomness of dungeon generation.\n\nAs stated previously, this WILL replace the last LineRandomizerTakeCount tilesets in the archetype's TileSets and BranchCapTileSets. As such you must guarantee that those elements can be replaced.")]
internal const string UseLineRandomizerTooltip = "If enabled, every archetype in LineRandomizerArchetypes will have the last LineRandomizerTakeCount tilesets replaced by a randomly selected set of tilesets from LineRandomizerTileSets. This applies for both archetype's TileSets and BranchCapTileSets.\n\nThis is designed for the scenario where dungeon generation takes a long time due to the combination of too many tiles and/or doorways in those tiles. This can reduce dungeon generation time while keeping some of the randomness of dungeon generation.\n\nAs stated previously, this WILL replace the last LineRandomizerTakeCount tilesets in the archetype's TileSets and BranchCapTileSets. As such you must guarantee that those elements can be replaced.";
internal const string ArchetypesTooltip = "The archetypes whose tilesets will be replaced.\n\nThese archetypes should ideally used in the Lines section of DungeonFlow, but it's a free country.";
internal const string TileSetsTooltip = "The tilesets that will be used for replacement.";
internal const string TileSetsTakeCountTooltip = "The amount of tilesets that will be replaced from the archetypes, starting from the last element to the first element.\n\nAs stated previously, this WILL replace the tilesets in the archetype's TileSets and BranchCapTileSets. As such you must guarantee that those elements can be replaced.";
[Tooltip(UseLineRandomizerTooltip)]
public bool UseLineRandomizer = false;
[Tooltip("The archetypes whose tilesets will be replaced.\n\nThese archetypes should ideally used in the Lines section of DungeonFlow, but it's a free country.")]
[Tooltip(ArchetypesTooltip)]
public List<DungeonArchetype> Archetypes = new List<DungeonArchetype>();
[Tooltip("The tilesets that will be used for replacement.")]
[Tooltip(TileSetsTooltip)]
public List<TileSet> TileSets = new List<TileSet>();
[Tooltip("The amount of tilesets that will be replaced from the archetypes, starting from the last element to the first element.\n\nAs stated previously, this WILL replace the tilesets in the archetype's TileSets and BranchCapTileSets. As such you must guarantee that those elements can be replaced.")]
[Tooltip(TileSetsTakeCountTooltip)]
public int TileSetsTakeCount = 3;
internal void CopyFrom(LineRandomizerProperties props) {
@ -249,13 +289,18 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class MiscellaneousProperties {
[Tooltip("If enabled, updates the MaxShadowsRequest to MaxShadowsRequestAmount when your dungeon loads.\n\nThis is designed for the scenario where your dungeon, for whatever reason, has too many lights nearby and causes the annoying 'Max shadow requests count reached' warning to spam the logs.")]
internal const string UseMaxShadowsRequestUpdateTooltip = "If enabled, updates the MaxShadowsRequest to MaxShadowsRequestAmount when your dungeon loads.\n\nThis is designed for the scenario where your dungeon, for whatever reason, has too many lights nearby and causes the annoying 'Max shadow requests count reached' warning to spam the logs.";
internal const string MaxShadowsRequestCountTooltip = "The amount of MaxShadowsRequest.\n\n4 is the game's default value. I find 8 to be more than acceptable.";
internal const string UseDoorwaySistersTooltip = "If enabled, the DoorwaySisters component will become active.\n\nThe component prevents an intersecting doorway from generating if it's 'sister' doorway already generated and both doorways would lead to the same neighboring tile.\n\nThis is designed for the scenario where, two neighboring doorways would lead to the same tile, one doorway is a locked door and the other is an open doorway. This would defeat the purpose of the locked door, and such as, this feature exists if needed.\n\nThis feature slows down dungeon generation slightly when enabled.";
internal const string UseRandomGuaranteedScrapSpawnTooltip = "If enabled, the RandomGuaranteedScrapSpawn component will be come active.\n\nThe component allows random scrap of a specified minimum value to always be spawned on a specific point.";
[Tooltip(UseMaxShadowsRequestUpdateTooltip)]
public bool UseMaxShadowsRequestUpdate = false;
[Tooltip("The amount of MaxShadowsRequest.\n\n4 is the game's default value. I find 8 to be more than acceptable.")]
[Tooltip(MaxShadowsRequestCountTooltip)]
public int MaxShadowsRequestCount = 8;
[Tooltip("If enabled, the DoorwaySisters component will become active.\n\nThe component prevents an intersecting doorway from generating if it's 'sister' doorway already generated and both doorways would lead to the same neighboring tile.\n\nThis is designed for the scenario where, two neighboring doorways would lead to the same tile, one doorway is a locked door and the other is an open doorway. This would defeat the purpose of the locked door, and such as, this feature exists if needed.\n\nThis feature slows down dungeon generation slightly when enabled.")]
[Tooltip(UseDoorwaySistersTooltip)]
public bool UseDoorwaySisters = false;
[Tooltip("If enabled, the RandomGuaranteedScrapSpawn component will be come active.\n\nThe component allows random scrap of a specified minimum value to always be spawned on a specific point.")]
[Tooltip(UseRandomGuaranteedScrapSpawnTooltip)]
public bool UseRandomGuaranteedScrapSpawn = false;
internal void CopyFrom(MiscellaneousProperties props) {

View File

@ -10,13 +10,18 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class ForcedTileSetList {
[Tooltip("List of tiles to be forcefully spawned.")]
public List<TileSet> Tilesets = new List<TileSet>();
[Tooltip("The weight based on the path's depth.")]
internal const string TileSetsTooltip = "List of tiles to be forcefully spawned.";
internal const string DepthWeightScaleTooltip = "The weight based on the path's depth.";
internal const string MainPathWeightTooltip = "The weight for the tile spawning on the main path.";
internal const string BranchPathWeightTooltip = "The weight for the tile spawning on the branch path.";
[Tooltip(TileSetsTooltip)]
public List<TileSet> TileSets = new List<TileSet>();
[Tooltip(DepthWeightScaleTooltip)]
public AnimationCurve DepthWeightScale = new AnimationCurve();
[Tooltip("The weight for the tile spawning on the main path.")]
[Tooltip(MainPathWeightTooltip)]
public float MainPathWeight = 1f;
[Tooltip("The weight for the tile spawning on the branch path.")]
[Tooltip(BranchPathWeightTooltip)]
public float BranchPathWeight = 1f;
}

View File

@ -10,10 +10,14 @@ namespace DunGenPlus.Collections {
[System.Serializable]
public class NodeArchetype {
[Tooltip("The normal node with this label will gain a randomly chosen archetype.\n\nIf empty, this becomes the default choice for any normal node without a NodeArchetype specified in this list.")]
public string label;
[Tooltip("The list of archetypes. One will be randomly chosen.")]
public List<DungeonArchetype> archetypes = new List<DungeonArchetype>();
internal const string LabelTooltip = "The normal node with this label will gain a randomly chosen archetype.\n\nIf empty, this becomes the default choice for any normal node without a NodeArchetype specified in this list.";
internal const string ArchetypesTooltip = "The list of archetypes. One will be randomly chosen.";
[Tooltip(LabelTooltip)]
public string Label;
[Tooltip(ArchetypesTooltip)]
public List<DungeonArchetype> Archetypes = new List<DungeonArchetype>();
}
}

View File

@ -86,8 +86,8 @@ namespace DunGenPlus.DevTools.Panels.Collections {
AddTileSets(dungeonFlow.TileInjectionRules.Select(n => n.TileSet));
if (extender) {
AddArchetypes(extender.Properties.NormalNodeArchetypesProperties.NormalNodeArchetypes.SelectMany(l => l.archetypes));
AddTileSets(extender.Properties.ForcedTilesProperties.ForcedTileSets.SelectMany(l => l.Tilesets));
AddArchetypes(extender.Properties.NormalNodeArchetypesProperties.NormalNodeArchetypes.SelectMany(l => l.Archetypes));
AddTileSets(extender.Properties.ForcedTilesProperties.ForcedTileSets.SelectMany(l => l.TileSets));
AddTiles(extender.Properties.AssetCacheTileList);
AddTileSets(extender.Properties.AssetCacheTileSetList);

View File

@ -73,38 +73,40 @@ namespace DunGenPlus.DevTools.Panels {
}
internal const string ActivateDunGenPlusTooltip = "If disabled, the dungeon generation will ignore this DunGenPlusExtender asset and simply create a vanilla dungeon instead when generating.";
public void SetupPanel() {
selectedExtenderer = API.GetDunGenExtender(selectedDungeonFlow);
var parentTransform = selectedListGameObject.transform;
var properties = selectedExtenderer.Properties;
manager.CreateBoolInputField(parentTransform, "Activate DunGenPlus", selectedExtenderer.Active, SetActivateDunGenPlus);
manager.CreateBoolInputField(parentTransform, ("Activate DunGenPlus", ActivateDunGenPlusTooltip), selectedExtenderer.Active, SetActivateDunGenPlus);
manager.CreateSpaceUIField(parentTransform);
var mainPathTransform = manager.CreateVerticalLayoutUIField(parentTransform);
mainPathParentGameobject = mainPathTransform.gameObject;
manager.CreateHeaderUIField(parentTransform, "Main Path");
manager.CreateIntSliderField(parentTransform, "Main Path Count", new IntParameter(properties.MainPathProperties.MainPathCount, 1, 10), SetMainPathCount);
manager.CreateIntSliderField(parentTransform, ("Main Path Count", MainPathProperties.MainPathCountTooltip), new IntParameter(properties.MainPathProperties.MainPathCount, 1, 10), SetMainPathCount);
mainPathTransform.SetAsLastSibling();
manager.CreateTileOptionsUIField(mainPathTransform, "Main Room Tile Prefab", selectedAssetCache.tiles.dictionary[properties.MainPathProperties.MainRoomTilePrefab], SetMainRoom);
manager.CreateEnumOptionsUIField<DunGenExtenderProperties.CopyNodeBehaviour>(mainPathTransform, "Copy Node Behaviour", (int)properties.MainPathProperties.CopyNodeBehaviour, SetCopyNodeBehaviour);
manager.CreateTileOptionsUIField(mainPathTransform, ("Main Room Tile Prefab", MainPathProperties.MainRoomTilePrefabTooltip), selectedAssetCache.tiles.dictionary[properties.MainPathProperties.MainRoomTilePrefab], SetMainRoom);
manager.CreateEnumOptionsUIField<DunGenExtenderProperties.CopyNodeBehaviour>(mainPathTransform, ("Copy Node Behaviour", MainPathProperties.CopyNodeBehaviourTooltip), (int)properties.MainPathProperties.CopyNodeBehaviour, SetCopyNodeBehaviour);
manager.CreateSpaceUIField(parentTransform);
var dungeonBoundsTransform = manager.CreateVerticalLayoutUIField(parentTransform);
dungeonBoundsParentGameobject = dungeonBoundsTransform.gameObject;
manager.CreateHeaderUIField(parentTransform, "Dungeon Bounds");
manager.CreateBoolInputField(parentTransform, "Use Dungeon Bounds", properties.DungeonBoundsProperties.UseDungeonBounds, SetUseDungeonBounds);
manager.CreateBoolInputField(parentTransform, ("Use Dungeon Bounds", DungeonBoundsProperties.UseDungeonBoundsTooltip), properties.DungeonBoundsProperties.UseDungeonBounds, SetUseDungeonBounds);
dungeonBoundsTransform.SetAsLastSibling();
manager.CreateVector3InputField(dungeonBoundsTransform, "Size Base", properties.DungeonBoundsProperties.SizeBase, SetDungeonBoundsSizeBase);
manager.CreateVector3InputField(dungeonBoundsTransform, "Size Factor", properties.DungeonBoundsProperties.SizeFactor, SetDungeonBoundsSizeFactor);
manager.CreateVector3InputField(dungeonBoundsTransform, "Position Offset", properties.DungeonBoundsProperties.PositionOffset, SetDungeonBoundsPosOffset);
manager.CreateVector3InputField(dungeonBoundsTransform, "Position Pivot", properties.DungeonBoundsProperties.PositionPivot, SetDungeonBoundsPosPivot);
manager.CreateVector3InputField(dungeonBoundsTransform, ("Size Base", DungeonBoundsProperties.SizeBaseTooltip), properties.DungeonBoundsProperties.SizeBase, SetDungeonBoundsSizeBase);
manager.CreateVector3InputField(dungeonBoundsTransform, ("Size Factor", DungeonBoundsProperties.SizeFactorTooltip), properties.DungeonBoundsProperties.SizeFactor, SetDungeonBoundsSizeFactor);
manager.CreateVector3InputField(dungeonBoundsTransform, ("Position Offset", DungeonBoundsProperties.PositionOffsetTooltip), properties.DungeonBoundsProperties.PositionOffset, SetDungeonBoundsPosOffset);
manager.CreateVector3InputField(dungeonBoundsTransform, ("Position Pivot", DungeonBoundsProperties.PositionPivotTooltip), properties.DungeonBoundsProperties.PositionPivot, SetDungeonBoundsPosPivot);
manager.CreateSpaceUIField(parentTransform);
var archetypesTransform = manager.CreateVerticalLayoutUIField(parentTransform);
archetypesNodesParentGameobject = archetypesTransform.gameObject;
manager.CreateHeaderUIField(parentTransform, "Archetypes Normal Nodes");
manager.CreateBoolInputField(parentTransform, "Add Archetypes", properties.NormalNodeArchetypesProperties.AddArchetypesToNormalNodes, SetAddArchetypes);
manager.CreateBoolInputField(parentTransform, ("Add Archetypes", NormalNodeArchetypesProperties.AddArchetypesToNormalNodesTooltip), properties.NormalNodeArchetypesProperties.AddArchetypesToNormalNodes, SetAddArchetypes);
archetypesTransform.SetAsLastSibling();
manager.CreateListUIField(archetypesTransform, "Normal Node Archetypes", properties.NormalNodeArchetypesProperties.NormalNodeArchetypes);
manager.CreateSpaceUIField(parentTransform);
@ -112,42 +114,42 @@ namespace DunGenPlus.DevTools.Panels {
var forcedTilesTransform = manager.CreateVerticalLayoutUIField(parentTransform);
forcedTilesParentGameobject = forcedTilesTransform.gameObject;
manager.CreateHeaderUIField(parentTransform, "Forced Tiles");
manager.CreateBoolInputField(parentTransform, "Use Forced Tiles", properties.ForcedTilesProperties.UseForcedTiles, SetUseForcedTiles);
manager.CreateBoolInputField(parentTransform, ("Use Forced Tiles", ForcedTilesProperties.UseForcedTilesTooltip), properties.ForcedTilesProperties.UseForcedTiles, SetUseForcedTiles);
forcedTilesTransform.SetAsLastSibling();
manager.CreateListUIField(forcedTilesTransform, "Forced Tile Sets", properties.ForcedTilesProperties.ForcedTileSets);
manager.CreateListUIField(forcedTilesTransform, ("Forced Tile Sets", ForcedTilesProperties.ForcedTileSetsTooltip), properties.ForcedTilesProperties.ForcedTileSets);
manager.CreateSpaceUIField(parentTransform);
var branchLoopTransform = manager.CreateVerticalLayoutUIField(parentTransform);
branchLoopBoostParentGameobject = branchLoopTransform.gameObject;
manager.CreateHeaderUIField(parentTransform, "Branch Path Multi Sim");
manager.CreateBoolInputField(parentTransform, "Use Branch Path Multi Sim", properties.BranchPathMultiSimulationProperties.UseBranchPathMultiSim, SetUseBranchPathMultiSim);
manager.CreateBoolInputField(parentTransform, ("Use Branch Path Multi Sim", BranchPathMultiSimulationProperties.UseBranchPathMultiSimTooltip), properties.BranchPathMultiSimulationProperties.UseBranchPathMultiSim, SetUseBranchPathMultiSim);
branchLoopTransform.SetAsLastSibling();
manager.CreateIntInputField(branchLoopTransform, "Simulation Count", new IntParameter(properties.BranchPathMultiSimulationProperties.SimulationCount, 1, 10, 1), SetSimulationCount);
manager.CreateFloatInputField(branchLoopTransform, "Length Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.LengthWeightScale, 0f, 2f, 0f), SetLengthScale);
manager.CreateFloatInputField(branchLoopTransform, "Norm. Length Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.NormalizedLengthWeightScale, 0f, 2f, 0f), SetNormalizedLengthScale);
manager.CreateIntInputField(branchLoopTransform, ("Simulation Count", BranchPathMultiSimulationProperties.SimulationCountTooltip), new IntParameter(properties.BranchPathMultiSimulationProperties.SimulationCount, 1, 10, 1), SetSimulationCount);
manager.CreateFloatInputField(branchLoopTransform, ("Length Weight Scale", BranchPathMultiSimulationProperties.LengthWeightScaleTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.LengthWeightScale, 0f, 2f, 0f), SetLengthScale);
manager.CreateFloatInputField(branchLoopTransform, ("Norm. Length Weight Scale", BranchPathMultiSimulationProperties.NormalizedLengthWeightScaleTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.NormalizedLengthWeightScale, 0f, 2f, 0f), SetNormalizedLengthScale);
manager.CreateSpaceUIField(branchLoopTransform);
manager.CreateTextUIField(branchLoopTransform, "Same Path Connect");
manager.CreateFloatInputField(branchLoopTransform, "Base Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.SamePathBaseWeightScale, 0f, 2f, 0f), SamePathBaseConnectScale);
manager.CreateFloatInputField(branchLoopTransform, "Depth Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.SamePathDepthWeightScale, 0f, 2f, 0f), SamePathConnectDepthScale);
manager.CreateFloatInputField(branchLoopTransform, "Norm. Depth Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.SamePathNormalizedDepthWeightScale, 0f, 2f, 0f), SamePathConnectNormalizedDepthScale);
manager.CreateTextUIField(branchLoopTransform, ("Same Path Connect", "Weight scale for branch paths that start from a main path and connect later to the same main path."));
manager.CreateFloatInputField(branchLoopTransform, ("Base Weight Scale", BranchPathMultiSimulationProperties.SamePathBaseWeightScaleTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.SamePathBaseWeightScale, 0f, 2f, 0f), SamePathBaseConnectScale);
manager.CreateFloatInputField(branchLoopTransform, ("Depth Weight Scale", BranchPathMultiSimulationProperties.SamePathDepthWeightScaleTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.SamePathDepthWeightScale, 0f, 2f, 0f), SamePathConnectDepthScale);
manager.CreateFloatInputField(branchLoopTransform, ("Norm. Depth Weight Scale", BranchPathMultiSimulationProperties.SamePathNormalizedDepthWeightTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.SamePathNormalizedDepthWeightScale, 0f, 2f, 0f), SamePathConnectNormalizedDepthScale);
manager.CreateSpaceUIField(branchLoopTransform);
manager.CreateTextUIField(branchLoopTransform, "Diff Path Connect");
manager.CreateFloatInputField(branchLoopTransform, "Base Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.DiffPathBaseWeightScale, 0f, 2f, 0f), DiffPathBaseConnectScale);
manager.CreateFloatInputField(branchLoopTransform, "Depth Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.DiffPathDepthWeightScale, 0f, 2f, 0f), DiffPathConnectDepthScale);
manager.CreateFloatInputField(branchLoopTransform, "Norm. Depth Weight Scale", new FloatParameter(properties.BranchPathMultiSimulationProperties.DiffPathNormalizedDepthWeightScale, 0f, 2f, 0f), DiffPathConnectNormalizedDepthScale);
manager.CreateTextUIField(branchLoopTransform, ("Diff Path Connect", "Weight scale for branch paths that start from a main path and connect later to a different main path."));
manager.CreateFloatInputField(branchLoopTransform, ("Base Weight Scale", BranchPathMultiSimulationProperties.DiffPathBaseWeightScaleTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.DiffPathBaseWeightScale, 0f, 2f, 0f), DiffPathBaseConnectScale);
manager.CreateFloatInputField(branchLoopTransform, ("Depth Weight Scale", BranchPathMultiSimulationProperties.DiffPathDepthWeightScaleTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.DiffPathDepthWeightScale, 0f, 2f, 0f), DiffPathConnectDepthScale);
manager.CreateFloatInputField(branchLoopTransform, ("Norm. Depth Weight Scale", BranchPathMultiSimulationProperties.DiffPathNormalizedDepthWeightTooltip), new FloatParameter(properties.BranchPathMultiSimulationProperties.DiffPathNormalizedDepthWeightScale, 0f, 2f, 0f), DiffPathConnectNormalizedDepthScale);
manager.CreateSpaceUIField(branchLoopTransform);
manager.CreateHeaderUIField(parentTransform, "Miscellaneous");
var maxShadowTransform = manager.CreateVerticalLayoutUIField(parentTransform);
maxShadowsParentGameobject = maxShadowTransform.gameObject;
manager.CreateBoolInputField(parentTransform, "Use Max Shadows Request", properties.MiscellaneousProperties.UseMaxShadowsRequestUpdate, SetUseMaxShadows);
manager.CreateIntInputField(maxShadowTransform, "Shadows Request Amount", new IntParameter(properties.MiscellaneousProperties.MaxShadowsRequestCount, 4, 20, 4), SetMaxShadowsCount);
manager.CreateBoolInputField(parentTransform, ("Use Max Shadows Request", MiscellaneousProperties.UseMaxShadowsRequestUpdateTooltip), properties.MiscellaneousProperties.UseMaxShadowsRequestUpdate, SetUseMaxShadows);
manager.CreateIntInputField(maxShadowTransform, ("Shadows Request Amount", MiscellaneousProperties.MaxShadowsRequestCountTooltip), new IntParameter(properties.MiscellaneousProperties.MaxShadowsRequestCount, 4, 20, 4), SetMaxShadowsCount);
maxShadowTransform.SetAsLastSibling();
manager.CreateBoolInputField(parentTransform, "Use Doorway Sisters", properties.MiscellaneousProperties.UseDoorwaySisters, SetUseDoorwaySisters);
manager.CreateBoolInputField(parentTransform, "Use Random Guaranteed Scrap", properties.MiscellaneousProperties.UseRandomGuaranteedScrapSpawn, SetUseRandomGuaranteedScrap);
manager.CreateBoolInputField(parentTransform, ("Use Doorway Sisters", MiscellaneousProperties.UseDoorwaySistersTooltip), properties.MiscellaneousProperties.UseDoorwaySisters, SetUseDoorwaySisters);
manager.CreateBoolInputField(parentTransform, ("Use Random Guaranteed Scrap", MiscellaneousProperties.UseRandomGuaranteedScrapSpawnTooltip), properties.MiscellaneousProperties.UseRandomGuaranteedScrapSpawn, SetUseRandomGuaranteedScrap);
manager.CreateSpaceUIField(parentTransform);
mainPathParentGameobject.SetActive(properties.MainPathProperties.MainPathCount > 1);
@ -288,6 +290,8 @@ namespace DunGenPlus.DevTools.Panels {
public void RestoreOriginalState(){
selectedExtenderer.Properties.CopyFrom(selectedAssetCache.originalProperties);
ClearPanel();
SetupPanel();
}
}

View File

@ -22,6 +22,8 @@ namespace DunGenPlus.DevTools.Panels {
internal ExtendedLevel[] levels;
internal IEnumerable<string> levelOptions;
private GameObject asyncParentGameobject;
public override void AwakeCall(){
Instance = this;
@ -32,21 +34,26 @@ namespace DunGenPlus.DevTools.Panels {
manager.CreateHeaderUIField(parentTransform, "Dungeon Generator");
seedInputField = manager.CreateIntInputField(parentTransform, "Seed", gen.Seed, SetSeed);
manager.CreateBoolInputField(parentTransform, "Randomize Seed", gen.ShouldRandomizeSeed, SetRandomSeed);
manager.CreateBoolInputField(parentTransform, ("Randomize Seed", "If true, creates and saves a new seed when generating the dungeon."), gen.ShouldRandomizeSeed, SetRandomSeed);
manager.CreateSpaceUIField(parentTransform);
manager.CreateIntInputField(parentTransform, "Max Attempts", new IntParameter(gen.MaxAttemptCount, 0, 500, 0), SetMaxAttempts);
manager.CreateIntInputField(parentTransform, ("Max Attempts", "Maximum number of dungeon generation attempts before giving up."), new IntParameter(gen.MaxAttemptCount, 0, 500, 0), SetMaxAttempts);
manager.CreateSpaceUIField(parentTransform);
manager.CreateBoolInputField(parentTransform, "Generate Async", gen.GenerateAsynchronously, SetGenerateAsync);
manager.CreateFloatInputField(parentTransform, "Max Async (ms)", new FloatParameter(gen.MaxAsyncFrameMilliseconds, 0f, float.MaxValue), SetMaxAsync);
manager.CreateFloatInputField(parentTransform, "Pause Between Rooms", new FloatParameter(gen.PauseBetweenRooms, 0f, float.MaxValue), SetPauseBetweenRooms);
var asyncTransform = manager.CreateVerticalLayoutUIField(parentTransform);
asyncParentGameobject = asyncTransform.gameObject;
manager.CreateBoolInputField(parentTransform, ("Generate Async", "If true, visually generates the dungeon tile by tile."), gen.GenerateAsynchronously, SetGenerateAsync);
manager.CreateFloatInputField(asyncTransform, "Max Async (ms)", new FloatParameter(gen.MaxAsyncFrameMilliseconds, 0f, float.MaxValue), SetMaxAsync);
manager.CreateFloatInputField(asyncTransform, "Pause Between Rooms", new FloatParameter(gen.PauseBetweenRooms, 0f, float.MaxValue), SetPauseBetweenRooms);
asyncTransform.SetAsLastSibling();
manager.CreateSpaceUIField(parentTransform);
manager.CreateHeaderUIField(parentTransform, "Levels");
manager.CreateLevelOptionsUIField(parentTransform, "Level", 0, SetLevel);
lengthMultiplierField = manager.CreateTextUIField(parentTransform, "Length Multiplier");
lengthMultiplierField = manager.CreateTextUIField(parentTransform, ("Length Multiplier", "Dungeon size multiplier based on the level."));
SetLevel(levels[0]);
asyncParentGameobject.SetActive(gen.GenerateAsynchronously);
}
public void SetSeed(int value) {
@ -63,6 +70,7 @@ namespace DunGenPlus.DevTools.Panels {
public void SetGenerateAsync(bool state) {
dungeon.Generator.GenerateAsynchronously = state;
asyncParentGameobject.SetActive(state);
}
public void SetMaxAsync(float value) {

View File

@ -41,8 +41,8 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
var entry = (NodeArchetype)list[index];
DevDebugManager.Instance.CreateStringInputField(parentTransform, new TitleParameter("Label", layoutOffset), entry.label, (t) => entry.label = t);
DevDebugManager.Instance.CreateListUIField(parentTransform, new TitleParameter("Archetypes", layoutOffset), entry.archetypes);
DevDebugManager.Instance.CreateStringInputField(parentTransform, new TitleParameter("Label", NodeArchetype.LabelTooltip, layoutOffset), entry.Label, (t) => entry.Label = t);
DevDebugManager.Instance.CreateListUIField(parentTransform, new TitleParameter("Archetypes", NodeArchetype.ArchetypesTooltip, layoutOffset), entry.Archetypes);
}
}
@ -55,12 +55,12 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
var entry = (ForcedTileSetList)list[index];
DevDebugManager.Instance.CreateFloatInputField(parentTransform, new TitleParameter("Main Path Weight", layoutOffset), entry.MainPathWeight, (t) => entry.MainPathWeight = t);
DevDebugManager.Instance.CreateFloatInputField(parentTransform, new TitleParameter("Branch Path Weight", layoutOffset), entry.BranchPathWeight, (t) => entry.BranchPathWeight = t);
DevDebugManager.Instance.CreateFloatInputField(parentTransform, new TitleParameter("Main Path Weight", ForcedTileSetList.MainPathWeightTooltip, layoutOffset), entry.MainPathWeight, (t) => entry.MainPathWeight = t);
DevDebugManager.Instance.CreateFloatInputField(parentTransform, new TitleParameter("Branch Path Weight", ForcedTileSetList.BranchPathWeightTooltip, layoutOffset), entry.BranchPathWeight, (t) => entry.BranchPathWeight = t);
// depth is weird cause we have to account for every entry's unique depth curve, even if they don't have one
DevDebugManager.Instance.CreateAnimationCurveOptionsUIField(parentTransform, new TitleParameter("Depth Weight Scale", layoutOffset), entry.DepthWeightScale, (t) => entry.DepthWeightScale = t);
DevDebugManager.Instance.CreateListUIField(parentTransform, new TitleParameter("Tile Sets", layoutOffset), entry.Tilesets);
DevDebugManager.Instance.CreateAnimationCurveOptionsUIField(parentTransform, new TitleParameter("Depth Weight Scale", ForcedTileSetList.DepthWeightScaleTooltip, layoutOffset), entry.DepthWeightScale, (t) => entry.DepthWeightScale = t);
DevDebugManager.Instance.CreateListUIField(parentTransform, new TitleParameter("Tile Sets", ForcedTileSetList.TileSetsTooltip, layoutOffset), entry.TileSets);
}
}

View File

@ -23,7 +23,7 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
}
public static implicit operator TitleParameter(string text) => new TitleParameter(text);
public static implicit operator TitleParameter((string text, string hoverText) pair) => new TitleParameter(pair.text, pair.hoverText);
}
internal struct IntParameter {

View File

@ -17,7 +17,7 @@ namespace DunGenPlus.DevTools.UIElements
public void SetupDropdown<T>(TitleParameter titleParameter, int baseValue, Action<T> setAction, Func<int, T> convertIndex, IEnumerable<string> options) {
SetupBase(titleParameter);
var maxLength = (int)Mathf.LerpUnclamped(24f, 20f, layoutOffset / 24f);
var maxLength = (int)Mathf.LerpUnclamped(28f, 24f, layoutOffset / 24f);
dropDown.options = options.Select(c => {
return new TMP_Dropdown.OptionData(c.Substring(0, Math.Min(maxLength, c.Length)));
}).ToList();

View File

@ -146,6 +146,7 @@
<Compile Include="Components\MainRoomDoorwayGroups.cs" />
<Compile Include="Components\Props\SpawnSyncedObjectCycle.cs" />
<Compile Include="Components\Scrap\RandomGuaranteedScrapSpawn.cs" />
<Compile Include="PluginConfig.cs" />
<Compile Include="DevTools\DevDebugManager.cs" />
<Compile Include="DevTools\DevDebugManagerUI.cs" />
<Compile Include="DevTools\DevDebugOpen.cs" />

View File

@ -29,7 +29,7 @@ namespace DunGenPlus.Generation {
// try every tile, if we somehow fail than man that sucks
foreach(var pair in allTiles){
var t = pair.t;
var tileProxy = gen.AddTile(t, item.Tilesets, t.Placement.NormalizedDepth, null, TilePlacementResult.None);
var tileProxy = gen.AddTile(t, item.TileSets, t.Placement.NormalizedDepth, null, TilePlacementResult.None);
if (tileProxy == null) continue;
tileProxy.Placement.BranchDepth = t.Placement.BranchDepth;

View File

@ -18,7 +18,9 @@ namespace DunGenPlus.Patches {
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "Awake")]
public static void AwakePatch(){
var devDebug = new GameObject("DevDebugOpen", typeof(DevDebugOpen));
if (PluginConfig.EnableDevDebugTools.Value){
var devDebug = new GameObject("DevDebugOpen", typeof(DevDebugOpen));
}
}
[HarmonyPrefix]

View File

@ -25,7 +25,7 @@ namespace DunGenPlus {
internal const string modGUID = "dev.ladyalice.dungenplus";
private const string modName = "Dungeon Generation Plus";
private const string modVersion = "1.0.6";
private const string modVersion = "1.1.0";
internal readonly Harmony Harmony = new Harmony(modGUID);
@ -41,6 +41,8 @@ namespace DunGenPlus {
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
logger.LogInfo($"Plugin {modName} has been added!");
PluginConfig.SetupConfig(Config);
Harmony.PatchAll(typeof(DungeonGeneratorPatch));
Harmony.PatchAll(typeof(DoorwayConnectionPatch));
Harmony.PatchAll(typeof(RoundManagerPatch));

View File

@ -0,0 +1,18 @@
using BepInEx.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DunGenPlus {
internal class PluginConfig {
public static ConfigEntry<bool> EnableDevDebugTools;
public static void SetupConfig(ConfigFile cfg) {
EnableDevDebugTools = cfg.Bind(new ConfigDefinition("Dev", "Enable Dev Debug Tools"), false, new ConfigDescription("If enabled, allows the dev debug tools to be usable in the ship.\n\nPress M to activate."));
}
}
}

Binary file not shown.