From 0c43fc111217853670bfab6c7a9f6180aa2eb7e4 Mon Sep 17 00:00:00 2001 From: Pasha Date: Wed, 14 Jan 2026 12:03:15 +0000 Subject: [PATCH] Added info text --- Assets/Prefabs/SampleChild.prefab | 81 ++++++++++++++++++++++++++ Assets/Scripts/WindowComponents.cs | 4 +- Assets/Scripts/Windows/BasicWindow.cs | 5 ++ Assets/Scripts/Windows/ImageWindow.cs | 9 ++- Assets/Scripts/Windows/MovingWindow.cs | 8 ++- 5 files changed, 101 insertions(+), 6 deletions(-) diff --git a/Assets/Prefabs/SampleChild.prefab b/Assets/Prefabs/SampleChild.prefab index 1dd43de..f3af726 100644 --- a/Assets/Prefabs/SampleChild.prefab +++ b/Assets/Prefabs/SampleChild.prefab @@ -75,6 +75,85 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2265690506723964757 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2762027888324636750} + - component: {fileID: 1362071040755362419} + - component: {fileID: 2038821404454815492} + m_Layer: 5 + m_Name: InfoText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2762027888324636750 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2265690506723964757} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 25269235060726753} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -15, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1362071040755362419 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2265690506723964757} + m_CullTransparentMesh: 1 +--- !u!114 &2038821404454815492 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2265690506723964757} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 20 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: --- !u!1 &3890928559484794403 GameObject: m_ObjectHideFlags: 0 @@ -106,6 +185,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2035964200443923097} + - {fileID: 2762027888324636750} m_Father: {fileID: 7011418079103154681} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} @@ -336,6 +416,7 @@ MonoBehaviour: m_EditorClassIdentifier: k__BackingField: {fileID: 3009414327569646558} k__BackingField: {fileID: 7011418079103154681} + k__BackingField: {fileID: 2038821404454815492} --- !u!114 &3265764588146964386 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/WindowComponents.cs b/Assets/Scripts/WindowComponents.cs index 9901b01..ab0fb5c 100644 --- a/Assets/Scripts/WindowComponents.cs +++ b/Assets/Scripts/WindowComponents.cs @@ -1,6 +1,5 @@ -using TreeEditor; +using UnityEngine.UI; using UnityEngine; -using UnityEngine.UI; namespace InterfaceOff { @@ -8,6 +7,7 @@ namespace InterfaceOff { [field: SerializeField] public Image WindowImage { get; private set; } [field: SerializeField] public RectTransform Transform { get; private set; } + [field: SerializeField] public Text InfoText { get; private set; } public Rect Rect => new ( diff --git a/Assets/Scripts/Windows/BasicWindow.cs b/Assets/Scripts/Windows/BasicWindow.cs index fe5820e..8b4ea51 100644 --- a/Assets/Scripts/Windows/BasicWindow.cs +++ b/Assets/Scripts/Windows/BasicWindow.cs @@ -2,6 +2,11 @@ { public class BasicWindow : WindowBase { + public override void OnWindowInstantiation() + { + Components.InfoText.text = "Close"; + } + public override void OnWindowClicked() { Destroy(gameObject); diff --git a/Assets/Scripts/Windows/ImageWindow.cs b/Assets/Scripts/Windows/ImageWindow.cs index 60491d0..e065f9d 100644 --- a/Assets/Scripts/Windows/ImageWindow.cs +++ b/Assets/Scripts/Windows/ImageWindow.cs @@ -17,10 +17,14 @@ namespace InterfaceOff public override void OnWindowInstantiation() { - Sprite[] sprites = CanvasManager.Instance.Images.GetRandomSpriteSet(); + /* Lets the player know what to do via text */ + Components.InfoText.text = "Rotate"; + /* Creates the images to rotate */ + Sprite[] sprites = CanvasManager.Instance.Images.GetRandomSpriteSet(); for (int i = 0; i < 4; i++) { + /* Fetches/Creates needed components */ GameObject go = Instantiate(CanvasManager.Instance.ImagePrefab, transform); RectTransform t = go.GetComponent(); @@ -32,6 +36,7 @@ namespace InterfaceOff img.material = new Material(Shader.Find("UI/Default")); img.sprite = sprites[i]; + /* Adds a function to the buttons for them to rotate */ Button button = go.GetComponent