예제 #1
0
    protected override void OnOpened()
    {
        base.OnOpened();
        UIAlertBoxContext tContext = _context as UIAlertBoxContext;

        if (tContext == null)
        {
            _mode = AlertMode.OkCancel;
            CloseSelf();
            return;
        }
        _mode           = tContext.mode;
        _content        = tContext.content;
        titleTxt.text   = tContext.title;
        contentTxt.text = tContext.content.Replace(" ", "\u00A0");;
        if (tContext.mode == AlertMode.Ok)
        {
            cancelBtn.gameObject.SetActive(false);
        }
        else
        {
            cancelBtn.gameObject.SetActive(true);
        }
        if (!string.IsNullOrEmpty(tContext.okBtnContent))
        {
            okBtnTxt.text = tContext.okBtnContent;
        }
        if (!string.IsNullOrEmpty(tContext.cancelBtnContent))
        {
            cancelBtnTxt.text = tContext.cancelBtnContent;
        }
    }
예제 #2
0
파일: UIManager.cs 프로젝트: hjj0416/Demo
    public void Alert(string title, string msg, AlertMode mode, Action <AlertResult> cb = null)
    {
        UIAlertBoxContext context = new UIAlertBoxContext(title, msg, mode);

        Instance.ShowWindow(WindowID.UIAlertBox, context, (w) =>
        {
            UIAlertBox win = w as UIAlertBox;
            win.OnCommit   = cb;
        });
    }