From 9651955b38a66992cf73dc8ba6e38c8d0ffbcc80 Mon Sep 17 00:00:00 2001 From: drewcassidy Date: Thu, 23 Jul 2020 17:49:42 -0700 Subject: [PATCH] UI loading cleanup --- .../Plugins/ConformalDecals.dll | 4 +- Source/ConformalDecals/UI/UILoader.cs | 37 ++----------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index 79260ec..3814cc1 100644 --- a/GameData/ConformalDecals/Plugins/ConformalDecals.dll +++ b/GameData/ConformalDecals/Plugins/ConformalDecals.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0f4f721828115244ad20072e98654bfc0622e80479e904a7123aa4151958ec5 -size 73216 +oid sha256:c1b9b78469e10f7934a10b599b21bbe4c0931c135a2c929f9b2d64f3b1e35fef +size 72704 diff --git a/Source/ConformalDecals/UI/UILoader.cs b/Source/ConformalDecals/UI/UILoader.cs index c97f5cb..67dfa04 100644 --- a/Source/ConformalDecals/UI/UILoader.cs +++ b/Source/ConformalDecals/UI/UILoader.cs @@ -59,10 +59,8 @@ namespace ConformalDecals.UI { ProcessSelectable(tag.gameObject, skin.toggle); break; case UITag.UIType.BoxSlider: - ProcessBoxSlider(tag.gameObject, skin.horizontalSlider, skin.horizontalSliderThumb); - break; case UITag.UIType.Slider: - ProcessSlider(tag.gameObject, skin.horizontalSlider, skin.horizontalSliderThumb, skin.horizontalSlider, skin.horizontalSliderThumb); + ProcessSlider(tag.gameObject, skin.horizontalSlider, skin.horizontalSliderThumb); break; case UITag.UIType.Box: ProcessSelectable(tag.gameObject, skin.box); @@ -105,6 +103,7 @@ namespace ConformalDecals.UI { var state = selectable.spriteState; state.highlightedSprite = style.highlight.background; + state.selectedSprite = style.highlight.background; state.pressedSprite = style.active.background; state.disabledSprite = style.disabled.background; selectable.spriteState = state; @@ -118,39 +117,11 @@ namespace ConformalDecals.UI { if (toggle != null) ProcessImage(toggle.graphic as Image, style.active); } - private static void ProcessSlider(GameObject gameObject, UIStyle horizontalStyle, UIStyle horizontalThumbStyle, UIStyle verticalStyle, UIStyle verticalThumbStyle) { - var slider = gameObject.GetComponent(); - if (slider == null) { - ProcessImage(gameObject, horizontalThumbStyle); - } - else { - UIStyle sliderStyle; - UIStyle thumbStyle; - if (slider.direction == Slider.Direction.BottomToTop || slider.direction == Slider.Direction.TopToBottom) { - sliderStyle = verticalStyle; - thumbStyle = verticalThumbStyle; - } - else { - sliderStyle = horizontalStyle; - thumbStyle = horizontalThumbStyle; - } - - ProcessSelectable(gameObject, thumbStyle); - - var back = gameObject.transform.Find("Background"); - if (back != null) { - ProcessImage(back.gameObject, sliderStyle); - } - } - } - - private static void ProcessBoxSlider(GameObject gameObject, UIStyle backgroundStyle, UIStyle thumbStyle) { + private static void ProcessSlider(GameObject gameObject, UIStyle backgroundStyle, UIStyle thumbStyle) { ProcessSelectable(gameObject, thumbStyle); var background = gameObject.transform.Find("Background"); - if (background != null) { - ProcessImage(background.gameObject, backgroundStyle); - } + if (background != null) ProcessImage(background.gameObject, backgroundStyle); } private static void ProcessDropdown(GameObject gameObject, UIStyle buttonStyle, UIStyle windowStyle) {