细节调整
This commit is contained in:
parent
bbc3deeef2
commit
02b8f97d83
@ -30,7 +30,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 3777003654129381334}
|
m_GameObject: {fileID: 3777003654129381334}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 3, y: 3, z: 3}
|
m_LocalScale: {x: 15, y: 15, z: 15}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -61,7 +61,7 @@ MeshRenderer:
|
|||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: bdad3ccf6401a414188827874d8999aa, type: 2}
|
- {fileID: 2100000, guid: 82096aab38f01cb40a1cbf8629a810ba, type: 2}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
|
|||||||
@ -108,9 +108,11 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
character: {fileID: 1056360222971152080}
|
character: {fileID: 1056360222971152080}
|
||||||
characterAnimator: {fileID: 0}
|
characterAnimator: {fileID: 0}
|
||||||
isQuit: 0
|
|
||||||
CurrentIndex: 0
|
CurrentIndex: 0
|
||||||
|
CurrentDistance: 0
|
||||||
|
PreElevation: 0
|
||||||
|
PreSlope: 0
|
||||||
record: []
|
record: []
|
||||||
_reviewItemScript: {fileID: 0}
|
_reviewItemScript: {fileID: 0}
|
||||||
_playerController: {fileID: 0}
|
_playerController: {fileID: 0}
|
||||||
LastTicks: 0
|
tickOffset: 0
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -12,13 +12,13 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
public class ChartDataSourceScript:MonoBehaviour, IComparer<DoubleVector2>
|
public class ChartDataSourceScript:MonoBehaviour, IComparer<DoubleVector2>
|
||||||
{
|
{
|
||||||
public string Category = "Player 2";
|
public string Category = "Player 2";
|
||||||
public int DownSampleToPoints = 100;
|
public int DownSampleToPoints = 200;
|
||||||
List<DoubleVector2> mData = new List<DoubleVector2>(); // the data held by the chart
|
public List<DoubleVector2> mData = new List<DoubleVector2>(); // the data held by the chart
|
||||||
double pageSize = 2f;
|
double pageSize = 2f;
|
||||||
double currentPagePosition = 0.0;
|
double currentPagePosition = 0.0;
|
||||||
double currentZoom = 0f;
|
double currentZoom = 0f;
|
||||||
GraphChartBase graph;
|
GraphChartBase graph;
|
||||||
double mCurrentPageSizeFactor = double.NegativeInfinity;
|
public double mCurrentPageSizeFactor = double.NegativeInfinity;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,8 +63,8 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
//获取路书信息
|
//获取路书信息
|
||||||
mapApi = ConfigHelper.mapApi;
|
mapApi = ConfigHelper.mapApi;
|
||||||
routeId = App.RouteIdParam > 0? App.RouteIdParam : 2633;
|
routeId = App.RouteIdParam > 0? App.RouteIdParam : 2633;
|
||||||
mapRoute = mapApi.GetById(routeId).data;
|
//mapRoute = mapApi.GetById(routeId).data;
|
||||||
miniMap = transform.Find("MiniMap").gameObject;//小地图
|
//miniMap = transform.Find("MiniMap").gameObject;//小地图
|
||||||
resultPanel = transform.Find("SingleUI/Panel/ResultPanel").gameObject;
|
resultPanel = transform.Find("SingleUI/Panel/ResultPanel").gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
loadingController = FindObjectOfType<LoadingController>();
|
loadingController = FindObjectOfType<LoadingController>();
|
||||||
loadingController.InjectController(this);
|
loadingController.InjectController(this);
|
||||||
//开始loading
|
//开始loading
|
||||||
Init();
|
StartCoroutine(Init());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEvent(GameObject sender, EventTriggerType eventType,UnityAction<BaseEventData> unityAction)
|
public void AddEvent(GameObject sender, EventTriggerType eventType,UnityAction<BaseEventData> unityAction)
|
||||||
@ -92,14 +92,17 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
{
|
{
|
||||||
return UIManager.Instance.loginRegOptions.GetCountryImageByName(name);
|
return UIManager.Instance.loginRegOptions.GetCountryImageByName(name);
|
||||||
}
|
}
|
||||||
private void Init()
|
private IEnumerator Init()
|
||||||
{
|
{
|
||||||
loadingController.Init(mapRoute);//初始化loading页面 10
|
yield return new WaitForSeconds(1);
|
||||||
loadingController.AddProcess(10);
|
mapRoute = mapApi.GetById(routeId).data;
|
||||||
MapUDPService.Init();//初始化TCP
|
miniMap = transform.Find("MiniMap").gameObject;//小地图
|
||||||
|
loadingController.Init(mapRoute);//初始化loading页面
|
||||||
loadingController.AddProcess(10);
|
loadingController.AddProcess(10);
|
||||||
InitData();//初始化数据
|
InitData();//初始化数据
|
||||||
InitGameObject();//初始化场景
|
InitGameObject();//初始化场景
|
||||||
|
MapUDPService.Init();//初始化TCP
|
||||||
|
loadingController.AddProcess(10);
|
||||||
}
|
}
|
||||||
//初始化数据
|
//初始化数据
|
||||||
private void InitData()
|
private void InitData()
|
||||||
@ -134,6 +137,8 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
App.routeResult = null;
|
App.routeResult = null;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
//异步请求mapbox画出当前路书路线图
|
||||||
|
loadingController.DrawMapRoute(mapData);
|
||||||
//计算上次骑行距离调整地图中心点
|
//计算上次骑行距离调整地图中心点
|
||||||
double endDistance = selectParamModel.EndDistance;
|
double endDistance = selectParamModel.EndDistance;
|
||||||
coordiantes = Along(endDistance);
|
coordiantes = Along(endDistance);
|
||||||
@ -146,8 +151,6 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
loadingController.CreateRankingList(mapRouteRankingList);
|
loadingController.CreateRankingList(mapRouteRankingList);
|
||||||
loadingController.AddProcess(10);
|
loadingController.AddProcess(10);
|
||||||
}
|
}
|
||||||
//异步请求mapbox画出当前路书路线图
|
|
||||||
loadingController.DrawMapRoute(mapData);
|
|
||||||
}
|
}
|
||||||
//加载人物和地图以及UI界面
|
//加载人物和地图以及UI界面
|
||||||
private void InitGameObject()
|
private void InitGameObject()
|
||||||
@ -269,14 +272,15 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
cyclingController.recorderData.AntModelId = AntModelId;
|
cyclingController.recorderData.AntModelId = AntModelId;
|
||||||
cyclingController.recorderData.ManufacturerId = ManufacturerId;
|
cyclingController.recorderData.ManufacturerId = ManufacturerId;
|
||||||
cyclingController.recorderData.DeviceNumber = DeviceNumber;
|
cyclingController.recorderData.DeviceNumber = DeviceNumber;
|
||||||
#if !UNITY_EDITOR
|
|
||||||
cyclingController.recorderData.SaveData(cyclingModel, selectParamModel, imageFileName);
|
|
||||||
#endif
|
|
||||||
//显示骑行结果
|
//显示骑行结果
|
||||||
resultPanel.SetActive(true);
|
resultPanel.SetActive(true);
|
||||||
var rs = resultPanel.GetComponent<ResultPanelScript>();
|
var rs = resultPanel.GetComponent<ResultPanelScript>();
|
||||||
rs.InjectController(this);
|
rs.InjectController(this);
|
||||||
rs.SetDataSource(cyclingController.recorderData);
|
rs.SetDataSource(cyclingController.recorderData);
|
||||||
|
#if !UNITY_EDITOR
|
||||||
|
cyclingController.recorderData.SaveData(cyclingModel, selectParamModel, imageFileName);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string CaptureCamera(Camera camera, Rect rect)
|
protected string CaptureCamera(Camera camera, Rect rect)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Mapbox.Unity.Map;
|
using Mapbox.Unity.Map;
|
||||||
|
using DG.Tweening;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Assets.Scripts.Apis;
|
using Assets.Scripts.Apis;
|
||||||
using System;
|
using System;
|
||||||
@ -8,6 +9,7 @@ using Assets.Scripts.Apis.Models;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
@ -66,13 +68,50 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
public void DrawMapRoute(MapDataModel mapData)
|
public void DrawMapRoute(MapDataModel mapData)
|
||||||
{
|
{
|
||||||
var url = Helper.GetMapboxApiUrl(mapData.List);
|
var url = Helper.GetMapboxApiUrl(mapData.List);
|
||||||
Utils.DisplayImageAysnc(StartCoroutine, mapRouteImage, url, dowloadCallBack);
|
if (App.TextureCache.ContainsKey(url))
|
||||||
mapRouteImage.gameObject.SetActive(false);
|
{
|
||||||
|
mapRouteImage.texture = App.TextureCache[url];
|
||||||
|
var canvasGroup = mapRouteImage.GetComponent<CanvasGroup>();
|
||||||
|
canvasGroup.DOFade(1, 1);
|
||||||
|
this.AddProcess(10);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utils.DisplayImageAysnc(StartCoroutine, mapRouteImage, url, dowloadCallBack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void dowloadCallBack()
|
|
||||||
|
private void dowloadCallBack(string url)
|
||||||
{
|
{
|
||||||
mapRouteImage.gameObject.SetActive(true);
|
if (!App.TextureCache.ContainsKey(url))
|
||||||
this.AddProcess(10);
|
{
|
||||||
|
App.TextureCache.Add(url, mapRouteImage.texture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
App.TextureCache[url] = mapRouteImage.texture;
|
||||||
|
}
|
||||||
|
var canvasGroup = mapRouteImage.GetComponent<CanvasGroup>();
|
||||||
|
canvasGroup.DOFade(1, 1);
|
||||||
|
this.AddProcess(10);
|
||||||
|
}
|
||||||
|
float t = 1f;
|
||||||
|
IEnumerator doCanvasGroup(CanvasGroup cp)
|
||||||
|
{
|
||||||
|
t -= Time.deltaTime;
|
||||||
|
while (t<0)
|
||||||
|
{
|
||||||
|
if (1 != cp.alpha)
|
||||||
|
{
|
||||||
|
cp.alpha = Mathf.Lerp(cp.alpha, 1, alphaSpeed * Time.deltaTime);
|
||||||
|
if (Mathf.Abs(1 - cp.alpha) <= 0.01f)
|
||||||
|
{
|
||||||
|
cp.alpha = 1;
|
||||||
|
}
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
t = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//设定当前loading进度
|
//设定当前loading进度
|
||||||
public void AddProcess(float v)
|
public void AddProcess(float v)
|
||||||
|
|||||||
@ -164,7 +164,8 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
Ticks = ticks,
|
Ticks = ticks,
|
||||||
Mode = cyclingModel.ToString(),
|
Mode = cyclingModel.ToString(),
|
||||||
Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
||||||
GlobalCyclingId = 0
|
GlobalCyclingId = 0,
|
||||||
|
Source = "",
|
||||||
};
|
};
|
||||||
//var range = new MapSpeedRange().GetSpeedRange(RiderDatas, CurrentRoute.RouteInstance.Distance);
|
//var range = new MapSpeedRange().GetSpeedRange(RiderDatas, CurrentRoute.RouteInstance.Distance);
|
||||||
interruptRecord.SpeedRange = null; //JsonConvert.SerializeObject(range);
|
interruptRecord.SpeedRange = null; //JsonConvert.SerializeObject(range);
|
||||||
|
|||||||
@ -33,9 +33,9 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
weight = App.CurrentUser.Weight;
|
weight = App.CurrentUser.Weight;
|
||||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
//#if UNITY_EDITOR
|
||||||
power = 2000;//测试功率
|
power = 20000;//测试功率
|
||||||
#endif
|
//#endif
|
||||||
mainController.TrackResistance(currentSlope);//TODO
|
mainController.TrackResistance(currentSlope);//TODO
|
||||||
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
||||||
distance = mainController.UpdateDistance(speed);
|
distance = mainController.UpdateDistance(speed);
|
||||||
|
|||||||
@ -122,6 +122,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//开始伴侣骑行的面板
|
//开始伴侣骑行的面板
|
||||||
private void PreStart(BaseEventData baseEventData)
|
private void PreStart(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
|
cyclingController.SetCyclingModel(CyclingModel.Review);
|
||||||
transform.gameObject.SetActive(false);
|
transform.gameObject.SetActive(false);
|
||||||
foreach (var item in gameObjects)
|
foreach (var item in gameObjects)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -305,7 +305,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
private void ShadowRide(BaseEventData baseEventData)
|
private void ShadowRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
mainController.SetCyclingModel(CyclingModel.Review);
|
//mainController.SetCyclingModel(CyclingModel.Review);
|
||||||
selectPanel.SetActive(false);
|
selectPanel.SetActive(false);
|
||||||
//显示影子选手骑行列表
|
//显示影子选手骑行列表
|
||||||
selectPlayer.SetActive(true);
|
selectPlayer.SetActive(true);
|
||||||
@ -411,8 +411,8 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
clearLock = true;
|
clearLock = true;
|
||||||
isSimple *= -1;
|
isSimple *= -1;
|
||||||
simpleBtn.targetGraphic = simpleBtn.image;
|
simpleBtn.transform.GetComponent<Image>().sprite = isSimple == -1 ? Resources.Load<Sprite>("Images/Ride/full") : Resources.Load<Sprite>("Images/Ride/simple");
|
||||||
simpleBtn.image.sprite = isSimple == -1? Resources.Load<Sprite>("Images/Ride/full") : Resources.Load<Sprite>("Images/Ride/simple");
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,32 +534,61 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
void MoveChartMarkPoint()
|
void MoveChartMarkPoint()
|
||||||
{
|
{
|
||||||
Vector3 prePosition = img.transform.position;
|
Vector3 prePosition = img.transform.position;
|
||||||
int nextIndex = playerController.CurrentIndex+1;
|
int nextIndex = playerController.CurrentIndex;
|
||||||
double ditance = playerController.Distance;//当前移动距离
|
double ditance = playerController.Distance;//当前移动距离
|
||||||
double currentDistance = playerController.CurrentDistance;//当前区间距离
|
double currentDistance = playerController.CurrentDistance;//当前区间距离
|
||||||
var t = currentDistance != 0 ? ditance*1000 / currentDistance : 0;
|
var t = currentDistance != 0 ? ditance*1000 / currentDistance : 1;
|
||||||
var n = graph.DataSource.GetPoint("Player 2", nextIndex);
|
var n = graph.DataSource.GetPoint("Player 2", nextIndex);
|
||||||
|
|
||||||
graph.PointToWorldSpace(out Vector3 nextPosition, n.x, n.y, "Player 2");
|
graph.PointToWorldSpace(out Vector3 nextPosition, n.x, n.y, "Player 2");
|
||||||
|
//var currentPos = Vector3.Lerp(prePosition, nextPosition, (float)t);
|
||||||
|
if (mainController.isStart)
|
||||||
|
{
|
||||||
|
var ss = graph.GetComponentInChildren<ChartDataSourceScript>();
|
||||||
|
if (ss.total <= ss.DownSampleToPoints)
|
||||||
|
{
|
||||||
|
img.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //人 - 线(中点) - 人(ss.total - graph.HorizontalScrolling <100)
|
||||||
|
//人物移动到中间的时候,线开始向左边平滑移动
|
||||||
|
var mapData = mainController.GetMapData();
|
||||||
|
//线移动
|
||||||
|
var interval = ditance / mapData.TotalDistance * ss.total;
|
||||||
|
|
||||||
|
//线到头了开始移动人物
|
||||||
|
var s = (ss.total - graph.HorizontalScrolling);
|
||||||
|
img.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||||
|
//if (s < 200)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// graph.HorizontalScrolling = nextIndex + 1 - t;
|
||||||
|
// img.transform.DOMove(new Vector3(prePosition.x, currentPos.y, 0), 1);
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// //人移动 当前中间的时候开始切换线移动
|
||||||
|
// img.transform.DOMove(new Vector3(currentPos.x, currentPos.y, 0), 0);
|
||||||
|
// //线快加载五年的时候
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//线即将加载完
|
||||||
|
|
||||||
|
|
||||||
var currentPos = Vector3.Lerp(prePosition, nextPosition, (float)t);
|
|
||||||
img.transform.DOMove(currentPos, 1);
|
|
||||||
var ss = graph.GetComponentInChildren<ChartDataSourceScript>();
|
|
||||||
var q = ss.pageStartThreshold;
|
|
||||||
var p = ss.pageEndThreshold;
|
|
||||||
var diff = currentPos.x - prePosition.x;
|
|
||||||
var s = graph.ScrollableData;
|
|
||||||
var sss = s.GetMaxValue(0, true);
|
|
||||||
Debug.Log(sss);
|
|
||||||
//graph.HorizontalScrolling += diff / graph.TotalWidth;
|
|
||||||
//人物移动到中间的时候,线开始向左边平滑移动
|
|
||||||
//int del = (int)Math.Round(graph.DataSource.HorizontalViewSize / 2, 0);
|
//int del = (int)Math.Round(graph.DataSource.HorizontalViewSize / 2, 0);
|
||||||
//if (playerController.CurrentIndex % del == 0)
|
//if (playerController.CurrentIndex % del == 0)
|
||||||
//{
|
//{
|
||||||
// graph.HorizontalScrolling += 1;
|
// graph.HorizontalScrolling += 1;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#region 注释
|
#region 注释
|
||||||
//var dataPoints = elevationChart.series.list[0].dataPoints.OrderBy(c => c.x).ToList();
|
//var dataPoints = elevationChart.series.list[0].dataPoints.OrderBy(c => c.x).ToList();
|
||||||
//if (dataPoints.Count > 0)
|
//if (dataPoints.Count > 0)
|
||||||
//{
|
//{
|
||||||
@ -582,7 +611,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
// //testButton.transform.DOLocalMove(new Vector3(pointMap[playerController.CurrentIndex - 1].x-Screen.width/2, pointMap[playerController.CurrentIndex - 1].y, 0),0.5f);
|
// //testButton.transform.DOLocalMove(new Vector3(pointMap[playerController.CurrentIndex - 1].x-Screen.width/2, pointMap[playerController.CurrentIndex - 1].y, 0),0.5f);
|
||||||
// //pointMap.Remove(playerController.CurrentIndex - 1);
|
// //pointMap.Remove(playerController.CurrentIndex - 1);
|
||||||
//}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,5 +105,6 @@ namespace Assets.Scripts.Apis.Models
|
|||||||
public string Param { get; set; }
|
public string Param { get; set; }
|
||||||
|
|
||||||
public int GlobalCyclingId { get; set; }
|
public int GlobalCyclingId { get; set; }
|
||||||
|
public string Source { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,14 +37,17 @@ public class MainController : MonoBehaviour
|
|||||||
//});
|
//});
|
||||||
if (App.MainSceneParam.ContainsKey("Name"))
|
if (App.MainSceneParam.ContainsKey("Name"))
|
||||||
{
|
{
|
||||||
if(App.MainSceneParam["Name"] == "MapListPanel")
|
UIManager.PushHome();
|
||||||
|
if (App.MainSceneParam["Name"] == "MapListPanel")
|
||||||
{
|
{
|
||||||
UIManager.ShowMapListPanel();
|
UIManager.ShowMapListPanel();
|
||||||
|
App.MainSceneParam["Name"] = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App.MainSceneParam["Name"] == "UserInfoPanel")
|
if (App.MainSceneParam["Name"] == "UserInfoPanel")
|
||||||
{
|
{
|
||||||
UIManager.ShowUserInfoPanel();
|
UIManager.ShowUserInfoPanel();
|
||||||
|
App.MainSceneParam["Name"] = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -67,10 +67,34 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
|||||||
// //transform.localPosition.Set(transform.localPosition.x, localY.Value, transform.localPosition.z);
|
// //transform.localPosition.Set(transform.localPosition.x, localY.Value, transform.localPosition.z);
|
||||||
// //transform.DOLocalMoveY(localY.Value, 0.5f);
|
// //transform.DOLocalMoveY(localY.Value, 0.5f);
|
||||||
//});
|
//});
|
||||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
|
||||||
|
UIManager.AddEvent(transform.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (Base) =>
|
||||||
{
|
{
|
||||||
UIManager.ShowMapDetailPanel(myMap.Id);
|
App.RouteIdParam = myMap.Id;
|
||||||
|
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||||
|
{
|
||||||
|
App.MainSceneParam.Add("Name", "MapListPanel");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
App.MainSceneParam["Name"] = "MapListPanel";
|
||||||
|
}
|
||||||
|
SceneManager.LoadScene("Ride");
|
||||||
});
|
});
|
||||||
|
//transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||||
|
//{
|
||||||
|
// //UIManager.ShowMapDetailPanel(myMap.Id);
|
||||||
|
// App.RouteIdParam = myMap.Id;
|
||||||
|
// if (!App.MainSceneParam.ContainsKey("Name"))
|
||||||
|
// {
|
||||||
|
// App.MainSceneParam.Add("Name", "MapListPanel");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// App.MainSceneParam["Name"]= "MapListPanel";
|
||||||
|
// }
|
||||||
|
// SceneManager.LoadScene("Ride");
|
||||||
|
//});
|
||||||
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
||||||
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
|
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
|
||||||
|
|
||||||
|
|||||||
@ -57,10 +57,12 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
|||||||
btnContinue = right.Find("BtnContinue");
|
btnContinue = right.Find("BtnContinue");
|
||||||
if (btnContinue)
|
if (btnContinue)
|
||||||
{
|
{
|
||||||
|
bool enabled = result.ContinueCyclingParam != null;
|
||||||
|
|
||||||
//btnContinue.gameObject.SetActive(false);
|
//btnContinue.gameObject.SetActive(false);
|
||||||
btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
|
btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
|
||||||
btnContinue.GetComponent<Button>().interactable = !(result.Progress == 1.0);
|
btnContinue.GetComponent<Button>().interactable = enabled;
|
||||||
btnContinue.GetComponent<Button>().enabled = !(result.Progress == 1.0);
|
btnContinue.GetComponent<Button>().enabled = enabled;
|
||||||
}
|
}
|
||||||
btnReRide = right.Find("BtnReRide");
|
btnReRide = right.Find("BtnReRide");
|
||||||
if (btnReRide)
|
if (btnReRide)
|
||||||
@ -114,8 +116,9 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
|||||||
{
|
{
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
btnContinue.GetComponent<Image>().color =
|
bool enabled = routeResult.ContinueCyclingParam == null;
|
||||||
routeResult.Progress == 1? Utils.HexToColorHtml("#c8c8c880"): Utils.HexToColorHtml("#F93086");
|
btnContinue.GetComponent<Image>().color =
|
||||||
|
enabled ? Utils.HexToColorHtml("#c8c8c880"): Utils.HexToColorHtml("#F93086");
|
||||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
||||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||||
|
|||||||
@ -130,6 +130,11 @@ public class UIManager : MonoBehaviour
|
|||||||
public static UIManager Instance;
|
public static UIManager Instance;
|
||||||
|
|
||||||
private static Stack<PFUIPanel> stack;
|
private static Stack<PFUIPanel> stack;
|
||||||
|
public static void PushHome()
|
||||||
|
{
|
||||||
|
stack.Clear();
|
||||||
|
stack.Push(UIManager.Instance.HomePanel);
|
||||||
|
}
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
UIManager.Instance = this;
|
UIManager.Instance = this;
|
||||||
|
|||||||
@ -147,7 +147,7 @@ namespace Assets.Scripts
|
|||||||
startCoroutine(DownloadImage(img, url));
|
startCoroutine(DownloadImage(img, url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DisplayImageAysnc(StartCoroutine startCoroutine, RawImage img, string url,Action action)
|
public static void DisplayImageAysnc(StartCoroutine startCoroutine, RawImage img, string url,Action<string> action)
|
||||||
{
|
{
|
||||||
startCoroutine(DownloadImageCallBack(img, url, action));
|
startCoroutine(DownloadImageCallBack(img, url, action));
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ namespace Assets.Scripts
|
|||||||
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnumerator DownloadImageCallBack(RawImage img, string MediaUrl,Action action)
|
static IEnumerator DownloadImageCallBack(RawImage img, string MediaUrl,Action<string> action)
|
||||||
{
|
{
|
||||||
UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
|
UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
|
||||||
yield return request.SendWebRequest();
|
yield return request.SendWebRequest();
|
||||||
@ -179,7 +179,7 @@ namespace Assets.Scripts
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
||||||
action.Invoke();
|
action.Invoke(MediaUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*显示网络图片*/
|
/*显示网络图片*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user