refactor: Update Unity to 2022.3.62
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Cryville.Crtr.UI {
|
||||
[SerializeField] TextMeshProUGUI m_button1Text;
|
||||
[SerializeField] GameObject m_button1;
|
||||
float _fadeDuration;
|
||||
static readonly Queue<DialogEntry> _queue = new Queue<DialogEntry>();
|
||||
static readonly Queue<DialogEntry> _queue = new();
|
||||
struct DialogEntry {
|
||||
public Action<int> callback;
|
||||
public string message;
|
||||
@@ -57,8 +57,7 @@ namespace Cryville.Crtr.UI {
|
||||
}
|
||||
public void OnButton(int id) {
|
||||
if (_cur == null) return;
|
||||
var cb = _cur.Value.callback;
|
||||
if (cb != null) cb(id);
|
||||
_cur.Value.callback?.Invoke(id);
|
||||
_cur = null;
|
||||
}
|
||||
public static void Suppress() {
|
||||
@@ -75,15 +74,14 @@ namespace Cryville.Crtr.UI {
|
||||
_queue.Enqueue(new DialogEntry { callback = callback, message = message, action0 = action0, action1 = action1 });
|
||||
}
|
||||
public static int ShowAndWait(string message, string action0 = "OK", string action1 = null) {
|
||||
using (var ev = new AutoResetEvent(false)) {
|
||||
int result = 0;
|
||||
_queue.Enqueue(new DialogEntry {
|
||||
callback = r => { result = r; ev.Set(); },
|
||||
message = message, action0 = action0, action1 = action1,
|
||||
});
|
||||
ev.WaitOne();
|
||||
return result;
|
||||
}
|
||||
using var ev = new AutoResetEvent(false);
|
||||
int result = 0;
|
||||
_queue.Enqueue(new DialogEntry {
|
||||
callback = r => { result = r; ev.Set(); },
|
||||
message = message, action0 = action0, action1 = action1,
|
||||
});
|
||||
ev.WaitOne();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user