CommonUIComponent.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using GameFramework.Event;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using GFMain;
  6. using UnityEngine;
  7. using UnityGameFramework.Runtime;
  8. using UnityCommon;
  9. namespace GFMain
  10. {
  11. public class CommonUIComponent : GameFrameworkComponent
  12. {
  13. public MessageBox messageBox;
  14. public InputPanel inputPanel;
  15. protected override void Awake()
  16. {
  17. base.Awake();
  18. messageBox = Instantiate(messageBox.gameObject, transform).GetComponent<MessageBox>();
  19. messageBox.Visible = false;
  20. inputPanel = Instantiate(inputPanel.gameObject, transform).GetComponent<InputPanel>();
  21. inputPanel.Visible = false;
  22. //messageBox.ShowAction = (s) =>
  23. // {
  24. // if (s)
  25. // {
  26. // MainEntry.Base.PauseGame();
  27. // }
  28. // else
  29. // {
  30. // MainEntry.Base.ResumeGame();
  31. // }
  32. // };
  33. }
  34. //public void Init(Action completed)
  35. //{
  36. // onCompleted = completed;
  37. // MainEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUISuccess);
  38. // OpenUIForm("Assets/UnityCommon/UI/Common/MessageBox.prefab", "Top");
  39. //}
  40. //private int countOpenUI = 0;
  41. //private void OpenUIForm(string uiFormAssetName, string uiGroupName)
  42. //{
  43. // countOpenUI++;
  44. // MainEntry.UI.OpenUIForm(uiFormAssetName, uiGroupName);
  45. //}
  46. //private Action onCompleted;//³õʼ»¯Íê±Ï»Øµ÷
  47. //private void OnOpenUISuccess(object sender, GameEventArgs e)
  48. //{
  49. // OpenUIFormSuccessEventArgs args = (OpenUIFormSuccessEventArgs)e;
  50. // if (args.UIForm.Logic is MessageBox)
  51. // {
  52. // messageBox = (MessageBox)args.UIForm.Logic;
  53. // messageBox.Visible = false;
  54. // messageBox.ShowAction = (s) =>
  55. // {
  56. // if (s)
  57. // {
  58. // MainEntry.Base.PauseGame();
  59. // }
  60. // else
  61. // {
  62. // MainEntry.Base.ResumeGame();
  63. // }
  64. // };
  65. // OpenUIFormCompleted();
  66. // }
  67. //}
  68. //private void OpenUIFormCompleted()
  69. //{
  70. // countOpenUI--;
  71. // if (countOpenUI == 0)
  72. // onCompleted?.Invoke();
  73. //}
  74. }
  75. }