2021-04-09 15:57:50 +08:00
|
|
|
|
using Assets.Scripts;
|
2021-09-23 18:14:53 +08:00
|
|
|
|
using Assets.Scripts.Apis;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
using Assets.Scripts.Apis.Models;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.EventSystems;
|
2021-04-19 14:38:31 +08:00
|
|
|
|
using UnityEngine.SceneManagement;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
2021-09-06 16:53:48 +08:00
|
|
|
|
public class RouteItem : MonoBehaviour
|
|
|
|
|
|
#if !(UNITY_ANDROID || UNITY_IOS)
|
|
|
|
|
|
,IPointerEnterHandler,IPointerExitHandler
|
|
|
|
|
|
#endif
|
2021-04-09 15:57:50 +08:00
|
|
|
|
{
|
2021-04-19 14:38:31 +08:00
|
|
|
|
RouteResult routeResult;
|
2021-09-23 18:14:53 +08:00
|
|
|
|
RowerResultModel rowerResult;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
// Start is called before the first frame update
|
2021-09-06 16:53:48 +08:00
|
|
|
|
Transform left,row1,row2,right,rightDot;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
Transform btnReRide, btnContinue, btnDelete;
|
2021-07-29 19:55:29 +08:00
|
|
|
|
Transform btnDetail;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-23 18:14:53 +08:00
|
|
|
|
|
2021-04-09 15:57:50 +08:00
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
string titleColor = "#5c5c6e";
|
2021-04-19 14:36:08 +08:00
|
|
|
|
RouteResult data;
|
2021-04-19 15:44:11 +08:00
|
|
|
|
//滑动索引 0route 1match
|
|
|
|
|
|
int index;
|
2021-09-13 17:33:58 +08:00
|
|
|
|
//交互用
|
|
|
|
|
|
private Transform parent { get; set; }
|
2021-09-23 18:14:53 +08:00
|
|
|
|
public void Initial(object result, int index, Transform parent = null,bool top = false)
|
2021-04-09 15:57:50 +08:00
|
|
|
|
{
|
2021-09-23 18:14:53 +08:00
|
|
|
|
this.index = index;
|
|
|
|
|
|
if (parent)
|
2021-09-13 17:33:58 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.parent = parent;
|
|
|
|
|
|
}
|
2021-09-06 16:53:48 +08:00
|
|
|
|
left = transform.Find("BigLeft/Left");
|
2021-04-09 15:57:50 +08:00
|
|
|
|
row1 = left.Find("Main").Find("Row1");
|
|
|
|
|
|
row2 = left.Find("Main").Find("Row2");
|
2021-09-23 18:14:53 +08:00
|
|
|
|
rightDot = transform.Find("RightDot");
|
|
|
|
|
|
if (rightDot != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIManager.AddEvent(rightDot.Find("BtnDot").gameObject, EventTriggerType.PointerClick, (b) => OnPointerEnter(null));
|
|
|
|
|
|
UIManager.AddEvent(rightDot.Find("BtnDelete").gameObject, EventTriggerType.PointerClick, (b) => Delete());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//right.gameObject.SetActive(true);
|
|
|
|
|
|
#if !(UNITY_ANDROID || UNITY_IOS)
|
|
|
|
|
|
gameObject.GetComponent<Button>().onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Detail();
|
|
|
|
|
|
});
|
|
|
|
|
|
#else
|
|
|
|
|
|
gameObject.GetComponent<Button>().enabled = false;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
if (result is RouteResult)
|
|
|
|
|
|
{
|
|
|
|
|
|
Initial((RouteResult)result, index, parent);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Initial((RowerResultModel)result, index, parent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 划船机初始化
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="result"></param>
|
|
|
|
|
|
/// <param name="index"></param>
|
|
|
|
|
|
/// <param name="parent"></param>
|
|
|
|
|
|
public void Initial(RowerResultModel result, int index, Transform parent = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
rowerResult = result;
|
|
|
|
|
|
row1.Find("Rank").gameObject.SetActive(false);
|
|
|
|
|
|
row1.Find("Times").gameObject.SetActive(false);
|
|
|
|
|
|
var raw = transform.Find("BigLeft/CoverImage").GetComponent<RawImage>();
|
|
|
|
|
|
if (string.IsNullOrEmpty(result.Cover))
|
|
|
|
|
|
{
|
|
|
|
|
|
raw.texture = Resources.Load<Texture>("Images/Rower/地图1");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Utils.DisplayImage(raw, result.Cover, true);
|
|
|
|
|
|
}
|
2022-05-09 13:18:14 +08:00
|
|
|
|
row1.Find("Time").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Rowing time")}:</color>{TimeSpan.FromSeconds(result.Ticks).ToString()}";
|
2022-04-06 10:21:30 +08:00
|
|
|
|
row1.Find("Distance").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("row distance")}:</color>{result.TotalDistance}M";
|
2021-12-03 18:19:24 +08:00
|
|
|
|
row2.Find("Device").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Rowing equipment")}:</color>{result.ManufacturerName}";
|
2021-09-23 18:14:53 +08:00
|
|
|
|
left.Find("Progress").gameObject.SetActive(false);
|
2022-03-28 17:42:23 +08:00
|
|
|
|
string typeStr = "Free";
|
|
|
|
|
|
if (result.Type == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
typeStr = $"{result.TypeValue}M";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (result.Type == 2 && result.TypeValue.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
var ts = TimeSpan.FromSeconds(result.TypeValue.Value);
|
|
|
|
|
|
if (ts.TotalHours >= 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
typeStr = ts.TotalHours.ToString("#0.0") + "h";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ts.TotalMinutes >= 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
typeStr = ts.TotalMinutes.ToString("#0.0") + "min";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
typeStr = result.TypeValue.Value + "s";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
left.Find("Main/Name").GetComponent<Text>().text = $"{result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} {typeStr} Rowing";
|
2021-09-23 18:14:53 +08:00
|
|
|
|
left.Find("Main/Time").GetComponent<Text>().text = $"{result.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} ~ {result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}";
|
|
|
|
|
|
var rect = left.Find("Main").GetComponent<RectTransform>();
|
|
|
|
|
|
rect.sizeDelta = new Vector2(399,rect.sizeDelta.y);
|
|
|
|
|
|
SetButtonColor(false);
|
|
|
|
|
|
right = transform.Find("RightRower");
|
|
|
|
|
|
if (right != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnDetail = right.Find("BtnDetail");
|
|
|
|
|
|
if (btnDetail)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIManager.AddEvent(btnDetail.gameObject, EventTriggerType.PointerClick, b =>
|
|
|
|
|
|
{
|
2022-05-31 16:51:07 +08:00
|
|
|
|
//UIManager.ShowActivityPanel("http://192.168.0.101:3081/rower/record/27C0BE5C-3818-45D0-A2FD-681AC2ACFB64?UserId=16650");
|
|
|
|
|
|
#if UNITY_ANDROID || UNITY_IOS
|
|
|
|
|
|
UIManager.ShowActivityPanel($"{App.websiteDict[App.Host]}rower/record/{result.Id}?UserId={App.CurrentUser.Id}");
|
|
|
|
|
|
#else
|
2022-03-10 18:10:34 +08:00
|
|
|
|
Application.OpenURL($"{App.websiteDict[App.Host]}rower/record/{result.Id}?Token={App.CurrentUser.cookie}");
|
2022-05-31 16:51:07 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
//Application.OpenURL($"{App.websiteDict[App.Host]}rower/record/{result.Id}?Token={App.CurrentUser.cookie}");
|
2022-03-10 18:10:34 +08:00
|
|
|
|
//UIManager.ShowRowerResult(result.Id);
|
2021-09-23 18:14:53 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
btnReRide = right.Find("BtnRide");
|
|
|
|
|
|
if (btnReRide)
|
|
|
|
|
|
{
|
|
|
|
|
|
UIManager.AddEvent(btnReRide.gameObject, EventTriggerType.PointerClick, b =>
|
|
|
|
|
|
{
|
2021-09-28 17:51:58 +08:00
|
|
|
|
UIManager.ShowConfirm("Re-Rowing", "Rowing again?", () =>
|
|
|
|
|
|
{
|
2021-09-29 11:06:05 +08:00
|
|
|
|
UIManager.CloseConfirm();
|
2022-04-14 19:18:44 +08:00
|
|
|
|
UIManager.ShowRowerPanel(result);
|
2021-09-28 17:51:58 +08:00
|
|
|
|
});
|
2021-09-23 18:14:53 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//UIManager.AddEvent(transform.gameObject, EventTriggerType.PointerClick, b => UIManager.ShowRowerResult(result.Id));
|
|
|
|
|
|
}
|
2021-05-08 14:38:23 +08:00
|
|
|
|
|
2021-09-23 18:14:53 +08:00
|
|
|
|
public void Initial(RouteResult result,int index,Transform parent = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
routeResult = result;
|
2021-11-19 10:54:14 +08:00
|
|
|
|
Utils.DisplayImageTempDict(transform.Find("BigLeft/CoverImage").GetComponent<RawImage>(), result.RouteImage,
|
|
|
|
|
|
parent.GetComponent<ResultListController>().caches);
|
|
|
|
|
|
//Utils.DisplayImage(transform.Find("BigLeft/CoverImage").GetComponent<RawImage>(), result.RouteImage, true);
|
2021-05-08 14:38:23 +08:00
|
|
|
|
|
2021-04-09 15:57:50 +08:00
|
|
|
|
left.Find("Main").Find("Name").GetComponent<Text>().text = result.RouteName;
|
2021-12-30 16:51:04 +08:00
|
|
|
|
left.Find("Main").Find("Time").GetComponent<Text>().text = result.CreateTime.ToLocalString("HH:mm:ss dd-MM-yyyy");
|
2021-12-03 18:19:24 +08:00
|
|
|
|
row1.Find("Time").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Riding Time")}:</color>{result.TrainingTime}";
|
|
|
|
|
|
row1.Find("Distance").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Mileage")}:</color>{result.EndDistance.ToString("#0.00")}KM";
|
|
|
|
|
|
row1.Find("Times").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Times")}:</color>{result.Count}";
|
2021-04-19 15:44:11 +08:00
|
|
|
|
if (index == 0)
|
|
|
|
|
|
{
|
2021-12-03 18:19:24 +08:00
|
|
|
|
row1.Find("Rank").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Rank")}:</color>{result.Ranking}";
|
2021-04-19 15:44:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
row1.Find("Rank").GetComponent<Text>().text = $"";
|
|
|
|
|
|
}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
left.Find("Progress").Find("Image").GetComponent<Image>().fillAmount = (float)result.Progress;
|
|
|
|
|
|
left.Find("Progress").Find("Value").GetComponent<Text>().text = (result.Progress * 100).ToString("#0");
|
2021-12-03 18:19:24 +08:00
|
|
|
|
row2.Find("Device").GetComponent<Text>().text = $"<color={titleColor}>{App.GetLocalString("Cycling Equipment")}:</color>{result.ManufacturerName}";
|
2021-04-19 15:44:11 +08:00
|
|
|
|
if (index == 0)
|
2021-04-09 15:57:50 +08:00
|
|
|
|
{
|
2021-04-19 15:44:11 +08:00
|
|
|
|
right = transform.Find("Right");
|
2021-07-29 19:55:29 +08:00
|
|
|
|
right.gameObject.SetActive(true);
|
2021-04-19 15:44:11 +08:00
|
|
|
|
btnContinue = right.Find("BtnContinue");
|
|
|
|
|
|
if (btnContinue)
|
|
|
|
|
|
{
|
2021-04-25 19:41:35 +08:00
|
|
|
|
bool enabled = result.ContinueCyclingParam != null;
|
|
|
|
|
|
|
2021-04-19 15:44:11 +08:00
|
|
|
|
//btnContinue.gameObject.SetActive(false);
|
2021-04-25 15:33:17 +08:00
|
|
|
|
//btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
|
|
|
|
|
|
UIManager.AddEvent(btnContinue.gameObject, EventTriggerType.PointerClick, (b) => GoContinue());
|
2021-04-25 19:41:35 +08:00
|
|
|
|
btnContinue.GetComponent<Button>().interactable = enabled;
|
|
|
|
|
|
btnContinue.GetComponent<Button>().enabled = enabled;
|
2021-04-19 15:44:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
btnReRide = right.Find("BtnReRide");
|
|
|
|
|
|
if (btnReRide)
|
|
|
|
|
|
{
|
|
|
|
|
|
//btnReRide.gameObject.SetActive(false);
|
2021-04-25 15:33:17 +08:00
|
|
|
|
UIManager.AddEvent(btnReRide.gameObject, EventTriggerType.PointerClick, (b) => GoReRide());
|
|
|
|
|
|
//btnReRide.GetComponent<Button>().onClick.AddListener(GoReRide);
|
2021-04-19 15:44:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
btnDelete = right.Find("BtnDelete");
|
|
|
|
|
|
if (btnDelete)
|
|
|
|
|
|
{
|
|
|
|
|
|
//btnDelete.gameObject.SetActive(false);
|
2021-04-25 15:33:17 +08:00
|
|
|
|
//btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
|
2021-09-28 11:30:51 +08:00
|
|
|
|
#if UNITY_ANDROID || UNITY_IOS
|
2021-12-17 13:03:19 +08:00
|
|
|
|
UIManager.AddEvent(left.Find("Main/ShareContainer/Wx").gameObject, EventTriggerType.PointerClick, b =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log(App.CurrentUser.WebHost);
|
2021-12-17 18:28:02 +08:00
|
|
|
|
if (App.weChatController.IsWeChatAppInstalled())
|
|
|
|
|
|
{
|
2021-12-29 17:05:58 +08:00
|
|
|
|
App.weChatController.ShareWebpageToWX(0, $"http://{App.CurrentUser.WebHost}/RoutesRecords/" + result.RankingId, result.RouteName, "By " + App.CurrentUser.Nickname, null);
|
2021-12-17 18:28:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Utils.showToast(null, "未安装微信");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-17 13:03:19 +08:00
|
|
|
|
});
|
2021-09-06 16:53:48 +08:00
|
|
|
|
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Detail());
|
2021-09-28 11:30:51 +08:00
|
|
|
|
#else
|
|
|
|
|
|
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Delete());
|
|
|
|
|
|
#endif
|
2021-04-19 15:44:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
SetButtonColor(false);
|
|
|
|
|
|
transform.Find("RightMatch").gameObject.SetActive(false);
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
2021-04-19 15:44:11 +08:00
|
|
|
|
else
|
2021-04-09 15:57:50 +08:00
|
|
|
|
{
|
2021-09-02 14:18:26 +08:00
|
|
|
|
//Debug.Log(index);
|
2021-04-19 15:44:11 +08:00
|
|
|
|
right = transform.Find("RightMatch");
|
2021-07-29 19:55:29 +08:00
|
|
|
|
right.gameObject.SetActive(true);
|
|
|
|
|
|
btnDetail = right.Find("BtnDetail");
|
|
|
|
|
|
|
|
|
|
|
|
UIManager.AddEvent(btnDetail.gameObject, EventTriggerType.PointerClick, (b) => Detail());
|
2021-07-29 13:55:33 +08:00
|
|
|
|
UIManager.AddEvent(right.Find("BtnRide").gameObject, EventTriggerType.PointerClick, (b) => Ride());
|
2021-07-29 19:55:29 +08:00
|
|
|
|
SetButtonColor(false);
|
|
|
|
|
|
transform.Find("Right").gameObject.SetActive(false);
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
2021-09-23 18:14:53 +08:00
|
|
|
|
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
2021-07-29 13:55:33 +08:00
|
|
|
|
void Detail()
|
|
|
|
|
|
{
|
2021-07-29 19:55:29 +08:00
|
|
|
|
var url = routeResult.ViewUrl + "?Token=" + App.CurrentUser.cookie;
|
|
|
|
|
|
if (index == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
url += "&raceId=" + routeResult.MapCompetitionId;
|
|
|
|
|
|
}
|
|
|
|
|
|
Application.OpenURL(url);
|
2021-07-29 13:55:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
void Ride()
|
|
|
|
|
|
{
|
2021-07-29 19:55:29 +08:00
|
|
|
|
UIManager.ShowConfirm("Ride", "Ride this route?", () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
App.RouteIdParam = routeResult.RouteId;
|
|
|
|
|
|
App.routeResult = routeResult;
|
|
|
|
|
|
App.routeResult.ContinueCyclingParam = null;
|
|
|
|
|
|
RecordFromUrl();
|
|
|
|
|
|
SceneManager.LoadScene("Ride");
|
|
|
|
|
|
});
|
2021-07-29 13:55:33 +08:00
|
|
|
|
}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
private void Delete()
|
|
|
|
|
|
{
|
2021-04-28 15:21:06 +08:00
|
|
|
|
UIManager.ShowConfirm("Delete", "Delete this record?", async () =>
|
|
|
|
|
|
{
|
2021-09-23 18:14:53 +08:00
|
|
|
|
JsonResult<object> r = null;
|
|
|
|
|
|
if (index != 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
r = await ConfigHelper.mapApi.DeleteRecord(routeResult.Id);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
r = await ConfigHelper.rowerApi.Delete(rowerResult.Id);
|
|
|
|
|
|
}
|
2021-04-28 15:21:06 +08:00
|
|
|
|
UIManager.CloseConfirm();
|
|
|
|
|
|
if (r.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DestroyImmediate(gameObject);
|
|
|
|
|
|
}
|
2021-09-23 18:14:53 +08:00
|
|
|
|
else
|
2021-04-28 15:21:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
Utils.showToast(gameObject, r.errMsg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void GoReRide()
|
|
|
|
|
|
{
|
2021-04-28 15:21:06 +08:00
|
|
|
|
UIManager.ShowConfirm("ReRide", "Ride again?", () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
App.RouteIdParam = routeResult.RouteId;
|
2021-11-11 17:45:02 +08:00
|
|
|
|
App.routeResult = null;//routeResult;
|
|
|
|
|
|
//App.routeResult.ContinueCyclingParam = null;
|
2021-04-29 18:07:30 +08:00
|
|
|
|
RecordFromUrl();
|
2021-04-28 15:21:06 +08:00
|
|
|
|
SceneManager.LoadScene("Ride");
|
|
|
|
|
|
});
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
2021-04-29 18:07:30 +08:00
|
|
|
|
private void RecordFromUrl()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (App.MainSceneParam.ContainsKey("Name"))
|
|
|
|
|
|
{
|
|
|
|
|
|
App.MainSceneParam["Name"] = "UserInfoPanel";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
App.MainSceneParam.Add("Name", "UserInfoPanel");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
private void GoContinue()
|
|
|
|
|
|
{
|
2021-04-28 15:21:06 +08:00
|
|
|
|
UIManager.ShowConfirm("Continue", "Continue riding?", () =>
|
2021-04-19 14:38:31 +08:00
|
|
|
|
{
|
2021-04-28 15:21:06 +08:00
|
|
|
|
if (routeResult.ContinueCyclingParam != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
App.RouteIdParam = routeResult.RouteId;
|
|
|
|
|
|
App.routeResult = routeResult;
|
2021-04-29 18:07:30 +08:00
|
|
|
|
RecordFromUrl();
|
2021-04-28 15:21:06 +08:00
|
|
|
|
SceneManager.LoadScene("Ride");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
2021-09-06 16:53:48 +08:00
|
|
|
|
#if !(UNITY_ANDROID || UNITY_IOS)
|
2021-04-19 15:44:11 +08:00
|
|
|
|
void SetButtonColor(bool f)
|
|
|
|
|
|
{
|
2021-07-29 19:55:29 +08:00
|
|
|
|
if (routeResult!=null)
|
2021-04-19 15:44:11 +08:00
|
|
|
|
{
|
2021-07-29 19:55:29 +08:00
|
|
|
|
if (index == 0)
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
2021-07-29 19:55:29 +08:00
|
|
|
|
if (f)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool enabled = routeResult.ContinueCyclingParam == null;
|
|
|
|
|
|
btnContinue.GetComponent<Image>().color =
|
|
|
|
|
|
enabled ? Utils.HexToColorHtml("#75264e") : Utils.HexToColorHtml("#F93086");
|
|
|
|
|
|
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
|
|
|
|
|
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
|
|
|
|
|
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#474759");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#23232D");
|
|
|
|
|
|
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
|
|
|
|
|
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
|
|
|
|
|
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
|
|
|
|
|
}
|
2021-04-26 16:25:52 +08:00
|
|
|
|
}
|
2021-07-29 19:55:29 +08:00
|
|
|
|
else if (index == 1)
|
2021-04-26 16:25:52 +08:00
|
|
|
|
{
|
2021-07-29 19:55:29 +08:00
|
|
|
|
if (f)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnDetail.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
|
|
|
|
|
btnDetail.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
btnDetail.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
btnDetail.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
|
|
|
|
|
}
|
2021-04-26 16:25:52 +08:00
|
|
|
|
}
|
2021-04-19 15:44:11 +08:00
|
|
|
|
}
|
2021-04-26 16:25:52 +08:00
|
|
|
|
|
2021-04-19 15:44:11 +08:00
|
|
|
|
}
|
2021-08-27 15:06:56 +08:00
|
|
|
|
#else
|
|
|
|
|
|
void SetButtonColor(bool f)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!f)
|
|
|
|
|
|
{
|
2021-09-23 18:14:53 +08:00
|
|
|
|
transform.Find("RightRower").gameObject.SetActive(false);
|
2021-08-27 15:06:56 +08:00
|
|
|
|
transform.Find("Right").gameObject.SetActive(false);
|
|
|
|
|
|
transform.Find("RightMatch").gameObject.SetActive(false);
|
|
|
|
|
|
transform.Find("RightDot").gameObject.SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
transform.Find("Right").gameObject.SetActive(index == 0);
|
|
|
|
|
|
if (index == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool disabled = routeResult.ContinueCyclingParam == null;
|
|
|
|
|
|
if (disabled)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#cdcdcd");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
transform.Find("RightMatch").gameObject.SetActive(index == 1);
|
2021-09-23 18:14:53 +08:00
|
|
|
|
transform.Find("RightRower").gameObject.SetActive(index == 2);
|
2021-08-27 15:06:56 +08:00
|
|
|
|
transform.Find("RightDot").gameObject.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2021-09-06 16:53:48 +08:00
|
|
|
|
public bool enter { get; private set; }
|
2021-04-09 15:57:50 +08:00
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
|
|
|
|
{
|
|
|
|
|
|
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");
|
2021-07-29 13:55:33 +08:00
|
|
|
|
//if (index == 1)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
// right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
|
|
|
|
|
//}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
if (left != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
left.Find("Progress").Find("Image").GetComponent<Image>().color = Utils.HexToColorHtml("#5c5c6e");
|
|
|
|
|
|
left.Find("Progress").Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
left.Find("Progress").Find("bf").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (row1 != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
row1.Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
|
|
|
|
|
row1.Find("Distance").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
|
|
|
|
|
row1.Find("Times").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
|
|
|
|
|
row1.Find("Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
|
|
|
|
|
}
|
2021-09-07 16:12:16 +08:00
|
|
|
|
if (row2 != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
row2.Find("Device").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
|
|
|
|
|
}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
titleColor = "#414251";
|
2021-04-19 15:44:11 +08:00
|
|
|
|
SetButtonColor(false);
|
2021-04-28 15:21:06 +08:00
|
|
|
|
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
2021-09-06 16:53:48 +08:00
|
|
|
|
enter = false;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
|
|
|
|
{
|
2021-09-13 17:33:58 +08:00
|
|
|
|
var pController = parent.GetComponent<ResultListController>();
|
|
|
|
|
|
if (pController.currentItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
pController.currentItem.GetComponent<RouteItem>().OnPointerExit(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
pController.currentItem = transform;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
2021-07-29 13:55:33 +08:00
|
|
|
|
//if (index == 1)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
|
|
|
|
|
// right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
//}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
if (left != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
|
|
|
|
|
left.Find("Progress").Find("Image").GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
|
|
|
|
|
left.Find("Progress").Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
left.Find("Progress").Find("bf").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (row1 != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
row1.Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
row1.Find("Distance").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
row1.Find("Times").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
row1.Find("Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
}
|
2021-09-07 16:12:16 +08:00
|
|
|
|
if (row2 != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
row2.Find("Device").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
|
|
|
|
|
}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
titleColor = "#5c5c6e";
|
2021-04-19 15:44:11 +08:00
|
|
|
|
SetButtonColor(true);
|
2021-04-28 15:21:06 +08:00
|
|
|
|
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
|
2021-09-06 16:53:48 +08:00
|
|
|
|
enter = true;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|