修改all race跳到顶上的bug

This commit is contained in:
CaiYanPeng 2021-08-09 17:11:14 +08:00
parent 7a1042d184
commit 40bb16a132
2 changed files with 9 additions and 5 deletions

View File

@ -167,6 +167,8 @@ public class RaceHomeScript : RaceScript
//scroll.content //scroll.content
} }
rightContainer.Find("Container-2/BtnGoList").SetAsLastSibling(); rightContainer.Find("Container-2/BtnGoList").SetAsLastSibling();
rightContainer.Find("Container-2/BtnGoList").GetComponent<RaceMaskScript>().localY =
list.Count < 4 ? -167.5f :-492.5f;
} }
void OnBannerClick(MapCompetition map) void OnBannerClick(MapCompetition map)
{ {

View File

@ -5,21 +5,23 @@ using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
public class RaceMaskScript : MonoBehaviour, IPointerEnterHandler,IPointerExitHandler public class RaceMaskScript : MonoBehaviour, IPointerEnterHandler,IPointerExitHandler
{ {
float? localY = null; public float? localY { get; set; }
public void OnPointerEnter(PointerEventData eventData) public void OnPointerEnter(PointerEventData eventData)
{ {
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(1, 0.5f); transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
if (localY == null) if (localY.HasValue)
{ {
localY = transform.localPosition.y; transform.DOLocalMoveY(localY.Value + 5, 0.3f);
} }
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
} }
public void OnPointerExit(PointerEventData eventData) public void OnPointerExit(PointerEventData eventData)
{ {
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(0, 0.5f); transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(0, 0.5f);
transform.DOLocalMoveY(localY.Value, 0.3f); if (localY.HasValue)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
} }
// Start is called before the first frame update // Start is called before the first frame update