76 lines
2.4 KiB
C#
76 lines
2.4 KiB
C#
using System.Text;
|
||
using UnityEngine;
|
||
using UnityEngine.Serialization;
|
||
using UnityEngine.UI;
|
||
|
||
namespace Script.UI
|
||
{
|
||
public class SummaryPanel : PanelBase
|
||
{
|
||
[SerializeField] private Text txt_Score;
|
||
[SerializeField] private Text txt_True;
|
||
[SerializeField] private Text txt_False;
|
||
[SerializeField] private Text txt_Null;
|
||
[SerializeField] private Text txt_Accuracy;
|
||
[SerializeField] private Text txt_Time;
|
||
[SerializeField] private Button btn_Close;
|
||
|
||
public override void Init()
|
||
{
|
||
base.Init();
|
||
btn_Close.onClick.AddListener(ClickClose);
|
||
}
|
||
|
||
public override void Dispose()
|
||
{
|
||
base.Dispose();
|
||
btn_Close.onClick.RemoveListener(ClickClose);
|
||
}
|
||
|
||
public override void Open()
|
||
{
|
||
base.Open();
|
||
}
|
||
|
||
public override void ResetPanelData()
|
||
{
|
||
base.ResetPanelData();
|
||
|
||
UIManager.Instance.ClosePanel(PanelType.Answering);
|
||
UIManager.Instance.ClosePanel(PanelType.Tips);
|
||
|
||
SaveData();
|
||
}
|
||
|
||
private void ClickClose()
|
||
{
|
||
UIManager.Instance.OpenPanel(PanelType.Home);
|
||
Close();
|
||
}
|
||
|
||
private void SaveData()
|
||
{
|
||
var info = GlobalManager.Instance.CurrentInfo;
|
||
|
||
txt_Score.text = info.score.ToString();
|
||
txt_True.text = info.trueCount.ToString();
|
||
txt_False.text = info.falseCount.ToString();
|
||
txt_Null.text = info.nullCount.ToString();
|
||
txt_Accuracy.text = info.accuracy;
|
||
txt_Time.text = info.time;
|
||
|
||
StringBuilder sb = new StringBuilder();
|
||
sb.AppendLine($"选手ID:{info.id}");
|
||
sb.AppendLine($"赛项:{info.title}");
|
||
sb.AppendLine($"科目:{info.subject}");
|
||
sb.AppendLine($"分数:{txt_Score.text}");
|
||
sb.AppendLine($"正确数量:{txt_True.text}");
|
||
sb.AppendLine($"答错数量:{txt_False.text}");
|
||
sb.AppendLine($"未答数量:{txt_Null.text}");
|
||
sb.AppendLine($"正确率:{txt_Accuracy.text}");
|
||
sb.AppendLine($"用时:{txt_Time.text}");
|
||
FileManager.Instance.SavePlayerData(sb.ToString());
|
||
// ExcelManager.Instance.SaveAndExpIndex(GlobalManager.Instance.CurrentInfo, GlobalManager.Instance.Count - 1);
|
||
}
|
||
}
|
||
} |