-
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
1 parent
a34cd08
commit e963b35
Showing
58 changed files
with
3,753 additions
and
1,784 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
71 changes: 71 additions & 0 deletions
71
wle_pp/wle_pp/src/pp/cauldron/cauldron/components/clear_console_component.ts
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,71 @@ | ||
import { Component } from "@wonderlandengine/api"; | ||
import { property } from "@wonderlandengine/api/decorators.js"; | ||
import { XRUtils } from "../../../cauldron/utils/xr_utils.js"; | ||
|
||
export class ClearConsoleComponent extends Component { | ||
public static override TypeName = "pp-clear-console"; | ||
|
||
@property.enum(["Init", "Start", "Update", "Enter XR", "Exit XR"], "Init") | ||
private _myWhen!: number; | ||
|
||
@property.bool(true) | ||
private _myFirstTimeOnly!: boolean; | ||
|
||
private _myFirstTimeDone: boolean = false; | ||
|
||
public override init(): void { | ||
if (this._myWhen == 0) { | ||
this._clearConsole(); | ||
} | ||
} | ||
|
||
public override start(): void { | ||
if (this._myWhen == 1) { | ||
this._clearConsole(); | ||
} | ||
} | ||
|
||
public override update(dt: number): void { | ||
if (this._myWhen == 2) { | ||
this._clearConsole(); | ||
} | ||
} | ||
|
||
private _onXRSessionStart(): void { | ||
if (this._myWhen == 3) { | ||
this._clearConsole(); | ||
} | ||
} | ||
|
||
private _onXRSessionEnd(): void { | ||
if (this._myWhen == 4) { | ||
this._clearConsole(); | ||
} | ||
} | ||
|
||
private _clearConsole(): void { | ||
if (!this._myFirstTimeOnly || !this._myFirstTimeDone) { | ||
console.clear(); | ||
|
||
this._myFirstTimeDone = true; | ||
} | ||
|
||
if (this._myFirstTimeOnly && this._myFirstTimeDone) { | ||
this.active = false; | ||
} | ||
} | ||
|
||
public override onActivate(): void { | ||
if (this._myWhen == 3) { | ||
XRUtils.registerSessionStartEventListener(this, this._onXRSessionStart.bind(this), true, true, this.engine); | ||
} | ||
|
||
if (this._myWhen == 4) { | ||
XRUtils.registerSessionEndEventListener(this, this._onXRSessionEnd.bind(this), this.engine); | ||
} | ||
} | ||
|
||
public override onDeactivate(): void { | ||
XRUtils.unregisterSessionStartEndEventListeners(this, this.engine); | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
...wle_pp/src/pp/cauldron/cauldron/components/clear_console_on_xr_session_start_component.js
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
wle_pp/wle_pp/src/pp/cauldron/cauldron/components/set_engine_log_level_component.ts
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,35 @@ | ||
import { Component, LogLevel } from "@wonderlandengine/api"; | ||
import { property } from "@wonderlandengine/api/decorators.js"; | ||
|
||
export class SetEngineLogLevelComponent extends Component { | ||
public static override TypeName = "pp-set-engine-log-level"; | ||
|
||
@property.bool(true) | ||
private _myInfoEnabled!: boolean; | ||
|
||
@property.bool(true) | ||
private _myWarnEnabled!: boolean; | ||
|
||
@property.bool(true) | ||
private _myErrorEnabled!: boolean; | ||
|
||
public override init(): void { | ||
const logLevelsToDisable = []; | ||
|
||
if (!this._myInfoEnabled) { | ||
logLevelsToDisable.push(LogLevel.Info); | ||
} | ||
|
||
if (!this._myWarnEnabled) { | ||
logLevelsToDisable.push(LogLevel.Warn); | ||
} | ||
|
||
if (!this._myErrorEnabled) { | ||
logLevelsToDisable.push(LogLevel.Error); | ||
} | ||
|
||
if (logLevelsToDisable.length > 0) { | ||
this.engine.log.levels.disable(...logLevelsToDisable); | ||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.