骑行界面优化&PCtips显示调整
This commit is contained in:
1 parent
d91dc17ea7
commit
2743c8d185
23 files changed
+1368
-769
No files matched your search
@@ -326,12 +326,30 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
public static int GetNearRiderCount()
|
||||
{
|
||||
return onlineUserHelper.OnlineUsers.Where(c=> (c.Point[0] != 0 && c.Point[1] != 0)|| (c.Point[0] != -1 && c.Point[1] != -1)).Count();
|
||||
int count = 0;
|
||||
try
|
||||
{
|
||||
count = onlineUserHelper.OnlineUsers.Where(c => (c.Point[0] != 0 && c.Point[1] != 0) && (c.Point[0] != -1 && c.Point[1] != -1)).Count();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static int GetAllOnlineUserCount()
|
||||
{
|
||||
return onlineUserHelper.OnlineUsers.Count();
|
||||
int count = 0;
|
||||
try
|
||||
{
|
||||
count = onlineUserHelper.OnlineUsers.Count();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
return count;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取附近的人(当前在线的所有人)
|
||||
@@ -340,45 +358,46 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public static IList<NearRiderModel> GetNearRiderData(int pageIndex, int pageSize = 5, double[] point = null)
|
||||
{
|
||||
if (point == null) return null;
|
||||
|
||||
var dict = new List<System.Tuple<double, OnlineUser>>();
|
||||
var allOnlineUsers = onlineUserHelper.OnlineUsers.Where(c=>c.CompetitionId == 0);
|
||||
foreach (var item in allOnlineUsers)
|
||||
try
|
||||
{
|
||||
if (item.Id == App.CurrentUser.Id)
|
||||
var dict = new List<System.Tuple<double, OnlineUser>>();
|
||||
var allOnlineUsers = onlineUserHelper.OnlineUsers.Where(c => c.CompetitionId == 0);
|
||||
foreach (var item in allOnlineUsers)
|
||||
{
|
||||
dict.Add(new Tuple<double, OnlineUser>(0, item));
|
||||
continue;
|
||||
if (item.Id == App.CurrentUser.Id)
|
||||
{
|
||||
dict.Add(new Tuple<double, OnlineUser>(0, item));
|
||||
continue;
|
||||
}
|
||||
if (item.Point[0] != 0 && item.Point[1] != 0)
|
||||
{
|
||||
var distance = Math.Round(TurfHelper.GetDistances(point, item.Point) / 1000, 2);
|
||||
dict.Add(new Tuple<double, OnlineUser>(distance, item));
|
||||
}
|
||||
}
|
||||
if (item.Point[0] != 0 && item.Point[1] != 0)
|
||||
var allList = dict.OrderBy(d => d.Item1);//.Select(d=>d.Item2);
|
||||
var list = allList.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
|
||||
var nearData = list.Select(n => new NearRiderModel()
|
||||
{
|
||||
var distance = Math.Round(TurfHelper.GetDistances(point, item.Point) / 1000, 2);
|
||||
dict.Add(new Tuple<double, OnlineUser>(distance, item));
|
||||
}
|
||||
Headimage = n.Item2.HeadImage,
|
||||
Name = n.Item2.Name,
|
||||
Near = n.Item1, //Math.Round(TurfHelper.GetDistances(point, n.Point) / 1000, 2),
|
||||
KGWeight = n.Item2.WeightKg.ToString(),
|
||||
Speed = Math.Round(n.Item2.Speed, 1),
|
||||
CountryImg = App.Host + $"User/GetCountryImg?userid={n.Item2.Id}",
|
||||
IsSelf = n.Item2.IsSelf,
|
||||
Id = n.Item2.Id,
|
||||
Country = n.Item2.Country,
|
||||
}).ToList();
|
||||
return nearData;
|
||||
}
|
||||
var allList = dict.OrderBy(d => d.Item1);//.Select(d=>d.Item2);
|
||||
var list = allList.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
|
||||
var nearData = list.Select(n => new NearRiderModel()
|
||||
catch (Exception)
|
||||
{
|
||||
Headimage = n.Item2.HeadImage,
|
||||
Name = n.Item2.Name,
|
||||
Near = n.Item1, //Math.Round(TurfHelper.GetDistances(point, n.Point) / 1000, 2),
|
||||
KGWeight = n.Item2.WeightKg.ToString(),
|
||||
Speed = Math.Round(n.Item2.Speed, 1),
|
||||
CountryImg = App.Host + $"User/GetCountryImg?userid={n.Item2.Id}",
|
||||
IsSelf = n.Item2.IsSelf,
|
||||
Id = n.Item2.Id,
|
||||
Country = n.Item2.Country,
|
||||
}).ToList();
|
||||
return nearData;
|
||||
//return new
|
||||
//{
|
||||
// NearData = nearData,
|
||||
// PageCount = (int)Math.Ceiling((double)allList.Count() / pageSize)
|
||||
//};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class OnlineUserHelper
|
||||
{
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (mainController.mapRouteRankingList == null || mainController.mapRouteRankingList.Count == 0)
|
||||
{
|
||||
var lang = App.GetLocalLanguage();
|
||||
shadowButton.image.sprite = lang == "zh"? Resources.Load<Sprite>("Images/Ride/Shadow Mode_no"): Resources.Load<Sprite>("Images/Ride/Shadow Mode_no");
|
||||
shadowButton.image.sprite = lang == "zh"? Resources.Load<Sprite>("Images/Ride/Shadow Mode_PC_d") : Resources.Load<Sprite>("Images/Ride/Shadow Mode_no");
|
||||
shadowButton.enabled = false;
|
||||
shadowButton.interactable = false;
|
||||
}
|
||||
|
||||
@@ -294,28 +294,28 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
};
|
||||
|
||||
TouchKit.addGestureRecognizer(rotationRecognizer);
|
||||
//单指
|
||||
var touchRecognizer = new TKAnyTouchRecognizer(new TKRect(0, 0, Screen.width, Screen.height));
|
||||
DateTime startTimpStamp = DateTime.Now;
|
||||
Vector2 touchLocation = Vector2.down;
|
||||
touchRecognizer.onEnteredEvent += (r) =>
|
||||
{
|
||||
touchLocation = r.startTouchLocation();
|
||||
startTimpStamp = DateTime.Now;
|
||||
};
|
||||
touchRecognizer.onExitedEvent += (r) =>
|
||||
{
|
||||
if (competitionId == 0 && isStart && IsPointerOverGameObject(touchLocation))
|
||||
{
|
||||
var timespan = DateTime.Now - startTimpStamp;
|
||||
UnityEngine.Debug.Log($"{timespan.TotalMilliseconds}");
|
||||
if (timespan.TotalMilliseconds <= 120)
|
||||
{
|
||||
singleUIManager?.ClearPanel(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
TouchKit.addGestureRecognizer(touchRecognizer);
|
||||
////单指
|
||||
//var touchRecognizer = new TKAnyTouchRecognizer(new TKRect(0, 0, Screen.width, Screen.height));
|
||||
//DateTime startTimpStamp = DateTime.Now;
|
||||
//Vector2 touchLocation = Vector2.down;
|
||||
//touchRecognizer.onEnteredEvent += (r) =>
|
||||
//{
|
||||
// touchLocation = r.startTouchLocation();
|
||||
// startTimpStamp = DateTime.Now;
|
||||
//};
|
||||
//touchRecognizer.onExitedEvent += (r) =>
|
||||
//{
|
||||
// if (competitionId == 0 && isStart && IsPointerOverGameObject(touchRecognizer.STAR))
|
||||
// {
|
||||
// var timespan = DateTime.Now - startTimpStamp;
|
||||
// UnityEngine.Debug.Log($"{timespan.TotalMilliseconds}");
|
||||
// if (timespan.TotalMilliseconds <= 120)
|
||||
// {
|
||||
// singleUIManager?.ClearPanel(null);
|
||||
// }
|
||||
// }
|
||||
//};
|
||||
//TouchKit.addGestureRecognizer(touchRecognizer);
|
||||
//双指
|
||||
var PinchRecognizer = new TKPinchRecognizer();
|
||||
PinchRecognizer.gestureRecognizedEvent += (r) =>
|
||||
@@ -407,14 +407,15 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
float touchTimer = 0.1f;
|
||||
private void FixedUpdate()
|
||||
{
|
||||
HandleTouch();
|
||||
HandleMouseScrollWheel();
|
||||
}
|
||||
public bool isWatch { get; set; }
|
||||
private Vector3 currentCameraPos { get; set; }
|
||||
|
||||
Vector3 far = new Vector3(-18, 53, -48);
|
||||
Vector3 plane = new Vector3(-15, 43, -40);
|
||||
Vector3 near = new Vector3(-12, 35, -30);
|
||||
Vector3 far = new Vector3(-18, 50, -48);
|
||||
Vector3 plane = new Vector3(-15.1f, 42, -40);
|
||||
Vector3 near = new Vector3(-11.4f, 31, -30);
|
||||
List<Vector3> cameraList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -423,8 +424,9 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
private void HandleMouseScrollWheel()
|
||||
{
|
||||
var scrollDelta = Input.GetAxis("Mouse ScrollWheel");
|
||||
UnityEngine.Debug.Log($"scrolldelta{scrollDelta}");
|
||||
|
||||
|
||||
if (scrollDelta != 0 && Input.mousePosition != null && !IsPointerOverGameObject(Input.mousePosition))
|
||||
return;
|
||||
if (cameraList == null)
|
||||
{
|
||||
cameraList = new List<Vector3>();
|
||||
@@ -450,6 +452,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
}
|
||||
|
||||
DateTime startTimpStamp = DateTime.Now;
|
||||
private void HandleTouch()
|
||||
{
|
||||
if (singleUIManager == null)
|
||||
@@ -459,11 +463,19 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
UnityEngine.Debug.Log(Input.touches[0]);
|
||||
UnityEngine.Debug.Log($"{Input.touches[0]}{Input.touches[0].phase }");
|
||||
//单击切换极简模式
|
||||
if (Input.touches[0].tapCount==1 && Input.touches[0].phase == TouchPhase.Moved && isStart && singleUIManager.clearLock && competitionId == 0)
|
||||
if (Input.touches[0].tapCount == 1 && Input.touches[0].phase == TouchPhase.Began && isStart && singleUIManager.clearLock && competitionId == 0)
|
||||
{
|
||||
if (IsPointerOverGameObject(Input.mousePosition))
|
||||
startTimpStamp = DateTime.Now;
|
||||
}
|
||||
|
||||
//单击切换极简模式
|
||||
if (Input.touches[0].tapCount==1 && Input.touches[0].phase == TouchPhase.Ended && isStart && singleUIManager.clearLock && competitionId == 0)
|
||||
{
|
||||
var interval = DateTime.Now - startTimpStamp;
|
||||
UnityEngine.Debug.Log(interval);
|
||||
if (interval.TotalMilliseconds<=150 && IsPointerOverGameObject(Input.mousePosition))
|
||||
{
|
||||
singleUIManager?.ClearPanel(null);
|
||||
}
|
||||
@@ -472,6 +484,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
return;
|
||||
//双手触摸移动摄像机
|
||||
// Store both touches.
|
||||
Touch touchZero = Input.GetTouch(0);
|
||||
|
||||
@@ -154,10 +154,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
#endif
|
||||
var parent = panel.transform.Find("MapRanking");
|
||||
var title = panel.transform.Find("RankingTitle").gameObject;
|
||||
if (list.Count == 0)
|
||||
{
|
||||
title.SetActive(false);
|
||||
}
|
||||
title.SetActive(list.Count != 0);
|
||||
foreach (var item in list)
|
||||
{
|
||||
GameObject newObj = (GameObject)Instantiate(prefab, parent);
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
OnlineUserNum.text = " "+ MapUDPService.GetNearRiderCount().ToString();
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(OnlineUserNum.rectTransform);
|
||||
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
|
||||
if (nearList == null)
|
||||
return;
|
||||
var mod = MapUDPService.GetNearRiderCount() % pageSize;
|
||||
var pages = MapUDPService.GetNearRiderCount() / pageSize;
|
||||
totalPages = mod > 0 ? pages + 1 : pages;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
weight = App.CurrentUser.Weight;
|
||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||
//#if UNITY_EDITOR
|
||||
power = 1430;
|
||||
power = 143;
|
||||
//#endif
|
||||
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
timeRemaining = 1.0f;
|
||||
}
|
||||
}
|
||||
countDownTxt.text = count==0?"GO!": count.ToString();
|
||||
countDownTxt.text = count==0?App.GetLocalString("GO!"): count.ToString();
|
||||
}
|
||||
//重置游戏状态
|
||||
public void Reset()
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
_delayTime = App.delayTime;
|
||||
if (_delayTime != -1)
|
||||
{
|
||||
appVersion.text = $"<color={getColor(_delayTime)}>{_delayTime.ToString("0")}MS</color>\n{"V" + App.AppVersion}";
|
||||
appVersion.text = $"<color={getColor(_delayTime)}>{_delayTime.ToString("0")}ms</color>\n{"V" + App.AppVersion}";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user