Merge remote-tracking branch 'origin/dev_memory' into dev_cyp
# Conflicts: # Assets/Scenes/Login-Mobile.unity # Assets/Scenes/Login.unity
This commit is contained in:
commit
402f19b8a5
728 files changed
+31285
-60
No files matched your search
@@ -1,8 +1,10 @@
|
||||
using Assets.Scripts;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@@ -292,8 +294,16 @@ namespace Assets.Scripts.Apis
|
||||
request.CookieContainer.Add(item);
|
||||
}
|
||||
|
||||
var settings = new JsonSerializerSettings();
|
||||
|
||||
settings.Converters.Add(new IsoDateTimeConverter
|
||||
{
|
||||
Culture = CultureInfo.CurrentCulture,
|
||||
DateTimeStyles = DateTimeStyles.AssumeLocal
|
||||
});
|
||||
|
||||
var postData = new StringBuilder();
|
||||
var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(data));
|
||||
var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(data, settings));
|
||||
foreach (var item in values)
|
||||
{
|
||||
postData.Append(WebUtility.UrlEncode($"{ item.Key }={ item.Value }&"));
|
||||
|
||||
@@ -25,5 +25,7 @@ namespace Assets.Scripts.Apis.Models
|
||||
public string NickName { get; set; }
|
||||
|
||||
public double WeightKg { get; set; }
|
||||
public double Weight { get; set; }
|
||||
public double BikeWeight { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace Assets.Scripts.Scenes
|
||||
while (true)
|
||||
{
|
||||
ping = new Ping("47.97.84.8");
|
||||
yield return new WaitForSeconds(1);
|
||||
yield return new WaitForSeconds(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,17 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
//AntModelId = antModelId
|
||||
};
|
||||
|
||||
if (param != null)
|
||||
{
|
||||
recorderData.ContinueIndex = param.ContinueIndex??0;
|
||||
if (!string.IsNullOrEmpty(param.ContinueMark)) {
|
||||
recorderData.ContinueMark = param.ContinueMark;
|
||||
}
|
||||
recorderData.EndDistance = param.EndDistance;
|
||||
recorderData.PreDistance = param.EndDistance;
|
||||
recorderData.CurrentRouteStartDistance = param.EndDistance;
|
||||
}
|
||||
|
||||
//recorderData = recorderData1;
|
||||
this.IsRecord = true;
|
||||
//riders = riders1;
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
#region UI行为
|
||||
|
||||
protected virtual void MoveGraphHead()
|
||||
protected virtual void MoveGraphHead(bool init = false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -80,17 +80,6 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
//获取路书信息
|
||||
mapApi = ConfigHelper.mapApi;
|
||||
routeId = App.RouteIdParam > 0? App.RouteIdParam : 2633;
|
||||
//mapRoute = mapApi.GetById(routeId).data;
|
||||
//miniMap = transform.Find("MiniMap").gameObject;//小地图
|
||||
//var panel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Ride/Panel"), UIObject.transform);
|
||||
|
||||
//resultPanel = transform.Find("UI/Panel/ResultPanel").gameObject;
|
||||
|
||||
////获取海拔图UI对象
|
||||
//var graphObject = transform.Find("UI/Panel/GraphChart");
|
||||
//chartDataSourceScript = graphObject.GetComponent<ChartDataSourceScript>();
|
||||
//graph = graphObject.GetComponent<GraphChartBase>();
|
||||
|
||||
competitionId = App.CompetionId;
|
||||
App.CompetionId = 0;//清空比赛参数
|
||||
Resources.UnloadUnusedAssets();
|
||||
@@ -98,7 +87,6 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
//App.TextureCache.Clear();
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
Transform target;
|
||||
@@ -328,19 +316,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
App.routeResult = null;
|
||||
|
||||
#endregion
|
||||
////异步请求mapbox画出当前路书路线图
|
||||
//loadingController.DrawMapRouteAsync(mapRoute.Id);
|
||||
//loadingController.AddProcess(10);
|
||||
//计算上次骑行距离调整地图中心点
|
||||
double endDistance = selectParamModel.EndDistance;
|
||||
coordiantes = Along(endDistance);
|
||||
////查询排行榜
|
||||
//var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 10, "");
|
||||
//if (list.result)
|
||||
//{
|
||||
// loadingController.CreateRankingList(list.data.list);
|
||||
// loadingController.AddProcess(10);
|
||||
//}
|
||||
var shaowList = mapApi.GetShadowList(App.RouteIdParam, "", 0, 10);
|
||||
if (shaowList.result)
|
||||
{
|
||||
@@ -399,8 +376,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
RangeAroundTransformTileProviderOptions options = new RangeAroundTransformTileProviderOptions
|
||||
{
|
||||
targetTransform = target,
|
||||
visibleBuffer = 4,
|
||||
disposeBuffer = 4
|
||||
visibleBuffer = 2,
|
||||
disposeBuffer = 2
|
||||
};
|
||||
map.SetExtent(MapExtentType.RangeAroundTransform, options);
|
||||
map.SetExtentOptions(options);
|
||||
@@ -488,7 +465,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
//初始化海拔图头像位置
|
||||
var index = GetCurrentIndex(recorderData.EndDistance);
|
||||
InitGraph(index);
|
||||
//playerController.InitGraph(index);
|
||||
playerController.CurrentIndex = index;
|
||||
}
|
||||
public void InitGraph(int index)
|
||||
{
|
||||
@@ -499,9 +476,9 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
public void GameStart()
|
||||
{
|
||||
var check = CheckAnt();
|
||||
//#if UNITY_EDITOR
|
||||
// check = true;
|
||||
//#endif
|
||||
#if UNITY_EDITOR
|
||||
check = true;
|
||||
#endif
|
||||
if (check)
|
||||
{
|
||||
singleUIManager.StartRide();
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
|
||||
var mod = MapUDPService.GetNearRiderCount() % pageSize;
|
||||
var pages = MapUDPService.GetNearRiderCount() / pageSize;
|
||||
totalPages = mod > 0 ? pages + 1: pages;
|
||||
totalPages = mod > 0 ? pages + 1 : pages;
|
||||
//删除
|
||||
var currentNearList = FindObjectsOfType<NearByItemScript>();
|
||||
foreach (var item in currentNearList)
|
||||
@@ -54,14 +54,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
for (int i = 0; i < nearList.Count(); i++)
|
||||
{
|
||||
Create(nearList[i]);
|
||||
Create(nearList[i], currentNearList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Create(NearRiderModel item)
|
||||
private void Create(NearRiderModel item, NearByItemScript[] rankingList)
|
||||
{
|
||||
var rankingList = FindObjectsOfType<NearByItemScript>();
|
||||
//var rankingList = FindObjectsOfType<NearByItemScript>();
|
||||
var nearByItemscript = rankingList.Where(c => c.UserId == item.Id).FirstOrDefault();
|
||||
//如果当前有这个用户则更新没有则创建并setslibingindex
|
||||
if (nearByItemscript == null)
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
lineRender.numCornerVertices = 10;
|
||||
}
|
||||
|
||||
protected override void MoveGraphHead()
|
||||
protected override void MoveGraphHead(bool init=false)
|
||||
{
|
||||
if (mainController.cyclingModel == CyclingModel.Competition)
|
||||
{
|
||||
|
||||
@@ -36,6 +36,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//创建UI
|
||||
uiObject = uipanel.transform.Find("ArrowList");
|
||||
arrowImage = Instantiate(Resources.Load<Image>("UI/Prefab/Ride/ReviewArrow"), uiObject);
|
||||
//初始化位置
|
||||
Compute();
|
||||
var initPos = map.GeoToWorldPosition(currentlatlong);
|
||||
initPos.y += 1.35f;//提高y轴让人物站在地图上面
|
||||
transform.localPosition = initPos;
|
||||
CurrentIndex = mainController.GetCurrentIndex(totalDistance);
|
||||
MoveGraphHead(true);
|
||||
}
|
||||
|
||||
double diff = 0;
|
||||
@@ -157,7 +164,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
protected override void MoveGraphHead()
|
||||
protected override void MoveGraphHead(bool init = false)
|
||||
{
|
||||
var itemIndex = chartDataSourceScript.GetViewIndex(CurrentIndex);
|
||||
var m = graph.DataSource.GetPoint("Player 2", itemIndex);
|
||||
@@ -176,7 +183,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
head = headPanel.GetComponentInChildren<RawImage>();
|
||||
head.texture = _reviewItemScript.GetHead();
|
||||
}
|
||||
headPanel.transform.DOMove(new Vector3(itemPosition.x, itemPosition.y, 0), 1);
|
||||
var duration = init ? 0 : 1;
|
||||
headPanel.transform.DOMove(new Vector3(itemPosition.x, itemPosition.y, 0), duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
trail.enabled = false;
|
||||
|
||||
headPanel = uipanel.transform.Find("GraphChart/HeadPanel").gameObject;
|
||||
MoveGraphHead(true);
|
||||
}
|
||||
TargetData targetData;
|
||||
/// <summary>
|
||||
@@ -134,7 +135,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
// chartDataSourceScript.InitHorizontalScrolling(index);
|
||||
//}
|
||||
//移动海拔图头像
|
||||
protected override void MoveGraphHead()
|
||||
protected override void MoveGraphHead(bool init = false)
|
||||
{
|
||||
Vector3 oldPos = headPanel.transform.position;
|
||||
int nextIndex = CurrentIndex;
|
||||
@@ -154,7 +155,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
graph.HorizontalScrolling += offset;
|
||||
}
|
||||
headPanel.transform.DOMove(new Vector3(oldPos.x, nextPosition.y, 0), 1);
|
||||
var duration = init ? 0 : 1;
|
||||
headPanel.transform.DOMove(new Vector3(oldPos.x, nextPosition.y, 0), duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
break;
|
||||
case Model.CyclingModel.Review:
|
||||
singleArea.SetActive(false);
|
||||
//InitReview();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -101,12 +100,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
otherPlayerObj.transform.position = cyclingController.map.GeoToWorldPosition(cyclingController.Along(0));
|
||||
var otherPlayerController = otherPlayerObj.GetComponent<OtherPlayerController>();
|
||||
otherList.Add(otherPlayerController);
|
||||
otherPlayerController.record = item.record;
|
||||
|
||||
otherPlayerController.Weight = cyclingController.selectPlayerDic[item.UserId].Weight;
|
||||
otherPlayerController.BikeWeight = cyclingController.selectPlayerDic[item.UserId].BikeWeight;
|
||||
|
||||
otherPlayerController.record = item.record;
|
||||
otherPlayerController.Weight = item.Weight;
|
||||
otherPlayerController.BikeWeight = item.BikeWeight;
|
||||
otherPlayerController.SetController(reviewItemScript);
|
||||
|
||||
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayer, transform.parent.parent.parent);
|
||||
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
||||
miniController.SetController(otherPlayerController);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using DG.Tweening;
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using UnityEngine.EventSystems;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -29,13 +31,17 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (mainController.routeResult != null)
|
||||
{
|
||||
#region 注释伴侣骑行的重骑和继续骑行的逻辑
|
||||
//if (mainController.routeResult.Mode == CyclingModel.Review.ToString())
|
||||
//{
|
||||
// mainController.SetCyclingModel(CyclingModel.Review);
|
||||
// selectPanel.SetActive(false);
|
||||
// var reviewFactory = reviewPanel.transform.GetComponent<ReviewFactory>();
|
||||
// reviewFactory.Refresh();
|
||||
//}
|
||||
if (mainController.routeResult.Mode == CyclingModel.Review.ToString())
|
||||
{
|
||||
mainController.SetCyclingModel(CyclingModel.Review);
|
||||
selectPanel.SetActive(false);
|
||||
//查询选中人员的骑行记录
|
||||
MapApi mapApi = new MapApi();
|
||||
var rankingList = mapApi.GetRecordFileFromServer(mainController.routeResult.ContinueCyclingParam.RankingsId);
|
||||
var reviewFactory = reviewPanel.transform.GetComponent<ReviewFactory>();
|
||||
reviewFactory.Refresh();
|
||||
reviewFactory.SetReview(rankingList);
|
||||
}
|
||||
#endregion
|
||||
if (mainController.routeResult.Mode == CyclingModel.Single.ToString())
|
||||
{
|
||||
|
||||
@@ -249,8 +249,8 @@ public class RouteItem : MonoBehaviour
|
||||
UIManager.ShowConfirm("ReRide", "Ride again?", () =>
|
||||
{
|
||||
App.RouteIdParam = routeResult.RouteId;
|
||||
App.routeResult = routeResult;
|
||||
App.routeResult.ContinueCyclingParam = null;
|
||||
App.routeResult = null;//routeResult;
|
||||
//App.routeResult.ContinueCyclingParam = null;
|
||||
RecordFromUrl();
|
||||
SceneManager.LoadScene("Ride");
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Threading;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
@@ -53,7 +54,21 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("HomePanel", ref this.mHomePanel);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RunOnUnityThread(Action action)
|
||||
{
|
||||
// is this right?
|
||||
if (unityThread == Thread.CurrentThread.ManagedThreadId)
|
||||
{
|
||||
action();
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (runInUpdate)
|
||||
{
|
||||
runInUpdate.Enqueue(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
private UserInfoController mUserInfoPanel;
|
||||
public UserInfoController UserInfoPanel
|
||||
{
|
||||
@@ -362,9 +377,12 @@ public class UIManager : MonoBehaviour
|
||||
stack.Clear();
|
||||
stack.Push(UIManager.Instance.HomePanel);
|
||||
}
|
||||
public static int unityThread;
|
||||
static public Queue<Action> runInUpdate = new Queue<Action>();
|
||||
private void Awake()
|
||||
{
|
||||
UIManager.Instance = this;
|
||||
unityThread = Thread.CurrentThread.ManagedThreadId;
|
||||
stack = new Stack<PFUIPanel>();
|
||||
loginRegOptions = new LoginRegOptions();
|
||||
var userInfosJson = PlayerPrefs.GetString("UserInfos");
|
||||
@@ -422,7 +440,16 @@ public class UIManager : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
while (runInUpdate.Count > 0)
|
||||
{
|
||||
Action action = null;
|
||||
lock (runInUpdate)
|
||||
{
|
||||
if (runInUpdate.Count > 0)
|
||||
action = runInUpdate.Dequeue();
|
||||
}
|
||||
action?.Invoke();
|
||||
}
|
||||
}
|
||||
//重新查询已经参赛列表
|
||||
public static void UpdateJoinCompetition()
|
||||
|
||||
Reference in new issue
Block a user