Added more debug messages
The last node of the alternate main paths will now end that main path DevDebugWindow: Added zoom in/out Add Assets panel BranchCapTileSets are added to the assets
This commit is contained in:
parent
cd9b233040
commit
4754677ae3
|
@ -47,6 +47,8 @@ namespace DunGenPlus.DevTools {
|
||||||
private Vector3 lastCameraPosition;
|
private Vector3 lastCameraPosition;
|
||||||
private Quaternion lastCameraRotation;
|
private Quaternion lastCameraRotation;
|
||||||
|
|
||||||
|
private Vector2 cameraYRange;
|
||||||
|
|
||||||
void Awake(){
|
void Awake(){
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
|
@ -66,6 +68,8 @@ namespace DunGenPlus.DevTools {
|
||||||
disabledGameObject = new GameObject("Disabled GOBJ");
|
disabledGameObject = new GameObject("Disabled GOBJ");
|
||||||
disabledGameObject.SetActive(false);
|
disabledGameObject.SetActive(false);
|
||||||
disabledGameObject.transform.SetParent(transform);
|
disabledGameObject.transform.SetParent(transform);
|
||||||
|
|
||||||
|
cameraYRange = new Vector2(devCamera.transform.position.y - 200f, devCamera.transform.position.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy(){
|
void OnDestroy(){
|
||||||
|
@ -92,6 +96,13 @@ namespace DunGenPlus.DevTools {
|
||||||
var movement = delta;
|
var movement = delta;
|
||||||
devCamera.transform.position += new Vector3(-movement.x, 0f, -movement.y);
|
devCamera.transform.position += new Vector3(-movement.x, 0f, -movement.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var scroll = Mouse.current.scroll.value.y;
|
||||||
|
if (scroll != 0f) {
|
||||||
|
var pos = devCamera.transform.position;
|
||||||
|
pos.y = Mathf.Clamp(pos.y + scroll * -0.05f, cameraYRange.x, cameraYRange.y);
|
||||||
|
devCamera.transform.position = pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenPanel(int index) {
|
public void OpenPanel(int index) {
|
||||||
|
@ -201,6 +212,7 @@ namespace DunGenPlus.DevTools {
|
||||||
private void UpdatePanels() {
|
private void UpdatePanels() {
|
||||||
DunFlowPanel.Instance?.UpdatePanel(true);
|
DunFlowPanel.Instance?.UpdatePanel(true);
|
||||||
DunGenPlusPanel.Instance?.UpdatePanel(true);
|
DunGenPlusPanel.Instance?.UpdatePanel(true);
|
||||||
|
AssetsPanel.Instance?.UpdatePanel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDungeonBounds(){
|
public void UpdateDungeonBounds(){
|
||||||
|
|
|
@ -118,10 +118,18 @@ namespace DunGenPlus.DevTools {
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ListUIElement CreateListUIField<T>(Transform parentTransform, TitleParameter titleParameter, List<T> list){
|
public ListUIElement CreateListUIField<T>(Transform parentTransform, TitleParameter titleParameter, List<T> list, bool useAddRemove = true){
|
||||||
|
return CreateListSimpleUIField(parentTransform, titleParameter, list, false, useAddRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListUIElement CreateListExtendedUIField<T>(Transform parentTransform, TitleParameter titleParameter, List<T> list, bool useAddRemove = true){
|
||||||
|
return CreateListSimpleUIField(parentTransform, titleParameter, list, true, useAddRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ListUIElement CreateListSimpleUIField<T>(Transform parentTransform, TitleParameter titleParameter, List<T> list, bool useExtended, bool useAddRemove){
|
||||||
var gameObject = Instantiate(listUIPrefab, parentTransform);
|
var gameObject = Instantiate(listUIPrefab, parentTransform);
|
||||||
var field = gameObject.GetComponent<ListUIElement>();
|
var field = gameObject.GetComponent<ListUIElement>();
|
||||||
field.SetupList(titleParameter, list);
|
field.SetupList(titleParameter, list, useExtended, useAddRemove);
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +168,7 @@ namespace DunGenPlus.DevTools {
|
||||||
|
|
||||||
public DropdownInputField CreateEnumOptionsUIField<T>(Transform parentTransform, TitleParameter titleParameter, int baseValue, Action<T> setAction) where T: Enum{
|
public DropdownInputField CreateEnumOptionsUIField<T>(Transform parentTransform, TitleParameter titleParameter, int baseValue, Action<T> setAction) where T: Enum{
|
||||||
var options = Enum.GetNames(typeof(T));
|
var options = Enum.GetNames(typeof(T));
|
||||||
return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => (T)(object)i, options);
|
return CreateOptionsUIField(parentTransform, titleParameter, baseValue, setAction, (i) => (T)Enum.ToObject(typeof(T), i), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DropdownInputField CreateAnimationCurveOptionsUIField(Transform parentTransform, TitleParameter titleParameter, AnimationCurve baseValue, Action<AnimationCurve> setAction){
|
public DropdownInputField CreateAnimationCurveOptionsUIField(Transform parentTransform, TitleParameter titleParameter, AnimationCurve baseValue, Action<AnimationCurve> setAction){
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
using DunGen;
|
||||||
|
using DunGenPlus.Collections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DunGenPlus.DevTools.Panels
|
||||||
|
{
|
||||||
|
internal class AssetsPanel : BasePanel {
|
||||||
|
|
||||||
|
public static AssetsPanel Instance { get; internal set; }
|
||||||
|
|
||||||
|
public override void AwakeCall() {
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetPanelVisibility(bool visible){
|
||||||
|
base.SetPanelVisibility(visible);
|
||||||
|
if (visible) UpdatePanel(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdatePanel(bool refreshPanel){
|
||||||
|
if (refreshPanel) {
|
||||||
|
ClearPanel();
|
||||||
|
SetupPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupPanel(){
|
||||||
|
var parentTransform = mainGameObject.transform;
|
||||||
|
manager.CreateListExtendedUIField(parentTransform, "Archetypes", selectedAssetCache.archetypes.list.Select(t => t.Item).Where(t => t != null).ToList(), false);
|
||||||
|
manager.CreateSpaceUIField(parentTransform);
|
||||||
|
|
||||||
|
manager.CreateListExtendedUIField(parentTransform, "Tilesets", selectedAssetCache.tileSets.list.Select(t => t.Item).Where(t => t != null).ToList(), false);
|
||||||
|
manager.CreateSpaceUIField(parentTransform);
|
||||||
|
|
||||||
|
manager.CreateListExtendedUIField(parentTransform, "Tiles", selectedAssetCache.tiles.list.Select(t => t.Item).Where(t => t != null).ToList(), false);
|
||||||
|
manager.CreateSpaceUIField(parentTransform);
|
||||||
|
|
||||||
|
manager.CreateListExtendedUIField(parentTransform, "Main Paths", selectedAssetCache.mainPathExtenders.list.Select(t => t.Item).Where(t => t != null).ToList(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearPanel(){
|
||||||
|
manager.ClearTransformChildren(mainGameObject.transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -82,7 +82,10 @@ namespace DunGenPlus.DevTools.Panels.Collections {
|
||||||
void AddArchetypes(IEnumerable<DungeonArchetype> archetypes){
|
void AddArchetypes(IEnumerable<DungeonArchetype> archetypes){
|
||||||
foreach(var x in archetypes){
|
foreach(var x in archetypes){
|
||||||
archetypesHashSet.Add(x);
|
archetypesHashSet.Add(x);
|
||||||
if (x != null) AddTileSets(x.TileSets);
|
if (x != null) {
|
||||||
|
AddTileSets(x.TileSets);
|
||||||
|
AddTileSets(x.BranchCapTileSets);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static UnityEngine.Rendering.DebugUI;
|
|
||||||
|
|
||||||
namespace DunGenPlus.DevTools.Panels {
|
namespace DunGenPlus.DevTools.Panels {
|
||||||
internal class DunFlowPanel : BasePanel {
|
internal class DunFlowPanel : BasePanel {
|
||||||
|
@ -15,7 +14,6 @@ namespace DunGenPlus.DevTools.Panels {
|
||||||
|
|
||||||
public override void AwakeCall(){
|
public override void AwakeCall(){
|
||||||
Instance = this;
|
Instance = this;
|
||||||
Plugin.logger.LogInfo("AwakeCall");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using DunGenPlus.DevTools.UIElements;
|
|
||||||
using DunGenPlus.DevTools.UIElements.Collections;
|
using DunGenPlus.DevTools.UIElements.Collections;
|
||||||
using DunGenPlus.DevTools.Panels.Collections;
|
|
||||||
using static UnityEngine.Rendering.DebugUI;
|
|
||||||
|
|
||||||
namespace DunGenPlus.DevTools.Panels {
|
namespace DunGenPlus.DevTools.Panels {
|
||||||
internal class DunGenPlusPanel : BasePanel {
|
internal class DunGenPlusPanel : BasePanel {
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
|
||||||
internal abstract class ListEntryType {
|
internal abstract class ListEntryType {
|
||||||
public abstract object CreateEmptyObject();
|
public abstract object CreateEmptyObject();
|
||||||
public abstract void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset);
|
public abstract void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset);
|
||||||
|
|
||||||
|
public virtual bool UseCustomElementText() => false;
|
||||||
|
|
||||||
|
public virtual string GetCustomElementText(IList list, int index) => string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ListEntryDungeonArchetype : ListEntryType {
|
internal class ListEntryDungeonArchetype : ListEntryType {
|
||||||
|
@ -26,6 +31,32 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class ListEntryDungeonArchetypeExtended : ListEntryType {
|
||||||
|
public override object CreateEmptyObject() => null;
|
||||||
|
|
||||||
|
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
|
||||||
|
var entry = (DungeonArchetype)list[index];
|
||||||
|
DevDebugManager.Instance.CreateListUIField(parentTransform, "Tile Sets", entry.TileSets);
|
||||||
|
DevDebugManager.Instance.CreateEnumOptionsUIField<BranchCapType>(parentTransform, "Branch Cap Type", (int)entry.BranchCapType, (t) => entry.BranchCapType = t);
|
||||||
|
DevDebugManager.Instance.CreateListUIField(parentTransform, "Branch Cap Tile Sets", entry.BranchCapTileSets);
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateIntRangeInputField(parentTransform, "Branch Count", entry.BranchCount, (t) => entry.BranchCount = t);
|
||||||
|
DevDebugManager.Instance.CreateIntRangeInputField(parentTransform, "Branching Depth", entry.BranchingDepth, (t) => entry.BranchingDepth = t);
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Straigten Chance", new FloatParameter(entry.StraightenChance, 0f, 1f), (t) => entry.StraightenChance = t);
|
||||||
|
DevDebugManager.Instance.CreateBoolInputField(parentTransform, "Unique", entry.Unique, (t) => entry.Unique = t);
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateSpaceUIField(parentTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool UseCustomElementText() => true;
|
||||||
|
|
||||||
|
public override string GetCustomElementText(IList list, int index) {
|
||||||
|
var entry = (DungeonArchetype)list[index];
|
||||||
|
return entry.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal class ListEntryTileSet : ListEntryType {
|
internal class ListEntryTileSet : ListEntryType {
|
||||||
public override object CreateEmptyObject() => null;
|
public override object CreateEmptyObject() => null;
|
||||||
|
|
||||||
|
@ -36,6 +67,67 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class ListEntryTileExtended : ListEntryType {
|
||||||
|
public override object CreateEmptyObject() => null;
|
||||||
|
|
||||||
|
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
|
||||||
|
var entry = (GameObject)list[index];
|
||||||
|
var tile = entry.GetComponent<Tile>();
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateEnumOptionsUIField<TileRepeatMode>(parentTransform, "Repeat Mode", (int)tile.RepeatMode, (t) => tile.RepeatMode = t);
|
||||||
|
DevDebugManager.Instance.CreateBoolInputField(parentTransform, "Allow Imm. Repeats", tile.allowImmediateRepeats, (t) => tile.allowImmediateRepeats = t);
|
||||||
|
DevDebugManager.Instance.CreateBoolInputField(parentTransform, "Allow Rotation", tile.AllowRotation, (t) => tile.AllowRotation = t);
|
||||||
|
DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Connection Chance", new FloatParameter(tile.ConnectionChance, 0f, 1f), (t) => tile.ConnectionChance = t);
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateSpaceUIField(parentTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool UseCustomElementText() => true;
|
||||||
|
|
||||||
|
public override string GetCustomElementText(IList list, int index) {
|
||||||
|
var entry = (GameObject)list[index];
|
||||||
|
return entry.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class ListEntryTileSetExtended : ListEntryType {
|
||||||
|
public override object CreateEmptyObject() => null;
|
||||||
|
|
||||||
|
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
|
||||||
|
var entry = (TileSet)list[index];
|
||||||
|
var weights = entry.TileWeights.Weights;
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateListUIField(parentTransform, "Weights", weights);
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateSpaceUIField(parentTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool UseCustomElementText() => true;
|
||||||
|
|
||||||
|
public override string GetCustomElementText(IList list, int index) {
|
||||||
|
var entry = (TileSet)list[index];
|
||||||
|
return entry.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class ListEntryGameObjectChance : ListEntryType {
|
||||||
|
public override object CreateEmptyObject() {
|
||||||
|
var item = new GameObjectChance();
|
||||||
|
item.TileSet = null;
|
||||||
|
item.DepthWeightScale = null;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
|
||||||
|
var entry = (GameObjectChance)list[index];
|
||||||
|
|
||||||
|
DevDebugManager.Instance.CreateTileOptionsUIField(parentTransform, "Tile", DevDebugManager.Instance.selectedAssetCache.tiles.dictionary[entry.Value], (t) => entry.Value = t);
|
||||||
|
DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Main Path Weight", entry.MainPathWeight, (t) => entry.MainPathWeight = t);
|
||||||
|
DevDebugManager.Instance.CreateFloatInputField(parentTransform, "Branch Path Weight", entry.BranchPathWeight, (t) => entry.BranchPathWeight = t);
|
||||||
|
DevDebugManager.Instance.CreateAnimationCurveOptionsUIField(parentTransform, "Depth Weight Scale", entry.DepthWeightScale, (t) => entry.DepthWeightScale = t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal class ListEntryMainPathExtender : ListEntryType {
|
internal class ListEntryMainPathExtender : ListEntryType {
|
||||||
public override object CreateEmptyObject() => null;
|
public override object CreateEmptyObject() => null;
|
||||||
|
|
||||||
|
@ -46,6 +138,48 @@ namespace DunGenPlus.DevTools.UIElements.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class ListEntryMainPathExtenderExtended : ListEntryType {
|
||||||
|
public override object CreateEmptyObject() => null;
|
||||||
|
|
||||||
|
public override void CreateEntry(IList list, int index, Transform parentTransform, float layoutOffset) {
|
||||||
|
var entry = (MainPathExtender)list[index];
|
||||||
|
|
||||||
|
Transform CreateOverrideTransform<T>(PropertyOverride<T> property, string title){
|
||||||
|
var transform = DevDebugManager.Instance.CreateVerticalLayoutUIField(parentTransform);
|
||||||
|
DevDebugManager.Instance.CreateBoolInputField(parentTransform, new TitleParameter(title, layoutOffset), property.Override, (t) => {
|
||||||
|
property.Override = t;
|
||||||
|
transform.gameObject.SetActive(t);
|
||||||
|
});
|
||||||
|
transform.SetAsLastSibling();
|
||||||
|
return transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
var branchModeTransform = CreateOverrideTransform(entry.BranchMode, "Branch Mode Override");
|
||||||
|
DevDebugManager.Instance.CreateEnumOptionsUIField<BranchMode>(branchModeTransform, new TitleParameter("Branch Mode", layoutOffset), (int)entry.BranchMode.Value, (t) => entry.BranchMode.Value = t);
|
||||||
|
|
||||||
|
var branchCodeTransform = CreateOverrideTransform(entry.BranchCount, "Branch Count Override");
|
||||||
|
DevDebugManager.Instance.CreateIntRangeInputField(branchCodeTransform, new TitleParameter("Branch Code", layoutOffset), entry.BranchCount.Value, (t) => entry.BranchCount.Value = t);
|
||||||
|
|
||||||
|
var lengthTransform = CreateOverrideTransform(entry.Length, "Length Override");
|
||||||
|
DevDebugManager.Instance.CreateIntRangeInputField(lengthTransform, new TitleParameter("Length", layoutOffset), entry.Length.Value, (t) => entry.Length.Value = t);
|
||||||
|
|
||||||
|
var nodesTransform = CreateOverrideTransform(entry.Nodes, "Nodes Override");
|
||||||
|
DevDebugManager.Instance.CreateListUIField(nodesTransform, new TitleParameter("Nodes", layoutOffset), entry.Nodes.Value);
|
||||||
|
|
||||||
|
var linesTransform = CreateOverrideTransform(entry.Lines, "Lines Override");
|
||||||
|
DevDebugManager.Instance.CreateListUIField(linesTransform, new TitleParameter("Lines", layoutOffset), entry.Lines.Value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool UseCustomElementText() => true;
|
||||||
|
|
||||||
|
public override string GetCustomElementText(IList list, int index) {
|
||||||
|
var entry = (MainPathExtender)list[index];
|
||||||
|
return entry.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
internal class ListEntryNodeArchetype : ListEntryType {
|
internal class ListEntryNodeArchetype : ListEntryType {
|
||||||
public override object CreateEmptyObject() => new NodeArchetype();
|
public override object CreateEmptyObject() => new NodeArchetype();
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,11 @@ namespace DunGenPlus.DevTools.UIElements {
|
||||||
|
|
||||||
public GameObject templatePrefab;
|
public GameObject templatePrefab;
|
||||||
public Transform listTransform;
|
public Transform listTransform;
|
||||||
|
public GameObject buttonsGameObject;
|
||||||
|
|
||||||
internal IList list;
|
internal IList list;
|
||||||
internal Type listType;
|
internal Type listType;
|
||||||
|
internal bool useExtended;
|
||||||
|
|
||||||
public static readonly Dictionary<Type, ListEntryType> typeDictionary = new Dictionary<Type, ListEntryType>() {
|
public static readonly Dictionary<Type, ListEntryType> typeDictionary = new Dictionary<Type, ListEntryType>() {
|
||||||
{ typeof(DungeonArchetype), new ListEntryDungeonArchetype() },
|
{ typeof(DungeonArchetype), new ListEntryDungeonArchetype() },
|
||||||
|
@ -31,10 +33,20 @@ namespace DunGenPlus.DevTools.UIElements {
|
||||||
{ typeof(TileInjectionRule), new ListEntryTileInjectionRule() },
|
{ typeof(TileInjectionRule), new ListEntryTileInjectionRule() },
|
||||||
{ typeof(GraphNode), new ListEntryGraphNode() },
|
{ typeof(GraphNode), new ListEntryGraphNode() },
|
||||||
{ typeof(GraphLine), new ListEntryGraphLine() },
|
{ typeof(GraphLine), new ListEntryGraphLine() },
|
||||||
|
{ typeof(GameObjectChance), new ListEntryGameObjectChance() },
|
||||||
{ typeof(MainPathExtender), new ListEntryMainPathExtender() }
|
{ typeof(MainPathExtender), new ListEntryMainPathExtender() }
|
||||||
};
|
};
|
||||||
|
|
||||||
public void SetupList<T>(TitleParameter titleParameter, List<T> list) {
|
public static readonly Dictionary<Type, ListEntryType> typeExtendedDictionary = new Dictionary<Type, ListEntryType>() {
|
||||||
|
{ typeof(DungeonArchetype), new ListEntryDungeonArchetypeExtended() },
|
||||||
|
{ typeof(TileSet), new ListEntryTileSetExtended() },
|
||||||
|
{ typeof(GameObject), new ListEntryTileExtended() },
|
||||||
|
{ typeof(MainPathExtender), new ListEntryMainPathExtenderExtended() },
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public void SetupList<T>(TitleParameter titleParameter, List<T> list, bool useExtended, bool useAddRemove) {
|
||||||
SetupBase(titleParameter);
|
SetupBase(titleParameter);
|
||||||
|
|
||||||
var cValue = Mathf.LerpUnclamped(0.4f, 0.6f, titleParameter.offset / 100f);
|
var cValue = Mathf.LerpUnclamped(0.4f, 0.6f, titleParameter.offset / 100f);
|
||||||
|
@ -42,6 +54,11 @@ namespace DunGenPlus.DevTools.UIElements {
|
||||||
|
|
||||||
this.list = list;
|
this.list = list;
|
||||||
listType = typeof(T);
|
listType = typeof(T);
|
||||||
|
this.useExtended = useExtended;
|
||||||
|
if (!useAddRemove) {
|
||||||
|
buttonsGameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
for(var i = 0; i < list.Count; ++i) {
|
for(var i = 0; i < list.Count; ++i) {
|
||||||
CreateEntry(i);
|
CreateEntry(i);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +66,8 @@ namespace DunGenPlus.DevTools.UIElements {
|
||||||
|
|
||||||
public void AddElement() {
|
public void AddElement() {
|
||||||
object item = null;
|
object item = null;
|
||||||
if (!typeDictionary.TryGetValue(listType, out var value)){
|
var dictionary = useExtended ? typeExtendedDictionary : typeDictionary;
|
||||||
|
if (!dictionary.TryGetValue(listType, out var value)){
|
||||||
Plugin.logger.LogError($"Type {listType} does not has a defined list UI display");
|
Plugin.logger.LogError($"Type {listType} does not has a defined list UI display");
|
||||||
}
|
}
|
||||||
item = value.CreateEmptyObject();
|
item = value.CreateEmptyObject();
|
||||||
|
@ -67,19 +85,32 @@ namespace DunGenPlus.DevTools.UIElements {
|
||||||
var copy = CreateCopy(index);
|
var copy = CreateCopy(index);
|
||||||
var copyParentTransform = copy.transform.Find("Items");
|
var copyParentTransform = copy.transform.Find("Items");
|
||||||
|
|
||||||
if (!typeDictionary.TryGetValue(listType, out var value)){
|
var dictionary = useExtended ? typeExtendedDictionary : typeDictionary;
|
||||||
|
if (!dictionary.TryGetValue(listType, out var value)){
|
||||||
Plugin.logger.LogError($"Type {listType} does not has a defined list UI display");
|
Plugin.logger.LogError($"Type {listType} does not has a defined list UI display");
|
||||||
}
|
}
|
||||||
value.CreateEntry(list, index, copyParentTransform, layoutOffset + 24f);
|
value.CreateEntry(list, index, copyParentTransform, layoutOffset + 24f);
|
||||||
|
SetElementText(copy, value, index);
|
||||||
copy.SetActive(true);
|
copy.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject CreateCopy(int index){
|
public GameObject CreateCopy(int index){
|
||||||
var copy = Instantiate(templatePrefab, listTransform);
|
var copy = Instantiate(templatePrefab, listTransform);
|
||||||
copy.transform.Find("Element").GetComponent<TextMeshProUGUI>().text = $"Element {index}";
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetElementText(GameObject elementGameObject, ListEntryType entryType, int index){
|
||||||
|
var comp = elementGameObject.transform.Find("Element").GetComponent<TextMeshProUGUI>();
|
||||||
|
string elementText;
|
||||||
|
if (entryType.UseCustomElementText()) {
|
||||||
|
elementText = entryType.GetCustomElementText(list, index);
|
||||||
|
comp.fontStyle |= FontStyles.Underline;
|
||||||
|
} else {
|
||||||
|
elementText = $"Element {index}";
|
||||||
|
}
|
||||||
|
comp.text = elementText;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@
|
||||||
<Compile Include="Components\MainRoomDoorwayGroups.cs" />
|
<Compile Include="Components\MainRoomDoorwayGroups.cs" />
|
||||||
<Compile Include="Components\Props\SpawnSyncedObjectCycle.cs" />
|
<Compile Include="Components\Props\SpawnSyncedObjectCycle.cs" />
|
||||||
<Compile Include="Components\Scrap\RandomGuaranteedScrapSpawn.cs" />
|
<Compile Include="Components\Scrap\RandomGuaranteedScrapSpawn.cs" />
|
||||||
|
<Compile Include="DevTools\Panels\AssetsPanel.cs" />
|
||||||
<Compile Include="Generation\DunGenPlusGenerationPaths.cs" />
|
<Compile Include="Generation\DunGenPlusGenerationPaths.cs" />
|
||||||
<Compile Include="MainPathExtender.cs" />
|
<Compile Include="MainPathExtender.cs" />
|
||||||
<Compile Include="PluginConfig.cs" />
|
<Compile Include="PluginConfig.cs" />
|
||||||
|
|
Binary file not shown.
|
@ -16,6 +16,7 @@ using UnityEngine.Rendering;
|
||||||
using UnityEngine.Rendering.HighDefinition;
|
using UnityEngine.Rendering.HighDefinition;
|
||||||
using BepInEx.Logging;
|
using BepInEx.Logging;
|
||||||
using DunGenPlus.DevTools;
|
using DunGenPlus.DevTools;
|
||||||
|
using DunGenPlus.Patches;
|
||||||
|
|
||||||
[assembly: SecurityPermission( SecurityAction.RequestMinimum, SkipVerification = true )]
|
[assembly: SecurityPermission( SecurityAction.RequestMinimum, SkipVerification = true )]
|
||||||
namespace DunGenPlus.Generation {
|
namespace DunGenPlus.Generation {
|
||||||
|
@ -138,7 +139,7 @@ namespace DunGenPlus.Generation {
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
var mainRoomStartingLengthIndex = mainRoom.Placement.Depth + 1;
|
var mainRoomStartingLengthIndex = mainRoom.Placement.Depth + 1;
|
||||||
Plugin.logger.LogDebug($"Length Index: {mainRoomStartingLengthIndex}");
|
Plugin.logger.LogDebug($"Main Room Length Index: {mainRoomStartingLengthIndex}");
|
||||||
|
|
||||||
//FixDoorwaysToAllFloors(mainRoom, doorwayGroups);
|
//FixDoorwaysToAllFloors(mainRoom, doorwayGroups);
|
||||||
|
|
||||||
|
@ -184,7 +185,9 @@ namespace DunGenPlus.Generation {
|
||||||
|
|
||||||
// most of this code is a mix of the GenerateMainPath()
|
// most of this code is a mix of the GenerateMainPath()
|
||||||
// and GenerateBranch() code
|
// and GenerateBranch() code
|
||||||
for(var t = mainRoomStartingLengthIndex; t < targetLength; ++t){
|
var reachedLastNode = false;
|
||||||
|
var lastNode = nodes.ElementAt(nodes.Count() - 1);
|
||||||
|
for(var t = mainRoomStartingLengthIndex; t < targetLength && !reachedLastNode; ++t){
|
||||||
var lineDepthRatio = Mathf.Clamp01((float)t / (targetLength - 1));
|
var lineDepthRatio = Mathf.Clamp01((float)t / (targetLength - 1));
|
||||||
var lineAtDepth = GetLineAtDepth(gen.DungeonFlow, lineDepthRatio);
|
var lineAtDepth = GetLineAtDepth(gen.DungeonFlow, lineDepthRatio);
|
||||||
if (lineAtDepth == null){
|
if (lineAtDepth == null){
|
||||||
|
@ -211,6 +214,11 @@ namespace DunGenPlus.Generation {
|
||||||
if (graphNode != null) {
|
if (graphNode != null) {
|
||||||
archetype = ModifyMainBranchNodeArchetype(null, graphNode, gen.RandomStream);
|
archetype = ModifyMainBranchNodeArchetype(null, graphNode, gen.RandomStream);
|
||||||
useableTileSets = graphNode.TileSets;
|
useableTileSets = graphNode.TileSets;
|
||||||
|
|
||||||
|
// Zaggy wants the last node to stop dungeon generation
|
||||||
|
if (graphNode == lastNode) {
|
||||||
|
reachedLastNode = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
archetype = gen.currentArchetype;
|
archetype = gen.currentArchetype;
|
||||||
useableTileSets = archetype.TileSets;
|
useableTileSets = archetype.TileSets;
|
||||||
|
@ -219,12 +227,26 @@ namespace DunGenPlus.Generation {
|
||||||
var tileProxy = gen.AddTile(previousTile, useableTileSets, lineDepthRatio, archetype, TilePlacementResult.None);
|
var tileProxy = gen.AddTile(previousTile, useableTileSets, lineDepthRatio, archetype, TilePlacementResult.None);
|
||||||
|
|
||||||
if (tileProxy == null) {
|
if (tileProxy == null) {
|
||||||
Plugin.logger.LogDebug($"Alt. main branch gen failed at {b}:{lineDepthRatio}");
|
var prevName = previousTile != null ? previousTile.Prefab.name : "NULL";
|
||||||
|
var archetypeName = archetype ? archetype.name : "NULL";
|
||||||
|
var tileSetNames = string.Join(", ", useableTileSets);
|
||||||
|
Plugin.logger.LogDebug($"Alt. main branch gen failed at Branch {b} (Length: {t}, Ratio: {lineDepthRatio})");
|
||||||
|
Plugin.logger.LogDebug($"Prev tile: {prevName}\nArchetype: {archetypeName}\nTilesets: {tileSetNames}");
|
||||||
|
Plugin.logger.LogDebug($"Reason: {DungeonGeneratorPatch.lastTilePlacementResult}");
|
||||||
|
|
||||||
|
if (previousTile != null) {
|
||||||
|
var availableDoorways = string.Join(",", previousTile.UnusedDoorways);
|
||||||
|
var usedDoorways = string.Join(",", previousTile.UsedDoorways);
|
||||||
|
|
||||||
|
Plugin.logger.LogDebug($"Available Doorways: {availableDoorways}");
|
||||||
|
Plugin.logger.LogDebug($"Used Doorways: {usedDoorways}");
|
||||||
|
}
|
||||||
|
|
||||||
yield return gen.Wait(gen.InnerGenerate(true));
|
yield return gen.Wait(gen.InnerGenerate(true));
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lineDepthRatio >= 1f){
|
if (reachedLastNode || lineDepthRatio >= 1f){
|
||||||
Plugin.logger.LogDebug($"Alt. main branch at {b} ended with {tileProxy.PrefabTile.name}");
|
Plugin.logger.LogDebug($"Alt. main branch at {b} ended with {tileProxy.PrefabTile.name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,13 @@ namespace DunGenPlus.Patches {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TilePlacementResult lastTilePlacementResult;
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(DungeonGenerator), "AddTilePlacementResult")]
|
||||||
|
public static void AddTilePlacementResultPatch(TilePlacementResult result){
|
||||||
|
lastTilePlacementResult = result;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(DungeonGenerator), "GenerateMainPath", MethodType.Enumerator)]
|
[HarmonyPatch(typeof(DungeonGenerator), "GenerateMainPath", MethodType.Enumerator)]
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace DunGenPlus {
|
||||||
public static ConfigEntry<bool> EnableDevDebugTools;
|
public static ConfigEntry<bool> EnableDevDebugTools;
|
||||||
|
|
||||||
public static void SetupConfig(ConfigFile cfg) {
|
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."));
|
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 LeftAlt + M to activate."));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue