Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts: # Assets/Scenes/Login-Mobile.unity # Assets/Scripts/UI/Prefab/Panel/NewRouteDetailController.cs
This commit is contained in:
commit
f23fc4b4c0
45 files changed
+4765
-1412
No files matched your search
@@ -16,7 +16,11 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
return Get($"Map/GetMapToken?name={name}");
|
||||
}
|
||||
|
||||
public string GetTipsList()
|
||||
{
|
||||
return Get($"Map/GetTipList");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取路线数据
|
||||
/// </summary>
|
||||
@@ -178,9 +182,9 @@ namespace Assets.Scripts.Apis
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<JsonResult<List<MapRoute>>> GetMapRouteAreaDetailList(int id, int pageIndex, int pageSize)
|
||||
public async Task<JsonResult<MapRouteAreaRouteList>> GetMapRouteAreaDetailList(int id, int pageIndex, int pageSize)
|
||||
{
|
||||
var result = await GetAsync<JsonResult<List<MapRoute>>>($"MapRouteArea/GetRouteList?areaId={id}&pageSize={pageSize}&pageIndex={pageIndex}");
|
||||
var result = await GetAsync<JsonResult<MapRouteAreaRouteList>>($"MapRouteArea/GetRouteList?areaId={id}&pageSize={pageSize}&pageIndex={pageIndex}");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Assets.Scripts.Apis.Models
|
||||
|
||||
public bool IsOfficial { get; set; }
|
||||
public int MapCompetitionType { get; set; }
|
||||
public object NickName { get; set; }
|
||||
public string NickName { get; set; }
|
||||
public int pageCount { get; set; }
|
||||
public int RouteId { get; set; }
|
||||
public string Sponsor { get; set; }
|
||||
|
||||
@@ -109,5 +109,7 @@ namespace Assets.Scripts.Apis.Models
|
||||
public string Camera { get; set; }
|
||||
public string MineCountString { get; set; }
|
||||
public int MineCount { get; set; }
|
||||
|
||||
public int[] RouteIds { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,21 @@ namespace Assets.Scripts.Apis.Models
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
|
||||
public class MapRouteAreaRouteList
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<MapRoute> RouteList
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public List<int> RouteIds
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
}
|
||||
public class MapMaxRanking
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -369,6 +369,7 @@ public class MainController : BaseScene
|
||||
//发送消息
|
||||
|
||||
var list = MapUDPService.GetAllOnlineUserList();
|
||||
var lang = App.GetLocalLanguage();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.RouteId > 0)
|
||||
@@ -389,11 +390,11 @@ public class MainController : BaseScene
|
||||
var message = "";
|
||||
if (item.TotalTicks == 0)
|
||||
{
|
||||
message = $"发起了对<color=#ff2742>{item.RouteName}</color>的挑战";
|
||||
message = lang=="zh"?$"发起了对<color=#ff2742>{item.RouteName}</color>的挑战": $"start a challenge to the<color=#ff2742>{item.RouteName}</color>";
|
||||
}
|
||||
if (item.IsCompleted)
|
||||
{
|
||||
message = $"完成了<color=#ff2742>{item.RouteName}</color>的挑战";
|
||||
message = lang == "zh" ? $"完成了<color=#ff2742>{item.RouteName}</color>的挑战": $"completed the challenge of the<color=#ff2742>{item.RouteName}</color>";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
@@ -405,23 +406,35 @@ public class MainController : BaseScene
|
||||
var message = $"{item.Name}上线了";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.Id}{item.LastActiveTime}{item.Point}");
|
||||
}
|
||||
//距离
|
||||
if (item.EndDistance > 50)
|
||||
//距离50
|
||||
if (item.EndDistance >= 50)
|
||||
{
|
||||
var message = $"在骑行过程中突破了<color=#00ff00>{"50KM"}</color>的挑战";
|
||||
var message = lang == "zh" ? $"在骑行过程中突破了<color=#00ff00>{"50KM"}</color>的挑战" : $"distance up to <color=#00ff00>{"50KM"}</color> during riding!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}50KM");
|
||||
}
|
||||
//速度
|
||||
if (item.Speed > 10)
|
||||
//距离100
|
||||
if (item.EndDistance >= 100)
|
||||
{
|
||||
var message = $"在骑行过程中速度达到了惊人的<color=#ff0000>{item.Speed}</color>KM/H";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}10KM/H");
|
||||
var message = lang == "zh" ? $"在骑行过程中突破了<color=#00ff00>{"100KM"}</color>的挑战": $"distance up to <color=#00ff00>{"100KM"}</color> during riding!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}50KM");
|
||||
}
|
||||
//速度35
|
||||
if (item.Speed >= 35)
|
||||
{
|
||||
var message = lang == "zh" ? $"在骑行过程中速度达到了惊人的<color=#ff0000>{Math.Round(item.Speed, 2)}</color>KM/H": $"speed up to <color=#ff0000>{Math.Round(item.Speed, 2)}</color>KM/H during riding!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}35KM/H");
|
||||
}
|
||||
//速度50
|
||||
if (item.Speed >= 50)
|
||||
{
|
||||
var message = lang == "zh" ? $"在骑行过程中速度达到了惊人的<color=#ff0000>{Math.Round(item.Speed,2)}</color>KM/H" : $"speed up to <color=#ff0000>{Math.Round(item.Speed, 2)}</color>KM/H during riding!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}50KM/H");
|
||||
}
|
||||
//功体比
|
||||
if (item.WeightKg > 2)
|
||||
if (item.WeightKg >= 3)
|
||||
{
|
||||
var message = $"在骑行过程中功体比达到了惊人的<color=#0000ff>{item.WeightKg}</color>w/kg";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}2WeightKg");
|
||||
var message = lang == "zh" ? $"在骑行过程中功体比达到了惊人的<color=#0000ff>{Math.Round(item.WeightKg, 2)}</color>w/kg": $"w/kg up to <color=#0000ff>{Math.Round(item.WeightKg, 2)}</color>w/kg during riding!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name), $"{item.RouteId}{item.Name}3WeightKg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,8 +252,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
AddProcess(20);
|
||||
#endregion
|
||||
|
||||
StartCoroutine(HiddenLoading());
|
||||
//StartCoroutine(HiddenLoading());
|
||||
}
|
||||
private int maxShowCout = 9;
|
||||
private void ShowPlayers(List<CompetitionPlayer> list)
|
||||
|
||||
@@ -6,6 +6,7 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -19,6 +20,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
GameObject TitleImage { get; set; }
|
||||
GameObject WatchTitle { get; set; }
|
||||
GameObject RankingPanel { get; set; }
|
||||
GameObject ShareButton { get; set; }
|
||||
GameObject ToolBarPanel { get; set; }
|
||||
GameObject WeChatButton { get; set; }
|
||||
|
||||
|
||||
RawImage TopHead { get; set; }
|
||||
RawImage SecondHead { get; set; }
|
||||
RawImage ThirdHead { get; set; }
|
||||
@@ -50,8 +56,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
WatchTitle = transform.Find("WatchTitle").gameObject;
|
||||
CloseTitle = transform.Find("CloseTitle").GetComponent<Text>();
|
||||
CloseTime = transform.Find("CloseTime").GetComponent<Text>();
|
||||
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
ShareButton = transform.Find("ShareButton").gameObject;
|
||||
ToolBarPanel = transform.Find("ToolBarPanel").gameObject;
|
||||
WeChatButton = transform.Find("ToolBarPanel/WeChatButton").gameObject;
|
||||
ShareButton.SetActive(!cyclingController.isWatch);
|
||||
UIManager.AddEvent(ShareButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, OpenShare);
|
||||
UIManager.AddEvent(WeChatButton, UnityEngine.EventSystems.EventTriggerType.PointerClick, OpenShare);
|
||||
#endif
|
||||
SpriteTop = Resources.Load<Sprite>("Images/Ride/Match/top-1");
|
||||
SpriteSecond = Resources.Load<Sprite>("Images/Ride/Match/top-2");
|
||||
SpriteThrid = Resources.Load<Sprite>("Images/Ride/Match/top-3");
|
||||
@@ -212,5 +224,24 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
SceneManager.LoadScene("MainScene");
|
||||
App.MainSceneParam["Name"] = "RaceHomePanel";
|
||||
}
|
||||
|
||||
private void OpenShare(BaseEventData baseEventData)
|
||||
{
|
||||
((RectTransform)ToolBarPanel.transform).pivot = new Vector2(0, ((RectTransform)ToolBarPanel.transform).pivot.y);
|
||||
ShareButton.SetActive(false);
|
||||
ToolBarPanel.transform.DOScaleX(1, 1);
|
||||
}
|
||||
|
||||
private void ShareWechat(BaseEventData baseEventData)
|
||||
{
|
||||
if (App.weChatController.IsWeChatAppInstalled())
|
||||
{
|
||||
App.weChatController.ShareWebpageToWX(0, $"{App.CurrentUser.WebHost}Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}", cyclingController.competition.NickName, "By " + App.CurrentUser.Nickname);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(null, "未安装微信");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
App.TextureCache.Clear();
|
||||
mapApi = new MapApi();
|
||||
ShowLoading();
|
||||
//ShowLoading();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
@@ -144,18 +144,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Utils.DisplayImageAysnc(StartCoroutine, mapRouteImage, url, DowloadCallBack);
|
||||
}
|
||||
}
|
||||
protected void DowloadCallBack(string url)
|
||||
protected void DowloadCallBack(string url,RawImage rawImage)
|
||||
{
|
||||
if (!App.TextureCache.ContainsKey(url))
|
||||
{
|
||||
App.TextureCache.Add(url, mapRouteImage.texture);
|
||||
App.TextureCache.Add(url, rawImage?.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.TextureCache[url] = mapRouteImage.texture;
|
||||
App.TextureCache[url] = rawImage?.texture;
|
||||
}
|
||||
var canvasGroup = mapRouteImage.GetComponent<CanvasGroup>();
|
||||
canvasGroup.DOFade(1, 1);
|
||||
var canvasGroup = rawImage.GetComponent<CanvasGroup>();
|
||||
canvasGroup?.DOFade(1, 1);
|
||||
}
|
||||
//设定当前loading进度
|
||||
public virtual void AddProcess(float v)
|
||||
|
||||
@@ -248,9 +248,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
MoveElevationImage();
|
||||
BindDataSource();
|
||||
MoveCamera();
|
||||
time += 1f;
|
||||
}
|
||||
MoveCamera();
|
||||
MoveDistance();
|
||||
}
|
||||
private float cameraX = 0;
|
||||
private float cameraY = 0;
|
||||
@@ -313,7 +314,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//影子骑行按钮控制
|
||||
if (mainController.mapRouteRankingList == null || mainController.mapRouteRankingList.Count == 0)
|
||||
{
|
||||
shadowButton.image.sprite = Resources.Load<Sprite>("Images/Ride/Shadow Mode_no");
|
||||
var lang = App.GetLocalLanguage();
|
||||
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;
|
||||
}
|
||||
@@ -347,14 +349,25 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
ChangeView(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//移动摄像头和箭头位置
|
||||
//移动摄像头
|
||||
public void MoveCamera()
|
||||
{
|
||||
if (target != null && mainController.Is3dView && mainController.RotateLock && mainController.currentPlayer.Speed > 0)
|
||||
{
|
||||
Vector3 v = Vector3.zero;
|
||||
v.y += mainController.currentPlayer.currentRotation.eulerAngles.y + 160f;
|
||||
if (mainController.RotateLock)
|
||||
{
|
||||
target.transform.DOLocalRotate(v, 1f, RotateMode.Fast);
|
||||
}
|
||||
}
|
||||
}
|
||||
//移动3d人物和箭头位置
|
||||
public void MoveDistance()
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
target.transform.position = mainController.currentPlayer.currentPos; //player.transform.position;// new Vector3((float)Math.Round(player.transform.position.x,1), 0, (float)Math.Round(player.transform.position.z,1));
|
||||
if (!mainController.Is3dView)
|
||||
{
|
||||
Vector3 v = Vector3.zero;
|
||||
@@ -363,17 +376,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//mainController.player.transform.localScale.Set(0.1f, 0.1f, 0.1f);
|
||||
player.transform.localScale = m;
|
||||
}
|
||||
else
|
||||
{
|
||||
//3d视角跟随人物转动
|
||||
//CameraVector.x = cameraX;
|
||||
//CameraVector.y = cameraY;
|
||||
//CameraVector.z = cameraZ;
|
||||
//target.transform.eulerAngles = CameraVector;
|
||||
Vector3 v = Vector3.zero;
|
||||
v.y += mainController.currentPlayer.currentRotation.eulerAngles.y + 160f; //target.transform.rotation = playerController.transform.rotation;//new Quaternion(playerController.transform.rotation.x, playerController.transform.rotation.y +1f, playerController.transform.rotation.z, playerController.transform.rotation.w);
|
||||
target.transform.eulerAngles = v; //.Set(0, playerController.currentRotation.eulerAngles.y + 160f, 0);// = new Vector3(0, playerController.transform.eulerAngles.y + 160f, 0);
|
||||
}
|
||||
target.transform.position = mainController.currentPlayer.currentPos;
|
||||
//target.transform.DOLocalMove(mainController.currentPlayer.currentPos, 0.5f); //player.transform.position;// new Vector3((float)Math.Round(player.transform.position.x,1), 0, (float)Math.Round(player.transform.position.z,1));
|
||||
//控制照片移动
|
||||
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||
if (mainController.currentPlayer.Speed > 0 && mainController.isStart)
|
||||
@@ -386,7 +390,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
}
|
||||
//绑定数据源
|
||||
|
||||
public void BindDataSource()
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
|
||||
@@ -23,6 +23,8 @@ using ChartAndGraph;
|
||||
using UnityEngine.UI;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine.SceneManagement;
|
||||
using DG.Tweening;
|
||||
using System.Timers;
|
||||
|
||||
public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
@@ -99,6 +101,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
void OnDestroy()
|
||||
{
|
||||
//MapUDPService.Dispose();
|
||||
TouchKit.removeAllGestureRecognizers();
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
}
|
||||
@@ -170,6 +173,9 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
return CompetitionMobileArrow;
|
||||
}
|
||||
|
||||
public bool RotateLock = true;
|
||||
|
||||
private bool touchLock = true;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -230,6 +236,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
|
||||
SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
|
||||
|
||||
HandleTouchAndInput();
|
||||
//进入比赛
|
||||
if (competitionId > 0)
|
||||
{
|
||||
@@ -243,7 +250,10 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
StartCoroutine(Init());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
float timer = 1f;
|
||||
bool clearLock = false;
|
||||
|
||||
@@ -251,6 +261,94 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
ClearTempFile();
|
||||
}
|
||||
#region 手势移动&PC鼠标的控制
|
||||
private void HandleTouchAndInput()
|
||||
{
|
||||
var rotationRecognizer = new TKOneFingerRotationRecognizer
|
||||
{
|
||||
targetPosition = Camera.main.WorldToScreenPoint(target.position)
|
||||
};
|
||||
rotationRecognizer.gestureRecognizedEvent += (r) =>
|
||||
{
|
||||
if (Is3dView && IsPointerOverGameObject(r.startTouchLocation()))
|
||||
{
|
||||
RotateLock = false;
|
||||
DOTween.Kill(target);
|
||||
target.transform.Rotate(new Vector3(0, 1, 0), r.deltaRotation);
|
||||
}
|
||||
};
|
||||
|
||||
var timer = new Timer
|
||||
{
|
||||
Interval = 1000
|
||||
};
|
||||
timer.Elapsed += (s, e) =>
|
||||
{
|
||||
RotateLock = true;
|
||||
timer.Stop();
|
||||
};
|
||||
|
||||
rotationRecognizer.gestureCompleteEvent += (r) => {
|
||||
UnityEngine.Debug.Log("gestureCompleteEvent");
|
||||
timer.Start();
|
||||
};
|
||||
|
||||
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(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) =>
|
||||
{
|
||||
if (Is3dView && IsPointerOverGameObject(PinchRecognizer.startTouchLocation()))
|
||||
{
|
||||
if (cameraList == null)
|
||||
{
|
||||
cameraList = new List<Vector3>();
|
||||
cameraList.Add(near);
|
||||
cameraList.Add(plane);
|
||||
cameraList.Add(far);
|
||||
}
|
||||
var prePos = Camera.main.transform.localPosition;
|
||||
var nextPos = Camera.main.transform.localPosition;
|
||||
if (r.deltaScale < 0)
|
||||
{
|
||||
nextPos = cameraList.Where(c => c.y > Camera.main.transform.localPosition.y).FirstOrDefault();
|
||||
if (nextPos != Vector3.zero)
|
||||
Camera.main.transform.DOLocalMove(nextPos, 0.5f);
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
if (r.deltaScale > 0)
|
||||
{
|
||||
nextPos = cameraList.Where(c => c.y < Camera.main.transform.localPosition.y).LastOrDefault();
|
||||
if (nextPos != Vector3.zero)
|
||||
Camera.main.transform.DOLocalMove(nextPos, 0.5f);
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
}
|
||||
};
|
||||
TouchKit.addGestureRecognizer(PinchRecognizer);
|
||||
}
|
||||
/// <summary>
|
||||
/// 检测是否点击UI
|
||||
/// </summary>
|
||||
@@ -273,6 +371,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
bool _dragStartedOnUI = false;
|
||||
protected override void Update()
|
||||
{
|
||||
@@ -307,23 +407,15 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
float touchTimer = 0.1f;
|
||||
private void FixedUpdate()
|
||||
{
|
||||
touchTimer -= Time.deltaTime;
|
||||
if (touchTimer <= 0)
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
HandleTouch();
|
||||
#else
|
||||
HandleTouch();
|
||||
HandleMouseScrollWheel();
|
||||
#endif
|
||||
touchTimer += 0.1f;
|
||||
}
|
||||
}
|
||||
public bool isWatch { get; set; }
|
||||
private Vector3 currentCameraPos { get; set; }
|
||||
|
||||
Vector3 far = new Vector3(-25, 73, -70);
|
||||
Vector3 plane = new Vector3(-15, 43, -40);
|
||||
Vector3 near = new Vector3(-8, 23, -20);
|
||||
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>
|
||||
@@ -332,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>();
|
||||
@@ -347,16 +440,20 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
nextPos = cameraList.Where(c => c.y > Camera.main.transform.localPosition.y).FirstOrDefault();
|
||||
if (nextPos != Vector3.zero)
|
||||
StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
Camera.main.transform.DOLocalMove(nextPos, 0.5f);
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
|
||||
if (scrollDelta > 0)
|
||||
{
|
||||
nextPos = cameraList.Where(c => c.y < Camera.main.transform.localPosition.y).LastOrDefault();
|
||||
if (nextPos != Vector3.zero)
|
||||
StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
Camera.main.transform.DOLocalMove(nextPos, 0.5f);
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
}
|
||||
|
||||
DateTime startTimpStamp = DateTime.Now;
|
||||
private void HandleTouch()
|
||||
{
|
||||
if (singleUIManager == null)
|
||||
@@ -366,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);
|
||||
}
|
||||
@@ -379,6 +484,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
return;
|
||||
//双手触摸移动摄像机
|
||||
// Store both touches.
|
||||
Touch touchZero = Input.GetTouch(0);
|
||||
@@ -406,13 +512,15 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
nextPos = cameraList.Where(c => c.y > Camera.main.transform.localPosition.y).FirstOrDefault();
|
||||
if (nextPos != Vector3.zero)
|
||||
StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
Camera.main.transform.DOLocalMove(nextPos, 0.5f);
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
if (offset > 0)
|
||||
{
|
||||
nextPos = cameraList.Where(c => c.y < Camera.main.transform.localPosition.y).LastOrDefault();
|
||||
if (nextPos != Vector3.zero)
|
||||
StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
Camera.main.transform.DOLocalMove(nextPos, 0.5f);
|
||||
//StartCoroutine(MoveCamera(prePos, nextPos));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -439,7 +547,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
}
|
||||
private IEnumerator Init()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
yield return null; //new WaitForSeconds(1);
|
||||
mapRoute = mapApi.GetById(routeId).data;
|
||||
loadingController.Init();//初始化loading页面
|
||||
loadingController.AddProcess(10);
|
||||
@@ -671,22 +779,12 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
chartDataSourceScript.InitHorizontalScrolling(index);
|
||||
}
|
||||
|
||||
private IEnumerator MoveCamera(Vector3 prePos, Vector3 nextPos)
|
||||
{
|
||||
float t = 0;
|
||||
while (t < 0.37f)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
|
||||
Camera.main.transform.localPosition = v;
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
//SingleUIManager singleUIManager;
|
||||
public BaseUIManager singleUIManager;
|
||||
public void GameStart()
|
||||
{
|
||||
StartCoroutine(MoveCamera(far, plane));//初始摄像头
|
||||
Camera.main.transform.DOLocalMove(near, 1.5f);
|
||||
//StartCoroutine(MoveCamera(far, near));//初始摄像头
|
||||
var check = CheckAnt();
|
||||
#if UNITY_EDITOR
|
||||
check = true;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using System.Linq;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -62,6 +63,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
altitudeGraph = panel.transform.Find("AltitudeGraph").GetComponent<RawImage>();
|
||||
mapRanking = panel.transform.Find("MapRanking");
|
||||
mapId = panel.transform.Find("MapId").GetComponent<Text>();
|
||||
|
||||
#if UNITY_STANDALONE_WIN
|
||||
UIManager.RemoveEvent(distance.gameObject);
|
||||
UIManager.RemoveEvent(slope.gameObject);
|
||||
@@ -127,20 +129,30 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Utils.DisplayImage(head, userList[0].HeadImage);//头像
|
||||
country.texture = cyclingController.GetCountryImageByCode(route.CountryCode);//上传者国家
|
||||
mapCountry.texture = cyclingController.GetCountryImageByName(userList[0].Country);//路书国家
|
||||
Utils.DisplayImage(altitudeGraph, route.AltitudeGraph);//海拔图
|
||||
//Utils.DisplayImage(altitudeGraph, route.AltitudeGraph);//海拔图
|
||||
Utils.DisplayImageAysnc(StartCoroutine, altitudeGraph, route.AltitudeGraph, DowloadCallBack);
|
||||
}
|
||||
#endregion
|
||||
//异步请求mapbox画出当前路书路线图
|
||||
DrawMapRouteAsync(route.Id);
|
||||
AddProcess(10);
|
||||
//查询排行榜
|
||||
var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 10, "");
|
||||
var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 99999, "");
|
||||
if (list.result)
|
||||
{
|
||||
if (list.data.list.Count > 10)
|
||||
{
|
||||
var ViewAll = panel.transform.Find("ViewAll").gameObject;
|
||||
ViewAll.SetActive(true);
|
||||
UIManager.AddEvent(ViewAll, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Application.OpenURL($"{App.CurrentUser.WebHost}/Routes/{cyclingController.mapRoute.Id}?Token={App.CurrentUser.cookie}");
|
||||
});
|
||||
}
|
||||
CreateRankingList(list.data.list);
|
||||
AddProcess(10);
|
||||
}
|
||||
StartCoroutine(HiddenLoading());
|
||||
//StartCoroutine(HiddenLoading());
|
||||
}
|
||||
|
||||
//创建排行榜
|
||||
@@ -148,17 +160,20 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var prefab = Resources.Load<GameObject>("UI/Prefab/Ride/Mobile/RankingItem");
|
||||
var myprefab = Resources.Load<GameObject>("UI/Prefab/Ride/Mobile/MySelfRankingItem");
|
||||
#else
|
||||
var prefab = Resources.Load<GameObject>("UI/Prefab/Ride/RankingItem");
|
||||
var myprefab = Resources.Load<GameObject>("UI/Prefab/Ride/MySelfRankingItem");
|
||||
#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);
|
||||
int index = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
index++;
|
||||
if (index > 10)
|
||||
break;
|
||||
GameObject newObj = (GameObject)Instantiate(prefab, parent);
|
||||
var selectPlayerItemScript = newObj.GetComponent<RankingItemScript>();
|
||||
selectPlayerItemScript.SetRanking(item.RowNumber.ToString());
|
||||
@@ -168,6 +183,19 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var texture = cyclingController.GetCountryImageByCode(item.CountryCode);
|
||||
selectPlayerItemScript.SetCountry(texture);
|
||||
}
|
||||
//如果有自己的记录显示自己的排名
|
||||
var myself = list.Where(c => c.MySelf).FirstOrDefault();
|
||||
if (myself != null)
|
||||
{
|
||||
GameObject newObj = (GameObject)Instantiate(myprefab, parent);
|
||||
var selectPlayerItemScript = newObj.GetComponent<RankingItemScript>();
|
||||
selectPlayerItemScript.SetRanking(myself.RowNumber.ToString());
|
||||
selectPlayerItemScript.SetName(myself.NickName);
|
||||
selectPlayerItemScript.SetTimer(myself.IsDNF ? "DNF" : myself.TotalTime);
|
||||
selectPlayerItemScript.SetHead(myself.WxHeadImg);
|
||||
var texture = cyclingController.GetCountryImageByCode(myself.CountryCode);
|
||||
selectPlayerItemScript.SetCountry(texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -36,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;
|
||||
@@ -89,12 +92,17 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (cyclingController.currentPlayer.UserId == item.Id)
|
||||
{
|
||||
nearByItemscript.setHead(item.Headimage);
|
||||
nearByItemscript.transform.SetAsFirstSibling();
|
||||
}
|
||||
else
|
||||
{
|
||||
nearByItemscript.transform.SetSiblingIndex((int)Math.Ceiling(item.Near));
|
||||
}
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
nearByItemscript.setCountry(cyclingController.GetCountryImageByName(item.Country));
|
||||
#endif
|
||||
nearByItemscript.setDistance(item.Near.ToString() + "KM");
|
||||
nearByItemscript.transform.SetSiblingIndex((int)item.Near);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
currentlatlong = mainController.GetCenterCoordinate();
|
||||
uipanel = mainController.GetUIPanel();
|
||||
trail = FindObjectOfType<TrailRenderer>();
|
||||
trail.startWidth = 1f;
|
||||
trail.endWidth = 1f;
|
||||
trail.startWidth = 0.5f;
|
||||
trail.endWidth = 0.5f;
|
||||
trail.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
||||
trail.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
||||
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
||||
@@ -60,9 +60,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cadance = mainController.UpdateCadence();
|
||||
weight = App.CurrentUser.Weight;
|
||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||
#if UNITY_EDITOR
|
||||
power = 1430;
|
||||
#endif
|
||||
//#if UNITY_EDITOR
|
||||
power = 143;
|
||||
//#endif
|
||||
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -132,7 +132,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//上传数据
|
||||
public override void Upload()
|
||||
{
|
||||
if (!mainController.cyclingController.recorderData.Saved)//处理重复上传的问题
|
||||
if (mainController.cyclingController.recorderData != null&&!mainController.cyclingController.recorderData.Saved)//处理重复上传的问题
|
||||
{
|
||||
mainController.Save(TotalDistance);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
@@ -40,6 +41,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
GameObject goResultBtn;
|
||||
GameObject cancelBtn;
|
||||
GameObject shareWxBtn;
|
||||
GameObject shareButton;
|
||||
Transform toolbar;
|
||||
#endregion
|
||||
|
||||
CyclingController cyclingController;
|
||||
@@ -68,8 +71,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
#endregion
|
||||
goResultBtn = transform.Find("ConFirmButton").gameObject;
|
||||
cancelBtn = transform.Find("CloseButton").gameObject;
|
||||
toolbar = transform.Find("ToolBarPanel");
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
shareWxBtn = transform.Find("ToolBarPanel/WeChatButton").gameObject;
|
||||
|
||||
shareButton = transform.Find("ShareButton").gameObject;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void InjectController(CyclingController controller)
|
||||
@@ -78,12 +84,27 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cyclingController.AddEvent(goResultBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, GoResult);
|
||||
cyclingController.AddEvent(cancelBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel);
|
||||
cyclingController.AddEvent(shareWxBtn, EventTriggerType.PointerClick, shareToWx);
|
||||
cyclingController.AddEvent(shareButton, EventTriggerType.PointerClick, opneShare);
|
||||
}
|
||||
|
||||
private void opneShare(BaseEventData baseEventData)
|
||||
{
|
||||
((RectTransform)toolbar).pivot = new Vector2(0, ((RectTransform)toolbar).pivot.y);
|
||||
toolbar.gameObject.SetActive(true);
|
||||
shareButton.SetActive(false);
|
||||
toolbar.DOScaleX(1,1);
|
||||
}
|
||||
|
||||
private void shareToWx(BaseEventData b)
|
||||
{
|
||||
var bs = cyclingController.CaptureCamera();
|
||||
WeChatController.Instance.ShareImageToWX(0, bs);
|
||||
if (App.weChatController.IsWeChatAppInstalled())
|
||||
{
|
||||
App.weChatController.ShareWebpageToWX(0, $"{App.CurrentUser.WebHost}Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}", cyclingController.competition.NickName, "By " + App.CurrentUser.Nickname);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(null, "未安装微信");
|
||||
}
|
||||
}
|
||||
|
||||
private void GoResult(BaseEventData baseEventData)
|
||||
|
||||
@@ -203,13 +203,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
lineRender.startColor = new Color(1, 1, 1, 0.65f);
|
||||
|
||||
//设置宽度
|
||||
lineRender.startWidth = 1.5f;
|
||||
lineRender.endWidth = 1.5f;
|
||||
lineRender.startWidth = 1f;
|
||||
lineRender.endWidth = 1f;
|
||||
lineRender.positionCount = dat.Count;
|
||||
lineRender.SetPositions(feat.Points[0].ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 10;
|
||||
//lineRender.numCornerVertices = 30;
|
||||
lineRender.numCornerVertices = 30;
|
||||
|
||||
|
||||
}
|
||||
@@ -231,13 +231,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
lineRender.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||
|
||||
//设置宽度
|
||||
lineRender.startWidth = 1f;
|
||||
lineRender.endWidth = 1f;
|
||||
lineRender.startWidth = 0.5f;
|
||||
lineRender.endWidth = 0.5f;
|
||||
lineRender.positionCount = feat.Count;
|
||||
lineRender.SetPositions(feat.ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 10;
|
||||
//lineRender.numCornerVertices = 10;
|
||||
lineRender.numCornerVertices = 10;
|
||||
//
|
||||
lineRender.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
lineRender.allowOcclusionWhenDynamic = false;
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
UIManager.AddEvent(startBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide);
|
||||
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SingleRide);
|
||||
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShadowRide);
|
||||
@@ -100,7 +99,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
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
using DG.Tweening;
|
||||
using System.Timers;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
@@ -119,8 +120,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 =>
|
||||
{
|
||||
@@ -135,7 +146,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)
|
||||
{
|
||||
@@ -164,14 +175,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:
|
||||
@@ -1,6 +1,8 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -18,6 +20,8 @@ public class NewRouteDetailController : PFUIPanel
|
||||
{false,Resources.Load<Sprite>("Images/NewDesign/icon_heji_unlike") },
|
||||
{true,Resources.Load<Sprite>("Images/NewDesign/icon_heji_like") },
|
||||
};
|
||||
List<int> routeIds { get; set; }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
caches = new Dictionary<string, Texture>();
|
||||
@@ -85,7 +89,7 @@ public class NewRouteDetailController : PFUIPanel
|
||||
rect.offsetMin = new Vector2(rect.offsetMin.x, 0);
|
||||
BindHeadImage();
|
||||
}
|
||||
|
||||
float timer = 1f;
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -104,6 +108,18 @@ public class NewRouteDetailController : PFUIPanel
|
||||
OnEndDrag(null);
|
||||
}
|
||||
}
|
||||
timer -= Time.deltaTime;
|
||||
while (timer < 0)
|
||||
{
|
||||
var list = MapUDPService.GetAllOnlineUserList();
|
||||
if (list.Count > 0 && routeIds != null)
|
||||
{
|
||||
//当前集合骑行人数
|
||||
var currentUserCount = list.Where(c => routeIds.Contains(c.RouteId)).Count();
|
||||
Debug.Log($"当前集合骑行人数{currentUserCount}");
|
||||
}
|
||||
timer += 1f;
|
||||
}
|
||||
}
|
||||
MapRouteAreaItem area;
|
||||
int pageIndex = 0, pageSize = 10;
|
||||
@@ -171,9 +187,10 @@ public class NewRouteDetailController : PFUIPanel
|
||||
var res = await ConfigHelper.mapApi.GetMapRouteAreaDetailList(area.Id, pageIndex, pageSize);
|
||||
if (res.result)
|
||||
{
|
||||
if (res.data.Count > 0)
|
||||
if (res.data.RouteList.Count > 0)
|
||||
{
|
||||
DisplayMaps(res.data);
|
||||
DisplayMaps(res.data.RouteList);
|
||||
routeIds = res.data.RouteIds;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+17
-17
@@ -925,12 +925,12 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (eventTriggerType == EventTriggerType.PointerClick)
|
||||
{
|
||||
var audioSource = gameObject.GetComponent<AudioSource>();
|
||||
if (audioSource != null)
|
||||
audioSource.PlayOneShot(buttonClip);
|
||||
}
|
||||
//if (eventTriggerType == EventTriggerType.PointerClick)
|
||||
//{
|
||||
// var audioSource = gameObject.GetComponent<AudioSource>();
|
||||
// if (audioSource != null)
|
||||
// audioSource.PlayOneShot(buttonClip);
|
||||
//}
|
||||
call(e);
|
||||
});
|
||||
|
||||
@@ -942,17 +942,17 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
cursor = Resources.Load<Texture2D>("Images/PointerButtonHover");
|
||||
}
|
||||
//设置点击音效
|
||||
if (buttonClip == null)
|
||||
{
|
||||
buttonClip = Resources.Load<AudioClip>("audio/高科技UI点击触控警告提示反馈APP菜单UI-很酷的应用程序_爱给网_aigei_com");
|
||||
}
|
||||
var audioSource = gameObject.GetComponent<AudioSource>();
|
||||
if (audioSource == null)
|
||||
{
|
||||
audioSource = gameObject.AddComponent<AudioSource>();
|
||||
}
|
||||
audioSource.volume = 0.5f;
|
||||
////设置点击音效
|
||||
//if (buttonClip == null)
|
||||
//{
|
||||
// buttonClip = Resources.Load<AudioClip>("audio/高科技UI点击触控警告提示反馈APP菜单UI-很酷的应用程序_爱给网_aigei_com");
|
||||
//}
|
||||
//var audioSource = gameObject.GetComponent<AudioSource>();
|
||||
//if (audioSource == null)
|
||||
//{
|
||||
// audioSource = gameObject.AddComponent<AudioSource>();
|
||||
//}
|
||||
//audioSource.volume = 0.5f;
|
||||
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) =>
|
||||
{
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace Assets.Scripts
|
||||
|
||||
}
|
||||
|
||||
public static void DisplayImageAysnc(StartCoroutine startCoroutine, RawImage img, string url,Action<string> action)
|
||||
public static void DisplayImageAysnc(StartCoroutine startCoroutine, RawImage img, string url,Action<string,RawImage> action)
|
||||
{
|
||||
startCoroutine(DownloadImageCallBack(img, url, action));
|
||||
}
|
||||
@@ -482,7 +482,7 @@ namespace Assets.Scripts
|
||||
_t.name = MediaUrl;
|
||||
return _t;
|
||||
}
|
||||
static IEnumerator DownloadImageCallBack(RawImage img, string MediaUrl,Action<string> action)
|
||||
static IEnumerator DownloadImageCallBack(RawImage img, string MediaUrl,Action<string,RawImage> action)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
|
||||
yield return request.SendWebRequest();
|
||||
@@ -492,7 +492,7 @@ namespace Assets.Scripts
|
||||
{
|
||||
var data = request.downloadHandler.data;
|
||||
img.texture = Utils.GetDownloadTexture(MediaUrl, data);
|
||||
action.Invoke(MediaUrl);
|
||||
action.Invoke(MediaUrl, img);
|
||||
}
|
||||
}
|
||||
/*显示网络图片*/
|
||||
|
||||
Reference in new issue
Block a user