工具栏修改

This commit is contained in:
Caiyanpeng committed 2022-01-11 16:21:13 +08:00
1 parent 05e3d2f887
commit 5672898ce4
5 files changed
+235 -13

No files matched your search

+35 -8
View File
@@ -9,6 +9,7 @@ using UnityEngine.EventSystems;
using UnityEngine.Events;
using DG.Tweening;
using System.Timers;
using System.Collections;
namespace Assets.Scripts.UI.Control
{
@@ -31,7 +32,8 @@ namespace Assets.Scripts.UI.Control
//private Texture2D cursor;
private Outline outline;
private Button mButton;
private Sequence se = null;
protected void Awake()
{
@@ -120,7 +122,6 @@ namespace Assets.Scripts.UI.Control
}
}
public bool showTooltip { get; set; }
private void BindEvent()
{
Timer timer = new Timer();
@@ -128,8 +129,9 @@ namespace Assets.Scripts.UI.Control
var group = tooltips.GetComponent<CanvasGroup>();
timer.Elapsed += (r, s) =>
{
Debug.Log(131);
timer.Stop();
group.DOFade(1, 0.5f);
};
//鼠标进入
@@ -144,9 +146,25 @@ namespace Assets.Scripts.UI.Control
if (!string.IsNullOrWhiteSpace(Tooltips) && showTooltip)
{
#endif
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
tooltips.SetActive(true);
timer.Start();
//tooltips.SetActive(true);
//tooltips.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
//tooltips.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
//DOTween.CompleteAll(true);
se = DOTween.Sequence();
se.SetDelay(1);
se.AppendCallback(() =>
{
DOTween.CompleteAll(true);
tooltips.SetActive(true);
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
tooltips.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
});
se.Play();
//StartCoroutine(DelayShowTooltip());
//timer.Start();
}
switch (mType)
{
@@ -183,6 +201,7 @@ namespace Assets.Scripts.UI.Control
if (!string.IsNullOrWhiteSpace(Tooltips) && showTooltip)
{
#endif
DOTween.CompleteAll(true);
group.DOFade(0, 1f).onComplete += () => {
tooltips.SetActive(false);
};
@@ -215,6 +234,15 @@ namespace Assets.Scripts.UI.Control
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerDown, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{
if (!this.isActiveAndEnabled) return;
DOTween.CompleteAll(true);
tooltips.SetActive(false);
//else
//{
// DOTween.CompleteAll(true);
// tooltips.SetActive(true);
// tooltips.GetComponent<CanvasGroup>().alpha = 0f;
// tooltips.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
//}
switch (mType)
{
case Type.Normal:
@@ -244,7 +272,7 @@ namespace Assets.Scripts.UI.Control
{
if (!this.isActiveAndEnabled) return;
//Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
switch (mType)
{
case Type.Normal:
@@ -275,7 +303,6 @@ namespace Assets.Scripts.UI.Control
}));
}
public void SetEnabled(bool value)
{
base.enabled = value;
+19 -2
View File
@@ -41,7 +41,7 @@ public class MainNav : MonoBehaviour
#if UNITY_ANDROID || UNITY_IOS
UIManager.AddEvent(transform.Find("Delay").gameObject, EventTriggerType.PointerClick, b =>
{
delayTime = 3;
delayTime = 3;
transform.Find("Delay/Tooltips").gameObject.SetActive(true);
transform.Find("Delay/Tooltips").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
});
@@ -57,7 +57,22 @@ public class MainNav : MonoBehaviour
{
UIManager.ShowPrePanel();
});
UIManager.AddEvent(transform.Find("Delay").gameObject, EventTriggerType.PointerClick, x =>
{
var tooltips = transform.Find("Delay/Tooltips").gameObject;
if (tooltips.activeInHierarchy)
{
DOTween.CompleteAll(true);
tooltips.SetActive(false);
}
else
{
DOTween.CompleteAll(true);
tooltips.SetActive(true);
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
tooltips.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
}
});
UIManager.AddEvent(transform.Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowSettingModal();
@@ -94,6 +109,7 @@ public class MainNav : MonoBehaviour
// Update is called once per frame
void Update()
{
#if UNITY_ANDROID || UNITY_IOS
if (delayTime < 0)
{
Debug.Log("小时");
@@ -108,6 +124,7 @@ public class MainNav : MonoBehaviour
Debug.Log(delayTime);
delayTime -= Time.deltaTime;
}
#endif
}
public void ShowExit()