SUIPanelUpdate.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace SFramework
  5. {
  6. public class SUIPanelUpdate : SUIObjectBase
  7. {
  8. private GameObject _textInfo;
  9. private GameObject _imageProgress;
  10. public override void UI_Awake()
  11. {
  12. Debug.Log("SUIPanelUpdate -> Awake()");
  13. GameObject rootCanvas = GameObject.Find("Canvas_Update(Clone)");
  14. Debug.Assert(rootCanvas != null);
  15. _rootPanel = rootCanvas.transform.Find("Panel_Update").gameObject;
  16. Debug.Assert(_rootPanel != null);
  17. _textInfo = _rootPanel.transform.Find("Text_Info").gameObject;
  18. Debug.Assert(_textInfo != null);
  19. _imageProgress = _rootPanel.transform.Find("Image_Progress").gameObject;
  20. Debug.Assert(_imageProgress != null);
  21. }
  22. public override void UI_Start()
  23. {
  24. Debug.Log("SUIPanelUpdate -> Start()");
  25. }
  26. public void SetProgressPercent(float percent)
  27. {
  28. if (percent <= 0.0f) percent = 0.0f;
  29. if (percent >= 1.0f) percent = 1.0f;
  30. _imageProgress.GetComponent<UnityEngine.UI.Image>().fillAmount = percent;
  31. }
  32. public void SetUpdateInfo(string information)
  33. {
  34. _textInfo.GetComponent<UnityEngine.UI.Text>().text = information;
  35. }
  36. }
  37. }