Exemple #1
0
    public void ShowDialog(string content, string[] options, UIDialogOpt.OnOptionChosen optionChosen)
    {
        this.gameObject.SetActive(true);
        txtContent.text = content;
        float height = 0;

        height = txtContent.preferredHeight;

        //最多3条选项
        height += textToSide + textInterval;
        for (int i = 0; i < 3; i++)
        {
            UIDialogOpt dialogOpt = trOptions[i].GetComponent <UIDialogOpt>();
            if (i < options.Length)
            {
                dialogOpt.SetOption(options[i], optionChosen, i);
                dialogOpt.SetCover(false);
                trOptions[i].anchoredPosition = new Vector2(0, -height);
                height += textInterval / 2 + optionHeight;
            }
            else
            {
                dialogOpt.SetOption(null, null, i + 1);
            }
        }

        height += textToSide / 2;
        RectTransform rect = transform as RectTransform;

        rect.offsetMin = rect.anchoredPosition - new Vector2(dialogWidth / 2, height / 2);
        rect.offsetMax = rect.offsetMin + new Vector2(dialogWidth, height);
    }
Exemple #2
0
 public void ShowDialog(string content, string[] options, UIDialogOpt.OnOptionChosen optionChosen)
 {
     HideAllWnd();
     dialog.ShowDialog(content, options, optionChosen);
 }
Exemple #3
0
 //显示对话框
 static public void ShowDialog(string content, string[] options, UIDialogOpt.OnOptionChosen optionChosen)
 {
     GameObject.FindWithTag(TextResources.gamePlayUITag).GetComponent <GamePlayUI>().ShowDialog(content, options, optionChosen);
 }