Ejemplo n.º 1
0
        // Use this for initialization
        public void Initialize(string title, string body, OnDialogCallback cb = null)
        {
            m_txtTitle.text = title;
            m_txtBody.text  = body;

            m_OnDialogClosedCB = cb;
        }
Ejemplo n.º 2
0
 // Use this for initialization
 public void Initialize(OnDialogCallback cb, string title, string body, string placeholder)
 {
     m_OnDialogClosedCB    = cb ?? throw new System.ArgumentNullException("cb");
     m_txtTitle.text       = title;
     m_txtBody.text        = body;
     m_txtPlaceholder.text = placeholder;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Deletes a dialog by ID.
        /// </summary>
        /// <param name="dialogId">The ID of the dialog to delete.</param>
        /// <param name="callback">The callback to invoke on success or failure.</param>
        /// <returns>Returns true if request is sent.</returns>
        public bool DeleteDialog(string dialogId, OnDialogCallback callback)
        {
            if (string.IsNullOrEmpty(dialogId))
            {
                throw new ArgumentNullException("dialogId");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, "/v1/dialogs/" + dialogId);

            if (connector == null)
            {
                return(false);
            }

            DeleteDialogReq req = new DeleteDialogReq();

            req.Callback   = callback;
            req.OnResponse = OnDeleteDialogResp;
            req.Delete     = true;

            return(connector.Send(req));
        }
Ejemplo n.º 4
0
        public static InfoDialog Create(string title, string body, OnDialogCallback cb = null)
        {
            GameObject goDlg = Instantiate(Resources.Load <GameObject>("Dialogs/Generic/CanvasInfoDialog"));
            InfoDialog dlg   = goDlg.GetComponent <InfoDialog>();

            dlg.Initialize(title, body, cb);

            return(dlg);
        }
Ejemplo n.º 5
0
        public static ConfirmDialog Create(OnDialogCallback cb, string title, string body, string submit = "OK", string cancel = "Cancel")
        {
            GameObject    goDlg = Instantiate(Resources.Load <GameObject>("Dialogs/Generic/CanvasConfirmDialog"));
            ConfirmDialog dlg   = goDlg.GetComponent <ConfirmDialog>();

            dlg.Initialize(cb, title, body, submit, cancel);

            return(dlg);
        }
Ejemplo n.º 6
0
        public static InputDialog Create(OnDialogCallback cb, string title, string body, string placeholder)
        {
            GameObject  goDlg = Instantiate(Resources.Load <GameObject>("Dialogs/CanvasInputDialog"));
            InputDialog dlg   = goDlg.GetComponent <InputDialog>();

            dlg.Initialize(cb, title, body, placeholder);

            return(dlg);
        }
Ejemplo n.º 7
0
        public static CreateAccountDialog Create(OnDialogCallback onCloseCB = null)
        {
            GameObject          goDlg = Instantiate(Resources.Load <GameObject>("Dialogs/CanvasCreateAccount"));
            CreateAccountDialog dlg   = goDlg.GetComponent <CreateAccountDialog>();

            dlg.m_OnDialogClosedCB = onCloseCB;

            return(dlg);
        }
Ejemplo n.º 8
0
        // Use this for initialization
        public void Initialize(OnDialogCallback cb, string title, string body, string submit = "OK", string cancel = "Cancel")
        {
            m_txtTitle.text = title;
            m_txtBody.text  = body;

            m_txtSubmit.text = submit;
            m_txtCancel.text = cancel;

            m_OnDialogClosedCB = cb ?? throw new System.ArgumentNullException("cb");
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Downloads the dialog by the dialog ID into the provided filename.
        /// </summary>
        /// <param name="dialogId">The ID of the dialog to download.</param>
        /// <param name="dialogFileName">The filename to download the dialog into.</param>
        /// <param name="callback">The callback to invoke on failure or success.</param>
        /// <param name="format">The format to download.</param>
        /// <returns>Returns true if request is sent.</returns>
        public bool DownloadDialog(string dialogId, string dialogFileName, OnDialogCallback callback, DialogFormat format = DialogFormat.XML)
        {
            if (string.IsNullOrEmpty(dialogId))
            {
                throw new ArgumentNullException("dialogId");
            }
            if (string.IsNullOrEmpty(dialogFileName))
            {
                throw new ArgumentNullException("dialogFileName");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, "/v1/dialogs/" + dialogId);

            if (connector == null)
            {
                return(false);
            }

            DownloadDialogReq req = new DownloadDialogReq();

            req.DialogFileName = dialogFileName;
            req.Callback       = callback;
            req.OnResponse     = OnDownloadDialogResp;
            if (format == DialogFormat.XML)
            {
                req.Headers["Accept"] = "application/wds+xml";
            }
            else if (format == DialogFormat.JSON)
            {
                req.Headers["Accept"] = "application/wds+json";
            }
            else
            {
                req.Headers["Accept"] = "application/octet-stream";
            }

            return(connector.Send(req));
        }