diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index ea74e88..afc4c2d 100644 Binary files a/GameData/ConformalDecals/Plugins/ConformalDecals.dll and b/GameData/ConformalDecals/Plugins/ConformalDecals.dll differ diff --git a/GameData/ConformalDecals/Resources/ui.conformaldecals b/GameData/ConformalDecals/Resources/ui.conformaldecals index c5f886f..8083a9f 100644 Binary files a/GameData/ConformalDecals/Resources/ui.conformaldecals and b/GameData/ConformalDecals/Resources/ui.conformaldecals differ diff --git a/Source/ConformalDecals/ConformalDecals.csproj b/Source/ConformalDecals/ConformalDecals.csproj index 067412d..c66ad9a 100644 --- a/Source/ConformalDecals/ConformalDecals.csproj +++ b/Source/ConformalDecals/ConformalDecals.csproj @@ -87,6 +87,7 @@ + diff --git a/Source/ConformalDecals/ModuleConformalText.cs b/Source/ConformalDecals/ModuleConformalText.cs index e805e9a..6957e51 100644 --- a/Source/ConformalDecals/ModuleConformalText.cs +++ b/Source/ConformalDecals/ModuleConformalText.cs @@ -26,8 +26,8 @@ namespace ConformalDecals { { if (_textEntryGui == null) { _textEntryGui = Instantiate(UILoader.textEntryPrefab, MainCanvasUtil.MainCanvas.transform, true); - _textEntryGui.AddComponent(); - MenuNavigation.SpawnMenuNavigation(_textEntryGui, Navigation.Mode.Automatic, true); + //_textEntryGui.AddComponent(); + //MenuNavigation.SpawnMenuNavigation(_textEntryGui, Navigation.Mode.Automatic, true); } } } diff --git a/Source/ConformalDecals/UI/TextEntryController.cs b/Source/ConformalDecals/UI/TextEntryController.cs new file mode 100644 index 0000000..4d4c04b --- /dev/null +++ b/Source/ConformalDecals/UI/TextEntryController.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace ConformalDecals.UI { + public class TextEntryController : MonoBehaviour { + public void OnClose() { + Debug.Log("Close!"); + } + } +} \ No newline at end of file diff --git a/Source/ConformalDecals/UI/UILoader.cs b/Source/ConformalDecals/UI/UILoader.cs index e0743a3..81ef217 100644 --- a/Source/ConformalDecals/UI/UILoader.cs +++ b/Source/ConformalDecals/UI/UILoader.cs @@ -18,6 +18,8 @@ namespace ConformalDecals.UI { ProcessWindow(textEntryPrefab); Debug.Log("[ConformalDecals] UI prefabs loaded and modified"); + + var window = Instantiate(UILoader.textEntryPrefab, MainCanvasUtil.MainCanvas.transform, true); } private static void ProcessWindow(GameObject window) { @@ -37,7 +39,7 @@ namespace ConformalDecals.UI { var tags = window.GetComponentsInChildren(true); foreach (var tag in tags) { - Debug.Log($"Handling object ${tag.gameObject.name}"); + Debug.Log($"Handling object {tag.gameObject.name}"); switch (tag.type) { case UITag.UIType.Window: ProcessImage(tag.gameObject, skin.window); @@ -46,6 +48,9 @@ namespace ConformalDecals.UI { ProcessSelectable(tag.gameObject, skin.button); break; case UITag.UIType.ButtonToggle: + ProcessToggleButton(tag.gameObject, skin.button); + break; + case UITag.UIType.RadioToggle: ProcessSelectable(tag.gameObject, skin.toggle); break; case UITag.UIType.Slider: @@ -68,10 +73,12 @@ namespace ConformalDecals.UI { } private static void ProcessImage(GameObject gameObject, UIStyle style) { - var image = gameObject.GetComponent(); - if (image == null) throw new FormatException("No Image component present"); - - image.sprite = style.normal.background; + ProcessImage(gameObject.GetComponent(), style.normal); + } + + private static void ProcessImage(Image image, UIStyleState state) { + image.sprite = state.background; + image.color = Color.white; image.type = Image.Type.Sliced; } @@ -79,7 +86,7 @@ namespace ConformalDecals.UI { var selectable = gameObject.GetComponent(); if (selectable == null) throw new FormatException("No Selectable component present"); - ProcessImage(gameObject, style); + ProcessImage(selectable.image, style.normal); selectable.transition = Selectable.Transition.SpriteSwap; @@ -87,6 +94,15 @@ namespace ConformalDecals.UI { state.highlightedSprite = style.highlight.background; state.pressedSprite = style.active.background; state.disabledSprite = style.disabled.background; + + selectable.spriteState = state; + } + + private static void ProcessToggleButton(GameObject gameObject, UIStyle style) { + ProcessSelectable(gameObject, style); + + var toggle = gameObject.GetComponent(); + ProcessImage(toggle.graphic as Image, style.active); } private static void ProcessSlider(GameObject gameObject, UIStyle horizontalStyle, UIStyle horizontalThumbStyle, UIStyle verticalStyle, UIStyle verticalThumbStyle) { diff --git a/Source/ConformalDecals/UI/UITag.cs b/Source/ConformalDecals/UI/UITag.cs index ecc2397..5574ee9 100644 --- a/Source/ConformalDecals/UI/UITag.cs +++ b/Source/ConformalDecals/UI/UITag.cs @@ -8,6 +8,7 @@ namespace ConformalDecals.UI { Box, Button, ButtonToggle, + RadioToggle, Slider, Dropdown, Label,