骑行数据逻辑调整

This commit is contained in:
lishuo committed 2021-04-27 20:28:03 +08:00
1 parent 8226b8a7c2
commit 00b9c7e796
15 files changed
+4173 -21344

No files matched your search

+17 -24
View File
@@ -87,6 +87,7 @@ namespace Assets.Scenes.Ride.Scripts
Button alertBtn;
Button alertCloseBtn;
Text preSlopeText;
GameObject startPanel;
void Awake()
{
#region 控件获取与事件绑定
@@ -95,7 +96,8 @@ namespace Assets.Scenes.Ride.Scripts
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
leftPanel = transform.Find("Panel/ReviewPanel").gameObject;
nearByPanel = transform.Find("Panel/NearPanel").gameObject;
startBtn = transform.Find("Panel/StartButton").GetComponent<Button>();
startPanel = transform.Find("Panel/StartPanel").gameObject;
startBtn = transform.Find("Panel/StartPanel/StartButton").GetComponent<Button>();
simpleBtn = transform.Find("Panel/SimpleButton").GetComponent<Button>();
ditance = transform.Find("Panel/ComputerPanel/DistanceView/Distance").GetComponent<Text>();
titlePanel = transform.Find("Panel/TitlePanel").gameObject;
@@ -115,19 +117,13 @@ namespace Assets.Scenes.Ride.Scripts
countDownTxt = transform.Find("Panel/CountDown").GetComponent<Text>();
mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>();
totalClimb = transform.Find("Panel/ComputerPanel/TotalClimbView/TotalClimb").GetComponent<Text>();
elevationChart = transform.Find("Panel/ElevationChart").GetComponent<LineChart>();
//img = transform.Find("Panel/ElevationChart/HeadImage").GetComponent<RawImage>();
img = transform.Find("Panel/GraphChart/Head").GetComponent<RawImage>();
t = transform.Find("Panel/GraphChart/Button");
miniMap = transform.Find("Panel/MiniMap").GetComponent<RawImage>();
alertPanel = transform.Find("Panel/Alert").gameObject;
alertBtn = transform.Find("Panel/Alert/SaveButton").GetComponent<Button>();
alertCloseBtn = transform.Find("Panel/Alert/CloseButton").GetComponent<Button>();
UIManager.AddEvent(alertBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, AlertOk);
UIManager.AddEvent(alertCloseBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, AlertClose);
selectPanel = transform.Find("Panel/SelectPanel").gameObject;
selectPlayer = transform.Find("Panel/SelectPlayer").gameObject;
reviewPanel = transform.Find("Panel/ReviewPanel").gameObject;
@@ -349,35 +345,32 @@ namespace Assets.Scenes.Ride.Scripts
{
selectPlayer.SetActive(true);
}
public void AlertOk(BaseEventData baseEventData)
{
alertPanel.SetActive(false);
UIManager.Show(UIManager.Instance.DevicePanel, transform.Find("Panel").GetComponent<PFUIPanel>());
}
public void AlertClose(BaseEventData baseEventData)
{
alertPanel.SetActive(false);
}
public void StartRide(BaseEventData baseEventData)
{
var antConnected = mainController.CheckAnt();//初始化ant+设备
#if !UNITY_EDITOR
#if UNITY_EDITOR
antConnected = true;
#endif
if (!antConnected)
{
alertPanel.SetActive(true);
}
#endif
//加个5秒钟倒计时
count = 5;
startBtn.gameObject.SetActive(false);
countDownTxt.gameObject.SetActive(true);
countDownTxt.text = count.ToString();
else {
//加个5秒钟倒计时
count = 5;
startPanel.SetActive(false);
startBtn.gameObject.SetActive(false);
countDownTxt.gameObject.SetActive(true);
countDownTxt.text = count.ToString();
}
}
//暂停游戏
private void PauseRide(BaseEventData baseEventData)
{
mainController.SetPause();
startBtn.gameObject.SetActive(true);
startPanel.SetActive(true);
}
private void SaveRide(BaseEventData baseEventData)
{