コード例 #1
0
    //알림 뷰의 내용을 갱신하는 메서드
    public void UpdateContent(string title, string message, StoreAlertViewOptions options = null)
    {
        if (title.Equals(""))
        {
            titleLabel.transform.gameObject.SetActive(false);
        }
        else
        {
            titleLabel.text = title;
        }
        messageLabel.text = message;

        if (options != null)
        {
            //표시 옵션이 지정돼 있을 때 옵션의 내용에 맞춰 버튼을 표시하거나 표시하지 않는다.
            cancelButton.transform.parent.gameObject.SetActive(options.cancelButtonTitle != null || options.okButtonTitle != null);
            cancelButton.gameObject.SetActive(options.cancelButtonTitle != null);
            cancelButtonLabel.text = options.cancelButtonTitle ?? "";
            cancelButtonDelegate   = options.cancelButtonDelegate;

            okButton.gameObject.SetActive(options.okButtonTitle != null);
            okButtonLabel.text = options.okButtonTitle ?? "";
            okButtonDelegate   = options.okButtonDelegate;
        }
        else
        {
            cancelButton.gameObject.SetActive(false);
            okButton.gameObject.SetActive(true);
            okButtonLabel.text = "확인";
        }
    }
コード例 #2
0
    //알림 뷰를 표시하는 static 메서드
    public static StoreAlertViewController Show(string title, string message, StoreAlertViewOptions options = null)
    {
        if (prefab == null)
        {
            prefab = Resources.Load("StoreAlertView") as GameObject;
        }

        GameObject obj = Instantiate(prefab) as GameObject;
        StoreAlertViewController alertView = obj.GetComponent <StoreAlertViewController>();

        alertView.UpdateContent(title, message, options);

        OnEvent();
        return(alertView);
    }