Beispiel #1
0
    public override void Tips(string body)
    {
        UICustomeDialogueOption option = UICustomeDialogueOption.CustomStyleTips;

        option.body = body;
        Show(option);
    }
Beispiel #2
0
    public void ShowRequiredUpdate(string storeUrl)
    {
        UICustomeDialogueOption option = new UICustomeDialogueOption();

        option.title     = EB.Localizer.GetString("ID_SPARX_APP_UPDATE_TITLE");
        option.body      = EB.Localizer.GetString("ID_SPARX_APP_UPDATE_MESSAGE");
        option.accept    = UICustomeDialogueOption.ButtonGo;
        option.minHeight = UICustomeDialogueOption.ThreeLineHeight;
        if (!string.IsNullOrEmpty(storeUrl))
        {
            EB.Uri    uri = new EB.Uri(storeUrl);
            Hashtable qs  = EB.QueryString.Parse(uri.GetComponent(EB.Uri.Component.Query, string.Empty));
            qs.Add("platform", EB.Sparx.Device.Platform);
            qs.Add("source", EB.Sparx.Device.Source);
            qs.Add("child", EB.Sparx.Device.ChildSource);
            uri.SetComponent(EB.Uri.Component.Query, EB.QueryString.Stringify(qs));

            option.onClick = delegate(eUIDialogueButtons button, UIDialogeOption opt)
            {
                Application.OpenURL(opt.param as string);
            };

            option.param   = uri.ToString();
            option.buttons = eUIDialogueButtons.Accept;
        }
        else
        {
            option.buttons = eUIDialogueButtons.None;
        }

        UIStack.Instance.ShowDialog(option);
    }
Beispiel #3
0
    public override void Error(string body, OnUIDialogueButtonClick onclose)
    {
        UICustomeDialogueOption option = UICustomeDialogueOption.CustomStyleError;

        option.body    = body;
        option.onClose = onclose ?? option.onClose;
        Show(option);
    }
Beispiel #4
0
    public override IEnumerator OnRemoveFromStack()
    {
        if (mCustomOption != null)
        {
            if (mCustomOption.accept != null && acceptButton != null && acceptObject != null && acceptObject.activeSelf)
            {
                UILabel acceptLabel = acceptButton.GetComponentInChildren <UILabel>();
                if (acceptLabel != null)
                {
                    acceptLabel.text = mOriginAccept;
                }
            }

            if (mCustomOption.decline != null && declineButton != null && declineObject != null && declineObject.activeSelf)
            {
                UILabel declineLabel = declineButton.GetComponentInChildren <UILabel>();
                if (declineLabel != null)
                {
                    declineLabel.text = mOriginDecline;
                }
            }

            if (mCustomOption.cancel != null && cancelButton != null && cancelObject != null && cancelObject.activeSelf)
            {
                UILabel cancelLabel = cancelButton.GetComponentInChildren <UILabel>();
                if (cancelLabel != null)
                {
                    cancelLabel.text = mOriginCancel;
                }
            }

            if (body != null && body.activeSelf)
            {
                UILabel bodyLabel = body.GetComponentInChildren <UILabel>();
                bodyLabel.alignment = mOriginAllianment;
                if (mCustomOption.lineSpace != 0)
                {
                    bodyLabel.spacingY = mOriginSpace;
                }
                if (mCustomOption.minHeight != 0)
                {
                    bodyLabel.overflowMethod          = mOriginOverflow;
                    bodyLabel.height                  = mOriginHeight;
                    bodyLabel.transform.localPosition = Vector3.zero;
                }

                UISprite bodyBackground = body.GetComponentInChildren <UISprite>(true);
                if (bodyBackground != null)
                {
                    bodyBackground.enabled = mOriginBodyBackgroundEnabled;
                }
            }

            mCustomOption = null;
        }

        yield return(base.OnRemoveFromStack());
    }
Beispiel #5
0
 /// <summary>
 /// 获取通用提示框并展示option中内容
 /// </summary>
 /// <param name="option"></param>
 public void ShowDialog(UICustomeDialogueOption option)
 {
     if (_dialogueInstance == null || UIController.IsDestroyed(_dialogueInstance))
     {
         UIHierarchyHelper.Instance.LoadAndPlaceAsync(go =>
         {
             _dialogueInstance = go.GetComponent <UICustomDialogue>();
             dialogueInstanceFunc(option);
         }, dialoguePrefabPath, UIHierarchyHelper.eUIType.None, null, true);
     }
     else
     {
         dialogueInstanceFunc(option);
     }
 }
Beispiel #6
0
    public override void Show(UIDialogeOption option)
    {
        base.Show(option);

        if (Option != option)
        {
            // queued
            return;
        }

        if (option is UICustomeDialogueOption == false)
        {
            return;
        }

        mCustomOption = option as UICustomeDialogueOption;

        // set style
        if (mCustomOption.accept != null && acceptButton != null && acceptObject != null && acceptObject.activeSelf)
        {
            UILabel acceptLabel = acceptButton.GetComponentInChildren <UILabel>();
            if (acceptLabel != null)
            {
                mOriginAccept    = acceptLabel.text;
                acceptLabel.text = mCustomOption.accept;
            }
        }

        if (mCustomOption.decline != null && declineButton != null && declineObject != null && declineObject.activeSelf)
        {
            UILabel declineLabel = declineButton.GetComponentInChildren <UILabel>();
            if (declineLabel != null)
            {
                mOriginDecline    = declineLabel.text;
                declineLabel.text = mCustomOption.decline;
            }
        }

        if (mCustomOption.cancel != null && cancelButton != null && cancelObject != null && cancelObject.activeSelf)
        {
            UILabel cancelLabel = cancelButton.GetComponentInChildren <UILabel>();
            if (cancelLabel != null)
            {
                mOriginCancel    = cancelLabel.text;
                cancelLabel.text = mCustomOption.cancel;
            }
        }

        if (body != null && body.activeSelf)
        {
            UILabel bodyLabel = body.GetComponentInChildren <UILabel>();

            mOriginAllianment = bodyLabel.alignment;
            mOriginOverflow   = bodyLabel.overflowMethod;
            mOriginHeight     = bodyLabel.height;
            mOriginSpace      = bodyLabel.spacingY;

            //bodyLabel.alignment = mCustomOption.alignment;
            if (mCustomOption.lineSpace != 0)
            {
                bodyLabel.spacingY = mCustomOption.lineSpace;
            }
            if (mCustomOption.minHeight != 0)
            {
                bodyLabel.ProcessText();
                if (bodyLabel.height < mCustomOption.minHeight)
                {
                    bodyLabel.overflowMethod = UILabel.Overflow.ShrinkContent;
                    bodyLabel.height         = Mathf.Max(bodyLabel.height, mCustomOption.minHeight);
                }
            }

            UISprite bodyBackground = body.GetComponentInChildren <UISprite>(true);
            if (bodyBackground != null)
            {
                mOriginBodyBackgroundEnabled = bodyBackground.enabled;
                bodyBackground.enabled       = !mCustomOption.hideBodyBackground;
            }
        }
    }
Beispiel #7
0
 private void dialogueInstanceFunc(UICustomeDialogueOption option)
 {
     _dialogueInstance.Show(option);
 }