Skip to content

Commit bfbb59b

Browse files
committed
Fix message box bug
1 parent 70c7e13 commit bfbb59b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/UnityPackage/Assets/Middleware/UiManager/UiManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class UiManager
2020
private class ModalEntity
2121
{
2222
public UiDialogHandle Handle;
23-
public bool IsPrefab;
23+
public bool IsTemporary;
2424
public RectTransform Curtain;
2525
public ShowModalOption Option;
2626
}
@@ -145,7 +145,7 @@ public UiDialogHandle ShowModalTemplate(GameObject gameObject, object param = nu
145145
dialogGo.SetActive(true);
146146

147147
var dialog = dialogGo.GetComponent<UiDialog>();
148-
return ShowModalInternal(dialog, false, param, option);
148+
return ShowModalInternal(dialog, true, param, option);
149149
}
150150

151151
public UiDialogHandle ShowModal<T>(T dialog, object param = null,
@@ -179,7 +179,7 @@ public UiDialogHandle ShowModalRoot<T>(object param = null,
179179
return ShowModal(dialog, param, option);
180180
}
181181

182-
private UiDialogHandle ShowModalInternal(UiDialog dialog, bool isPrefab, object param, ShowModalOption option)
182+
private UiDialogHandle ShowModalInternal(UiDialog dialog, bool isTemporary, object param, ShowModalOption option)
183183
{
184184
float z = (_modals.Count + 2) * -10;
185185

@@ -218,7 +218,7 @@ private UiDialogHandle ShowModalInternal(UiDialog dialog, bool isPrefab, object
218218
_modals.Add(new ModalEntity
219219
{
220220
Handle = handle,
221-
IsPrefab = isPrefab,
221+
IsTemporary = isTemporary,
222222
Curtain = curtain,
223223
Option = option
224224
});
@@ -253,7 +253,7 @@ internal bool HideModal(UiDialog dialog, object returnValue)
253253
var dialogCg = dialog.GetComponent<CanvasGroup>();
254254
dialogCg.DOFade(0f, 0.2f).SetEase(Ease.OutCubic).SetUpdate(true).OnComplete(() =>
255255
{
256-
if (entity.IsPrefab)
256+
if (entity.IsTemporary)
257257
{
258258
UnityEngine.Object.Destroy(entity.Handle.Dialog.gameObject);
259259
}

src/UnityPackage/Assets/Middleware/UiManager/UiMessageBox.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,23 @@ public static UiDialogHandle ShowQuestionBox(
105105

106106
case QuestionType.RetryCancel:
107107
b0Text.text = "Retry";
108-
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Ok));
108+
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Retry));
109109
b1Text.text = "Cancel";
110110
b1.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Cancel));
111111
break;
112112

113113
case QuestionType.YesNo:
114114
b0Text.text = "Yes";
115-
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Ok));
115+
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Yes));
116116
b1Text.text = "No";
117-
b1.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Cancel));
117+
b1.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.No));
118118
break;
119119

120120
case QuestionType.ContinueStop:
121121
b0Text.text = "Continue";
122-
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Ok));
122+
b0.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Continue));
123123
b1Text.text = "Stop";
124-
b1.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Cancel));
124+
b1.onClick.AddListener(() => msgBox.OnQuestionBoxButtonClick(QuestionResult.Stop));
125125
break;
126126
}
127127

0 commit comments

Comments
 (0)