From 69b8a01b717b42b5cdf9894a75ce1e96b332c635 Mon Sep 17 00:00:00 2001 From: unknown <john.schihada@hotmail.com> Date: Mon, 30 Nov 2020 22:09:45 +0100 Subject: [PATCH] Made hint-buttons visible/invisible when available or not --- .../Prefabs/ScrollParameterDisplay.prefab | 80 +++++++++++++++++++ .../InventoryStuff/RenderedScrollFact.cs | 12 +-- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab b/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab index f959f292..f8270ac7 100644 --- a/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab +++ b/Assets/Resources/Prefabs/ScrollParameterDisplay.prefab @@ -257,6 +257,76 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultColor.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultColor.a + value: 0.5294118 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: highlightColor.r + value: 0.9529412 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: highlightColor.g + value: 0.5137255 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: highlightColor.b + value: 0.07058824 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultHintButtonColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultHintButtonColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultHintButtonColor.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: defaultHintButtonColor.a + value: 0.5294118 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: availableHintButtonColor.r + value: 0.9529412 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: availableHintButtonColor.g + value: 0.5137255 + objectReference: {fileID: 0} + - target: {fileID: 1430730640409366961, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: availableHintButtonColor.b + value: 0.07058824 + objectReference: {fileID: 0} - target: {fileID: 1686984722580339795, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} propertyPath: m_fontSize @@ -282,6 +352,16 @@ PrefabInstance: propertyPath: m_margin.y value: -5.0954895 objectReference: {fileID: 0} + - target: {fileID: 5738028260646118123, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6338961308496269799, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, + type: 3} + propertyPath: m_Interactable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 7669725544194832573, guid: 0f75dbd3f5b33b040948ba58d3b90cb0, type: 3} propertyPath: m_AnchoredPosition.y diff --git a/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs b/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs index 3263b260..4aa715dc 100644 --- a/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs +++ b/Assets/Scripts/InventoryStuff/RenderedScrollFact.cs @@ -11,9 +11,6 @@ public class RenderedScrollFact : MonoBehaviour private string _label; public string factUri; - private Color defaultColor = new Color(255,255,255,135); - private Color highlightColor = new Color(255,0,0,135); - public GameObject ScrollParameterObject; public string Label @@ -37,17 +34,14 @@ public void OnClickHintButton() { } public void OnHintAvailable(List<string> uris) { - UnityEngine.UI.Button button = ScrollParameterObject.GetComponentInChildren<UnityEngine.UI.Button>(); - UnityEngine.UI.ColorBlock buttonColor = button.colors; + GameObject hintButton = ScrollParameterObject.transform.GetChild(2).gameObject; if (uris.Contains(factUri)) { - buttonColor.normalColor = highlightColor; - button.colors = buttonColor; + hintButton.SetActive(true); } else { - buttonColor.normalColor = defaultColor; - button.colors = buttonColor; + hintButton.SetActive(false); } } } -- GitLab