YanCheng_Metrology/Assets/Scripts/Project/UI/UI_Panel/UI_PracticeCompletedPanel.cs

46 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using System;
public class UI_PracticeCompletedPanel : BasePanel
{
public UI_PracticeInfoItem piiPrefab;
public RectTransform content;
public void Init()
{
ScoreModel scoreModel = ScoreManager.instance.GetScore(GameManager.RunModelMgr.schemeID);
for (int i = 0; i < scoreModel.pointList.Count; i++)
{
int index = i;
UI_PracticeInfoItem temp = Instantiate(piiPrefab, content);
temp.Init(index, scoreModel.pointList[index]);
}
GetControl<TextMeshProUGUI>("ScoreRes").text = scoreModel.score.ToString();
GetControl<TextMeshProUGUI>("UsedTimesRes").text = (DateTime.Now - GameManager.RunModelMgr.startTime).ToString(@"hh\:mm\:ss");
Debug.Log("¿ªÊ¼Ê±¼ä£º" + GameManager.RunModelMgr.startTime.ToString() + " ½áÊøÊ±¼ä£º" + DateTime.Now.ToString());
}
protected override void OnClick(string btnName)
{
switch (btnName)
{
case "restartBtn":
GameManager.Instance.Practice();
break;
case "backBtn":
GameManager.Instance.ShowUIPanelAndLoadScene(true);
break;
case "closeBtn":
break;
default:
break;
}
GameManager.UIMgr.HidePanel<UI_PracticeCompletedPanel>();
}
}