|
@@ -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>
|