-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { BaseTextDraw } from "./baseTextDraw"; | ||
|
||
export abstract class BasePlayerTextDraw extends BaseTextDraw {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export abstract class BaseTextDraw {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./baseTextDraw"; | ||
export * from "./basePlayerTextDraw"; | ||
export * from "./textdrawEvent"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { EventBus } from "@/utils/eventBus"; | ||
|
||
export enum textDrawHooks { | ||
created = "OnTextDrawCreate", | ||
destroyed = "OnTextDrawDestroy", | ||
} | ||
|
||
export const textDrawBus = new EventBus(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CommonTextDraw } from "@/interfaces"; | ||
import { BasePlayerTextDraw } from "./basePlayerTextDraw"; | ||
import { BaseTextDraw } from "./baseTextDraw"; | ||
import { textDrawBus, textDrawHooks } from "./textdrawBus"; | ||
|
||
export abstract class BaseTextDrawEvent< | ||
T extends BaseTextDraw, | ||
PT extends BasePlayerTextDraw | ||
> { | ||
public readonly textDraws = new Set<CommonTextDraw<T, PT>>(); | ||
constructor() { | ||
textDrawBus.on(textDrawHooks.created, (textDraw: CommonTextDraw<T, PT>) => { | ||
this.textDraws.add(textDraw); | ||
}); | ||
textDrawBus.on( | ||
textDrawHooks.destroyed, | ||
(textDraw: CommonTextDraw<T, PT>) => { | ||
this.textDraws.delete(textDraw); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters