From f5fc58e9718e78adab3689a88986e01ab6e7e9da Mon Sep 17 00:00:00 2001
From: vegu-ai-tools <152010387+vegu-ai-tools@users.noreply.github.com>
Date: Thu, 8 May 2025 01:04:23 +0300
Subject: [PATCH] allow updationg of scene phase through director console
---
.../src/components/DirectorConsole.vue | 88 +++++++++++++++----
.../src/components/TalemateApp.vue | 15 +++-
.../WorldStateManagerSceneOutline.vue | 2 +-
3 files changed, 86 insertions(+), 19 deletions(-)
diff --git a/talemate_frontend/src/components/DirectorConsole.vue b/talemate_frontend/src/components/DirectorConsole.vue
index f3350141..2e37bef9 100644
--- a/talemate_frontend/src/components/DirectorConsole.vue
+++ b/talemate_frontend/src/components/DirectorConsole.vue
@@ -2,16 +2,24 @@
- Current Phase {{ intent.name }}
+ Current Phase
-
-
- No scene phase set
-
+
+
+
Manage
@@ -48,6 +56,10 @@ export default {
},
props: {
scene: Object,
+ open: {
+ type: Boolean,
+ default: false,
+ }
},
inject: [
'openWorldStateManager',
@@ -55,28 +67,72 @@ export default {
'registerMessageHandler',
'unregisterMessageHandler',
],
- computed: {
- intent() {
- if(!this.scene || !this.scene.data || !this.scene.data.intent) {
- return {
- name: null,
- intent: null,
- }
+ watch: {
+ open(newVal) {
+ if(newVal) {
+ this.getSceneIntent();
}
- return this.scene.data.intent;
+ },
+ },
+ computed: {
+ sceneTypes() {
+ if(!this.intent || !this.intent.scene_types) {
+ return [];
+ }
+
+ const types = [];
+ for(const key in this.intent.scene_types) {
+ types.push({
+ value: this.intent.scene_types[key].id,
+ title: this.intent.scene_types[key].name,
+ });
+ }
+
+ return types;
}
},
data() {
return {
messages: [],
max_messages: 20,
+ dirty: {},
+ intent: {
+ intent: null,
+ phase: {
+ intent: null,
+ scene_type: null,
+ },
+ scene_types: {},
+ start: 0,
+ },
}
},
methods: {
clearMessages() {
this.messages = [];
},
+ updateSceneIntent() {
+ if(!this.intent || !this.intent.intent) {
+ return;
+ }
+ this.getWebsocket().send(JSON.stringify({
+ type: 'world_state_manager',
+ action: 'set_scene_intent',
+ ...this.intent,
+ }));
+ },
+ getSceneIntent() {
+ this.getWebsocket().send(JSON.stringify({
+ type: 'world_state_manager',
+ action: 'get_scene_intent',
+ }));
+ },
handleMessage(message) {
+
+ if (message.action === 'get_scene_intent') {
+ this.intent = message.data;
+ }
+
if(message.type != "director") {
return;
}
@@ -86,7 +142,7 @@ export default {
return;
}
- this.messages.push(message);
+ this.messages.unshift(message);
// Keep messages within the max limit
while(this.messages.length > this.max_messages) {
diff --git a/talemate_frontend/src/components/TalemateApp.vue b/talemate_frontend/src/components/TalemateApp.vue
index 7517a17d..57d0b018 100644
--- a/talemate_frontend/src/components/TalemateApp.vue
+++ b/talemate_frontend/src/components/TalemateApp.vue
@@ -129,10 +129,10 @@
-
+
mdi-bullhorn Director Console
-
+
@@ -496,6 +496,17 @@ export default {
return false;
+ },
+ directorConsoleWidth() {
+ // based on the screen width, set the width of the director console
+ const screenWidth = window.innerWidth;
+ if(screenWidth <= 1920) {
+ return 400;
+ } else if(screenWidth <= 2560) {
+ return 600;
+ } else {
+ return 800;
+ }
}
},
mounted() {
diff --git a/talemate_frontend/src/components/WorldStateManagerSceneOutline.vue b/talemate_frontend/src/components/WorldStateManagerSceneOutline.vue
index 8690d34b..fd58e353 100644
--- a/talemate_frontend/src/components/WorldStateManagerSceneOutline.vue
+++ b/talemate_frontend/src/components/WorldStateManagerSceneOutline.vue
@@ -1,6 +1,6 @@
-
+