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

            DialogFormData data = (DialogFormData)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);
            }
        }
Beispiel #4
0
        protected override void OnEnter(ProcedureOwner procedureOwner)
        {
            base.OnEnter(procedureOwner);

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

            DialogFormData parms = new DialogFormData();

            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);
        }
Beispiel #5
0
        public void OpenDialog(DialogFormData 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);
            }
        }