骑行页面消息通知
在线用户和影子选手用图片显示,缩放等功能按钮微调
This commit is contained in:
1 parent
2b4b2c4f70
commit
8f0598580d
37 files changed
+5951
-3153
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using Assets.Scripts;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -23,7 +24,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
private int offset = 8;//显示区域的数量
|
||||
|
||||
CyclingController cyclingController;
|
||||
private void Start()
|
||||
private void Awake()
|
||||
{
|
||||
cyclingController = FindObjectOfType<CyclingController>();
|
||||
playerController = FindObjectOfType<PlayerController>();
|
||||
@@ -35,15 +36,33 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
UIManager.AddEvent(scroll, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
}
|
||||
}
|
||||
bool startMouse = false;
|
||||
float t =1f;
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetAxis("Mouse ScrollWheel") != 0)
|
||||
{
|
||||
if (scroll.GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1))
|
||||
{
|
||||
startMouse = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (startMouse)
|
||||
{
|
||||
startMouse = false;
|
||||
OnEndDrag(null);
|
||||
}
|
||||
}
|
||||
|
||||
t -= Time.deltaTime;
|
||||
while (t < 0)
|
||||
{
|
||||
Utils.DestroyChildren(transform);
|
||||
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
|
||||
|
||||
totalPages = MapUDPService.GetNearRiderCount();
|
||||
for (int i = 0; i < nearList.Count(); i++)
|
||||
{
|
||||
Create(nearList[i]);
|
||||
@@ -51,20 +70,29 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
t = 1;
|
||||
}
|
||||
}
|
||||
private int totalPages = 0;
|
||||
private void OnEndDrag(BaseEventData arg0)
|
||||
{
|
||||
var scrollrect = scroll.GetComponent<ScrollRect>();
|
||||
if (scrollrect.verticalNormalizedPosition <= 0)
|
||||
{
|
||||
Debug.Log(scrollrect.verticalNormalizedPosition);
|
||||
pageIndex++;
|
||||
var p = pageIndex + 1;
|
||||
if (p * pageSize <= totalPages)
|
||||
{
|
||||
pageIndex++;
|
||||
}
|
||||
//RefreshList();
|
||||
|
||||
}
|
||||
if (scrollrect.verticalNormalizedPosition >= 1)
|
||||
if (scrollrect.verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1))
|
||||
{
|
||||
if(pageIndex > 0)
|
||||
var p = pageIndex - 1;
|
||||
if (p > 0)
|
||||
{
|
||||
pageIndex--;
|
||||
}
|
||||
//if (pageIndex > 0)
|
||||
// pageIndex--;
|
||||
//RefreshList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user