ExamInfo.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /****************************************************************************
  2. * 2023.10 DESKTOP-DL7CJI0
  3. ****************************************************************************/
  4. using System;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. using QFramework;
  9. using UnityEditor;
  10. using ChivaXR;
  11. using System.Collections;
  12. namespace QFramework
  13. {
  14. public partial class ExamInfo : UIElement
  15. {
  16. private void Awake()
  17. {
  18. //SubmitBtn.onClick.AddListener(() =>
  19. //{
  20. // UIKit.GetPanel<PC_OperatePanel>().SubmitResult.gameObject.SetActive(true);
  21. //});
  22. //ExamHelpBtn.onClick.AddListener(ExamHelpBtnClick);
  23. }
  24. /// <summary>
  25. /// ¿¼ÊÔÓÃʱ
  26. /// </summary>
  27. /// <param name="time"></param>
  28. public void SetExamTime(int time)
  29. {
  30. TimeSpan ts = new TimeSpan(0, 0, Convert.ToInt32(time));
  31. string str = "";
  32. if (ts.Hours > 0)
  33. {
  34. str = String.Format("{0:00}", ts.Hours) + ":" + String.Format("{0:00}", ts.Minutes) + ":" + String.Format("{0:00}", ts.Seconds);
  35. }
  36. if (ts.Hours == 0 && ts.Minutes > 0)
  37. {
  38. str = "00:" + String.Format("{0:00}", ts.Minutes) + ":" + String.Format("{0:00}", ts.Seconds);
  39. }
  40. if (ts.Hours == 0 && ts.Minutes == 0)
  41. {
  42. str = "00:00:" + String.Format("{0:00}", ts.Seconds);
  43. }
  44. ExamTime.text = str;
  45. }
  46. protected override void OnBeforeDestroy()
  47. {
  48. }
  49. public void ShowWrongInfo(string info)
  50. {
  51. StopAllCoroutines();
  52. WrongInfo.text = "";
  53. StartCoroutine(WaitShowWrongInfo(info));
  54. }
  55. IEnumerator WaitShowWrongInfo(string info)
  56. {
  57. ErrorInfoTitle.gameObject.SetActive(true);
  58. WrongInfo.text = info;
  59. ErrorInfoTitle.rectTransform.sizeDelta = new Vector2(WrongInfo.rectTransform.sizeDelta.x + 100, ErrorInfoTitle.rectTransform.sizeDelta.y);
  60. yield return new WaitForSeconds(2);
  61. ErrorInfoTitle.gameObject.SetActive(false);
  62. }
  63. private void ExamHelpBtnClick()
  64. {
  65. OperateSetting.Instance.ToolPackUILogic.SetHint(true);
  66. ExamManagerForPC.instance.RecordFault(ProcessManagement.Instance.currentStepID,ErrorReason.SelectWrongTarget);
  67. }
  68. }
  69. }