From a8614e118656cbc7b4b888be58c029da88cec1bc Mon Sep 17 00:00:00 2001 From: Tim Aidley Date: Sun, 19 Mar 2023 19:46:42 -0700 Subject: [PATCH] Back button works --- Assets/Prefabs/Panels/SketchbookPanel.prefab | 35 +++++++++++++++++++ Assets/Scripts/GUI/LoadSketchButton.cs | 1 + Assets/Scripts/GUI/SketchbookPanel.cs | 14 ++++++++ .../ResourceCollectionSketchSet.cs | 2 +- 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Assets/Prefabs/Panels/SketchbookPanel.prefab b/Assets/Prefabs/Panels/SketchbookPanel.prefab index e19ead508c..05d06c33e7 100644 --- a/Assets/Prefabs/Panels/SketchbookPanel.prefab +++ b/Assets/Prefabs/Panels/SketchbookPanel.prefab @@ -15210,6 +15210,41 @@ PrefabInstance: propertyPath: m_DescriptionText value: Back objectReference: {fileID: 0} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 2478559423573741591} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: BackButtonPressed + objectReference: {fileID: 0} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: TiltBrush.SketchbookPanel, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 7879899076693153277, guid: 0963942396a615f4fb1b390436e881b8, + type: 3} + propertyPath: m_Action.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0963942396a615f4fb1b390436e881b8, type: 3} --- !u!4 &5835854812254485208 stripped diff --git a/Assets/Scripts/GUI/LoadSketchButton.cs b/Assets/Scripts/GUI/LoadSketchButton.cs index 86e5a81cee..a7760233c4 100644 --- a/Assets/Scripts/GUI/LoadSketchButton.cs +++ b/Assets/Scripts/GUI/LoadSketchButton.cs @@ -163,6 +163,7 @@ override protected void OnButtonPressed() { var sketchSet = new ResourceCollectionSketchSet(collection); SketchbookPanel.Instance.PushSketchSet(SketchbookPanel.Instance.SelectedSketchStack, sketchSet); + return; } } diff --git a/Assets/Scripts/GUI/SketchbookPanel.cs b/Assets/Scripts/GUI/SketchbookPanel.cs index 1dc14af147..1546a4ff7f 100644 --- a/Assets/Scripts/GUI/SketchbookPanel.cs +++ b/Assets/Scripts/GUI/SketchbookPanel.cs @@ -265,6 +265,15 @@ public void PushSketchSet(int stack, ISketchSet sketchSet) } } + public void PopSketchSet(int stack) + { + m_SetStacks[stack].Pop(); + if (stack == m_SelectedStack) + { + SetVisibleSketchSet((RootSet)m_SelectedStack); + } + } + void SetVisibleSketchSet(RootSet stack) { int stackIndex = (int)stack; @@ -824,6 +833,11 @@ public void ButtonPressed(GalleryButton.Type rType, BaseButton button = null) } } + public void BackButtonPressed() + { + PopSketchSet(m_SelectedStack); + } + private void OnSketchSetDirty() { ComputeNumPages(); diff --git a/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs b/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs index da8ce4c95d..11888285a6 100644 --- a/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs +++ b/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs @@ -148,7 +148,7 @@ public bool GetSketchIcon(int index, out Texture2D icon, out string[] authors, o var sketch = m_Sketches[index]; icon = sketch.Icon; authors = sketch.Authors; - description = "DESCRIPTION NOT IMPLEMENTED"; + description = sketch.ResourceFileInfo.Resource.Description ?? ""; return icon != null; }