12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 Jiang Yin. All rights reserved.
- // Homepage: https://gameframework.cn/
- // Feedback: mailto:ellan@gameframework.cn
- //------------------------------------------------------------
- using UnityEngine;
- using UnityGameFramework.Runtime;
- namespace MetaClient
- {
- public class MenuForm : UGuiForm
- {
- [SerializeField]
- private GameObject m_QuitButton = null;
- private ProcedureMenu m_ProcedureMenu = null;
- public void OnStartButtonClick()
- {
- m_ProcedureMenu.StartGame();
- }
- public void OnSettingButtonClick()
- {
- GameEntry.UI.OpenUIForm(UIFormId.SettingForm);
- }
- public void OnAboutButtonClick()
- {
- GameEntry.UI.OpenUIForm(UIFormId.AboutForm);
- }
- public void OnQuitButtonClick()
- {
- GameEntry.UI.OpenDialog(new DialogParams()
- {
- Mode = 2,
- Title = GameEntry.Localization.GetString("AskQuitGame.Title"),
- Message = GameEntry.Localization.GetString("AskQuitGame.Message"),
- OnClickConfirm = delegate (object userData) { UnityGameFramework.Runtime.GameEntry.Shutdown(ShutdownType.Quit); },
- });
- }
- #if UNITY_2017_3_OR_NEWER
- protected override void OnOpen(object userData)
- #else
- protected internal override void OnOpen(object userData)
- #endif
- {
- base.OnOpen(userData);
- m_ProcedureMenu = (ProcedureMenu)userData;
- if (m_ProcedureMenu == null)
- {
- Log.Warning("ProcedureMenu is invalid when open MenuForm.");
- return;
- }
- m_QuitButton.SetActive(Application.platform != RuntimePlatform.IPhonePlayer);
- }
- #if UNITY_2017_3_OR_NEWER
- protected override void OnClose(bool isShutdown, object userData)
- #else
- protected internal override void OnClose(bool isShutdown, object userData)
- #endif
- {
- m_ProcedureMenu = null;
- base.OnClose(isShutdown, userData);
- }
- }
- }
|