CommonUtil.cs 1005 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections.Generic;
  2. namespace ET.Client
  3. {
  4. public class CommonUtil : Singleton<CommonUtil>
  5. {
  6. public async ETTask OpenCommonServerMsgPanel(string content)
  7. {
  8. if (string.IsNullOrEmpty(content))
  9. {
  10. Log.Error("content == null");
  11. return;
  12. }
  13. var ui = UIHelper.Get(GameUtil.Instance.GetSceneComponent(), UIType.UICommonServerMsg);
  14. if (ui != null && ui.GameObject.activeInHierarchy)
  15. {
  16. var com = ui.GetComponent<UICommonServerMsgComponent>();
  17. com.PushTask(content);
  18. }
  19. else
  20. {
  21. Dictionary<string, object> dic = new Dictionary<string, object>()
  22. {
  23. { "content",content},
  24. };
  25. await UIHelper.Create(GameUtil.Instance.GetSceneComponent(), UIType.UICommonServerMsg, UILayer.High, dic);
  26. }
  27. }
  28. }
  29. }