TextLogCheck.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class TextLogCheck : MonoBehaviour
  6. {
  7. public GameObject center;
  8. public TaskManager tm;
  9. private void OnDisable()
  10. {
  11. center.SetActive(true);
  12. }
  13. private void OnEnable()
  14. {
  15. center.SetActive(false);
  16. Text t = this.GetComponent<Text>();
  17. t.text = "";
  18. for (int i = 0; i < tm.tconfigs.Count; i++)
  19. {
  20. if(i<=tm.nowTaskCt)
  21. {
  22. for (int j = 0; j < tm.tconfigs[i].items.Length; j++)
  23. {
  24. if (i < tm.nowTaskCt)
  25. {
  26. if(!tm.tconfigs[i].items[j].isNoshow)
  27. {
  28. if (tm.iidex == 1 && tm.tconfigs[i].items[j].info2 != "")
  29. t.text += "\n" + tm.tconfigs[i].items[j].info2 + "\n";
  30. else
  31. {
  32. t.text += "\n" + tm.tconfigs[i].items[j].info + "\n";
  33. }
  34. }
  35. }
  36. else if(j<=tm.nowTaskIndex)
  37. {
  38. if (!tm.tconfigs[i].items[j].isNoshow)
  39. {
  40. if (tm.iidex == 1 && tm.tconfigs[i].items[j].info2 != "")
  41. t.text += "\n" + tm.tconfigs[i].items[j].info2 + "\n";
  42. else
  43. {
  44. t.text += "\n" + tm.tconfigs[i].items[j].info + "\n";
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. Invoke("refy",0.2f);
  52. }
  53. void refy()
  54. {
  55. this.transform.parent.GetComponent<RectTransform>().anchoredPosition = new Vector2(this.transform.parent.GetComponent<RectTransform>().anchoredPosition.x, 99999);
  56. }
  57. }