using GameFramework.Event; using System; using System.Collections; using System.Collections.Generic; using GFMain; using UnityEngine; using UnityGameFramework.Runtime; using UnityCommon; namespace GFMain { public class CommonUIComponent : GameFrameworkComponent { public MessageBox messageBox; public InputPanel inputPanel; protected override void Awake() { base.Awake(); messageBox = Instantiate(messageBox.gameObject, transform).GetComponent(); messageBox.Visible = false; inputPanel = Instantiate(inputPanel.gameObject, transform).GetComponent(); inputPanel.Visible = false; //messageBox.ShowAction = (s) => // { // if (s) // { // MainEntry.Base.PauseGame(); // } // else // { // MainEntry.Base.ResumeGame(); // } // }; } //public void Init(Action completed) //{ // onCompleted = completed; // MainEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUISuccess); // OpenUIForm("Assets/UnityCommon/UI/Common/MessageBox.prefab", "Top"); //} //private int countOpenUI = 0; //private void OpenUIForm(string uiFormAssetName, string uiGroupName) //{ // countOpenUI++; // MainEntry.UI.OpenUIForm(uiFormAssetName, uiGroupName); //} //private Action onCompleted;//初始化完毕回调 //private void OnOpenUISuccess(object sender, GameEventArgs e) //{ // OpenUIFormSuccessEventArgs args = (OpenUIFormSuccessEventArgs)e; // if (args.UIForm.Logic is MessageBox) // { // messageBox = (MessageBox)args.UIForm.Logic; // messageBox.Visible = false; // messageBox.ShowAction = (s) => // { // if (s) // { // MainEntry.Base.PauseGame(); // } // else // { // MainEntry.Base.ResumeGame(); // } // }; // OpenUIFormCompleted(); // } //} //private void OpenUIFormCompleted() //{ // countOpenUI--; // if (countOpenUI == 0) // onCompleted?.Invoke(); //} } }