Przeglądaj źródła

Merge branch 'master' of http://39.98.38.2:13000/lql/tba-nbhs

viviandjava 6 miesięcy temu
rodzic
commit
81b4727888

BIN
src/assets/images/layout/header-title-tsq2.png


+ 19 - 2
src/components/UePlayer.vue

@@ -2,8 +2,10 @@
 import {onMounted, ref} from "vue";
 import {Config, PixelStreaming} from '@epicgames-ps/lib-pixelstreamingfrontend-ue5.2';
 import {Application, PixelStreamingApplicationStyle} from '@epicgames-ps/lib-pixelstreamingfrontend-ui-ue5.2';
+import bus from "@/utils/bus";
 
 const uePlayerRef = ref(null)
+let stream;
 
 onMounted(() => {
   const pixelStreamingApplicationStyles = new PixelStreamingApplicationStyle();
@@ -18,12 +20,13 @@ onMounted(() => {
       AutoPlayVideo: true,
       StartVideoMuted: false,
       KeyboardInput: false,
-      MouseInput: true,
+      HoveringMouse: true,
+      MouseInput: true
     }
   });
 
   // 创建实现 Delegate 接口类的本机 DOM 委托实例
-  const stream = new PixelStreaming(config);
+  stream = new PixelStreaming(config);
   const application = new Application({
     stream,
     onColorModeChanged: (isLightMode) => pixelStreamingApplicationStyles.setColorMode(isLightMode)
@@ -32,6 +35,20 @@ onMounted(() => {
   uePlayerRef.value.appendChild(application.rootElement);
 })
 
+/**
+ * 给三维底板发送命令
+ * @param data 命令
+ */
+function emitUIInteraction(data) {
+  if (!stream) {
+    return
+  }
+  console.log('-- 发送命令', JSON.stringify(data))
+  stream.emitUIInteraction(data)
+}
+
+// 全局监听
+bus.on('emitUIInteraction', (data) => emitUIInteraction(data))
 </script>
 
 <template>