骑行界面优化&PCtips显示调整
This commit is contained in:
1 parent
d91dc17ea7
commit
2743c8d185
23 files changed
+1368
-769
No files matched your search
@@ -8,6 +8,7 @@ using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
using DG.Tweening;
|
||||
using System.Timers;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
@@ -109,8 +110,18 @@ namespace Assets.Scripts.UI.Control
|
||||
}
|
||||
}
|
||||
public bool showTooltip { get; set; }
|
||||
|
||||
private void BindEvent()
|
||||
{
|
||||
Timer timer = new Timer();
|
||||
timer.Interval = 1000;
|
||||
var group = tooltips.GetComponent<CanvasGroup>();
|
||||
timer.Elapsed += (r, s) =>
|
||||
{
|
||||
timer.Stop();
|
||||
group.DOFade(1, 0.5f);
|
||||
};
|
||||
|
||||
//鼠标进入
|
||||
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerEnter, new UnityEngine.Events.UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||
{
|
||||
@@ -125,7 +136,7 @@ namespace Assets.Scripts.UI.Control
|
||||
#endif
|
||||
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
|
||||
tooltips.SetActive(true);
|
||||
tooltips.GetComponent<CanvasGroup>().DOFade(1f, 0.2f);
|
||||
timer.Start();
|
||||
}
|
||||
switch (mType)
|
||||
{
|
||||
@@ -154,14 +165,17 @@ namespace Assets.Scripts.UI.Control
|
||||
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerExit, new UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
if (!this.isActiveAndEnabled) return;
|
||||
timer.Stop();
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
if (!string.IsNullOrWhiteSpace(Tooltips))
|
||||
{
|
||||
#else
|
||||
if (!string.IsNullOrWhiteSpace(Tooltips) && showTooltip)
|
||||
{
|
||||
#endif
|
||||
tooltips.SetActive(false);
|
||||
#endif
|
||||
group.DOFade(0, 1f).onComplete += () => {
|
||||
tooltips.SetActive(false);
|
||||
};
|
||||
}
|
||||
//Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
switch (mType)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using Assets.Scripts;
|
||||
|
||||
public class MultiTips:PFUIText
|
||||
{
|
||||
private Text text;
|
||||
private Button button;
|
||||
private string[] tips { get; set; }
|
||||
private int currentIndex = 0;
|
||||
|
||||
new void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
text = GetComponent<Text>();
|
||||
var tiplist = ConfigHelper.mapApi.GetTipsList();
|
||||
if (!string.IsNullOrEmpty(tiplist))
|
||||
{
|
||||
tips = tiplist.Split(',');
|
||||
}
|
||||
var random = new System.Random();
|
||||
currentIndex = random.Next(0, tips.Length);
|
||||
SetText();
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
new void Start()
|
||||
{
|
||||
base.Awake();
|
||||
}
|
||||
public void SetText()
|
||||
{
|
||||
if(text == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (currentIndex <= tips.Length)
|
||||
{
|
||||
text.text = tips[currentIndex];
|
||||
if (currentIndex + 1 < tips.Length)
|
||||
{
|
||||
currentIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
float time = 5f;
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
time -= Time.deltaTime;
|
||||
while (time<0)
|
||||
{
|
||||
SetText();
|
||||
time += 5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81e6186d0c08df64ba2687b894591e90
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user