ExamPanel.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using QFramework;
  4. using ChivaXR.Op;
  5. using DG.Tweening;
  6. namespace QFramework
  7. {
  8. public class ExamPanelData : UIPanelData
  9. {
  10. }
  11. public partial class ExamPanel : UIPanel
  12. {
  13. protected override void OnInit(IUIData uiData = null)
  14. {
  15. mData = uiData as ExamPanelData ?? new ExamPanelData();
  16. ExamManager.Instance.timeHandle += TimeHandle;
  17. ExamManager.Instance.deductionScoreHandle += DeductionScoreHandle;
  18. confirmBtn.onClick.AddListener(() =>
  19. {
  20. ExamFinishPopPanel.gameObject.SetActive(false);
  21. ScoreReportPanel.gameObject.SetActive(true);
  22. });
  23. }
  24. public void DeductionScoreHandle(ExamDataContainer examDataContainer)
  25. {
  26. ScoreReportPopText.text = (-examDataContainer.score).ToString();
  27. ScoreReportPopText.transform.DOScale(Vector3.one, 0.4f).OnComplete(() => ScoreReportPopText.transform.DOScale(Vector3.zero, 0.5f).SetDelay(1f));
  28. }
  29. public void TimeHandle(bool finish, string time)
  30. {
  31. Text.text = time;
  32. if (finish)
  33. {
  34. ExamFinishPopPanel.gameObject.SetActive(true);
  35. ScoreText.text = "考试成绩为:"+ ExamManager.Instance.ScoreSettlement();
  36. }
  37. }
  38. protected override void OnOpen(IUIData uiData = null)
  39. {
  40. }
  41. protected override void OnShow()
  42. {
  43. }
  44. protected override void OnHide()
  45. {
  46. }
  47. protected override void OnClose()
  48. {
  49. }
  50. }
  51. }