52 lines
2.2 KiB
C#
52 lines
2.2 KiB
C#
using Assets.Scripts.Apis.Models;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RowerWelldone : PFUIPanel
|
|
{
|
|
public override void Show()
|
|
{
|
|
base.Show();
|
|
Debug.Log("well done show");
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
UIManager.AddEvent(transform.Find("BtnDefine").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
|
{
|
|
Close();
|
|
UIManager.ShowHomePanel();
|
|
UIManager.ShowUserInfoPanel();
|
|
});
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
RowerRecordModel model;
|
|
public void Initial(RowerRecordModel model)
|
|
{
|
|
Debug.Log("Initial");
|
|
if (model == null) return;
|
|
this.model = model;
|
|
transform.Find("Time/Value1").GetComponent<Text>().text = model.CreateTime.ToLocalTime().ToString("yyyy-MM-dd");
|
|
transform.Find("Time/Value2").GetComponent<Text>().text = model.CreateTime.ToLocalTime().ToString("HH:mm:ss");
|
|
transform.Find("RowingTime/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(model.TotalTime).ToString();
|
|
transform.Find("Distance/Value").GetComponent<Text>().text = $"{model.TotalDistance.ToString()}M";
|
|
var datas = transform.Find("Other/Datas");
|
|
datas.Find("AvgRate/Value").GetComponent<Text>().text = $"{model.AvgRate.ToString("#0")}";
|
|
datas.Find("MaxRate/Value").GetComponent<Text>().text = $"{model.MaxRate.ToString()}";
|
|
datas.Find("AvgPower/Value").GetComponent<Text>().text = $"{model.AvgPower.ToString("#0")}";
|
|
datas.Find("MaxPower/Value").GetComponent<Text>().text = $"{model.MaxPower.ToString()}";
|
|
datas.Find("MaxPace/Value").GetComponent<Text>().text = $"{TimeSpan.FromSeconds(model.MaxPace).ToString(@"mm\:ss")}";
|
|
datas.Find("AvgPace/Value").GetComponent<Text>().text = $"{TimeSpan.FromSeconds(model.AvgPace).ToString(@"mm\:ss")}";
|
|
datas.Find("Calories/Value").GetComponent<Text>().text = $"{(model.Kj ?? 0).ToString("#0")}";
|
|
datas.Find("StrokeCount/Value").GetComponent<Text>().text = $"{model.StrokeCount}";
|
|
}
|
|
}
|