规范对话数据
This commit is contained in:
@@ -11,6 +11,7 @@ namespace UI
|
||||
private DialogFormBase _dialogForm;
|
||||
private int? _formSerialId;
|
||||
private bool _pendingRefresh;
|
||||
private Action _pendingCloseCompleted;
|
||||
|
||||
public DialogFormController()
|
||||
{
|
||||
@@ -31,7 +32,8 @@ namespace UI
|
||||
UIFormId targetFormId = MapDialogFormId(context.DialogUIMode);
|
||||
if (targetFormId == UIFormId.Undefined)
|
||||
{
|
||||
Log.Warning("DialogFormController open failed. Unsupported mode '{0}'.", context.DialogUIMode.ToString());
|
||||
Log.Warning("DialogFormController open failed. Unsupported mode '{0}'.",
|
||||
context.DialogUIMode.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -48,8 +50,14 @@ namespace UI
|
||||
}
|
||||
|
||||
public void CloseUI()
|
||||
{
|
||||
CloseUI(onClosed: null);
|
||||
}
|
||||
|
||||
public void CloseUI(Action onClosed = null)
|
||||
{
|
||||
_pendingRefresh = false;
|
||||
_pendingCloseCompleted = onClosed;
|
||||
|
||||
if (_formSerialId.HasValue)
|
||||
{
|
||||
@@ -61,6 +69,8 @@ namespace UI
|
||||
{
|
||||
_dialogForm.Close();
|
||||
}
|
||||
|
||||
InvokeCloseCompletedIfNeeded();
|
||||
}
|
||||
|
||||
public void OnDialogStarted(DialogFormContext context)
|
||||
@@ -163,6 +173,19 @@ namespace UI
|
||||
_dialogForm = null;
|
||||
_formSerialId = null;
|
||||
_pendingRefresh = false;
|
||||
InvokeCloseCompletedIfNeeded();
|
||||
}
|
||||
|
||||
private void InvokeCloseCompletedIfNeeded()
|
||||
{
|
||||
if (_pendingCloseCompleted == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Action callback = _pendingCloseCompleted;
|
||||
_pendingCloseCompleted = null;
|
||||
callback.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user