adding basic modal system

This commit is contained in:
Martin
2022-11-17 18:28:39 +01:00
parent 3c39653e47
commit 94605e673e
18 changed files with 1768 additions and 69 deletions

View File

@@ -0,0 +1,21 @@
import { Component } from "cc";
import { delay } from "../Utils/AsyncUtils";
export abstract class ModalWindow<TParam, TResult> extends Component {
private result: TResult;
private isDismissed = false;
public async runAsync(params?: TParam): Promise<TResult> {
this.setup(params);
while (!this.isDismissed) await delay(100);
return this.result;
}
protected abstract setup(params?: TParam): void;
protected dismiss(result?: TResult): void {
this.result = result;
this.isDismissed = true;
}
}