TopBar 버튼을 다시 눌러서 메뉴들 닫았을때 색이 되돌아가지 않는 버그 수정
This commit is contained in:
@@ -570,7 +570,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@@ -608,10 +608,10 @@ MonoBehaviour:
|
|||||||
m_SelectOnRight: {fileID: 0}
|
m_SelectOnRight: {fileID: 0}
|
||||||
m_Transition: 1
|
m_Transition: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
m_NormalColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_HighlightedColor: {r: 0.2980328, g: 0.27319673, b: 0.303, a: 1}
|
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_PressedColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||||
m_SelectedColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1}
|
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||||
m_ColorMultiplier: 1
|
m_ColorMultiplier: 1
|
||||||
m_FadeDuration: 0.1
|
m_FadeDuration: 0.1
|
||||||
@@ -672,6 +672,9 @@ MonoBehaviour:
|
|||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
openTime: 0.1
|
openTime: 0.1
|
||||||
|
closeColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
||||||
|
openColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1}
|
||||||
|
isButtonImageToggle: 1
|
||||||
--- !u!1 &1063646199281932845
|
--- !u!1 &1063646199281932845
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1251,7 +1254,7 @@ MonoBehaviour:
|
|||||||
Button_AssetWindow: {fileID: 9118390163350013474}
|
Button_AssetWindow: {fileID: 9118390163350013474}
|
||||||
Button_HierarchyWindow: {fileID: 0}
|
Button_HierarchyWindow: {fileID: 0}
|
||||||
Button_Tools: {fileID: 6255786153821147911}
|
Button_Tools: {fileID: 6255786153821147911}
|
||||||
Button_InterferedListWindow: {fileID: 0}
|
Button_ConflictedListWindow: {fileID: 0}
|
||||||
button_Icon: {fileID: 3577280054402309687}
|
button_Icon: {fileID: 3577280054402309687}
|
||||||
--- !u!1 &3034319458232227286
|
--- !u!1 &3034319458232227286
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -1466,7 +1469,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@@ -1504,10 +1507,10 @@ MonoBehaviour:
|
|||||||
m_SelectOnRight: {fileID: 0}
|
m_SelectOnRight: {fileID: 0}
|
||||||
m_Transition: 1
|
m_Transition: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
m_NormalColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_HighlightedColor: {r: 0.2980328, g: 0.27319673, b: 0.303, a: 1}
|
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_PressedColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||||
m_SelectedColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1}
|
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||||
m_ColorMultiplier: 1
|
m_ColorMultiplier: 1
|
||||||
m_FadeDuration: 0.1
|
m_FadeDuration: 0.1
|
||||||
@@ -1568,6 +1571,9 @@ MonoBehaviour:
|
|||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
openTime: 0.1
|
openTime: 0.1
|
||||||
|
closeColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
||||||
|
openColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1}
|
||||||
|
isButtonImageToggle: 1
|
||||||
--- !u!1 &3183454003344235609
|
--- !u!1 &3183454003344235609
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -2232,7 +2238,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@@ -2270,10 +2276,10 @@ MonoBehaviour:
|
|||||||
m_SelectOnRight: {fileID: 0}
|
m_SelectOnRight: {fileID: 0}
|
||||||
m_Transition: 1
|
m_Transition: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
m_NormalColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_HighlightedColor: {r: 0.2980328, g: 0.27319673, b: 0.303, a: 1}
|
m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_PressedColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||||
m_SelectedColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1}
|
m_SelectedColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||||
m_ColorMultiplier: 1
|
m_ColorMultiplier: 1
|
||||||
m_FadeDuration: 0.1
|
m_FadeDuration: 0.1
|
||||||
@@ -2334,6 +2340,9 @@ MonoBehaviour:
|
|||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
openTime: 0.1
|
openTime: 0.1
|
||||||
|
closeColor: {r: 0.23529412, g: 0.21568628, b: 0.23921569, a: 1}
|
||||||
|
openColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1}
|
||||||
|
isButtonImageToggle: 1
|
||||||
--- !u!1 &4302929749455078697
|
--- !u!1 &4302929749455078697
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -12081,6 +12081,8 @@ MonoBehaviour:
|
|||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
openTime: 0.1
|
openTime: 0.1
|
||||||
|
closeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
openColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
BG: {fileID: 627801129964666679}
|
BG: {fileID: 627801129964666679}
|
||||||
--- !u!1 &1618951800751397818
|
--- !u!1 &1618951800751397818
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -14702,6 +14704,8 @@ MonoBehaviour:
|
|||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
openTime: 0.1
|
openTime: 0.1
|
||||||
|
closeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
openColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
BG: {fileID: 4396171917364011593}
|
BG: {fileID: 4396171917364011593}
|
||||||
--- !u!224 &5012894770760959717 stripped
|
--- !u!224 &5012894770760959717 stripped
|
||||||
RectTransform:
|
RectTransform:
|
||||||
@@ -16823,6 +16827,8 @@ MonoBehaviour:
|
|||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
openTime: 0.1
|
openTime: 0.1
|
||||||
|
closeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
openColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
BG: {fileID: 725141755715026998}
|
BG: {fileID: 725141755715026998}
|
||||||
--- !u!1 &7358537005159908647
|
--- !u!1 &7358537005159908647
|
||||||
GameObject:
|
GameObject:
|
||||||
|
|||||||
@@ -2,33 +2,47 @@ using System.Collections;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace XED.UI
|
namespace XED.UI
|
||||||
{
|
{
|
||||||
public class UI_ButtonDropdown : UnityEngine.MonoBehaviour, IDeselectHandler
|
public class UI_ButtonDropdown : UnityEngine.MonoBehaviour, IDeselectHandler
|
||||||
{
|
{
|
||||||
|
Image buttonImage;
|
||||||
[SerializeField] protected GameObject dropdownScrollview;
|
[SerializeField] protected GameObject dropdownScrollview;
|
||||||
[SerializeField] private UnityEvent onDeselect;
|
[SerializeField] private UnityEvent onDeselect;
|
||||||
[SerializeField] float openTime = 0.1f;
|
[SerializeField] float openTime = 0.1f;
|
||||||
private Vector3 closeScale = new Vector3(1, 0, 1);
|
private Vector3 closeScale = new Vector3(1, 0, 1);
|
||||||
|
[SerializeField] bool isButtonImageToggle = false;
|
||||||
|
[SerializeField] Color closeColor = new Color(1, 1, 1, 1);
|
||||||
|
[SerializeField] Color openColor = new Color(1, 1, 1, 1);
|
||||||
private bool isOpen = false;
|
private bool isOpen = false;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
if (isButtonImageToggle) buttonImage = GetComponent<Image>();
|
||||||
dropdownScrollview.transform.localScale = closeScale;
|
dropdownScrollview.transform.localScale = closeScale;
|
||||||
gameObject.AddComponent<MeshRenderer>();
|
gameObject.AddComponent<MeshRenderer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Open()
|
public virtual void Open()
|
||||||
{
|
{
|
||||||
isOpen = !isOpen;
|
isOpen = !isOpen;
|
||||||
|
if (isOpen)
|
||||||
|
{
|
||||||
|
if (isButtonImageToggle) buttonImage.color = openColor;
|
||||||
StopAllCoroutines();
|
StopAllCoroutines();
|
||||||
if (isOpen) StartCoroutine(CoroutineOpen());
|
StartCoroutine(CoroutineOpen());
|
||||||
else StartCoroutine(CoroutineClose());
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
isOpen = false;
|
isOpen = false;
|
||||||
|
if (isButtonImageToggle) buttonImage.color = closeColor;
|
||||||
StopAllCoroutines();
|
StopAllCoroutines();
|
||||||
StartCoroutine(CoroutineClose());
|
StartCoroutine(CoroutineClose());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user