Removed initial voice logic.

This commit is contained in:
Michael Mainguy 2023-08-18 10:42:41 -05:00
parent a37618737a
commit 3140c180c6
5 changed files with 51 additions and 23 deletions

View File

@ -15,8 +15,6 @@ import log from "loglevel";
import {AppConfig} from "./util/appConfig"; import {AppConfig} from "./util/appConfig";
import {GamepadManager} from "./controllers/gamepadManager"; import {GamepadManager} from "./controllers/gamepadManager";
import {CustomEnvironment} from "./util/customEnvironment"; import {CustomEnvironment} from "./util/customEnvironment";
import {VoiceManager} from "./integration/voiceManager";
import {TranscriptType} from "./integration/voiceTranscript";
import {Controllers} from "./controllers/controllers"; import {Controllers} from "./controllers/controllers";
import {Introduction} from "./tutorial/introduction"; import {Introduction} from "./tutorial/introduction";
@ -113,7 +111,9 @@ export class App {
const gamepadManager = new GamepadManager(scene); const gamepadManager = new GamepadManager(scene);
/*
const voiceManager = new VoiceManager(); const voiceManager = new VoiceManager();
voiceManager.transcriptionObserver.add((text) => { voiceManager.transcriptionObserver.add((text) => {
logger.info('Transcription', text); logger.info('Transcription', text);
switch (text.type) { switch (text.type) {
@ -137,6 +137,8 @@ export class App {
} }
}); });
*/
window.addEventListener("keydown", (ev) => { window.addEventListener("keydown", (ev) => {
if (ev.key == "z") { if (ev.key == "z") {
voiceManager.startRecording(); voiceManager.startRecording();

View File

@ -16,7 +16,7 @@ export class IndexdbPersistenceManager implements IPersistenceManager {
constructor(name: string) { constructor(name: string) {
this.db = new Dexie(name); this.db = new Dexie(name);
const version = 5; const version = 6;
this.db.version(version).stores({config: "id,gridSnap,rotateSnap,createSnap"}); this.db.version(version).stores({config: "id,gridSnap,rotateSnap,createSnap"});
this.db.version(version).stores({entities: "id,diagramlistingid,position,rotation,last_seen,template,text,scale,color"}); this.db.version(version).stores({entities: "id,diagramlistingid,position,rotation,last_seen,template,text,scale,color"});
this.db.version(version).stores({diagramlisting: "id,name,description,sharekey"}); this.db.version(version).stores({diagramlisting: "id,name,description,sharekey"});

View File

@ -12,6 +12,7 @@ import {
} from "@babylonjs/core"; } from "@babylonjs/core";
import {Button3D, GUI3DManager, TextBlock} from "@babylonjs/gui"; import {Button3D, GUI3DManager, TextBlock} from "@babylonjs/gui";
import {DiaSounds} from "../util/diaSounds"; import {DiaSounds} from "../util/diaSounds";
import {AppConfig} from "../util/appConfig";
export class Introduction { export class Introduction {
@ -21,7 +22,7 @@ export class Introduction {
private current: AbstractMesh[] = []; private current: AbstractMesh[] = [];
private step: number = 0; private step: number = 0;
private items: AbstractMesh[] = []; private items: AbstractMesh[] = [];
private advance: Button3D;
constructor(scene: Scene) { constructor(scene: Scene) {
this.scene = scene; this.scene = scene;
this.manager = new GUI3DManager(scene); this.manager = new GUI3DManager(scene);
@ -30,25 +31,24 @@ export class Introduction {
public start() { public start() {
this.scene.physicsEnabled = true; this.scene.physicsEnabled = true;
const advance = new Button3D("advance"); this.advance = new Button3D("advance");
const text = new TextBlock("advance", "Click Me"); const text = new TextBlock("advance", "Click Me");
text.fontSize = "48px"; text.fontSize = "48px";
text.color = "#ffffff"; text.color = "#ffffff";
text.alpha = 1; text.alpha = 1;
advance.content = text; this.advance.content = text;
advance.onPointerClickObservable.add(() => { this.advance.onPointerClickObservable.add(() => {
console.log("click"); console.log("click");
this.takeStep(); this.takeStep();
}, -1, false, this, false); }, -1, false, this, false);
this.manager.addControl(advance); this.manager.addControl(this.advance);
advance.isVisible = false; this.advance.isVisible = false;
advance.position.y = 0; this.advance.position.y = 0;
advance.position.x = 2; this.advance.position.x = 2;
this.scene.onReadyObservable.add(() => { this.scene.onReadyObservable.add(() => {
advance.isVisible = true; this.advance.isVisible = true;
}); });
} }
buildVideo(url: string, size: number, position: Vector3): AbstractMesh { buildVideo(url: string, size: number, position: Vector3): AbstractMesh {
@ -64,6 +64,7 @@ export class Introduction {
const welcome = MeshBuilder.CreateTiledBox(text + "_box", {width: 1, height: 1, depth: 1}, this.scene); const welcome = MeshBuilder.CreateTiledBox(text + "_box", {width: 1, height: 1, depth: 1}, this.scene);
welcome.position = position; welcome.position = position;
welcome.scaling = new Vector3(size, size / 2, size); welcome.scaling = new Vector3(size, size / 2, size);
const aggregate = new PhysicsAggregate(welcome, PhysicsShapeType.BOX, { const aggregate = new PhysicsAggregate(welcome, PhysicsShapeType.BOX, {
friction: 1, friction: 1,
mass: 1, mass: 1,
@ -75,7 +76,7 @@ export class Introduction {
} }
}); });
aggregate.body.setCollisionCallbackEnabled(true); aggregate.body.setCollisionCallbackEnabled(true);
welcome.isPickable = true;
return welcome; return welcome;
} }
@ -95,26 +96,39 @@ export class Introduction {
private takeStep() { private takeStep() {
this.current.forEach((mesh) => { this.current.forEach((mesh) => {
const pos = mesh.getAbsolutePosition(); const pos = mesh.physicsBody.transformNode.absolutePosition.clone();
pos.x = pos.x - .1; pos.x = pos.x - .1;
mesh.physicsBody.applyImpulse(new Vector3(0, 5, 16), pos); mesh.physicsBody.applyImpulse(new Vector3(0, 8, 12), pos);
}); });
switch (this.step) { switch (this.step) {
case 0: case 0:
this.items.push(this.buildText("Welcome To", 1.5, 1024, new Vector3(0, 7, 5))); this.items.push(this.buildText("Welcome To", 3, 1024, new Vector3(0, 15, 5)));
this.items.push(this.buildText("Deep Diagram", 2, 1024, new Vector3(0, 5, 5))); this.items.push(this.buildText("Deep Diagram", 5, 1024, new Vector3(0, 10, 5)));
this.current = this.items.slice(-2); this.current = this.items.slice(-2);
break; break;
case 1: case 1:
this.items.push(this.buildText("Let us show you", 2.3, 1024, new Vector3(0, 8, 5))); this.items.push(this.buildText("Let us show you", 3, 1024, new Vector3(-1.5, 16, 5)));
this.items.push(this.buildText("what you can build", 3, 1200, new Vector3(0, 5, 5))); this.items.push(this.buildText("what you can build", 4, 1200, new Vector3(2, 12, 5)));
this.current = this.items.slice(-2); this.current = this.items.slice(-2);
break; break;
case 2: case 2:
this.items.push(this.buildText("A quick video", 2, 1024, new Vector3(0, 5, 5))); this.items.push(this.buildText("A quick video", 5, 1024, new Vector3(0, 15, 5)));
this.current = this.items.slice(-1);
break;
case 3: case 3:
this.items.push(this.buildVideo("A quick video", 2, new Vector3(0, 5, 5))); this.items.push(this.buildVideo("A quick video", 5, new Vector3(0, 8, 5)));
this.current = this.items.slice(-1);
break;
case 4:
this.items.forEach((mesh) => {
mesh.physicsBody.dispose();
mesh.dispose();
});
this.advance.dispose();
this.manager.dispose();
AppConfig.config.demoCompleted = true;
this.items = [];
} }
this.step++; this.step++;

View File

@ -12,6 +12,7 @@ export type SnapValue = {
export class AppConfig { export class AppConfig {
private readonly logger = log.getLogger('AppConfig'); private readonly logger = log.getLogger('AppConfig');
private _demoCompleted = false;
private gridSnap = 1; private gridSnap = 1;
private _turnSnap = 0; private _turnSnap = 0;
private rotateSnap = 0; private rotateSnap = 0;
@ -52,6 +53,15 @@ export class AppConfig {
return this.gridSnapArray[this.gridSnap]; return this.gridSnapArray[this.gridSnap];
} }
public get demoCompleted(): boolean {
return this._demoCompleted;
}
public set demoCompleted(val: boolean) {
this._demoCompleted = val;
this.save();
}
public set newRelicKey(val: string) { public set newRelicKey(val: string) {
this._newRelicKey = val; this._newRelicKey = val;
this.save(); this.save();
@ -197,7 +207,8 @@ export class AppConfig {
turnSnap: this.currentTurnSnap.value, turnSnap: this.currentTurnSnap.value,
physicsEnabled: this._physicsEnabled, physicsEnabled: this._physicsEnabled,
newRelicKey: this._newRelicKey, newRelicKey: this._newRelicKey,
newRelicAccount: this._newRelicAccount newRelicAccount: this._newRelicAccount,
demoCompleted: this._demoCompleted
}); });
} }

View File

@ -7,5 +7,6 @@ export type AppConfigType = {
physicsEnabled: boolean, physicsEnabled: boolean,
newRelicKey: string, newRelicKey: string,
newRelicAccount: string, newRelicAccount: string,
demoCompleted: boolean,
} }