移除xcharts和细节调整
This commit is contained in:
1 parent
b71a15e2ba
commit
6d45d052a0
511 files changed
+5342
-1941568
No files matched your search
@@ -77,6 +77,17 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
//开始loading
|
||||
StartCoroutine(Init());
|
||||
}
|
||||
public void SetUIManager(PFUIPanel mainPanel, PFUIPanel model)
|
||||
{
|
||||
UIManager.Instance.MainPanel = mainPanel;//this.transform.Find("SingleUI/Panel").GetComponent<PFUIPanel>();
|
||||
UIManager.Instance.ModalsPanel = model;// this.transform.Find("SingleUI/ModalPanel").GetComponent<PFUIPanel>();
|
||||
}
|
||||
|
||||
public void ReSetUIManager()
|
||||
{
|
||||
UIManager.Instance.MainPanel = this.transform.Find("SingleUI/Panel").GetComponent<PFUIPanel>();
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("SingleUI/ModalPanel").GetComponent<PFUIPanel>();
|
||||
}
|
||||
|
||||
public void AddEvent(GameObject sender, EventTriggerType eventType,UnityAction<BaseEventData> unityAction)
|
||||
{
|
||||
@@ -176,7 +187,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
cyclingController = new SingleModel(route, selectParamModel);
|
||||
break;
|
||||
case CyclingModel.Review:
|
||||
cyclingController = new SingleModel(route, selectParamModel);
|
||||
cyclingController = new ReviewModel(route, selectParamModel);
|
||||
break;
|
||||
}
|
||||
//进入倒计时
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
/// <param name="distance"></param>
|
||||
public double UpdateDistance(double speed)
|
||||
{
|
||||
return Math.Round(speed / 3600, 4);
|
||||
return Math.Round(speed / 3600, 5,MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
CyclingController cyclingController;
|
||||
private void Start()
|
||||
{
|
||||
|
||||
loadingPanel = transform.Find("Panel/LoadingPanel").gameObject;
|
||||
loadingPanel.showLoadingExtension();
|
||||
//InitGameObject();
|
||||
@@ -55,6 +56,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public void InjectController(CyclingController controller)
|
||||
{
|
||||
cyclingController = controller;
|
||||
PFUIPanel mainPanel = transform.Find("Panel").GetComponent<PFUIPanel>();
|
||||
PFUIPanel modelPanel = transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||||
cyclingController.SetUIManager(mainPanel, modelPanel);
|
||||
}
|
||||
//提供给主控制器初始化用
|
||||
public void Init(MapRoute route)
|
||||
@@ -175,7 +179,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
alert.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
cyclingController.ReSetUIManager();
|
||||
//启用ridenow
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
depressFlag = true;
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
public ReviewModel(Route route1, RouteResultParam param)
|
||||
: base(route1, CyclingModel.Review)
|
||||
{
|
||||
//rankings = service.GetMapRecordRankingsFromServe(param.RankingsId);
|
||||
riders = new List<BaseRider>();
|
||||
riders.Add(new OnlineRiderModel()
|
||||
{
|
||||
@@ -24,10 +25,21 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
WxHeadImg = App.CurrentUser.WxHeadImg,
|
||||
Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1])
|
||||
});
|
||||
|
||||
//foreach (var item in rankings)
|
||||
//{
|
||||
// riders.Add(new ReviewRiderModel()
|
||||
// {
|
||||
// NickName = item.NickName,
|
||||
// UserId = item.UserId,
|
||||
// WxHeadImg = item.WxHeadImg,
|
||||
// record = item.record,
|
||||
// Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1])
|
||||
// });
|
||||
//}
|
||||
recorderData = new RecorderDataModel()
|
||||
{
|
||||
CurrentUser = App.CurrentUser,
|
||||
//BelongUserId = PubCommData.CurrentUser.Id,
|
||||
Competitionid = 0,
|
||||
ContinueIndex = 0,
|
||||
ContinueMark = Guid.NewGuid().ToString(),
|
||||
@@ -36,10 +48,17 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
IsCompleted = false,
|
||||
IsNeedRanking = true,
|
||||
CyclingState = CyclingStateEnum.Prepare,
|
||||
//ManufacturerId = ManufacturerId,
|
||||
CurrentRoute = route,
|
||||
CurrentRouteStartDistance = 0,
|
||||
//DeviceNumber = DeviceNumber,
|
||||
//AntModelId = antModelId
|
||||
};
|
||||
|
||||
//recorderData = recorderData1;
|
||||
this.IsRecord = true;
|
||||
//riders = riders1;
|
||||
|
||||
}
|
||||
|
||||
public override void Run(TargetData targetData)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts.Model
|
||||
{
|
||||
public class RideSetting
|
||||
{
|
||||
public double sensitivity { set; get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bdb001023de8f942b52de4e72bc45e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -13,6 +13,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public ReviewItemScript _reviewItemScript;
|
||||
public PlayerController _playerController;
|
||||
RawImage head;
|
||||
GameObject headPanel;
|
||||
|
||||
public int tickOffset = 0;
|
||||
protected override void Init()
|
||||
@@ -46,16 +47,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
public void MoveHead(Transform parent,Vector3 nextPosition)
|
||||
{
|
||||
if (headPanel == null)
|
||||
{
|
||||
headPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Ride/HeadPanel"));
|
||||
headPanel.transform.parent = parent;
|
||||
headPanel.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||
}
|
||||
if (head == null)
|
||||
{
|
||||
head = Instantiate(Resources.Load<RawImage>("UI/Prefab/Ride/Head"));
|
||||
head = headPanel.GetComponentInChildren<RawImage>();
|
||||
head.texture = _reviewItemScript.GetHead();
|
||||
head.transform.parent = parent;
|
||||
head.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||
}
|
||||
head.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||
|
||||
headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cadance = mainController.UpdateCadence();
|
||||
weight = App.CurrentUser.Weight;
|
||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||
//#if UNITY_EDITOR
|
||||
power = 300;//测试功率
|
||||
//#endif
|
||||
mainController.TrackResistance(currentSlope);//TODO
|
||||
#if UNITY_EDITOR
|
||||
power = 2000;//测试功率
|
||||
#endif
|
||||
mainController.TrackResistance(currentSlope * App.rideSetting.sensitivity);
|
||||
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
||||
distance = mainController.UpdateDistance(speed);
|
||||
totalDistance += distance;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
class RideSettingScript:MonoBehaviour
|
||||
{
|
||||
Button cancelButton;
|
||||
Button saveButton;
|
||||
Slider slider;
|
||||
Text text;
|
||||
private void Start()
|
||||
{
|
||||
cancelButton = transform.Find("CancelButton").GetComponent<Button>();
|
||||
saveButton = transform.Find("SaveButton").GetComponent<Button>();
|
||||
slider = transform.Find("Sensitivity").GetComponent<Slider>();
|
||||
text = transform.Find("Sensitivity/Text").GetComponent<Text>();
|
||||
text.text = App.rideSetting.sensitivity.ToString("#0")+ "%";
|
||||
slider.onValueChanged.AddListener((f) =>
|
||||
{
|
||||
text.text = $"{(f).ToString("#0")}%";
|
||||
});
|
||||
UIManager.AddEvent(cancelButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel);
|
||||
UIManager.AddEvent(saveButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Save);
|
||||
}
|
||||
|
||||
private void Cancel(BaseEventData baseEventData)
|
||||
{
|
||||
transform.gameObject.SetActive(false);
|
||||
}
|
||||
private void Save(BaseEventData baseEventData)
|
||||
{
|
||||
App.rideSetting.sensitivity = Math.Round(slider.value,0) /100;
|
||||
transform.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5aaec488409621479548483b8250842
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -122,7 +122,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
dat.Add(item);
|
||||
}
|
||||
if (diff < 0 && diff > -200)
|
||||
if (diff <= 0 && diff > -200)
|
||||
{
|
||||
item.y += 0.15f;
|
||||
path.Add(item);
|
||||
|
||||
@@ -122,7 +122,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//开始伴侣骑行的面板
|
||||
private void PreStart(BaseEventData baseEventData)
|
||||
{
|
||||
cyclingController.SetCyclingModel(CyclingModel.Review);
|
||||
transform.gameObject.SetActive(false);
|
||||
foreach (var item in gameObjects)
|
||||
{
|
||||
@@ -132,7 +131,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cyclingController.selectParamModel.RankingsId.Add(seletedPlayerScript.GetRankingId());
|
||||
}
|
||||
}
|
||||
cyclingController.cyclingModel = CyclingModel.Review;
|
||||
cyclingController.SetCyclingModel(CyclingModel.Review);
|
||||
if (!reviewPanel.activeSelf)
|
||||
{
|
||||
reviewPanel.SetActive(true);
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XCharts;
|
||||
using XUGL;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using Mapbox.Unity.Map;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.EventSystems;
|
||||
using ChartAndGraph;
|
||||
using Assets.Scripts;
|
||||
@@ -63,8 +59,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Button cancelQuitButton;//退出panel取消按钮
|
||||
Button closeQuitButton;//退出panel关闭按钮
|
||||
|
||||
LineChart elevationChart;//海拔图
|
||||
RawImage img;//海拔图头像
|
||||
RawImage head;//海拔图头像
|
||||
RawImage miniMap;//小地图
|
||||
RawImage altitudeGraph;//海拔图
|
||||
Image leftImage;
|
||||
@@ -88,6 +83,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Button alertCloseBtn;
|
||||
Text preSlopeText;
|
||||
GameObject startPanel;
|
||||
GameObject headPanel;
|
||||
GameObject settingPanel;
|
||||
void Awake()
|
||||
{
|
||||
#region 控件获取与事件绑定
|
||||
@@ -118,7 +115,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>();
|
||||
totalClimb = transform.Find("Panel/ComputerPanel/TotalClimbView/TotalClimb").GetComponent<Text>();
|
||||
//img = transform.Find("Panel/ElevationChart/HeadImage").GetComponent<RawImage>();
|
||||
img = transform.Find("Panel/GraphChart/Head").GetComponent<RawImage>();
|
||||
head = transform.Find("Panel/GraphChart/HeadPanel/Head").GetComponent<RawImage>();
|
||||
headPanel = transform.Find("Panel/GraphChart/HeadPanel").gameObject;
|
||||
t = transform.Find("Panel/GraphChart/Button");
|
||||
miniMap = transform.Find("Panel/MiniMap").GetComponent<RawImage>();
|
||||
|
||||
@@ -143,7 +141,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
altitudeGraph = transform.Find("Panel/TitlePanel/AltitudeGraph").GetComponent<RawImage>();
|
||||
leftImage = transform.Find("Panel/TitlePanel/Left").GetComponent<Image>();
|
||||
rightImage = transform.Find("Panel/TitlePanel/Right").GetComponent<Image>();
|
||||
|
||||
settingPanel = transform.Find("Panel/SettingPanel").gameObject;
|
||||
preSlopeText = transform.Find("Panel/PreSlopePanel/PreSlopeText").GetComponent<Text>();
|
||||
|
||||
target = transform.parent.Find("Target").gameObject;
|
||||
@@ -271,7 +269,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
//控制照片移动
|
||||
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||
if (playerController.Distance > 0 && mainController.isStart)
|
||||
if (playerController.Speed > 0 && mainController.isStart)
|
||||
{
|
||||
arrow.transform.Find("bg").gameObject.SetActive(true);
|
||||
}
|
||||
@@ -420,6 +418,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//显示设置
|
||||
private void ShowSettingPanel(BaseEventData baseEventData)
|
||||
{
|
||||
settingPanel.SetActive(true);
|
||||
}
|
||||
int isSimple = 1;
|
||||
private bool clearLock = true;
|
||||
@@ -463,13 +462,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
chartDataSourceScript = transform.Find("Panel/GraphChart").GetComponent<ChartDataSourceScript>();
|
||||
graph = transform.Find("Panel/GraphChart").GetComponent<GraphChartBase>();
|
||||
chartDataSourceScript.SetDataSource(dd.ToArray());
|
||||
////初始化头像坐标
|
||||
//var n = graph.DataSource.GetPoint("Player 2", 0);
|
||||
//graph.PointToWorldSpace(out Vector3 nextPosition, n.x, n.y, "Player 2");
|
||||
//img.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||
|
||||
if (App.CurrentUser != null)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, img, App.CurrentUser.WxHeadImg);
|
||||
Utils.DisplayImage(StartCoroutine, head, App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,8 +482,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//移动当前用户头像
|
||||
private void MoverCurrentUserHead()
|
||||
{
|
||||
Vector3 prePos = img.transform.position;
|
||||
int nextIndex = playerController.CurrentIndex;
|
||||
Vector3 prePos = headPanel.transform.position;
|
||||
int nextIndex = playerController.CurrentIndex +1;
|
||||
var viewIndex = chartDataSourceScript.GetViewIndex(nextIndex);
|
||||
if (!mainController.isStart && !mainController.isPause && !mainController.isQuit)//未开始未暂停未结束
|
||||
{
|
||||
@@ -504,13 +500,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var distance = playerController.Distance;
|
||||
var offset = currentDistance > 0 ? distance * 1000 / currentDistance : 1;
|
||||
graph.HorizontalScrolling += offset;
|
||||
img.transform.DOMove(new Vector3(prePos.x, nextPosition.y, 0), 1);
|
||||
headPanel.transform.DOMove(new Vector3(prePos.x, nextPosition.y, 0), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
img.transform.DOMove(new Vector3(nextPosition.x , nextPosition.y, 0), 1);
|
||||
headPanel.transform.DOMove(new Vector3(nextPosition.x , nextPosition.y, 0), 1);
|
||||
}
|
||||
img.transform.SetSiblingIndex(999);
|
||||
headPanel.transform.SetSiblingIndex(999);
|
||||
}
|
||||
//移动其他骑手头像
|
||||
private void MoveOtherHeads()
|
||||
@@ -518,7 +514,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var others = FindObjectsOfType<OtherPlayerController>();
|
||||
foreach (var item in others)
|
||||
{
|
||||
var itemIndex = chartDataSourceScript.GetViewIndex(item.CurrentIndex);
|
||||
var itemIndex = chartDataSourceScript.GetViewIndex(item.CurrentIndex) + 1;
|
||||
if (!mainController.isStart && !mainController.isPause && !mainController.isQuit)//未开始未暂停未结束
|
||||
{
|
||||
itemIndex = 0;
|
||||
|
||||
@@ -18,23 +18,30 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
sprites.Add(Resources.Load<Sprite>($"Images/Ride/wave/wave{i.ToString("0000")}"));
|
||||
}
|
||||
image = transform.GetComponent<Image>();
|
||||
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
float time = 0;
|
||||
float totaltime = 0;
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
totaltime += Time.deltaTime;
|
||||
if (time < 0.03)
|
||||
{
|
||||
return;
|
||||
}
|
||||
time = 0;
|
||||
|
||||
image.sprite = sprites[index];
|
||||
index++;
|
||||
|
||||
if (index % 59 == 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
image.sprite = sprites[index];
|
||||
index ++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user