Skip to content

Commit d081a13

Browse files
committed
Arrange layout inputbox in case of only-ok.
1 parent 05d8e4c commit d081a13

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/UnityPackage/Assets/UiManager/UiMessageBox.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public enum QuestionResult
2929
public Text MessageText;
3030
public Button[] Buttons;
3131

32-
public static UiDialogHandle ShowMessageBox(string msg, QuestionResultDelegate callback = null)
32+
public static UiDialogHandle Show(string msg, QuestionResultDelegate callback = null)
3333
{
3434
UiDialogHandle handle;
3535
{
@@ -60,7 +60,7 @@ private void OnMessageBoxOkButtonClick()
6060
Hide(QuestionResult.Ok);
6161
}
6262

63-
public static UiDialogHandle ShowQuestionBox(
63+
public static UiDialogHandle Show(
6464
string msg, QuestionType questionType,
6565
QuestionResultDelegate callback = null, string customOkName = null)
6666
{
@@ -89,15 +89,18 @@ public static UiDialogHandle ShowQuestionBox(
8989
var b1 = msgBox.Buttons[1];
9090
var b1Text = b1.transform.Find("Text").GetComponent<Text>();
9191

92+
b1.gameObject.SetActive(questionType != QuestionType.Ok);
93+
9294
switch (questionType)
9395
{
9496
case QuestionType.Ok:
9597
b0Text.text = customOkName ?? "Ok";
9698
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Ok));
99+
b1.gameObject.SetActive(false);
97100
break;
98101

99102
case QuestionType.OkCancel:
100-
b0Text.text = "Ok";
103+
b0Text.text = customOkName ?? "Ok";
101104
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Ok));
102105
b1Text.text = "Cancel";
103106
b1.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Cancel));

0 commit comments

Comments
 (0)