Added UI button to DevDebugWindow to expand it :)

This commit is contained in:
LadyAliceMargatroid 2024-11-04 08:42:15 -08:00
parent 4754677ae3
commit cc019aef1c
4 changed files with 28 additions and 1 deletions

View File

@ -25,6 +25,7 @@ namespace DunGenPlus.DevTools {
public RuntimeDungeon dungeon; public RuntimeDungeon dungeon;
public GameObject devCamera; public GameObject devCamera;
public BasePanel[] panels; public BasePanel[] panels;
public RectTransform canvasRectTransform;
public TMP_Dropdown dungeonFlowSelectionDropDown; public TMP_Dropdown dungeonFlowSelectionDropDown;
private ExtendedDungeonFlow[] dungeonFlows; private ExtendedDungeonFlow[] dungeonFlows;
@ -49,6 +50,10 @@ namespace DunGenPlus.DevTools {
private Vector2 cameraYRange; private Vector2 cameraYRange;
// canvas
public bool canvasExtended;
private float canvasWidthTarget;
void Awake(){ void Awake(){
Instance = this; Instance = this;
@ -70,6 +75,9 @@ namespace DunGenPlus.DevTools {
disabledGameObject.transform.SetParent(transform); disabledGameObject.transform.SetParent(transform);
cameraYRange = new Vector2(devCamera.transform.position.y - 200f, devCamera.transform.position.y); cameraYRange = new Vector2(devCamera.transform.position.y - 200f, devCamera.transform.position.y);
canvasExtended = false;
canvasWidthTarget = 440f;
} }
void OnDestroy(){ void OnDestroy(){
@ -85,6 +93,10 @@ namespace DunGenPlus.DevTools {
} }
void Update(){ void Update(){
var sizeDelta = canvasRectTransform.sizeDelta;
sizeDelta.x = Mathf.Lerp(sizeDelta.x, canvasWidthTarget, Time.deltaTime * 10f);
canvasRectTransform.sizeDelta = sizeDelta;
statusTextMesh.text = dungeon.Generator.Status.ToString(); statusTextMesh.text = dungeon.Generator.Status.ToString();
if (!DevDebugOpen.IsSinglePlayerInShip()) { if (!DevDebugOpen.IsSinglePlayerInShip()) {
@ -111,6 +123,11 @@ namespace DunGenPlus.DevTools {
} }
} }
public void ToggleCanvasExtended(){
canvasExtended = !canvasExtended;
canvasWidthTarget = canvasExtended ? 800f : 440f;
}
public void SelectDungeonFlow(int index){ public void SelectDungeonFlow(int index){
selectedExtendedDungeonFlow = dungeonFlows[index]; selectedExtendedDungeonFlow = dungeonFlows[index];
selectedDungeonFlow = selectedExtendedDungeonFlow.DungeonFlow; selectedDungeonFlow = selectedExtendedDungeonFlow.DungeonFlow;

View File

@ -17,6 +17,7 @@ namespace DunGenPlus.DevTools.UIElements {
public LayoutElement layoutElement; public LayoutElement layoutElement;
internal float layoutOffset; internal float layoutOffset;
internal float layoutWidthBase;
public void SetupBase(TitleParameter titleParameter) { public void SetupBase(TitleParameter titleParameter) {
title = titleParameter.text; title = titleParameter.text;
@ -26,8 +27,17 @@ namespace DunGenPlus.DevTools.UIElements {
layoutOffset = titleParameter.offset; layoutOffset = titleParameter.offset;
if (layoutElement) { if (layoutElement) {
layoutElement.minWidth -= layoutOffset; layoutElement.minWidth -= layoutOffset;
layoutWidthBase = layoutElement.minWidth;
} }
}
void Update(){
if (layoutElement) {
var minWidth = layoutWidthBase;
if (DevDebugManager.Instance.canvasExtended) minWidth += 40f;
layoutElement.minWidth = Mathf.Lerp(layoutElement.minWidth, minWidth, Time.deltaTime * 10f);
}
} }
public void SetText(string value) { public void SetText(string value) {

Binary file not shown.