Fixes to DevDebug for AdditionalTiles and MainPathExtender
Changed entry to DevDebug mode to LeftAlt + M
This commit is contained in:
parent
d955f6e930
commit
cd9b233040
|
@ -15,7 +15,7 @@ namespace DunGenPlus.Collections {
|
|||
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.";
|
||||
internal const string MainPathDetailsTooltip = "Tooltip";
|
||||
internal const string MainPathDetailsTooltip = "Overrides certain DungeonFlow values during the main path generation.\n\nThe order of items in this list correspond to the order of the main paths being generated.\nThe first item in this list will activate for the first main path, the second item for the second main path, and so on. If there are more main paths than items in this list, the last item is used instead.";
|
||||
|
||||
|
||||
[Tooltip(MainPathCountTooltip)]
|
||||
|
@ -184,8 +184,8 @@ namespace DunGenPlus.Collections {
|
|||
[System.Serializable]
|
||||
public class AdditionalTilesProperties {
|
||||
|
||||
internal const string UseAdditionalTilesTooltip = "If enabled, attempts to forcefully spawn tiles from ForcedTileSets after branching paths are generated.";
|
||||
internal const string AdditionalTileSetsTooltip = "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.";
|
||||
internal const string UseAdditionalTilesTooltip = "If enabled, attempts to generate additional tiles from AdditionalTileSets after main and branching paths are generated.";
|
||||
internal const string AdditionalTileSetsTooltip = "The list of tiles that will be attempted to generate. Each entry will spawn only one tile from it's list.\n\nEven if the tile cannot be generated, the dungeon generation will not restart.";
|
||||
|
||||
[Tooltip(UseAdditionalTilesTooltip)]
|
||||
public bool UseAdditionalTiles = false;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace DunGenPlus.Collections {
|
|||
[System.Serializable]
|
||||
public class AdditionalTileSetList {
|
||||
|
||||
internal const string TileSetsTooltip = "List of tiles to be forcefully spawned.";
|
||||
internal const string TileSetsTooltip = "List of tiles to be generated.";
|
||||
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.";
|
||||
|
|
|
@ -138,6 +138,11 @@ namespace DunGenPlus.DevTools {
|
|||
return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => mainPanel.levels[i], mainPanel.levelOptions);
|
||||
}
|
||||
|
||||
public DropdownInputField CreateMainPathExtenderUIField(Transform parentTransform, TitleParameter titleParameter, int baseValue, Action<MainPathExtender> setAction){
|
||||
var assetCache = DevDebugManager.Instance.selectedAssetCache;
|
||||
return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => assetCache.mainPathExtenders.list[i].Item, assetCache.mainPathExtenders.options);
|
||||
}
|
||||
|
||||
public DropdownInputField CreateTileOptionsUIField(Transform parentTransform, TitleParameter titleParameter, int baseValue, Action<GameObject> setAction){
|
||||
var assetCache = DevDebugManager.Instance.selectedAssetCache;
|
||||
return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => assetCache.tiles.list[i].Item, assetCache.tiles.options);
|
||||
|
|
|
@ -20,15 +20,13 @@ namespace DunGenPlus.DevTools {
|
|||
}
|
||||
|
||||
public void Update(){
|
||||
if (IfKeyPress(Keyboard.current.mKey) && DevDebugManager.Instance == null && IsSinglePlayerInShip()){
|
||||
if (IfKeyPress(Keyboard.current.mKey, Keyboard.current.leftAltKey) && DevDebugManager.Instance == null && IsSinglePlayerInShip()){
|
||||
Instantiate(Assets.DevDebugPrefab);
|
||||
}
|
||||
}
|
||||
|
||||
bool IfKeyPress(params KeyControl[] keys){
|
||||
foreach(var k in keys){
|
||||
if (k.wasPressedThisFrame) return true;
|
||||
}
|
||||
bool IfKeyPress(KeyControl key, KeyControl hold){
|
||||
if (hold.isPressed && key.wasPressedThisFrame) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace DunGenPlus.DevTools.Panels.Collections {
|
|||
public readonly Collection<NullObject<TileSet>> tileSets;
|
||||
public readonly Collection<NullObject<GameObject>> tiles;
|
||||
public readonly Collection<NullObject<DungeonArchetype>> archetypes;
|
||||
public readonly Collection<NullObject<MainPathExtender>> mainPathExtenders;
|
||||
|
||||
public DungeonFlowCacheAssets(DungeonFlow dungeonFlow, DunGenExtender extender){
|
||||
if (extender){
|
||||
|
@ -45,6 +46,19 @@ namespace DunGenPlus.DevTools.Panels.Collections {
|
|||
var tileSetsHashSet = new HashSet<NullObject<TileSet>>() { new NullObject<TileSet>(null) };
|
||||
var tilesHashSet = new HashSet<NullObject<GameObject>>() { new NullObject<GameObject>(null) };
|
||||
var archetypesHashSet = new HashSet<NullObject<DungeonArchetype>>() { new NullObject<DungeonArchetype>(null) };
|
||||
var mainPathExtenderHashSet = new HashSet<NullObject<MainPathExtender>>() { new NullObject<MainPathExtender>(null) };
|
||||
|
||||
void AddNodes(IEnumerable<GraphNode> nodes){
|
||||
foreach(var n in nodes){
|
||||
AddTileSets(n.TileSets);
|
||||
}
|
||||
}
|
||||
|
||||
void AddLines(IEnumerable<GraphLine> lines){
|
||||
foreach(var n in lines){
|
||||
AddArchetypes(n.DungeonArchetypes);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTiles(IEnumerable<GameObject> tiles){
|
||||
foreach(var x in tiles) {
|
||||
|
@ -61,19 +75,29 @@ namespace DunGenPlus.DevTools.Panels.Collections {
|
|||
void AddTileSets(IEnumerable<TileSet> tileSets){
|
||||
foreach(var x in tileSets){
|
||||
tileSetsHashSet.Add(x);
|
||||
AddTilesW(x.TileWeights.Weights);
|
||||
if (x != null) AddTilesW(x.TileWeights.Weights);
|
||||
}
|
||||
}
|
||||
|
||||
void AddArchetypes(IEnumerable<DungeonArchetype> archetypes){
|
||||
foreach(var x in archetypes){
|
||||
archetypesHashSet.Add(x);
|
||||
AddTileSets(x.TileSets);
|
||||
if (x != null) AddTileSets(x.TileSets);
|
||||
}
|
||||
}
|
||||
|
||||
AddTileSets(dungeonFlow.Nodes.SelectMany(n => n.TileSets));
|
||||
AddArchetypes(dungeonFlow.Lines.SelectMany(l => l.DungeonArchetypes));
|
||||
void AddMainPathExtenders(IEnumerable<MainPathExtender> mainPaths){
|
||||
foreach(var x in mainPaths) {
|
||||
mainPathExtenderHashSet.Add(x);
|
||||
if (x != null) {
|
||||
AddNodes(x.Nodes.Value);
|
||||
AddLines(x.Lines.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AddNodes(dungeonFlow.Nodes);
|
||||
AddLines(dungeonFlow.Lines);
|
||||
AddTileSets(dungeonFlow.TileInjectionRules.Select(n => n.TileSet));
|
||||
|
||||
if (extender) {
|
||||
|
@ -83,11 +107,14 @@ namespace DunGenPlus.DevTools.Panels.Collections {
|
|||
AddTiles(extender.Properties.AssetCacheTileList);
|
||||
AddTileSets(extender.Properties.AssetCacheTileSetList);
|
||||
AddArchetypes(extender.Properties.AssetCacheArchetypeList);
|
||||
|
||||
AddMainPathExtenders(extender.Properties.MainPathProperties.MainPathDetails);
|
||||
}
|
||||
|
||||
tileSets = new Collection<NullObject<TileSet>>(tileSetsHashSet.ToList());
|
||||
tiles = new Collection<NullObject<GameObject>>(tilesHashSet.ToList());
|
||||
archetypes = new Collection<NullObject<DungeonArchetype>>(archetypesHashSet.ToList());
|
||||
mainPathExtenders = new Collection<NullObject<MainPathExtender>>(mainPathExtenderHashSet.ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ namespace DunGenPlus.DevTools.Panels {
|
|||
mainPathTransform.SetAsLastSibling();
|
||||
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.CreateListUIField(mainPathTransform, ("Main Path Details", MainPathProperties.MainPathDetailsTooltip), properties.MainPathProperties.MainPathDetails);
|
||||
manager.CreateSpaceUIField(parentTransform);
|
||||
|
||||
var dungeonBoundsTransform = manager.CreateVerticalLayoutUIField(parentTransform);
|
||||
|
|
|
@ -36,6 +36,16 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
|
|||
}
|
||||
}
|
||||
|
||||
internal class ListEntryMainPathExtender : ListEntryType {
|
||||
public override object CreateEmptyObject() => null;
|
||||
|
||||
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
|
||||
var entry = (MainPathExtender)list[index];
|
||||
var baseValue = DevDebugManager.Instance.selectedAssetCache.mainPathExtenders.dictionary[entry];
|
||||
DevDebugManager.Instance.CreateMainPathExtenderUIField(parentTransform, new TitleParameter("Main Path Extender", layoutOffset), baseValue, (t) => list[index] = t);
|
||||
}
|
||||
}
|
||||
|
||||
internal class ListEntryNodeArchetype : ListEntryType {
|
||||
public override object CreateEmptyObject() => new NodeArchetype();
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace DunGenPlus.DevTools.UIElements {
|
|||
{ typeof(AdditionalTileSetList), new ListEntryAdditionalTileSetList() },
|
||||
{ typeof(TileInjectionRule), new ListEntryTileInjectionRule() },
|
||||
{ typeof(GraphNode), new ListEntryGraphNode() },
|
||||
{ typeof(GraphLine), new ListEntryGraphLine() }
|
||||
{ typeof(GraphLine), new ListEntryGraphLine() },
|
||||
{ typeof(MainPathExtender), new ListEntryMainPathExtender() }
|
||||
};
|
||||
|
||||
public void SetupList<T>(TitleParameter titleParameter, List<T> list) {
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -70,15 +70,15 @@ namespace DunGenPlusEditor {
|
|||
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(ForcedTilesProperties))]
|
||||
[CustomPropertyDrawer(typeof(AdditionalTilesProperties))]
|
||||
public class ForcedTilesPropertiesPropertyDrawer : PropertyDrawer {
|
||||
|
||||
public override VisualElement CreatePropertyGUI(SerializedProperty property) {
|
||||
|
||||
var container = new VisualElement();
|
||||
|
||||
var box = PropertyDrawerUtility.CreateDropdown(property, "Forced Tiles");
|
||||
PropertyDrawerUtility.SetupItemsBoolProperty(box.container, property, "UseForcedTiles", "Disabled");
|
||||
var box = PropertyDrawerUtility.CreateDropdown(property, "Additional Tiles");
|
||||
PropertyDrawerUtility.SetupItemsBoolProperty(box.container, property, "UseAdditionalTiles", "Disabled");
|
||||
container.Add(box.parent);
|
||||
|
||||
return container;
|
||||
|
|
Loading…
Reference in New Issue