mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 00:26:04 +00:00
Menu modal WIP, new settigns
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
import { Animation, Component, _decorator } from "cc";
|
||||
import { UIButton } from "../UI/Button/UIButton";
|
||||
import { delay } from "../Utils/AsyncUtils";
|
||||
|
||||
const { property } = _decorator;
|
||||
|
||||
export abstract class ModalWindow<TParam, TResult> extends Component {
|
||||
@property(Animation) private animation: Animation;
|
||||
@property(UIButton) private closeButton: UIButton;
|
||||
@property(UIButton) private backgroundCloseButton: UIButton;
|
||||
|
||||
private result: TResult;
|
||||
private isDismissed = false;
|
||||
|
||||
public async runAsync(params?: TParam): Promise<TResult> {
|
||||
this.closeButton?.InteractedEvent.on(() => this.dismiss(), this);
|
||||
this.backgroundCloseButton?.InteractedEvent.on(() => this.dismiss(), this);
|
||||
|
||||
this.setup(params);
|
||||
this.animation?.play("open");
|
||||
while (!this.isDismissed) await delay(100);
|
||||
|
Reference in New Issue
Block a user