完成比赛相关接口&历史代码整合
This commit is contained in:
parent
58ec860669
commit
380e67cc1e
@ -1,37 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!84 &8400000
|
|
||||||
RenderTexture:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_Name: New Render Texture
|
|
||||||
m_ImageContentsHash:
|
|
||||||
serializedVersion: 2
|
|
||||||
Hash: 00000000000000000000000000000000
|
|
||||||
m_ForcedFallbackFormat: 4
|
|
||||||
m_DownscaleFallback: 0
|
|
||||||
serializedVersion: 3
|
|
||||||
m_Width: 256
|
|
||||||
m_Height: 256
|
|
||||||
m_AntiAliasing: 1
|
|
||||||
m_MipCount: -1
|
|
||||||
m_DepthFormat: 2
|
|
||||||
m_ColorFormat: 8
|
|
||||||
m_MipMap: 0
|
|
||||||
m_GenerateMips: 1
|
|
||||||
m_SRGB: 0
|
|
||||||
m_UseDynamicScale: 0
|
|
||||||
m_BindMS: 0
|
|
||||||
m_EnableCompatibleFormat: 1
|
|
||||||
m_TextureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_FilterMode: 1
|
|
||||||
m_Aniso: 0
|
|
||||||
m_MipBias: 0
|
|
||||||
m_WrapU: 1
|
|
||||||
m_WrapV: 1
|
|
||||||
m_WrapW: 1
|
|
||||||
m_Dimension: 2
|
|
||||||
m_VolumeDepth: 1
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 83f968668355a044584843a4bf7d592d
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 8400000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -30,7 +30,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
public bool IsShowInfo { get; set; }
|
public bool IsShowInfo { get; set; }
|
||||||
#region 动画控制参数
|
#region 动画控制参数
|
||||||
public Vector3 nextPos;
|
public Vector3 nextPos;
|
||||||
Vector3 prePos = Vector3.zero;
|
protected Vector3 prePos = Vector3.zero;
|
||||||
float timer = 1.0f;//计时器
|
float timer = 1.0f;//计时器
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -182,6 +182,8 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//移动动画控制
|
//移动动画控制
|
||||||
if (distance > 0)
|
if (distance > 0)
|
||||||
{
|
{
|
||||||
|
//transform.localPosition = nextPos;
|
||||||
|
StartCoroutine(LookAtNextPos());//转向
|
||||||
StartCoroutine(MoveTo());//移动
|
StartCoroutine(MoveTo());//移动
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,9 +290,8 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
public Vector3 currentPos = new Vector3(0,0,0);
|
public Vector3 currentPos = new Vector3(0,0,0);
|
||||||
//人物移动控制
|
//人物移动控制
|
||||||
IEnumerator MoveTo()
|
protected virtual IEnumerator MoveTo()
|
||||||
{
|
{
|
||||||
StartCoroutine(LookAtNextPos());//转向
|
|
||||||
//让人物移动分点增加动画的流畅度
|
//让人物移动分点增加动画的流畅度
|
||||||
float t = 0;
|
float t = 0;
|
||||||
while (t < 1)
|
while (t < 1)
|
||||||
@ -300,7 +301,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
|
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
|
||||||
currentPos = v;
|
currentPos = v;
|
||||||
transform.localPosition = v;
|
transform.localPosition = v;
|
||||||
yield return new WaitForEndOfFrame();
|
yield return null; new WaitForEndOfFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
566
Assets/Scenes/Ride/Scripts/BaseUIManager.cs
Normal file
566
Assets/Scenes/Ride/Scripts/BaseUIManager.cs
Normal file
@ -0,0 +1,566 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using System.Linq;
|
||||||
|
using Mapbox.Unity.Map;
|
||||||
|
using DG.Tweening;
|
||||||
|
using System;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using ChartAndGraph;
|
||||||
|
using Assets.Scripts;
|
||||||
|
using Assets.Scripts.Apis.Models;
|
||||||
|
|
||||||
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
|
{
|
||||||
|
|
||||||
|
public class BaseUIManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
#region UI control
|
||||||
|
protected GameObject target;
|
||||||
|
protected GameObject nearByPanel;//附近的人列表
|
||||||
|
protected GameObject leftPanel;//伴侣骑行列表
|
||||||
|
protected GameObject nextSlopePanel;//下一个坡度面板
|
||||||
|
protected GameObject currentSlopePanel;//当前坡度面板
|
||||||
|
protected GameObject selectPanel;//骑行模式选择
|
||||||
|
protected GameObject selectPlayer;//伴侣骑行选择窗口
|
||||||
|
protected GameObject reviewPanel;
|
||||||
|
protected GameObject titlePanel;
|
||||||
|
protected GameObject quitPanel;//退出界面
|
||||||
|
|
||||||
|
protected Text nextSlopeText;//下一个坡度
|
||||||
|
protected Text nextSlopeDistanceText;//下一个坡度距离
|
||||||
|
protected Text currentSlopeText;//当前坡度
|
||||||
|
protected Text currentSlopeDistanceText;//当前坡度已骑行距离
|
||||||
|
protected Text currentSlopeToatalDistanceText;//当前坡度总距离
|
||||||
|
protected Text speedTxt;//当前速度
|
||||||
|
protected Text powerTxt;//功率
|
||||||
|
protected Text timerTxt;//计时器
|
||||||
|
protected Text ditance;//当前骑行距离
|
||||||
|
protected Text totalDistance;//当前骑行距离
|
||||||
|
protected Text candance;//踏频
|
||||||
|
protected Text heartRate;//心率
|
||||||
|
protected Text countDownTxt;//倒计时5s
|
||||||
|
protected Text mapName;//路书名称
|
||||||
|
protected Text fps;//fps
|
||||||
|
protected Text totalClimb;
|
||||||
|
|
||||||
|
protected Button startBtn;//开始按钮
|
||||||
|
protected Button simpleBtn;//进入简约模式按钮
|
||||||
|
protected Button pauseButton;//暂停按钮
|
||||||
|
protected Button settingButton;//设置那妞
|
||||||
|
protected Button deviceButton;//设备按钮
|
||||||
|
protected Button viewButton;//视角按钮
|
||||||
|
protected Button exitButton;//退出按钮
|
||||||
|
protected Button singleButton;//单人骑行按钮
|
||||||
|
protected Button shadowButton;//影子选手按钮
|
||||||
|
protected Button addButton;//添加伴侣骑行
|
||||||
|
protected Button saveButton;//退出panel保存按钮
|
||||||
|
protected Button cancelQuitButton;//退出panel取消按钮
|
||||||
|
protected Button closeQuitButton;//退出panel关闭按钮
|
||||||
|
|
||||||
|
protected RawImage head;//海拔图头像
|
||||||
|
protected GameObject miniMap;//小地图
|
||||||
|
protected RawImage altitudeGraph;//海拔图
|
||||||
|
protected Image leftImage;
|
||||||
|
protected Image rightImage;
|
||||||
|
protected Image area;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 控制器
|
||||||
|
|
||||||
|
protected PlayerController playerController;//当前用户
|
||||||
|
protected CyclingController mainController;//主控制器
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected float timeRemaining = 1f;
|
||||||
|
protected int count = 0;
|
||||||
|
protected Image arrow;
|
||||||
|
protected AbstractMap map;
|
||||||
|
protected Transform t;
|
||||||
|
protected GameObject alertPanel;
|
||||||
|
protected Button alertBtn;
|
||||||
|
protected Button alertCloseBtn;
|
||||||
|
protected Text preSlopeText;
|
||||||
|
protected GameObject startPanel;
|
||||||
|
protected GameObject headPanel;
|
||||||
|
protected GameObject settingPanel;
|
||||||
|
protected Button abandonButton;
|
||||||
|
protected GameObject singleArea;
|
||||||
|
protected Sprite downhill1;
|
||||||
|
protected Sprite uphill1;
|
||||||
|
protected Sprite straight;
|
||||||
|
|
||||||
|
protected Sprite downhill1Small;
|
||||||
|
protected Sprite uphill1Small;
|
||||||
|
protected Sprite straightSmall;
|
||||||
|
|
||||||
|
protected Image nextSlopeImage;
|
||||||
|
protected Image currentSlopeImage;
|
||||||
|
protected Image miniMapProcess;
|
||||||
|
protected Image currentSlopeProcess;
|
||||||
|
protected Text miniMapProcessText;
|
||||||
|
|
||||||
|
protected Slider cameraSlider;
|
||||||
|
|
||||||
|
protected virtual void Awake()
|
||||||
|
{
|
||||||
|
#region 控件获取与事件绑定
|
||||||
|
fps = transform.Find("Panel/FPS").GetComponent<Text>();
|
||||||
|
arrow = transform.Find("Panel/Arrow").GetComponent<Image>();
|
||||||
|
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
||||||
|
leftPanel = transform.Find("Panel/ReviewPanel").gameObject;
|
||||||
|
nearByPanel = transform.Find("Panel/NearPanel").gameObject;
|
||||||
|
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/Distance").GetComponent<Text>();
|
||||||
|
titlePanel = transform.Find("Panel/TitlePanel").gameObject;
|
||||||
|
totalDistance = transform.Find("Panel/TitlePanel/TotalDistance").GetComponent<Text>();
|
||||||
|
candance = transform.Find("Panel/PowerPanel/Cadance").GetComponent<Text>();
|
||||||
|
heartRate = transform.Find("Panel/PowerPanel/Hrv").GetComponent<Text>();
|
||||||
|
nextSlopePanel = transform.Find("Panel/NextSlopePanel").gameObject;
|
||||||
|
currentSlopePanel = transform.Find("Panel/CurrentSlopePanel").gameObject;
|
||||||
|
nextSlopeText = transform.Find("Panel/NextSlopePanel/NextSlopeText").GetComponent<Text>();
|
||||||
|
nextSlopeDistanceText = transform.Find("Panel/NextSlopePanel/NextSlopeDistance").GetComponent<Text>();
|
||||||
|
currentSlopeText = transform.Find("Panel/CurrentSlopePanel/CurrentSlopeText").GetComponent<Text>();
|
||||||
|
currentSlopeDistanceText = transform.Find("Panel/CurrentSlopePanel/CurrentSlopeDistance").GetComponent<Text>();
|
||||||
|
currentSlopeToatalDistanceText = transform.Find("Panel/CurrentSlopePanel/TotalSlopeDistance").GetComponent<Text>();
|
||||||
|
currentSlopeProcess = transform.Find("Panel/CurrentSlopePanel/Process").GetComponent<Image>();
|
||||||
|
|
||||||
|
speedTxt = transform.Find("Panel/ComputerPanel/Speed").GetComponent<Text>();
|
||||||
|
powerTxt = transform.Find("Panel/PowerPanel/Power").GetComponent<Text>();
|
||||||
|
timerTxt = transform.Find("Panel/ComputerPanel/Timer").GetComponent<Text>();
|
||||||
|
countDownTxt = transform.Find("Panel/CountDown").GetComponent<Text>();
|
||||||
|
mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>();
|
||||||
|
totalClimb = transform.Find("Panel/ComputerPanel/TotalClimb").GetComponent<Text>();
|
||||||
|
//img = transform.Find("Panel/ElevationChart/HeadImage").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").gameObject;
|
||||||
|
|
||||||
|
alertPanel = transform.Find("Panel/Alert").gameObject;
|
||||||
|
|
||||||
|
selectPanel = transform.Find("Panel/SelectPanel").gameObject;
|
||||||
|
selectPlayer = transform.Find("Panel/SelectPlayer").gameObject;
|
||||||
|
reviewPanel = transform.Find("Panel/ReviewPanel").gameObject;
|
||||||
|
quitPanel = transform.Find("Panel/QuitPanel").gameObject;
|
||||||
|
|
||||||
|
pauseButton = transform.Find("Panel/ToolBarPanel/StartOrPauseButton").GetComponent<Button>();
|
||||||
|
settingButton = transform.Find("Panel/ToolBarPanel/SettingButton").GetComponent<Button>();
|
||||||
|
deviceButton = transform.Find("Panel/ToolBarPanel/DeviceButton").GetComponent<Button>();
|
||||||
|
exitButton = transform.Find("Panel/ToolBarPanel/ExitButton").GetComponent<Button>();
|
||||||
|
|
||||||
|
singleButton = transform.Find("Panel/SelectPanel/SingleButton").GetComponent<Button>();
|
||||||
|
shadowButton = transform.Find("Panel/SelectPanel/ShadowButton").GetComponent<Button>();
|
||||||
|
|
||||||
|
singleArea = transform.Find("Panel/ReviewPanel/SingleArea").gameObject;
|
||||||
|
addButton = transform.Find("Panel/ReviewPanel/SingleArea/AddButton").GetComponent<Button>();
|
||||||
|
|
||||||
|
saveButton = transform.Find("Panel/QuitPanel/QuitPanel/SaveButton").GetComponent<Button>();
|
||||||
|
cancelQuitButton = transform.Find("Panel/QuitPanel/QuitPanel/CancelButton").GetComponent<Button>();
|
||||||
|
closeQuitButton = transform.Find("Panel/QuitPanel/QuitPanel/CloseButton").GetComponent<Button>();
|
||||||
|
abandonButton = transform.Find("Panel/QuitPanel/QuitPanel/AbandonButton").GetComponent<Button>();
|
||||||
|
|
||||||
|
viewButton = transform.Find("Panel/ViewButton").GetComponent<Button>();
|
||||||
|
altitudeGraph = transform.Find("Panel/TitlePanel/AltitudeGraph").GetComponent<RawImage>();
|
||||||
|
leftImage = transform.Find("Panel/TitlePanel/AltitudeGraph/Left").GetComponent<Image>();
|
||||||
|
rightImage = transform.Find("Panel/TitlePanel/AltitudeGraph/Right").GetComponent<Image>();
|
||||||
|
area = transform.Find("Panel/TitlePanel/AltitudeGraph/Area").GetComponent<Image>();
|
||||||
|
settingPanel = transform.Find("Panel/SettingPanel").gameObject;
|
||||||
|
preSlopeText = transform.Find("Panel/PreSlopePanel/PreSlopeText").GetComponent<Text>();
|
||||||
|
|
||||||
|
nextSlopeImage = transform.Find("Panel/NextSlopePanel/NextSlopeImage").GetComponent<Image>();
|
||||||
|
currentSlopeImage = transform.Find("Panel/CurrentSlopePanel/Image").GetComponent<Image>();
|
||||||
|
|
||||||
|
//加载坡度图片
|
||||||
|
downhill1 = Resources.Load<Sprite>("Images/Ride/downhill 1");
|
||||||
|
uphill1 = Resources.Load<Sprite>("Images/Ride/uphill 1");
|
||||||
|
straight = Resources.Load<Sprite>("Images/Ride/straight");
|
||||||
|
|
||||||
|
downhill1Small = Resources.Load<Sprite>("Images/Ride/downhill-small");
|
||||||
|
uphill1Small = Resources.Load<Sprite>("Images/Ride/uphill-small");
|
||||||
|
straightSmall = Resources.Load<Sprite>("Images/Ride/straight-small");
|
||||||
|
|
||||||
|
target = transform.parent.Find("Target").gameObject;
|
||||||
|
//小地图进度
|
||||||
|
miniMapProcess = transform.Find("Panel/MiniMap/Process").GetComponent<Image>();
|
||||||
|
miniMapProcessText = transform.Find("Panel/MiniMap/Process/Text").GetComponent<Text>();
|
||||||
|
|
||||||
|
|
||||||
|
UIManager.AddEvent(pauseButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, PauseRide);
|
||||||
|
UIManager.AddEvent(exitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StopRide);
|
||||||
|
UIManager.AddEvent(saveButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SaveRide);
|
||||||
|
|
||||||
|
UIManager.AddEvent(settingButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSettingPanel);
|
||||||
|
UIManager.AddEvent(deviceButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowDevicePanel);
|
||||||
|
UIManager.AddEvent(simpleBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ClearPanel);
|
||||||
|
|
||||||
|
UIManager.AddEvent(abandonButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CancelQuit);
|
||||||
|
UIManager.AddEvent(closeQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CloseQuit);
|
||||||
|
UIManager.AddEvent(cancelQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CloseQuit);
|
||||||
|
|
||||||
|
UIManager.AddEvent(viewButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeView);
|
||||||
|
|
||||||
|
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerEnter, OnPointEnter);
|
||||||
|
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerEnter, OnPointEnter);
|
||||||
|
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, OnPointExit);
|
||||||
|
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, OnPointExit);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
protected virtual void Start()
|
||||||
|
{
|
||||||
|
Init();//初始
|
||||||
|
RenderChart();//渲染海拔图
|
||||||
|
}
|
||||||
|
protected virtual void Update()
|
||||||
|
{
|
||||||
|
time -= Time.deltaTime;
|
||||||
|
while (time < 0) {
|
||||||
|
MoveElevationImage();
|
||||||
|
BindDataSource();
|
||||||
|
fps.text = (1 / Time.deltaTime).ToString();
|
||||||
|
time = 1;
|
||||||
|
}
|
||||||
|
MoveCamera();
|
||||||
|
}
|
||||||
|
private float cameraX = 0;
|
||||||
|
private float cameraY = 0;
|
||||||
|
private float cameraZ = 0;
|
||||||
|
|
||||||
|
private Transform player;
|
||||||
|
private MapRoute routeInstance;
|
||||||
|
|
||||||
|
private float time = 1f;
|
||||||
|
private float? localY;
|
||||||
|
|
||||||
|
private Vector3 m = new Vector3(0.1f, 0.1f, 0.1f);
|
||||||
|
private Vector3 CameraVector = Vector3.zero;
|
||||||
|
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
playerController = FindObjectOfType<PlayerController>();
|
||||||
|
mainController = FindObjectOfType<CyclingController>();
|
||||||
|
player = transform.parent.Find("Player");
|
||||||
|
var route = mainController.GetRoute();
|
||||||
|
routeInstance = route.RouteInstance;
|
||||||
|
//初始化3d视角
|
||||||
|
var camera = routeInstance.Camera;
|
||||||
|
if (!string.IsNullOrEmpty(camera))
|
||||||
|
{
|
||||||
|
var cameraArr = camera.Split(',');
|
||||||
|
cameraX = float.Parse(cameraArr[0]);
|
||||||
|
cameraY = float.Parse(cameraArr[1]);
|
||||||
|
cameraZ = float.Parse(cameraArr[2]);
|
||||||
|
}
|
||||||
|
//开发者视角调整
|
||||||
|
cameraSlider = transform.Find("Panel/CameraSlider").GetComponent<Slider>();
|
||||||
|
Text CameraText = transform.Find("Panel/CameraSlider/Text").GetComponent<Text>();
|
||||||
|
string[] phoneList = new string[] { "18120141032", "15651831367", "18120141031", "15261826280", "18662240319" };
|
||||||
|
if (phoneList.Contains(App.CurrentUser.Phone))
|
||||||
|
{
|
||||||
|
cameraSlider.gameObject.SetActive(true);
|
||||||
|
cameraSlider.value = cameraY;
|
||||||
|
CameraText.text = cameraY.ToString("f0");
|
||||||
|
cameraSlider.onValueChanged.AddListener((f) =>
|
||||||
|
{
|
||||||
|
cameraY = f;
|
||||||
|
CameraText.text = f.ToString("f0");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//路书基本信息绑定
|
||||||
|
mapName.text = routeInstance.Name;
|
||||||
|
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程
|
||||||
|
Utils.DisplayImage(altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图
|
||||||
|
//影子骑行按钮控制
|
||||||
|
if (mainController.mapRouteRankingList == null || mainController.mapRouteRankingList.Count == 0)
|
||||||
|
{
|
||||||
|
shadowButton.image.sprite = Resources.Load<Sprite>("Images/Ride/Shadow Mode_no");
|
||||||
|
shadowButton.enabled = false;
|
||||||
|
shadowButton.interactable = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shadowButton.enabled = true;
|
||||||
|
shadowButton.interactable = true;
|
||||||
|
}
|
||||||
|
//标记3d的地图可以用
|
||||||
|
if (!route.RouteInstance.Enable3D)
|
||||||
|
{
|
||||||
|
viewButton.enabled = false;
|
||||||
|
viewButton.interactable = false;
|
||||||
|
mainController.Is3dView = false;
|
||||||
|
mainController.player.transform.localScale = new Vector3(0, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainController.Is3dView = false;
|
||||||
|
ChangeView(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//移动摄像头和箭头位置
|
||||||
|
public void MoveCamera()
|
||||||
|
{
|
||||||
|
if (target != null)
|
||||||
|
{
|
||||||
|
target.transform.position = playerController.currentPos; //player.transform.position;// new Vector3((float)Math.Round(player.transform.position.x,1), 0, (float)Math.Round(player.transform.position.z,1));
|
||||||
|
if (!mainController.Is3dView)
|
||||||
|
{
|
||||||
|
Vector3 v = Vector3.zero;
|
||||||
|
v.y += playerController.currentRotation.eulerAngles.y + 160f; //target.transform.rotation = playerController.transform.rotation;//new Quaternion(playerController.transform.rotation.x, playerController.transform.rotation.y +1f, playerController.transform.rotation.z, playerController.transform.rotation.w);
|
||||||
|
target.transform.eulerAngles = v; //.Set(0, playerController.currentRotation.eulerAngles.y + 160f, 0);// = new Vector3(0, playerController.transform.eulerAngles.y + 160f, 0);
|
||||||
|
//mainController.player.transform.localScale.Set(0.1f, 0.1f, 0.1f);
|
||||||
|
player.transform.localScale = m;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CameraVector.x = cameraX;
|
||||||
|
CameraVector.y = cameraY;
|
||||||
|
CameraVector.z = cameraZ;
|
||||||
|
target.transform.eulerAngles = CameraVector;
|
||||||
|
}
|
||||||
|
//控制照片移动
|
||||||
|
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||||
|
if (playerController.Speed > 0 && mainController.isStart)
|
||||||
|
{
|
||||||
|
arrow.transform.Find("bg").gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arrow.transform.Find("bg").gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//绑定数据源
|
||||||
|
public void BindDataSource()
|
||||||
|
{
|
||||||
|
//获取当前选中玩家绑定当前UI
|
||||||
|
if (playerController != null)
|
||||||
|
{
|
||||||
|
speedTxt.text = $"{Math.Round(playerController.Speed, 1)}";
|
||||||
|
powerTxt.text = $"{playerController.Power}";
|
||||||
|
timerTxt.text = Helper.FormatTicks(playerController.TotalTicks);
|
||||||
|
ditance.text = Math.Round(playerController.TotalDistance, 1).ToString("f1");
|
||||||
|
heartRate.text = $"{Math.Round(playerController.HeartRate, 0)}";
|
||||||
|
candance.text = $"{Math.Round(playerController.Cadance, 0)}";
|
||||||
|
preSlopeText.text = $"{Math.Round(playerController.PreSlope, 1)}%";
|
||||||
|
currentSlopeToatalDistanceText.text = $"Total:{Math.Round(playerController.CurrentDistance, 0)}M";
|
||||||
|
//坡度相关数据
|
||||||
|
nextSlopeText.text = Math.Round(playerController.NextSlope, 1).ToString() + "%";
|
||||||
|
//nextSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.NextSlopeDistance, 0, "-{0}M");
|
||||||
|
nextSlopeDistanceText.text = $"{Math.Round(playerController.NextSlopeTotalDistance, 0)}M";
|
||||||
|
currentSlopeText.text = Math.Round(playerController.CurrentSlope, 1).ToString() + "%";
|
||||||
|
currentSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.CurrentSlopeDistance, Math.Round(playerController.CurrentDistance, 0), playerController.CurrentIndex, 0, "{0}M", currentSlopeProcess);
|
||||||
|
currentSlopeDistanceText.GetComponent<NumberDotween>().AnimateNumText((float)playerController.CurrentDistance - (float)playerController.CurrentSlopeDistance, Math.Round(playerController.CurrentDistance, 0), playerController.CurrentIndex, 0, "{0}M", currentSlopeProcess);
|
||||||
|
totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString();
|
||||||
|
//小地图进度
|
||||||
|
var process = (float)(playerController.TotalDistance / routeInstance.Distance);
|
||||||
|
miniMapProcess.fillAmount = process;
|
||||||
|
miniMapProcessText.text = $"{process*100:f0}%";
|
||||||
|
//动态改变坡度图片
|
||||||
|
ChangeSlopeImage(nextSlopeImage, playerController.NextSlope);
|
||||||
|
ChangeSlopeImage(currentSlopeImage, playerController.CurrentSlope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//改变坡度图片
|
||||||
|
public void ChangeSlopeImage(Image image,double slope)
|
||||||
|
{
|
||||||
|
if (slope >= 1)
|
||||||
|
{
|
||||||
|
image.sprite = uphill1;
|
||||||
|
}
|
||||||
|
else if (slope > -1 && slope < 1)
|
||||||
|
{
|
||||||
|
image.sprite = straight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image.sprite = downhill1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//开始骑行
|
||||||
|
public virtual void StartRide()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//继续骑行
|
||||||
|
public virtual void ContinueRide()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//暂停游戏
|
||||||
|
public void PauseRide(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
mainController.SetPause();
|
||||||
|
count = 0;
|
||||||
|
countDownTxt.gameObject.SetActive(false);
|
||||||
|
startBtn.gameObject.SetActive(true);
|
||||||
|
startPanel.SetActive(true);
|
||||||
|
}
|
||||||
|
//保存游戏
|
||||||
|
public void SaveRide(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
if (playerController.TotalTicks > 0 && !mainController.isQuit)
|
||||||
|
{
|
||||||
|
mainController.SetQuit();
|
||||||
|
playerController.Upload();
|
||||||
|
quitPanel.SetActive(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene("MainScene");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//不保存退出
|
||||||
|
public void CancelQuit(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
quitPanel.SetActive(false);
|
||||||
|
SceneManager.LoadScene("MainScene");
|
||||||
|
}
|
||||||
|
//取消退出
|
||||||
|
public void CloseQuit(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
quitPanel.SetActive(false);
|
||||||
|
}
|
||||||
|
//切换视角
|
||||||
|
public void ChangeView(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
mainController.ChangeMapImageStyle(arrow.gameObject);
|
||||||
|
}
|
||||||
|
//结束游戏
|
||||||
|
public void StopRide(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
if (playerController.TotalTicks > 0)
|
||||||
|
{
|
||||||
|
quitPanel.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene("MainScene");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//显示设备连接
|
||||||
|
public void ShowDevicePanel(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
UIManager.Show(UIManager.Instance.DevicePanel, transform.Find("Panel").GetComponent<PFUIPanel>());
|
||||||
|
}
|
||||||
|
//显示设置
|
||||||
|
public void ShowSettingPanel(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
settingPanel.SetActive(true);
|
||||||
|
}
|
||||||
|
//进入简约模式
|
||||||
|
int isSimple = 1;
|
||||||
|
private bool clearLock = true;
|
||||||
|
public void ClearPanel(BaseEventData baseEventData)
|
||||||
|
{
|
||||||
|
if (clearLock)
|
||||||
|
{
|
||||||
|
clearLock = false;
|
||||||
|
leftPanel.transform.DOLocalMove(new Vector3(leftPanel.transform.localPosition.x + isSimple * 430f, leftPanel.transform.localPosition.y, leftPanel.transform.localPosition.z), 1);
|
||||||
|
titlePanel.transform.DOLocalMove(new Vector3(titlePanel.transform.localPosition.x, titlePanel.transform.localPosition.y + isSimple * 200f, titlePanel.transform.localPosition.z), 1);
|
||||||
|
miniMap.transform.DOLocalMove(new Vector3(miniMap.transform.localPosition.x, miniMap.transform.localPosition.y + isSimple * 260f, miniMap.transform.localPosition.z), 1);
|
||||||
|
nextSlopePanel.transform.DOLocalMove(new Vector3(nextSlopePanel.transform.localPosition.x, nextSlopePanel.transform.localPosition.y + isSimple * 260f, nextSlopePanel.transform.localPosition.z), 1);
|
||||||
|
currentSlopePanel.transform.DOLocalMove(new Vector3(currentSlopePanel.transform.localPosition.x, currentSlopePanel.transform.localPosition.y + isSimple * 120f, currentSlopePanel.transform.localPosition.z), 1);
|
||||||
|
var Scale = isSimple == 1 ? new Vector3(0.7f, 0.7f, 0.7f) : new Vector3(1f, 1f, 1f);
|
||||||
|
currentSlopePanel.transform.DOScale(Scale, 1);
|
||||||
|
|
||||||
|
viewButton.transform.DOLocalMove(new Vector3(viewButton.transform.localPosition.x + isSimple * 200f, viewButton.transform.localPosition.y, viewButton.transform.localPosition.z), 1);
|
||||||
|
|
||||||
|
nearByPanel.transform.DOLocalMove(new Vector3(nearByPanel.transform.localPosition.x + isSimple * -330f, nearByPanel.transform.localPosition.y, nearByPanel.transform.localPosition.z), 1).onComplete += () =>
|
||||||
|
{
|
||||||
|
clearLock = true;
|
||||||
|
isSimple *= -1;
|
||||||
|
simpleBtn.transform.GetComponent<Image>().sprite = isSimple == -1 ? Resources.Load<Sprite>("Images/Ride/full 1") : Resources.Load<Sprite>("Images/Ride/simple 1");
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//初始化海拔图
|
||||||
|
GraphChartBase graph;
|
||||||
|
ChartDataSourceScript chartDataSourceScript;
|
||||||
|
public void RenderChart()
|
||||||
|
{
|
||||||
|
var mapData = mainController.GetMapData();
|
||||||
|
double x = 0;
|
||||||
|
Dictionary<double, double> dataSource = new Dictionary<double, double>();
|
||||||
|
List<double> dd = new List<double>();
|
||||||
|
var one = mapData.List.Where(c => c.Distance == 0).Count();
|
||||||
|
foreach (var item in mapData.List)
|
||||||
|
{
|
||||||
|
if (!dataSource.ContainsKey(x))
|
||||||
|
{
|
||||||
|
dataSource.Add(x, item.Elevation);
|
||||||
|
}
|
||||||
|
x += item.Distance;
|
||||||
|
dd.Add(item.Elevation);
|
||||||
|
}
|
||||||
|
chartDataSourceScript = transform.Find("Panel/GraphChart").GetComponent<ChartDataSourceScript>();
|
||||||
|
graph = transform.Find("Panel/GraphChart").GetComponent<GraphChartBase>();
|
||||||
|
chartDataSourceScript.SetDataSource(dd.ToArray());
|
||||||
|
|
||||||
|
if (App.CurrentUser != null)
|
||||||
|
{
|
||||||
|
Utils.DisplayImage(head, App.CurrentUser.WxHeadImg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//移动总海拔图范围
|
||||||
|
public void MoveElevationImage()
|
||||||
|
{
|
||||||
|
if (chartDataSourceScript.mData.Count <= chartDataSourceScript.targetPoints)
|
||||||
|
{
|
||||||
|
leftImage.gameObject.SetActive(false);
|
||||||
|
rightImage.gameObject.SetActive(false);
|
||||||
|
altitudeGraph.gameObject.SetActive(false);
|
||||||
|
area.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var start = chartDataSourceScript.GetRealTimeStart();
|
||||||
|
var end = chartDataSourceScript.GetRealTimeEnd();
|
||||||
|
|
||||||
|
var originWith =0D;
|
||||||
|
var with = altitudeGraph.GetComponent<RectTransform>().sizeDelta.x;
|
||||||
|
|
||||||
|
var left = start * with + originWith;
|
||||||
|
var right = end * with + originWith;
|
||||||
|
var rectTransform = area.gameObject.GetComponent<RectTransform>();
|
||||||
|
var width = (float)(end - start)* 286F;
|
||||||
|
rectTransform.DOSizeDelta(new Vector2((float)width+5f, 40), 1);
|
||||||
|
rectTransform.DOLocalMoveX((float)(left), 1);
|
||||||
|
leftImage.GetComponent<RectTransform>().DOLocalMoveX((float)left, 1);
|
||||||
|
rightImage.GetComponent<RectTransform>().DOLocalMoveX((float)right, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 事件行为
|
||||||
|
|
||||||
|
public void OnPointEnter(BaseEventData pointerEventData)
|
||||||
|
{
|
||||||
|
var button = ((PointerEventData)pointerEventData).pointerEnter.GetComponent<Button>();
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
|
var enterTransform = button.transform;
|
||||||
|
if (localY == null)
|
||||||
|
{
|
||||||
|
localY = enterTransform.localPosition.y;
|
||||||
|
}
|
||||||
|
enterTransform.DOLocalMoveY(localY.Value + 5f, 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void OnPointExit(BaseEventData pointerEventData)
|
||||||
|
{
|
||||||
|
var button = ((PointerEventData)pointerEventData).pointerEnter.GetComponent<Button>();
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
|
var enterTransform = button.transform;
|
||||||
|
enterTransform.DOLocalMoveY(localY.Value, 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scenes/Ride/Scripts/BaseUIManager.cs.meta
Normal file
11
Assets/Scenes/Ride/Scripts/BaseUIManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1525adde7daa9b440b73a0d6223f2755
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -91,7 +91,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
miniMapPlayerPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/MiniMapPlayer");
|
miniMapPlayerPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/MiniMapPlayer");
|
||||||
target = transform.Find("Target");
|
target = transform.Find("Target");
|
||||||
//进入倒计时
|
//进入倒计时
|
||||||
singleUIManager = UIObject.GetComponent<SingleUIManager>();
|
singleUIManager = UIObject.GetComponent<BaseUIManager>();
|
||||||
loadingController = FindObjectOfType<LoadingController>();
|
loadingController = FindObjectOfType<LoadingController>();
|
||||||
loadingController.InjectController(this);
|
loadingController.InjectController(this);
|
||||||
//开始loading
|
//开始loading
|
||||||
@ -223,9 +223,13 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
case CyclingModel.Review:
|
case CyclingModel.Review:
|
||||||
cyclingController = new ReviewModel(route, selectParamModel);
|
cyclingController = new ReviewModel(route, selectParamModel);
|
||||||
break;
|
break;
|
||||||
|
//TODO:比赛模式
|
||||||
|
case CyclingModel.Competition:
|
||||||
|
cyclingController = new CompetitionModel(route, selectParamModel);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
AutoStart();
|
GameStart();//游戏进入开始倒计时
|
||||||
InitPlayer();
|
InitPlayer();//初始化人物方向等
|
||||||
}
|
}
|
||||||
PlayerController playerController;
|
PlayerController playerController;
|
||||||
//初始化人物位置角度
|
//初始化人物位置角度
|
||||||
@ -252,10 +256,11 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
var index = GetCurrentIndex(recorderData.EndDistance);
|
var index = GetCurrentIndex(recorderData.EndDistance);
|
||||||
playerController.InitGraph(index);
|
playerController.InitGraph(index);
|
||||||
}
|
}
|
||||||
SingleUIManager singleUIManager;
|
//SingleUIManager singleUIManager;
|
||||||
public void AutoStart()
|
BaseUIManager singleUIManager;
|
||||||
|
public void GameStart()
|
||||||
{
|
{
|
||||||
singleUIManager.StartRide(null);
|
singleUIManager.StartRide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoContinueRide()
|
public void GoContinueRide()
|
||||||
|
|||||||
@ -59,6 +59,21 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
_turfHelper = new TurfHelper(route.JsonData.List.Select(d => d.Point));
|
_turfHelper = new TurfHelper(route.JsonData.List.Select(d => d.Point));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual DateTime Now
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return UIManager.Now.GetDateTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string ShowTime
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Helper.FormatTicks(Ticks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 骑行函数(如果此方法不满足,可以在子类中重写此方法)
|
/// 骑行函数(如果此方法不满足,可以在子类中重写此方法)
|
||||||
@ -68,7 +83,8 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
{
|
{
|
||||||
//将当前用户的位置发送到udf服务
|
//将当前用户的位置发送到udf服务
|
||||||
SendUserPositionToServer();
|
SendUserPositionToServer();
|
||||||
|
//OutModel outData = GetSelfTargetData(targetData);
|
||||||
|
//BeforeRunAfterPakcData(targetData);//执行前的函数
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -105,7 +121,11 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 执行前,数据打包后
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outData"></param>
|
||||||
|
protected virtual void BeforeRunAfterPakcData(OutModel outData) { }
|
||||||
protected double SpeedToDistance(double speed)
|
protected double SpeedToDistance(double speed)
|
||||||
{
|
{
|
||||||
return Math.Round(speed / 3600, 5, MidpointRounding.AwayFromZero);
|
return Math.Round(speed / 3600, 5, MidpointRounding.AwayFromZero);
|
||||||
|
|||||||
@ -0,0 +1,324 @@
|
|||||||
|
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||||
|
using Assets.Scripts;
|
||||||
|
using Assets.Scripts.Apis;
|
||||||
|
using Assets.Scripts.Apis.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||||
|
{
|
||||||
|
public class CompetitionModel : BaseCycling
|
||||||
|
{
|
||||||
|
private MapCompetitionApi mapCompetitionApi;
|
||||||
|
|
||||||
|
private MapCompetition mapCompetition;
|
||||||
|
|
||||||
|
private List<CompetitionRankingResultModel> mapWorkoutRecordRankings = new List<CompetitionRankingResultModel>();
|
||||||
|
/// <summary>
|
||||||
|
/// 第一个到终点的时间
|
||||||
|
/// </summary>
|
||||||
|
private DateTime? FirstEndTime;
|
||||||
|
|
||||||
|
public override bool CanPause => false;
|
||||||
|
|
||||||
|
protected override string ShowTime
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CanStart())
|
||||||
|
{
|
||||||
|
var second = Math.Ceiling((Now - mapCompetition.StartTime).TotalSeconds);
|
||||||
|
|
||||||
|
var ts = TimeSpan.FromSeconds(second);
|
||||||
|
return $"{ (int)ts.TotalHours }:{ts:mm}:{ts:ss}";
|
||||||
|
}
|
||||||
|
return "00:00:00";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompetitionModel(Route route1, RouteResultParam param)
|
||||||
|
: base(route1, CyclingModel.Competition)
|
||||||
|
{
|
||||||
|
mapCompetitionApi = new MapCompetitionApi();
|
||||||
|
//param.EndDistance = 18;
|
||||||
|
recorderData = new RecorderDataModel()
|
||||||
|
{
|
||||||
|
CurrentUser = App.CurrentUser,
|
||||||
|
//BelongUserId = PubCommData.CurrentUser.Id,
|
||||||
|
Competitionid = param.CompetitionId??0,
|
||||||
|
ContinueIndex = param.ContinueIndex == null ? 0 : (int)param.ContinueIndex + 1,
|
||||||
|
ContinueMark = param.ContinueMark == null ? Guid.NewGuid().ToString() : param.ContinueMark,
|
||||||
|
EndDistance = param.EndDistance == 0 ? 0 : param.EndDistance,
|
||||||
|
IsCompleted = false,
|
||||||
|
IsNeedRanking = true,
|
||||||
|
CyclingState = CyclingStateEnum.Prepare,
|
||||||
|
//ManufacturerId = ManufacturerId,
|
||||||
|
CurrentRoute = route,
|
||||||
|
CurrentRouteStartDistance = param.EndDistance == 0 ? 0 : param.EndDistance,
|
||||||
|
//DeviceNumber = DeviceNumber,
|
||||||
|
//AntModelId = antModelId
|
||||||
|
};
|
||||||
|
|
||||||
|
IsRecord = true;
|
||||||
|
|
||||||
|
riders = new List<BaseRider>();
|
||||||
|
var rider = new OnlineRiderModel()
|
||||||
|
{
|
||||||
|
NickName = App.CurrentUser.Nickname,
|
||||||
|
UserId = App.CurrentUser.Id,
|
||||||
|
WxHeadImg = App.CurrentUser.WxHeadImg,
|
||||||
|
EndDistance = param.EndDistance == 0 ? 0 : param.EndDistance
|
||||||
|
};
|
||||||
|
if (recorderData.CurrentRouteStartDistance > 0)
|
||||||
|
{
|
||||||
|
rider.Point = _turfHelper.Along(param.EndDistance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rider.Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]);
|
||||||
|
}
|
||||||
|
riders.Add(rider);
|
||||||
|
|
||||||
|
var result = mapCompetitionApi.GetById(param.CompetitionId??0);
|
||||||
|
if (result.result == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FirstEndTime = mapCompetition.FirstEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BeforeRunAfterPakcData(OutModel outData)
|
||||||
|
{
|
||||||
|
outData.CanStart = CanStart();
|
||||||
|
outData.StartCountDown = StartCountdown();
|
||||||
|
var endCountDownResult = EndCountDown();
|
||||||
|
outData.EndCountDown = endCountDownResult.Item1;
|
||||||
|
outData.IsClosed = endCountDownResult.Item2;
|
||||||
|
|
||||||
|
|
||||||
|
#region 设置第一名的坐标
|
||||||
|
if (!FirstEndTime.HasValue)
|
||||||
|
{
|
||||||
|
var firstItem = base.realRiders.OrderByDescending(w => w.NextDistance).FirstOrDefault();
|
||||||
|
if (firstItem != null)
|
||||||
|
{
|
||||||
|
outData.FirstPoint = firstItem.Point;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
////如果骑行中,但是已经到结束时间
|
||||||
|
//if (outData.EndCountDown <= 0 && recorderData.CyclingState == CyclingStateEnum.Cycling)
|
||||||
|
//{
|
||||||
|
// base.CacheAnimate();
|
||||||
|
//}
|
||||||
|
var userList = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id)
|
||||||
|
.Where(d => d.CompetitionId == recorderData.Competitionid)
|
||||||
|
.OrderByDescending(u => u.IsCompleted).ThenByDescending(d => d.EndDistance);
|
||||||
|
|
||||||
|
|
||||||
|
riders.RemoveAll(r => r.IsSelf == false);
|
||||||
|
int index = 0;
|
||||||
|
List<CompetitionRankingSortModel> sort = new List<CompetitionRankingSortModel>();
|
||||||
|
|
||||||
|
//标识后面的用户都是比我慢的用户
|
||||||
|
var slowerThenMe = false;
|
||||||
|
if (userList.Any())
|
||||||
|
{
|
||||||
|
var point = new double[] { outData.targetData._Lat, outData.targetData._Lon };
|
||||||
|
var self = userList.SingleOrDefault(r => r.IsSelf);
|
||||||
|
if (self != null)
|
||||||
|
{
|
||||||
|
point = self.Point;
|
||||||
|
}
|
||||||
|
foreach (var item in userList)
|
||||||
|
{
|
||||||
|
#region 记录第一个冲线的时间
|
||||||
|
if (item.IsCompleted && !FirstEndTime.HasValue)
|
||||||
|
{
|
||||||
|
FirstEndTime = Now;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (item.IsSelf == false)
|
||||||
|
{
|
||||||
|
riders.Add(new OnlineRiderModel
|
||||||
|
{
|
||||||
|
NickName = item.Name,
|
||||||
|
UserId = item.Id,
|
||||||
|
WxHeadImg = item.HeadImage,
|
||||||
|
Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
||||||
|
EndDistance = item.EndDistance,
|
||||||
|
PreDistance = item.PreDistance
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
double near = Math.Round(TurfHelper.GetDistances(point, item.Point), 2);
|
||||||
|
if (slowerThenMe)
|
||||||
|
{
|
||||||
|
near = near * -1;
|
||||||
|
}
|
||||||
|
if (item.IsSelf)
|
||||||
|
{
|
||||||
|
near = 0;
|
||||||
|
slowerThenMe = true;
|
||||||
|
}
|
||||||
|
//else if (index == 1)
|
||||||
|
//{
|
||||||
|
// near = near * -1;
|
||||||
|
//}
|
||||||
|
sort.Add(new CompetitionRankingSortModel
|
||||||
|
{
|
||||||
|
Index = index,
|
||||||
|
Name = item.Name,
|
||||||
|
Near = near,
|
||||||
|
KGWeight = Math.Round(item.WeightKg, 2).ToString(),
|
||||||
|
Speed = Math.Round(item.Speed, 1),
|
||||||
|
CountryImg = ConfigHelper.Host + $"User/GetCountryImg?userid={ item.Id }",
|
||||||
|
UserId = item.Id,
|
||||||
|
IsSelf = item.IsSelf
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 骑行结束,比赛结果展示数据
|
||||||
|
var results = new List<CompetitionResultModel>();
|
||||||
|
if (recorderData.IsCompleted || recorderData.Saved || mapCompetition.HasRecord)
|
||||||
|
{
|
||||||
|
var users1 = userList.Where(d => d.IsCompleted || d.Saved);
|
||||||
|
if ((users1.Any() && users1.Any(d => mapWorkoutRecordRankings.All(u => u.UserId != d.Id)))
|
||||||
|
|| mapWorkoutRecordRankings.All(u => u.UserId != recorderData.BelongUserId))
|
||||||
|
{
|
||||||
|
var rrr = mapCompetitionApi.GetRankingList(recorderData.Competitionid);
|
||||||
|
if (rrr.result)
|
||||||
|
{
|
||||||
|
mapWorkoutRecordRankings = rrr.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var ranking in mapWorkoutRecordRankings)
|
||||||
|
{
|
||||||
|
//var ranking = mapWorkoutRecordRankings.SingleOrDefault(r => r.UserId == item.Id);
|
||||||
|
|
||||||
|
var createTime = "";
|
||||||
|
if (ranking != null)
|
||||||
|
{
|
||||||
|
createTime = ranking.CreateTime; //.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
results.Add(new CompetitionResultModel
|
||||||
|
{
|
||||||
|
Index = ranking.Index,
|
||||||
|
Name = ranking.NickName,
|
||||||
|
Weight = ranking?.Weight ?? 0,
|
||||||
|
WeightKg = ranking?.WeightKg ?? 0,
|
||||||
|
//Time = ranking?.TotalTime ?? "",
|
||||||
|
Power = ranking?.AveragePower ?? 0,
|
||||||
|
BicycleWeight = ranking?.BicycleWeight ?? 0,
|
||||||
|
HeartRate = ranking?.AverageHeartRate ?? 0,
|
||||||
|
DeviceType = ranking?.DeviceType ?? "",
|
||||||
|
CreateTime = createTime,
|
||||||
|
TripTime = ranking?.TripTime ?? "",
|
||||||
|
CompleteTime = ranking?.CompleteTime,
|
||||||
|
Gap = ranking?.Gap ?? ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
outData.CompetitionRanking = new CompetitionRankingModel
|
||||||
|
{
|
||||||
|
Sorts = sort,
|
||||||
|
MyRanking = sort.FindIndex(n => n.UserId == recorderData.BelongUserId) + 1,
|
||||||
|
Total = sort.Count,
|
||||||
|
Results = results
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 赛事模式有继续骑行,重写执行方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetData"></param>
|
||||||
|
public override void Run(TargetData targetData)
|
||||||
|
{
|
||||||
|
//base.BeforeRun(targetData);
|
||||||
|
if (recorderData.CyclingState == CyclingStateEnum.Prepare)
|
||||||
|
{
|
||||||
|
if (recorderData.EndDistance != 0)
|
||||||
|
{
|
||||||
|
currentDistance = recorderData.EndDistance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentDistance = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (recorderData.CyclingState == CyclingStateEnum.Cycling)
|
||||||
|
{
|
||||||
|
currentDistance = recorderData.EndDistance + SpeedToDistance(targetData._Speed);
|
||||||
|
}
|
||||||
|
base.Run(targetData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanStart()
|
||||||
|
{
|
||||||
|
if (mapCompetition == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//if (mapCompetition.CanStart)
|
||||||
|
//{
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (mapCompetition.HasRecord)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//已结束
|
||||||
|
if (mapCompetition.Status == 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (mapCompetition.StartTime <= Now && mapCompetition.EndTime > Now)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int StartCountdown()
|
||||||
|
{
|
||||||
|
if (CanStart()) return 0;
|
||||||
|
|
||||||
|
return (int)Math.Floor((mapCompetition.StartTime - Now).TotalSeconds);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 结束倒计时,bool值为true说明倒计时是关门时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (int, bool) EndCountDown()
|
||||||
|
{
|
||||||
|
if (CanStart() == false) return (0, false);
|
||||||
|
//if (recorderData.IsCompleted) return 0;
|
||||||
|
var end1 = (int)Math.Floor((mapCompetition.EndTime - Now).TotalSeconds);
|
||||||
|
if (!FirstEndTime.HasValue)
|
||||||
|
{
|
||||||
|
return (end1, false);
|
||||||
|
}
|
||||||
|
//var end2 = (int)Math.Floor((FirstEndTime.Value - Now).TotalSeconds);
|
||||||
|
var end2 = (int)Math.Floor((FirstEndTime.Value.AddMinutes(mapCompetition.CloseTime) - Now).TotalSeconds);
|
||||||
|
if (end1 < end2)
|
||||||
|
{
|
||||||
|
return (end1, false);
|
||||||
|
}
|
||||||
|
//return Math.Min(end1, end2);
|
||||||
|
return (end2, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 44b357cbe9541fa448708b42ff5bf3d6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -164,7 +164,8 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
headPanel.transform.DOMove(new Vector3(itemPosition.x, itemPosition.y, 0), 1);
|
headPanel.transform.position = new Vector3(itemPosition.x, itemPosition.y, 0);
|
||||||
|
//headPanel.transform.DOMove(new Vector3(itemPosition.x, itemPosition.y, 0), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head == null)
|
if (head == null)
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
|||||||
using System;
|
using System;
|
||||||
using ChartAndGraph;
|
using ChartAndGraph;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
@ -56,7 +57,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||||
//#if UNITY_EDITOR
|
//#if UNITY_EDITOR
|
||||||
System.Random rd = new System.Random();
|
System.Random rd = new System.Random();
|
||||||
//power = 1000; //rd.Next(150, 300);//测试功率
|
power = 400; //rd.Next(150, 300);//测试功率
|
||||||
//#endif
|
//#endif
|
||||||
mainController.TrackResistance(currentSlope * App.rideSetting.sensitivity / 100);
|
mainController.TrackResistance(currentSlope * App.rideSetting.sensitivity / 100);
|
||||||
}
|
}
|
||||||
@ -159,9 +160,25 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
headPanel.transform.position = new Vector3(nextPosition.x, nextPosition.y, 0);
|
||||||
|
//headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||||
}
|
}
|
||||||
headPanel.transform.SetSiblingIndex(999);
|
headPanel.transform.SetSiblingIndex(999);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
protected override IEnumerator MoveTo()
|
||||||
|
{
|
||||||
|
//让人物移动分点增加动画的流畅度
|
||||||
|
float t = 0;
|
||||||
|
while (t < 1)
|
||||||
|
{
|
||||||
|
t += Time.deltaTime;
|
||||||
|
|
||||||
|
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
|
||||||
|
currentPos = v;
|
||||||
|
transform.localPosition = v;
|
||||||
|
yield return new WaitForEndOfFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,329 +1,31 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using System.Linq;
|
|
||||||
using Mapbox.Unity.Map;
|
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using System;
|
|
||||||
using Assets.Scenes.Ride.Scripts.Model;
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using ChartAndGraph;
|
|
||||||
using Assets.Scripts;
|
|
||||||
using Assets.Scripts.Apis.Models;
|
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
|
public class SingleUIManager : BaseUIManager
|
||||||
public class SingleUIManager : MonoBehaviour
|
|
||||||
{
|
{
|
||||||
#region UI control
|
protected override void Awake()
|
||||||
GameObject target;
|
|
||||||
GameObject nearByPanel;//附近的人列表
|
|
||||||
GameObject leftPanel;//伴侣骑行列表
|
|
||||||
GameObject nextSlopePanel;//下一个坡度面板
|
|
||||||
GameObject currentSlopePanel;//当前坡度面板
|
|
||||||
GameObject selectPanel;//骑行模式选择
|
|
||||||
GameObject selectPlayer;//伴侣骑行选择窗口
|
|
||||||
GameObject reviewPanel;
|
|
||||||
GameObject titlePanel;
|
|
||||||
GameObject quitPanel;//退出界面
|
|
||||||
|
|
||||||
Text nextSlopeText;//下一个坡度
|
|
||||||
Text nextSlopeDistanceText;//下一个坡度距离
|
|
||||||
Text currentSlopeText;//当前坡度
|
|
||||||
Text currentSlopeDistanceText;//当前坡度已骑行距离
|
|
||||||
Text currentSlopeToatalDistanceText;//当前坡度总距离
|
|
||||||
Text speedTxt;//当前速度
|
|
||||||
Text powerTxt;//功率
|
|
||||||
Text timerTxt;//计时器
|
|
||||||
Text ditance;//当前骑行距离
|
|
||||||
Text totalDistance;//当前骑行距离
|
|
||||||
Text candance;//踏频
|
|
||||||
Text heartRate;//心率
|
|
||||||
Text countDownTxt;//倒计时5s
|
|
||||||
Text mapName;//路书名称
|
|
||||||
Text fps;//fps
|
|
||||||
Text totalClimb;
|
|
||||||
|
|
||||||
Button startBtn;//开始按钮
|
|
||||||
Button simpleBtn;//进入简约模式按钮
|
|
||||||
Button pauseButton;//暂停按钮
|
|
||||||
Button settingButton;//设置那妞
|
|
||||||
Button deviceButton;//设备按钮
|
|
||||||
Button viewButton;//视角按钮
|
|
||||||
Button exitButton;//退出按钮
|
|
||||||
Button singleButton;//单人骑行按钮
|
|
||||||
Button shadowButton;//影子选手按钮
|
|
||||||
Button addButton;//添加伴侣骑行
|
|
||||||
Button saveButton;//退出panel保存按钮
|
|
||||||
Button cancelQuitButton;//退出panel取消按钮
|
|
||||||
Button closeQuitButton;//退出panel关闭按钮
|
|
||||||
|
|
||||||
RawImage head;//海拔图头像
|
|
||||||
GameObject miniMap;//小地图
|
|
||||||
RawImage altitudeGraph;//海拔图
|
|
||||||
Image leftImage;
|
|
||||||
Image rightImage;
|
|
||||||
Image area;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 控制器
|
|
||||||
|
|
||||||
public PlayerController playerController;//当前用户
|
|
||||||
public CyclingController mainController;//主控制器
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private float timeRemaining = 1f;
|
|
||||||
private int count = 0;
|
|
||||||
Image arrow;
|
|
||||||
AbstractMap map;
|
|
||||||
Transform t;
|
|
||||||
GameObject alertPanel;
|
|
||||||
Button alertBtn;
|
|
||||||
Button alertCloseBtn;
|
|
||||||
Text preSlopeText;
|
|
||||||
GameObject startPanel;
|
|
||||||
GameObject headPanel;
|
|
||||||
GameObject settingPanel;
|
|
||||||
Button abandonButton;
|
|
||||||
GameObject singleArea;
|
|
||||||
Sprite downhill1;
|
|
||||||
Sprite uphill1;
|
|
||||||
Sprite straight;
|
|
||||||
|
|
||||||
Sprite downhill1Small;
|
|
||||||
Sprite uphill1Small;
|
|
||||||
Sprite straightSmall;
|
|
||||||
|
|
||||||
Image nextSlopeImage;
|
|
||||||
Image currentSlopeImage;
|
|
||||||
Image miniMapProcess;
|
|
||||||
Image currentSlopeProcess;
|
|
||||||
Text miniMapProcessText;
|
|
||||||
|
|
||||||
Slider cameraSlider;
|
|
||||||
|
|
||||||
void Awake()
|
|
||||||
{
|
{
|
||||||
#region 控件获取与事件绑定
|
base.Awake();
|
||||||
fps = transform.Find("Panel/FPS").GetComponent<Text>();
|
|
||||||
arrow = transform.Find("Panel/Arrow").GetComponent<Image>();
|
|
||||||
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
|
||||||
leftPanel = transform.Find("Panel/ReviewPanel").gameObject;
|
|
||||||
nearByPanel = transform.Find("Panel/NearPanel").gameObject;
|
|
||||||
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/Distance").GetComponent<Text>();
|
|
||||||
titlePanel = transform.Find("Panel/TitlePanel").gameObject;
|
|
||||||
totalDistance = transform.Find("Panel/TitlePanel/TotalDistance").GetComponent<Text>();
|
|
||||||
candance = transform.Find("Panel/PowerPanel/Cadance").GetComponent<Text>();
|
|
||||||
heartRate = transform.Find("Panel/PowerPanel/Hrv").GetComponent<Text>();
|
|
||||||
nextSlopePanel = transform.Find("Panel/NextSlopePanel").gameObject;
|
|
||||||
currentSlopePanel = transform.Find("Panel/CurrentSlopePanel").gameObject;
|
|
||||||
nextSlopeText = transform.Find("Panel/NextSlopePanel/NextSlopeText").GetComponent<Text>();
|
|
||||||
nextSlopeDistanceText = transform.Find("Panel/NextSlopePanel/NextSlopeDistance").GetComponent<Text>();
|
|
||||||
currentSlopeText = transform.Find("Panel/CurrentSlopePanel/CurrentSlopeText").GetComponent<Text>();
|
|
||||||
currentSlopeDistanceText = transform.Find("Panel/CurrentSlopePanel/CurrentSlopeDistance").GetComponent<Text>();
|
|
||||||
currentSlopeToatalDistanceText = transform.Find("Panel/CurrentSlopePanel/TotalSlopeDistance").GetComponent<Text>();
|
|
||||||
currentSlopeProcess = transform.Find("Panel/CurrentSlopePanel/Process").GetComponent<Image>();
|
|
||||||
|
|
||||||
speedTxt = transform.Find("Panel/ComputerPanel/Speed").GetComponent<Text>();
|
|
||||||
powerTxt = transform.Find("Panel/PowerPanel/Power").GetComponent<Text>();
|
|
||||||
timerTxt = transform.Find("Panel/ComputerPanel/Timer").GetComponent<Text>();
|
|
||||||
countDownTxt = transform.Find("Panel/CountDown").GetComponent<Text>();
|
|
||||||
mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>();
|
|
||||||
totalClimb = transform.Find("Panel/ComputerPanel/TotalClimb").GetComponent<Text>();
|
|
||||||
//img = transform.Find("Panel/ElevationChart/HeadImage").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").gameObject;
|
|
||||||
|
|
||||||
alertPanel = transform.Find("Panel/Alert").gameObject;
|
|
||||||
|
|
||||||
selectPanel = transform.Find("Panel/SelectPanel").gameObject;
|
|
||||||
selectPlayer = transform.Find("Panel/SelectPlayer").gameObject;
|
|
||||||
reviewPanel = transform.Find("Panel/ReviewPanel").gameObject;
|
|
||||||
quitPanel = transform.Find("Panel/QuitPanel").gameObject;
|
|
||||||
|
|
||||||
pauseButton = transform.Find("Panel/ToolBarPanel/StartOrPauseButton").GetComponent<Button>();
|
|
||||||
settingButton = transform.Find("Panel/ToolBarPanel/SettingButton").GetComponent<Button>();
|
|
||||||
deviceButton = transform.Find("Panel/ToolBarPanel/DeviceButton").GetComponent<Button>();
|
|
||||||
exitButton = transform.Find("Panel/ToolBarPanel/ExitButton").GetComponent<Button>();
|
|
||||||
|
|
||||||
singleButton = transform.Find("Panel/SelectPanel/SingleButton").GetComponent<Button>();
|
|
||||||
shadowButton = transform.Find("Panel/SelectPanel/ShadowButton").GetComponent<Button>();
|
|
||||||
|
|
||||||
singleArea = transform.Find("Panel/ReviewPanel/SingleArea").gameObject;
|
|
||||||
addButton = transform.Find("Panel/ReviewPanel/SingleArea/AddButton").GetComponent<Button>();
|
|
||||||
|
|
||||||
saveButton = transform.Find("Panel/QuitPanel/QuitPanel/SaveButton").GetComponent<Button>();
|
|
||||||
cancelQuitButton = transform.Find("Panel/QuitPanel/QuitPanel/CancelButton").GetComponent<Button>();
|
|
||||||
closeQuitButton = transform.Find("Panel/QuitPanel/QuitPanel/CloseButton").GetComponent<Button>();
|
|
||||||
abandonButton = transform.Find("Panel/QuitPanel/QuitPanel/AbandonButton").GetComponent<Button>();
|
|
||||||
|
|
||||||
viewButton = transform.Find("Panel/ViewButton").GetComponent<Button>();
|
|
||||||
altitudeGraph = transform.Find("Panel/TitlePanel/AltitudeGraph").GetComponent<RawImage>();
|
|
||||||
leftImage = transform.Find("Panel/TitlePanel/AltitudeGraph/Left").GetComponent<Image>();
|
|
||||||
rightImage = transform.Find("Panel/TitlePanel/AltitudeGraph/Right").GetComponent<Image>();
|
|
||||||
area = transform.Find("Panel/TitlePanel/AltitudeGraph/Area").GetComponent<Image>();
|
|
||||||
settingPanel = transform.Find("Panel/SettingPanel").gameObject;
|
|
||||||
preSlopeText = transform.Find("Panel/PreSlopePanel/PreSlopeText").GetComponent<Text>();
|
|
||||||
|
|
||||||
nextSlopeImage = transform.Find("Panel/NextSlopePanel/NextSlopeImage").GetComponent<Image>();
|
|
||||||
currentSlopeImage = transform.Find("Panel/CurrentSlopePanel/Image").GetComponent<Image>();
|
|
||||||
|
|
||||||
//加载坡度图片
|
|
||||||
downhill1 = Resources.Load<Sprite>("Images/Ride/downhill 1");
|
|
||||||
uphill1 = Resources.Load<Sprite>("Images/Ride/uphill 1");
|
|
||||||
straight = Resources.Load<Sprite>("Images/Ride/straight");
|
|
||||||
|
|
||||||
downhill1Small = Resources.Load<Sprite>("Images/Ride/downhill-small");
|
|
||||||
uphill1Small = Resources.Load<Sprite>("Images/Ride/uphill-small");
|
|
||||||
straightSmall = Resources.Load<Sprite>("Images/Ride/straight-small");
|
|
||||||
|
|
||||||
target = transform.parent.Find("Target").gameObject;
|
|
||||||
//小地图进度
|
|
||||||
miniMapProcess = transform.Find("Panel/MiniMap/Process").GetComponent<Image>();
|
|
||||||
miniMapProcessText = transform.Find("Panel/MiniMap/Process/Text").GetComponent<Text>();
|
|
||||||
|
|
||||||
UIManager.AddEvent(startBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide);
|
UIManager.AddEvent(startBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide);
|
||||||
UIManager.AddEvent(simpleBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ClearPanel);
|
|
||||||
UIManager.AddEvent(pauseButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, PauseRide);
|
|
||||||
UIManager.AddEvent(settingButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSettingPanel);
|
|
||||||
UIManager.AddEvent(deviceButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowDevicePanel);
|
|
||||||
UIManager.AddEvent(exitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StopRide);
|
|
||||||
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SingleRide);
|
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SingleRide);
|
||||||
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShadowRide);
|
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShadowRide);
|
||||||
UIManager.AddEvent(addButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSelectPlayer);
|
UIManager.AddEvent(addButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSelectPlayer);
|
||||||
UIManager.AddEvent(saveButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SaveRide);
|
|
||||||
UIManager.AddEvent(abandonButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CancelQuit);
|
|
||||||
UIManager.AddEvent(closeQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CloseQuit);
|
|
||||||
UIManager.AddEvent(cancelQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CloseQuit);
|
|
||||||
UIManager.AddEvent(viewButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ChangeView);
|
|
||||||
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerEnter, OnPointEnter);
|
|
||||||
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerEnter, OnPointEnter);
|
|
||||||
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, OnPointExit);
|
|
||||||
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerExit, OnPointExit);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
protected override void Start()
|
||||||
float? localY;
|
|
||||||
void OnPointEnter(BaseEventData pointerEventData)
|
|
||||||
{
|
{
|
||||||
var button = ((PointerEventData)pointerEventData).pointerEnter.GetComponent<Button>();
|
base.Start();
|
||||||
if (button != null)
|
|
||||||
{
|
|
||||||
var enterTransform = button.transform;
|
|
||||||
if (localY == null)
|
|
||||||
{
|
|
||||||
localY = enterTransform.localPosition.y;
|
|
||||||
}
|
|
||||||
enterTransform.DOLocalMoveY(localY.Value + 5f, 0.5f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void OnPointExit(BaseEventData pointerEventData)
|
protected override void Update()
|
||||||
{
|
{
|
||||||
var button = ((PointerEventData)pointerEventData).pointerEnter.GetComponent<Button>();
|
base.Update();
|
||||||
if (button != null)
|
|
||||||
{
|
|
||||||
var enterTransform = button.transform;
|
|
||||||
enterTransform.DOLocalMoveY(localY.Value, 0.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
RenderChart();
|
|
||||||
//ContinueRide();//继续骑行
|
|
||||||
}
|
|
||||||
// Update is called once per frame
|
|
||||||
float time = 1f;
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
time -= Time.deltaTime;
|
|
||||||
while (time < 0) {
|
|
||||||
MoveElevationImage();
|
|
||||||
BindDataSource();
|
|
||||||
fps.text = (1 / Time.deltaTime).ToString();
|
|
||||||
time = 1;
|
|
||||||
}
|
|
||||||
MoveCamera();
|
|
||||||
CountDown();
|
CountDown();
|
||||||
|
|
||||||
}
|
|
||||||
private float cameraX = 0;
|
|
||||||
private float cameraY = 0;
|
|
||||||
private float cameraZ = 0;
|
|
||||||
Transform player;
|
|
||||||
MapRoute routeInstance;
|
|
||||||
private void Init()
|
|
||||||
{
|
|
||||||
playerController = FindObjectOfType<PlayerController>();
|
|
||||||
mainController = FindObjectOfType<CyclingController>();
|
|
||||||
player = transform.parent.Find("Player");
|
|
||||||
var route = mainController.GetRoute();
|
|
||||||
routeInstance = route.RouteInstance;
|
|
||||||
//初始化3d视角
|
|
||||||
var camera = routeInstance.Camera;
|
|
||||||
if (!string.IsNullOrEmpty(camera))
|
|
||||||
{
|
|
||||||
var cameraArr = camera.Split(',');
|
|
||||||
cameraX = float.Parse(cameraArr[0]);
|
|
||||||
cameraY = float.Parse(cameraArr[1]);
|
|
||||||
cameraZ = float.Parse(cameraArr[2]);
|
|
||||||
}
|
|
||||||
//开发者视角调整
|
|
||||||
cameraSlider = transform.Find("Panel/CameraSlider").GetComponent<Slider>();
|
|
||||||
Text CameraText = transform.Find("Panel/CameraSlider/Text").GetComponent<Text>();
|
|
||||||
string[] phoneList = new string[] { "18120141032", "15651831367", "18120141031", "15261826280", "18662240319" };
|
|
||||||
if (phoneList.Contains(App.CurrentUser.Phone))
|
|
||||||
{
|
|
||||||
cameraSlider.gameObject.SetActive(true);
|
|
||||||
cameraSlider.value = cameraY;
|
|
||||||
CameraText.text = cameraY.ToString("f0");
|
|
||||||
cameraSlider.onValueChanged.AddListener((f) =>
|
|
||||||
{
|
|
||||||
cameraY = f;
|
|
||||||
CameraText.text = f.ToString("f0");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//路书基本信息绑定
|
|
||||||
mapName.text = routeInstance.Name;
|
|
||||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程
|
|
||||||
Utils.DisplayImage(altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图
|
|
||||||
//影子骑行按钮控制
|
|
||||||
if (mainController.mapRouteRankingList == null || mainController.mapRouteRankingList.Count == 0)
|
|
||||||
{
|
|
||||||
shadowButton.image.sprite = Resources.Load<Sprite>("Images/Ride/Shadow Mode_no");
|
|
||||||
shadowButton.enabled = false;
|
|
||||||
shadowButton.interactable = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shadowButton.enabled = true;
|
|
||||||
shadowButton.interactable = true;
|
|
||||||
}
|
|
||||||
//标记3d的地图可以用
|
|
||||||
if (!route.RouteInstance.Enable3D)
|
|
||||||
{
|
|
||||||
viewButton.enabled = false;
|
|
||||||
viewButton.interactable = false;
|
|
||||||
mainController.Is3dView = false;
|
|
||||||
mainController.player.transform.localScale = new Vector3(0, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainController.Is3dView = false;
|
|
||||||
ChangeView(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//继续骑行如果有伴侣就自动进入伴侣骑行
|
//继续骑行如果有伴侣就自动进入伴侣骑行
|
||||||
public void ContinueRide()
|
public override void ContinueRide()
|
||||||
{
|
{
|
||||||
if (mainController.routeResult != null)
|
if (mainController.routeResult != null)
|
||||||
{
|
{
|
||||||
@ -345,41 +47,6 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
nearByPanel.SetActive(true);
|
nearByPanel.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vector3 m = new Vector3(0.1f, 0.1f, 0.1f);
|
|
||||||
Vector3 CameraVector = Vector3.zero;
|
|
||||||
//移动摄像头和箭头位置
|
|
||||||
private void MoveCamera()
|
|
||||||
{
|
|
||||||
if (target != null)
|
|
||||||
{
|
|
||||||
target.transform.position = playerController.currentPos; //player.transform.position;// new Vector3((float)Math.Round(player.transform.position.x,1), 0, (float)Math.Round(player.transform.position.z,1));
|
|
||||||
if (!mainController.Is3dView)
|
|
||||||
{
|
|
||||||
Vector3 v = Vector3.zero;
|
|
||||||
v.y += playerController.currentRotation.eulerAngles.y + 160f; //target.transform.rotation = playerController.transform.rotation;//new Quaternion(playerController.transform.rotation.x, playerController.transform.rotation.y +1f, playerController.transform.rotation.z, playerController.transform.rotation.w);
|
|
||||||
target.transform.eulerAngles = v; //.Set(0, playerController.currentRotation.eulerAngles.y + 160f, 0);// = new Vector3(0, playerController.transform.eulerAngles.y + 160f, 0);
|
|
||||||
//mainController.player.transform.localScale.Set(0.1f, 0.1f, 0.1f);
|
|
||||||
player.transform.localScale = m;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CameraVector.x = cameraX;
|
|
||||||
CameraVector.y = cameraY;
|
|
||||||
CameraVector.z = cameraZ;
|
|
||||||
target.transform.eulerAngles = CameraVector;
|
|
||||||
}
|
|
||||||
//控制照片移动
|
|
||||||
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
|
||||||
if (playerController.Speed > 0 && mainController.isStart)
|
|
||||||
{
|
|
||||||
arrow.transform.Find("bg").gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arrow.transform.Find("bg").gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//倒计时
|
//倒计时
|
||||||
private void CountDown()
|
private void CountDown()
|
||||||
{
|
{
|
||||||
@ -411,53 +78,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
countDownTxt.text = count==0?"GO!": count.ToString();
|
countDownTxt.text = count==0?"GO!": count.ToString();
|
||||||
}
|
}
|
||||||
private void BindDataSource()
|
//重置游戏状态
|
||||||
{
|
|
||||||
//获取当前选中玩家绑定当前UI
|
|
||||||
if (playerController != null)
|
|
||||||
{
|
|
||||||
speedTxt.text = $"{Math.Round(playerController.Speed, 1)}";
|
|
||||||
powerTxt.text = $"{playerController.Power}";
|
|
||||||
timerTxt.text = Helper.FormatTicks(playerController.TotalTicks);
|
|
||||||
ditance.text = Math.Round(playerController.TotalDistance, 1).ToString("f1");
|
|
||||||
heartRate.text = $"{Math.Round(playerController.HeartRate, 0)}";
|
|
||||||
candance.text = $"{Math.Round(playerController.Cadance, 0)}";
|
|
||||||
preSlopeText.text = $"{Math.Round(playerController.PreSlope, 1)}%";
|
|
||||||
currentSlopeToatalDistanceText.text = $"Total:{Math.Round(playerController.CurrentDistance, 0)}M";
|
|
||||||
//坡度相关数据
|
|
||||||
nextSlopeText.text = Math.Round(playerController.NextSlope, 1).ToString() + "%";
|
|
||||||
//nextSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.NextSlopeDistance, 0, "-{0}M");
|
|
||||||
nextSlopeDistanceText.text = $"{Math.Round(playerController.NextSlopeTotalDistance, 0)}M";
|
|
||||||
currentSlopeText.text = Math.Round(playerController.CurrentSlope, 1).ToString() + "%";
|
|
||||||
currentSlopeDistanceText.GetComponent<NumberDotween>().AnimateNum((float)playerController.CurrentSlopeDistance, Math.Round(playerController.CurrentDistance, 0), playerController.CurrentIndex, 0, "{0}M", currentSlopeProcess);
|
|
||||||
currentSlopeDistanceText.GetComponent<NumberDotween>().AnimateNumText((float)playerController.CurrentDistance - (float)playerController.CurrentSlopeDistance, Math.Round(playerController.CurrentDistance, 0), playerController.CurrentIndex, 0, "{0}M", currentSlopeProcess);
|
|
||||||
totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString();
|
|
||||||
//小地图进度
|
|
||||||
var process = (float)(playerController.TotalDistance / routeInstance.Distance);
|
|
||||||
miniMapProcess.fillAmount = process;
|
|
||||||
miniMapProcessText.text = $"{process*100:f0}%";
|
|
||||||
//动态改变坡度图片
|
|
||||||
ChangeSlopeImage(nextSlopeImage, playerController.NextSlope);
|
|
||||||
ChangeSlopeImage(currentSlopeImage, playerController.CurrentSlope);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeSlopeImage(Image image,double slope)
|
|
||||||
{
|
|
||||||
if (slope >= 1)
|
|
||||||
{
|
|
||||||
image.sprite = uphill1;
|
|
||||||
}
|
|
||||||
else if (slope > -1 && slope < 1)
|
|
||||||
{
|
|
||||||
image.sprite = straight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
image.sprite = downhill1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//重置游戏
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
mainController.isStart = false;
|
mainController.isStart = false;
|
||||||
@ -466,6 +87,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
count = 0;
|
count = 0;
|
||||||
countDownTxt.gameObject.SetActive(false);
|
countDownTxt.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
//单人骑行
|
||||||
private void SingleRide(BaseEventData baseEventData)
|
private void SingleRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
selectPanel.SetActive(false);
|
selectPanel.SetActive(false);
|
||||||
@ -475,6 +97,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//显示附近的人列表
|
//显示附近的人列表
|
||||||
nearByPanel.SetActive(true);
|
nearByPanel.SetActive(true);
|
||||||
}
|
}
|
||||||
|
//伴侣骑行
|
||||||
private void ShadowRide(BaseEventData baseEventData)
|
private void ShadowRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
selectPanel.SetActive(false);
|
selectPanel.SetActive(false);
|
||||||
@ -484,174 +107,25 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//显示附近的人列表
|
//显示附近的人列表
|
||||||
nearByPanel.SetActive(true);
|
nearByPanel.SetActive(true);
|
||||||
}
|
}
|
||||||
|
//伴侣骑行选择界面
|
||||||
private void ShowSelectPlayer(BaseEventData baseEventData)
|
private void ShowSelectPlayer(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
selectPlayer.SetActive(true);
|
selectPlayer.SetActive(true);
|
||||||
}
|
}
|
||||||
|
//开始游戏触发事件
|
||||||
public void StartRide(BaseEventData baseEventData)
|
public void StartRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
// var antConnected = mainController.CheckAnt();//初始化ant+设备
|
this.StartRide();
|
||||||
//#if UNITY_EDITOR
|
|
||||||
// antConnected = true;
|
|
||||||
//#endif
|
|
||||||
// if (!antConnected)
|
|
||||||
// {
|
|
||||||
// alertPanel.SetActive(true);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
{
|
|
||||||
//加个5秒钟倒计时
|
|
||||||
count = 5;
|
|
||||||
startPanel.SetActive(false);
|
|
||||||
startBtn.gameObject.SetActive(false);
|
|
||||||
countDownTxt.gameObject.SetActive(true);
|
|
||||||
countDownTxt.text = count.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//暂停游戏
|
//开始骑行-加个5秒钟倒计时
|
||||||
private void PauseRide(BaseEventData baseEventData)
|
public override void StartRide()
|
||||||
{
|
{
|
||||||
mainController.SetPause();
|
count = 5;
|
||||||
count = 0;
|
startPanel.SetActive(false);
|
||||||
countDownTxt.gameObject.SetActive(false);
|
startBtn.gameObject.SetActive(false);
|
||||||
startBtn.gameObject.SetActive(true);
|
countDownTxt.gameObject.SetActive(true);
|
||||||
startPanel.SetActive(true);
|
countDownTxt.text = count.ToString();
|
||||||
}
|
|
||||||
private void SaveRide(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
if (playerController.TotalTicks > 0 && !mainController.isQuit)
|
|
||||||
{
|
|
||||||
mainController.SetQuit();
|
|
||||||
playerController.Upload();
|
|
||||||
quitPanel.SetActive(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SceneManager.LoadScene("MainScene");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void CancelQuit(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
quitPanel.SetActive(false);
|
|
||||||
SceneManager.LoadScene("MainScene");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseQuit(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
quitPanel.SetActive(false);
|
|
||||||
}
|
|
||||||
//切换到3d视角
|
|
||||||
private void ChangeView(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
mainController.ChangeMapImageStyle(arrow.gameObject);
|
|
||||||
}
|
|
||||||
//结束游戏
|
|
||||||
private void StopRide(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
if (playerController.TotalTicks > 0)
|
|
||||||
{
|
|
||||||
quitPanel.SetActive(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SceneManager.LoadScene("MainScene");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//显示设备连接
|
|
||||||
private void ShowDevicePanel(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
UIManager.Show(UIManager.Instance.DevicePanel, transform.Find("Panel").GetComponent<PFUIPanel>());
|
|
||||||
}
|
|
||||||
//显示设置
|
|
||||||
private void ShowSettingPanel(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
settingPanel.SetActive(true);
|
|
||||||
}
|
|
||||||
int isSimple = 1;
|
|
||||||
private bool clearLock = true;
|
|
||||||
private void ClearPanel(BaseEventData baseEventData)
|
|
||||||
{
|
|
||||||
if (clearLock)
|
|
||||||
{
|
|
||||||
clearLock = false;
|
|
||||||
leftPanel.transform.DOLocalMove(new Vector3(leftPanel.transform.localPosition.x + isSimple * 430f, leftPanel.transform.localPosition.y, leftPanel.transform.localPosition.z), 1);
|
|
||||||
titlePanel.transform.DOLocalMove(new Vector3(titlePanel.transform.localPosition.x, titlePanel.transform.localPosition.y + isSimple * 200f, titlePanel.transform.localPosition.z), 1);
|
|
||||||
miniMap.transform.DOLocalMove(new Vector3(miniMap.transform.localPosition.x, miniMap.transform.localPosition.y + isSimple * 260f, miniMap.transform.localPosition.z), 1);
|
|
||||||
nextSlopePanel.transform.DOLocalMove(new Vector3(nextSlopePanel.transform.localPosition.x, nextSlopePanel.transform.localPosition.y + isSimple * 260f, nextSlopePanel.transform.localPosition.z), 1);
|
|
||||||
currentSlopePanel.transform.DOLocalMove(new Vector3(currentSlopePanel.transform.localPosition.x, currentSlopePanel.transform.localPosition.y + isSimple * 120f, currentSlopePanel.transform.localPosition.z), 1);
|
|
||||||
var Scale = isSimple == 1 ? new Vector3(0.7f, 0.7f, 0.7f) : new Vector3(1f, 1f, 1f);
|
|
||||||
currentSlopePanel.transform.DOScale(Scale, 1);
|
|
||||||
|
|
||||||
viewButton.transform.DOLocalMove(new Vector3(viewButton.transform.localPosition.x + isSimple * 200f, viewButton.transform.localPosition.y, viewButton.transform.localPosition.z), 1);
|
|
||||||
|
|
||||||
nearByPanel.transform.DOLocalMove(new Vector3(nearByPanel.transform.localPosition.x + isSimple * -330f, nearByPanel.transform.localPosition.y, nearByPanel.transform.localPosition.z), 1).onComplete += () =>
|
|
||||||
{
|
|
||||||
clearLock = true;
|
|
||||||
isSimple *= -1;
|
|
||||||
simpleBtn.transform.GetComponent<Image>().sprite = isSimple == -1 ? Resources.Load<Sprite>("Images/Ride/full 1") : Resources.Load<Sprite>("Images/Ride/simple 1");
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GraphChartBase graph;
|
|
||||||
ChartDataSourceScript chartDataSourceScript;
|
|
||||||
//初始化海拔图
|
|
||||||
void RenderChart()
|
|
||||||
{
|
|
||||||
var mapData = mainController.GetMapData();
|
|
||||||
double x = 0;
|
|
||||||
Dictionary<double, double> dataSource = new Dictionary<double, double>();
|
|
||||||
List<double> dd = new List<double>();
|
|
||||||
var one = mapData.List.Where(c => c.Distance == 0).Count();
|
|
||||||
foreach (var item in mapData.List)
|
|
||||||
{
|
|
||||||
if (!dataSource.ContainsKey(x))
|
|
||||||
{
|
|
||||||
dataSource.Add(x, item.Elevation);
|
|
||||||
}
|
|
||||||
x += item.Distance;
|
|
||||||
dd.Add(item.Elevation);
|
|
||||||
}
|
|
||||||
chartDataSourceScript = transform.Find("Panel/GraphChart").GetComponent<ChartDataSourceScript>();
|
|
||||||
graph = transform.Find("Panel/GraphChart").GetComponent<GraphChartBase>();
|
|
||||||
chartDataSourceScript.SetDataSource(dd.ToArray());
|
|
||||||
|
|
||||||
if (App.CurrentUser != null)
|
|
||||||
{
|
|
||||||
Utils.DisplayImage(head, App.CurrentUser.WxHeadImg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//移动总海拔图范围
|
|
||||||
private void MoveElevationImage()
|
|
||||||
{
|
|
||||||
if (chartDataSourceScript.mData.Count <= chartDataSourceScript.targetPoints)
|
|
||||||
{
|
|
||||||
leftImage.gameObject.SetActive(false);
|
|
||||||
rightImage.gameObject.SetActive(false);
|
|
||||||
altitudeGraph.gameObject.SetActive(false);
|
|
||||||
area.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var start = chartDataSourceScript.GetRealTimeStart();
|
|
||||||
var end = chartDataSourceScript.GetRealTimeEnd();
|
|
||||||
|
|
||||||
var originWith =0D;
|
|
||||||
var with = altitudeGraph.GetComponent<RectTransform>().sizeDelta.x;
|
|
||||||
|
|
||||||
var left = start * with + originWith;
|
|
||||||
var right = end * with + originWith;
|
|
||||||
var rectTransform = area.gameObject.GetComponent<RectTransform>();
|
|
||||||
var width = (float)(end - start)* 286F;
|
|
||||||
rectTransform.DOSizeDelta(new Vector2((float)width+5f, 40), 1);
|
|
||||||
rectTransform.DOLocalMoveX((float)(left), 1);
|
|
||||||
leftImage.GetComponent<RectTransform>().DOLocalMoveX((float)left, 1);
|
|
||||||
rightImage.GetComponent<RectTransform>().DOLocalMoveX((float)right, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
81
Assets/Scripts/Apis/MapCompetitionApi.cs
Normal file
81
Assets/Scripts/Apis/MapCompetitionApi.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using Assets.Scripts.Apis.Models;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Apis
|
||||||
|
{
|
||||||
|
internal class MapCompetitionApi : ApiBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 比赛实体
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public JsonResult<MapCompetition> GetById(int id)
|
||||||
|
{
|
||||||
|
return Get<JsonResult<MapCompetition>>("/MapCompetition/GetDetail?id=" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前比赛排名
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public JsonResult<List<CompetitionRankingResultModel>> GetRankingList(int id)
|
||||||
|
{
|
||||||
|
var list = Get<JsonResult<dynamic>>($"/MapRecord/GetCompetitionRanking?id={ id }&pageIndex=0&pageSize=999");
|
||||||
|
|
||||||
|
return new JsonResult<List<CompetitionRankingResultModel>>
|
||||||
|
{
|
||||||
|
result = list.result,
|
||||||
|
errMsg = list.errMsg,
|
||||||
|
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CompetitionRankingResultModel>>(JsonConvert.SerializeObject(list.data.list))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//查询我参与的比赛列表
|
||||||
|
public JsonResult<List<JoinedCompetitionModel>> GetMyCompetitionList(string name)
|
||||||
|
{
|
||||||
|
var list = Get<JsonResult<dynamic>>($"/MapCompetition/GetMyList?name={ name }");
|
||||||
|
|
||||||
|
return new JsonResult<List<JoinedCompetitionModel>>
|
||||||
|
{
|
||||||
|
result = list.result,
|
||||||
|
errMsg = list.errMsg,
|
||||||
|
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JoinedCompetitionModel>>(JsonConvert.SerializeObject(list.data))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//查询比赛列表
|
||||||
|
public JsonResult<List<MapCompetitionModel>> GetCompetitionList(string name,int pageIndex,int pageSize,int status=0)
|
||||||
|
{
|
||||||
|
var list = Get<JsonResult<dynamic>>($"/MapCompetition/v1/GetList?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&status={ status }");
|
||||||
|
|
||||||
|
return new JsonResult<List<MapCompetitionModel>>
|
||||||
|
{
|
||||||
|
result = list.result,
|
||||||
|
errMsg = list.errMsg,
|
||||||
|
data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MapCompetitionModel>>(JsonConvert.SerializeObject(list.data))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//查询比赛详情
|
||||||
|
public JsonResult<MapCompetitionDetailModel> GetCompetitionDetail(int id)
|
||||||
|
{
|
||||||
|
var list = Get<JsonResult<dynamic>>($"/MapRouteGlobalCycling/Get?id={ id }");
|
||||||
|
|
||||||
|
return new JsonResult<MapCompetitionDetailModel>
|
||||||
|
{
|
||||||
|
result = list.result,
|
||||||
|
errMsg = list.errMsg,
|
||||||
|
data = Newtonsoft.Json.JsonConvert.DeserializeObject<MapCompetitionDetailModel>(JsonConvert.SerializeObject(list.data))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//报名必比赛
|
||||||
|
public JsonResult ApplyMapCompetition(int id)
|
||||||
|
{
|
||||||
|
return Get<JsonResult>($"/MapCompetition/ApplyMapCompetition?id={ id }");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Apis/MapCompetitionApi.cs.meta
Normal file
11
Assets/Scripts/Apis/MapCompetitionApi.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 89998d6971cbc68409034294cec3169c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
34
Assets/Scripts/Apis/Models/CompetitionRankingResultModel.cs
Normal file
34
Assets/Scripts/Apis/Models/CompetitionRankingResultModel.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
namespace Assets.Scripts.Apis.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 比赛排名的model
|
||||||
|
/// </summary>
|
||||||
|
public class CompetitionRankingResultModel
|
||||||
|
{
|
||||||
|
public int Index { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int RouteId { get; set; }
|
||||||
|
public double? AveragePower { get; set; }
|
||||||
|
public double? NormalizedPower { get; set; }
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
public int UserId { get; set; }
|
||||||
|
public double? AverageCadence { get; set; }
|
||||||
|
public int? MaxHeartRate { get; set; }
|
||||||
|
public int TotalTicks { get; set; }
|
||||||
|
//public string TotalTime { get; set; }
|
||||||
|
public string TripTime { get; set; }
|
||||||
|
public double Weight { get; set; }
|
||||||
|
public double WeightKg { get; set; }
|
||||||
|
public double TripDistance { get; set; }
|
||||||
|
public double TotalDistance { get; set; }
|
||||||
|
public int? AverageHeartRate { get; set; }
|
||||||
|
public double BicycleWeight { get; set; }
|
||||||
|
public string NickName { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
public string DeviceType { get; set; }
|
||||||
|
|
||||||
|
public string CompleteTime { get; set; }
|
||||||
|
|
||||||
|
public string Gap { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ba260963a0eda9848b585c258a1befc9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
42
Assets/Scripts/Apis/Models/JoinedCompetitionModel.cs
Normal file
42
Assets/Scripts/Apis/Models/JoinedCompetitionModel.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Apis.Models
|
||||||
|
{
|
||||||
|
public class JoinedCompetitionModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Dec { get; set; }
|
||||||
|
public int CreateUser { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public bool IsOfficial { get; set; }
|
||||||
|
public DateTime StartTime { get; set; }
|
||||||
|
public DateTime EndTime { get; set; }
|
||||||
|
public string CoverImage { get; set; }
|
||||||
|
public string Area { get; set; }
|
||||||
|
public int MapCompetitionType { get; set; }
|
||||||
|
public int Status { get; set; }
|
||||||
|
public string StatusStr { get; set; }
|
||||||
|
public object Sponsor { get; set; }
|
||||||
|
public int RouteId { get; set; }
|
||||||
|
public DateTime StartApplyTime { get; set; }
|
||||||
|
public DateTime EndApplyTime { get; set; }
|
||||||
|
public int MaxMembers { get; set; }
|
||||||
|
public int CloseTime { get; set; }
|
||||||
|
public string InviteCode { get; set; }
|
||||||
|
public string PhoneNumber { get; set; }
|
||||||
|
public DateTime? FirstEndTime { get; set; }
|
||||||
|
public bool IsComplete { get; set; }
|
||||||
|
public double TotalClimb { get; set; }
|
||||||
|
public double Distance { get; set; }
|
||||||
|
public double AverageGrade { get; set; }
|
||||||
|
public double EleDifference { get; set; }
|
||||||
|
public double MaxElevation { get; set; }
|
||||||
|
public string Hard { get; set; }
|
||||||
|
public bool CanEnter { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Apis/Models/JoinedCompetitionModel.cs.meta
Normal file
11
Assets/Scripts/Apis/Models/JoinedCompetitionModel.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a288d7af8a840f24589a9bcf63a445ac
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
55
Assets/Scripts/Apis/Models/MapCompetition.cs
Normal file
55
Assets/Scripts/Apis/Models/MapCompetition.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Apis.Models
|
||||||
|
{
|
||||||
|
public class MapCompetition
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Area { get; set; }
|
||||||
|
public string CompetitionType { get; set; }
|
||||||
|
public string CoverImage { get; set; }
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
public int CreateUser { get; set; }
|
||||||
|
public string Dec { get; set; }
|
||||||
|
public string EndApplyTime { get; set; }
|
||||||
|
public string EndApplyTimeVlaue { get; set; }
|
||||||
|
|
||||||
|
public bool IsOfficial { get; set; }
|
||||||
|
public int MapCompetitionType { get; set; }
|
||||||
|
public object NickName { get; set; }
|
||||||
|
public int pageCount { get; set; }
|
||||||
|
public int RouteId { get; set; }
|
||||||
|
public string Sponsor { get; set; }
|
||||||
|
public string StartApplyTime { get; set; }
|
||||||
|
public string StartApplyTimeVlaue { get; set; }
|
||||||
|
public DateTime StartTime { get; set; }
|
||||||
|
//public string StartTimeVlaue { get; set; }
|
||||||
|
|
||||||
|
public DateTime EndTime { get; set; }
|
||||||
|
//public string EndTimeVlaue { get; set; }
|
||||||
|
|
||||||
|
public int Status { get; set; }
|
||||||
|
public object StatusVlaue { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public double TotalDistance { get; set; }
|
||||||
|
public bool applyed { get; set; }
|
||||||
|
public bool CanJoin { get; set; }
|
||||||
|
public bool CanStart { get; set; }
|
||||||
|
public bool CanExit { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 服务器当前时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Now { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 第一个冲线时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? FirstEndTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 第一个冲线以后,还需要多少分钟自动结束
|
||||||
|
/// </summary>
|
||||||
|
public int CloseTime { get; set; }
|
||||||
|
|
||||||
|
public bool HasRecord { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Apis/Models/MapCompetition.cs.meta
Normal file
11
Assets/Scripts/Apis/Models/MapCompetition.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 213f656147b58d9468f6d5bf3c54c0e0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
25
Assets/Scripts/Apis/Models/MapCompetitionDetailModel.cs
Normal file
25
Assets/Scripts/Apis/Models/MapCompetitionDetailModel.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Apis.Models
|
||||||
|
{
|
||||||
|
public class MapCompetitionDetailModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public double LastDistance { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public double TotalDistance { get; set; }
|
||||||
|
public int Status { get; set; }
|
||||||
|
public string Desc { get; set; }
|
||||||
|
public string Dec { get; set; }
|
||||||
|
public DateTime StartTime { get; set; }
|
||||||
|
public bool CanStart { get; set; }
|
||||||
|
public string CoverImageUrl { get; set; }
|
||||||
|
public string CompetitionPreviewUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Apis/Models/MapCompetitionDetailModel.cs.meta
Normal file
11
Assets/Scripts/Apis/Models/MapCompetitionDetailModel.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 44ad8036668ddce41b39d57b308e5f11
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
24
Assets/Scripts/Apis/Models/MapCompetitionModel.cs
Normal file
24
Assets/Scripts/Apis/Models/MapCompetitionModel.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Apis.Models
|
||||||
|
{
|
||||||
|
public class MapCompetitionModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public int Status { get; set; }
|
||||||
|
public DateTime StartTime { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public int UserCount { get; set; }
|
||||||
|
public string StatusStr { get; set; }
|
||||||
|
public string CoverImage { get; set; }
|
||||||
|
public int MapCompetitionType { get; set; }
|
||||||
|
public double TotalDistance { get; set; }
|
||||||
|
public double LastDistance { get; set; }
|
||||||
|
public bool CanEnter { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Apis/Models/MapCompetitionModel.cs.meta
Normal file
11
Assets/Scripts/Apis/Models/MapCompetitionModel.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8017d7c6d2317804593c9e2a3cd25deb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
x
Reference in New Issue
Block a user