Ejemplo n.º 1
0
 private static void OpenNativeDialog(DialogFormParams dialogParams)
 {
     // TODO:这里应该弹出原生对话框,先简化实现为直接按确认按钮
     if (dialogParams.OnClickConfirm != null)
     {
         dialogParams.OnClickConfirm(dialogParams.UserData);
     }
 }
Ejemplo n.º 2
0
 public static void OpenDialog(this UIComponent uiComponent, DialogFormParams dialogParams)
 {
     if (((ProcedureBase)GameEntry.Procedure.CurrentProcedure).UseNativeDialog)
     {
         OpenNativeDialog(dialogParams);
     }
     else
     {
         uiComponent.OpenUIForm(UIFormId.DialogForm, dialogParams);
     }
 }
Ejemplo n.º 3
0
        protected override void OnOpen(object userData)
        {
            base.OnOpen(userData);

            DialogFormParams data = (DialogFormParams)userData;

            if (data == null)
            {
                Log.Warning("DialogFormParams is invalid.");
                return;
            }

            m_DialogMode = data.Mode;
            RefreshDialogMode();

            m_TitleText.text   = data.Title;
            m_MessageText.text = data.Message;

            m_PauseGame = data.PauseGame;
            RefreshPauseGame();

            m_UserData = data.UserData;

            if (m_ConfirmButton != null)
            {
                RefreshConfirmText(data.ConfirmText);
                m_OnClickConfirm = data.OnClickConfirm;
                m_ConfirmButton.onClick.Add(OnConfirmButtonClick);
            }

            if (m_CancelButton != null)
            {
                RefreshCancelText(data.CancelText);
                m_OnClickCancel = data.OnClickCancel;
                m_CancelButton.onClick.Add(OnCancelButtonClick);
            }

            if (m_OtherButton != null)
            {
                RefreshOtherText(data.OtherText);
                m_OnClickOther = data.OnClickOther;
                m_OtherButton.onClick.Add(OnOtherButtonClick);
            }
        }
Ejemplo n.º 4
0
        protected override void OnEnter(ProcedureOwner procedureOwner)
        {
            base.OnEnter(procedureOwner);

            GameEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUIFormSuccess);

            DialogFormParams parms = new DialogFormParams();

            parms.Title           = "Title";
            parms.Message         = "是否退出游戏?";
            parms.Mode            = 3;
            parms.ConfirmText     = "Confirm";
            parms.CancelText      = "Cancel";
            parms.OtherText       = "Other";
            parms.OnClickConfirm += o => { Log.Debug("确定"); };
            parms.OnClickCancel  += o => { GameEntry.UI.CloseUIForm(UIFormId.DialogForm); };
            parms.OnClickOther   += o => { Log.Debug("其他"); };

            GameEntry.UI.OpenUIForm(UIFormId.DialogForm, parms);
        }
Ejemplo n.º 5
0
        public void OpenDialog(DialogFormParams data)
        {
            if (data == null)
            {
                Log.Warning("DialogFormParams is invalid.");
                return;
            }

            m_DialogMode = data.Mode;
            RefreshDialogMode();

            m_TitleText.text   = data.Title;
            m_MessageText.text = data.Message;

            m_PauseGame = data.PauseGame;
            RefreshPauseGame();

            m_UserData = data.UserData;

            if (m_ConfirmButton != null)
            {
                RefreshConfirmText(data.ConfirmText);
                m_OnClickConfirm = data.OnClickConfirm;
                m_ConfirmButton.onClick.AddListener(OnConfirmButtonClick);
            }

            if (m_CancelButton != null)
            {
                RefreshCancelText(data.CancelText);
                m_OnClickCancel = data.OnClickCancel;
                m_CancelButton.onClick.AddListener(OnCancelButtonClick);
            }

            if (m_OtherButton != null)
            {
                RefreshOtherText(data.OtherText);
                m_OnClickOther = data.OnClickOther;
                m_OtherButton.onClick.AddListener(OnOtherButtonClick);
            }
        }