Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp

This commit is contained in:
CaiYanPeng 2022-01-25 17:17:17 +08:00
commit 3da12c3054
6 changed files with 60 additions and 35 deletions

View File

@ -404,6 +404,8 @@ public class MainController : BaseScene
var message = lang == "zh" ? $"{item.Name}进入了 运动地球" : "entered PowerFun";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(-1, message, item.HeadImage, item.Name, item.RouteName), $"{item.Id}{item.LastActiveTime}{item.Point}");
}
if (!string.IsNullOrEmpty(item.RouteName))
continue;
if (item.RouteId > 0)
{
var message = "";
@ -478,18 +480,22 @@ public class MainController : BaseScene
{
var tempRecordData = Newtonsoft.Json.JsonConvert.DeserializeObject<TempRecordData>(content);
App.tempRecordData = tempRecordData;
UIManager.ShowConfirm(App.GetLocalString("Reconnect"), App.GetLocalString("Did you want to reconnect the trip that was interrupted abnormally?"), () => {
if (App.tempRecordData.UserId == App.CurrentUser.Id)
{
UIManager.ShowConfirm(App.GetLocalString("Reconnect"), App.GetLocalString("Did you want to reconnect the trip that was interrupted abnormally?"), () =>
{
App.RouteIdParam = App.tempRecordData.RouteId;
App.CompetionId = App.tempRecordData.CompetitionId;
SceneManager.LoadScene("Ride");
},2,()=> {
}, 2, () =>
{
Helper.DelectDir(PFConstants.MapWorkoutRecordTempFolder);
App.tempRecordData = null;
});
}
}
}
}
private void OnDestroy()
{
EventQueueSystem.RemoveListener<LinkedMessageEvent>(LinkedMessageHandler);

View File

@ -274,6 +274,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
public class TempRecordData
{
public int CompetitionId { get; set; }
public int UserId { get; set; }
public int RouteId { get; set; }
public RouteResultParam selectParam { get; set; }
public double CurrentRouteStartDistance { get; set; }

View File

@ -126,6 +126,10 @@ namespace Assets.Scenes.Ride.Scripts
cyclingExcutor = mainController.cyclingController;
ComputeNextSlope();//计算下一个坡度相关数据
}
public virtual void UpdateAnimator()
{
characterAnimator = GetComponentInChildren<Animator>();
}
protected virtual void Excute()
{

View File

@ -372,8 +372,8 @@ namespace Assets.Scenes.Ride.Scripts
//{
// return;
//}
mainController.Is3dView = false;
ChangeView(null);
//mainController.Is3dView = true;
}
}

View File

@ -716,7 +716,7 @@ public class CyclingController : DeviceServiceMonoBase
private GameObject onlinePlayer { get; set; }
Vector3 MAX_SIZE = new Vector3(3f, 3f, 3f);
Vector3 MIN_SIZE = new Vector3(1f, 1f, 1f);
Vector3 MIN_SIZE = new Vector3(0.1f, 0.1f, 0.1f);
public void ChangeCurrentPlayer(int userId)
{
var coll = FindObjectsOfType<AbstractPlayer>();
@ -733,7 +733,15 @@ public class CyclingController : DeviceServiceMonoBase
Utils.DestroyChildren(selectedPlayer.transform);
var ss = Instantiate(onlineUserPrefab3d, selectedPlayer.transform);
ss.transform.localScale = Is3dView ? MAX_SIZE : MIN_SIZE;
selectedPlayer.UpdateAnimator();
}
Vector2d nextLatLon = Along(selectedPlayer.TotalDistance + 0.1);
//设定人物方向
var s = map.GeoToWorldPosition(selectedPlayer.Currentlatlong);
var e = map.GeoToWorldPosition(nextLatLon);
Quaternion neededRotation = Quaternion.LookRotation(s - e);
selectedPlayer.transform.rotation = Quaternion.Euler(0, neededRotation.eulerAngles.y, 0);
selectedPlayer.currentRotation = neededRotation;
}
var unselectedPlayers = coll.Where(c => c.UserId != userId).ToList();
@ -893,7 +901,7 @@ public BaseUIManager singleUIManager;
{
currentUser.SetDataSource(onlineTotalDistance, onlineDistance, onlineRider.Power, onlineRider.HeartRate, onlineRider.Cadence, onlineRider.TotalTicks, onlineRider.NickName, onlineRider.WeightKg, new Vector2d(onlineRider.Point.Latitude, onlineRider.Point.Longitude), index);
}
//如果是观察者且当前第一此进入场景(TODO这样切换会闪一下待解决)
if (isWatch && (currentPlayer is PlayerController || currentPlayer == null))
{
var userId = onlineRiders.FirstOrDefault()?.UserId ?? 0;
@ -1157,6 +1165,7 @@ public BaseUIManager singleUIManager;
RecorderDataModel recorderData = cyclingController.recorderData;
tempRecordData.RiderDatas = recorderData.RiderDatas;
tempRecordData.selectParam = recorderData.selectParam;
tempRecordData.UserId = App.CurrentUser.Id;
tempRecordData.RouteId = mapRoute.Id;
tempRecordData.CompetitionId = recorderData.Competitionid;
tempRecordData.StartTime = startTime;

View File

@ -30,27 +30,32 @@ namespace Assets.Scenes.Ride.Scripts
//创建UI
var uipanel = mainController.GetUIPanel();
uiObject = uipanel.transform.Find("ArrowList");
if (mainController.cyclingController.Mode == CyclingModel.Competition)
{
#if UNITY_IOS || UNITY_ANDROID
var CompetitionArrow = mainController.GetCompetitionMobileArrow();
arrowImage = Instantiate(CompetitionArrow, uiObject);
#else
var CompetitionArrow = mainController.GetCompetitionArrow();
arrowImage = Instantiate(CompetitionArrow, uiObject);
#endif
//比赛模式
if (!string.IsNullOrEmpty(headUrl))
{
var rawImge = arrowImage.transform.Find("Head").GetComponent<RawImage>();
Utils.DisplayImage(rawImge, headUrl, true);
rawImge.gameObject.SetActive(true);
}
}
else
// if (mainController.cyclingController.Mode == CyclingModel.Competition)
// {
//#if UNITY_IOS || UNITY_ANDROID
// var CompetitionArrow = mainController.GetCompetitionMobileArrow();
// arrowImage = Instantiate(CompetitionArrow, uiObject);
//#else
// var CompetitionArrow = mainController.GetCompetitionArrow();
// arrowImage = Instantiate(CompetitionArrow, uiObject);
//#endif
// //比赛模式
// if (!string.IsNullOrEmpty(headUrl))
// {
// var rawImge = arrowImage.transform.Find("Head").GetComponent<RawImage>();
// Utils.DisplayImage(rawImge, headUrl, true);
// rawImge.gameObject.SetActive(true);
// }
// }
// else
{
arrowImage = Instantiate(Resources.Load<Image>("UI/Prefab/Ride/ReviewArrow"), uiObject);
arrowImage.color = new Color(0.1529412f, 0.8745098f, 0.8901961f);
#if UNITY_IOS || UNITY_ANDROID
arrowImage.transform.DOScale(new Vector3(1f,1f,1f),0);
#else
arrowImage.transform.DOScale(new Vector3(2f,2f,2f),0);
#endif
}
}
public override bool GetStart()
@ -156,11 +161,11 @@ namespace Assets.Scenes.Ride.Scripts
protected override void AfterExcute()
{
var playerScreenPos = Camera.main.WorldToScreenPoint(transform.position);
//如果是比赛模式头像
if (mainController.cyclingModel == CyclingModel.Competition)
{
playerScreenPos.y += 10f;
}
////如果是比赛模式头像
//if (mainController.cyclingModel == CyclingModel.Competition)
//{
// playerScreenPos.y += 10f;
//}
//如果观察的是当前用户 隐藏UI 添加trailrender
var iscurrentUser = mainController.currentPlayer.UserId == UserId;
var s = mainController.currentPlayer.Currentlatlong;