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

44 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
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; scoreModel.pointList.Count > 0; i++)
{
int index = i;
UI_PracticeInfoItem temp = Instantiate(piiPrefab, content);
temp.Init(index + 1, scoreModel.pointList[index]);
}
GetControl<TextMeshProUGUI>("ScoreRes").text = scoreModel.score.ToString();
GetControl<TextMeshProUGUI>("UsedTimesRes").text = "00:555";
}
protected override void OnClick(string btnName)
{
switch (btnName)
{
case "restartBtn":
GameManager.Instance.Practice();
break;
case "backBtn":
GameManager.Instance.ShowUIPanelAndLoadScene(true);
break;
case "closeBtn":
GameManager.UIMgr.HidePanel<UI_PracticeCompletedPanel>();
break;
default:
break;
}
}
}