xushiting 3 年之前
父节点
当前提交
dca8283967
共有 2 个文件被更改,包括 13 次插入206 次删除
  1. 13 17
      dist/index.html
  2. 0 189
      src/App.js

+ 13 - 17
dist/index.html

@@ -366,23 +366,19 @@ const WASM_Version = "h264"
         return e
     }
 
-    var EventState = function() {
-    function i(e, t, r, n) {
-        t === void 0 && (t = !1),
-        this.initialize(e, t, r, n)
-    }
-    return i.prototype.initialize = function(e, t, r, n) {
-        return t === void 0 && (t = !1),
-        this.mask = e,
-        this.skipNextObservers = t,
-        this.target = r,
-        this.currentTarget = n,
-        this
+    function toast(i, e) {
+        const {onClick: t, duration: r} = e || {};
+        return window.Toastify({
+            text: i,
+            duration: r || 3e3,
+            position: "center",
+            onClick: function() {
+                t && t()
+            }
+        }).showToast()
     }
-    ,
-    i
-}()
-  , Observer = function() {
+
+var Observer = function() {
     function i(e, t, r) {
         r === void 0 && (r = null),
         this.callback = e,
@@ -396,7 +392,7 @@ const WASM_Version = "h264"
   , Observable = function() {
     function i(e) {
         this._observers = new Array,
-        this._eventState = new EventState(0),
+        this._eventState = new BABYLON.EventState(0),
         e && (this._onObserverAdded = e)
     }
     return i.FromPromise = function(e, t) {

+ 0 - 189
src/App.js

@@ -1,189 +0,0 @@
-var loadingImage = "../assets/loading.f375926b.png";
-const jsx = jsxRuntime.exports.jsx
-  , jsxs = jsxRuntime.exports.jsxs
-  , urlParam = new window.URLSearchParams(location.search)
-  , appId = urlParam.get("appId") || void 0
-  , releaseId = urlParam.get("releaseId") || void 0;
-appId || alert("AppId \u4E0D\u80FD\u4E3A\u7A7A");
-const xverse = new Xverse({
-    env: "DEV",
-    appId,
-    releaseId
-});
-let room;
-function App() {
-    const [i,e] = react.exports.useState(!0)
-      , [t,r] = react.exports.useState(!0)
-      , [n,o] = react.exports.useState("high")
-      , [a,s] = react.exports.useState("");
-    react.exports.useEffect(()=>{
-        l()
-    }
-    , []);
-    const l = async()=>{
-        var R;
-        const f = document.querySelector("#canvas")
-          , d = urlParam.get("roomId") || "e629ef3e-022d-4e64-8654-703bb96410eb"
-          , _ = urlParam.get("userId") || Math.random().toString(16).slice(2)
-          , g = urlParam.get("avatarId") || void 0
-          , m = urlParam.get("appId") || void 0
-          , v = urlParam.get("skinId") || void 0
-          , y = urlParam.get("pathName") || void 0
-          , b = urlParam.get("objectFit") || void 0
-          , T = {
-            width: parseInt(urlParam.get("width") || "1920"),
-            height: parseInt(urlParam.get("height") || "1080")
-        }
-          , C = urlParam.get("ws") ? decodeURIComponent(urlParam.get("ws")) : "wss://uat-eks.xverse.cn/ws"
-          , A = !!urlParam.get("debug")
-          , S = !!urlParam.get("preload")
-          , P = "full";
-        if (Logger.setLevel(A ? LoggerLevels.Debug : LoggerLevels.Warn),
-        S)
-            try {
-                await ((R = xverse.preload) == null ? void 0 : R.start(P, (M,x)=>{
-                    const I = `(${M}/${x})`;
-                    s(I)
-                }
-                ))
-            } catch (M) {
-                if (console.error(M),
-                M.code === Codes.PreloadCanceled) {
-                    toast("\u9884\u52A0\u8F7D\u88AB\u53D6\u6D88");
-                    return
-                }
-                toast("\u8FDB\u5165\u5931\u8D25, \u8BF7\u91CD\u8BD5");
-                return
-            }
-        try {
-            room = await xverse.joinRoom({
-                canvas: f,
-                skinId: v,
-                avatarId: g,
-                roomId: d,
-                userId: _,
-                wsServerUrl: C,
-                appId: m,
-                token: " ",
-                nickname: _,
-                firends: ["user1"],
-                viewMode: "full",
-                resolution: T,
-                pathName: y,
-                objectFit: b,
-                hasAvatar: !0,
-                syncToOthers: !0
-            }),
-            u(),
-            c(),
-            window.room = room,
-            e(!1)
-        } catch (M) {
-            console.error(M),
-            alert(M);
-            return
-        }
-    }
-      , u = ()=>{
-        room.on("_coreClick", ({point: f})=>{
-            room._userAvatar.moveTo({
-                point: f
-            })
-        }
-        )
-    }
-      , c = ()=>{
-        room.on("repeatLogin", function() {
-            toast("\u8BE5\u7528\u6237\u5DF2\u7ECF\u5728\u5176\u4ED6\u5730\u70B9\u767B\u5F55", {
-                duration: 1e4
-            })
-        }),
-        room.on("reconnecting", function({count: f}) {
-            toast(`\u5C1D\u8BD5\u7B2C${f}\u6B21\u91CD\u8FDE`)
-        }),
-        room.on("reconnected", function() {
-            toast("\u91CD\u8FDE\u6210\u529F")
-        }),
-        room.on("disconnected", function() {
-            const f = toast("\u8FDE\u63A5\u5931\u8D25\uFF0C\u624B\u52A8\u70B9\u51FB\u91CD\u8BD5", {
-                duration: 1e5,
-                onClick() {
-                    f.hideToast(),
-                    room.reconnect()
-                }
-            })
-        })
-    }
-    ;
-    return jsxs("div", {
-        className: "App",
-        children: [jsx("canvas", {
-            id: "canvas",
-            className: "stream unselect"
-        }), !i && (()=>jsxs("div", {
-            className: "debug_control_btns",
-            children: [jsx("button", {
-                onClick: ()=>{
-                    var y, b;
-                    (y = room.stats) != null && y.isShow ? room.stats.hide() : (b = room.stats) == null || b.show()
-                }
-                ,
-                children: "Toggle Stats"
-            }), jsx("button", {
-                onClick: ()=>{
-                    room.debug.toggleSceneshading(),
-                    r(room.debug.isSceneShading)
-                }
-                ,
-                children: t ? "\u53D6\u6D88\u4F4E\u6A21\u7740\u8272" : "\u4F4E\u6A21\u7740\u8272"
-            }), jsxs("button", {
-                onClick: ()=>{
-                    let y = "average";
-                    n === "high" ? y = "average" : n === "average" ? y = "low" : n === "low" ? y = "high" : y = "average",
-                    o(y),
-                    room.setPictureQualityLevel(y)
-                }
-                ,
-                children: ["\u753B\u8D28\uFF1A", n === "high" ? "\u9AD8" : n === "low" ? "\u4F4E" : "\u4E2D"]
-            }), jsx("button", {
-                onClick: ()=>{
-                    room.debug.toggleNearbyBreathPoint()
-                }
-                ,
-                className: "font-size-small",
-                children: "Toggle\u5468\u8FB9\u547C\u5438\u70B9"
-            }), jsx("button", {
-                onClick: ()=>{
-                    room.debug.toggleTapBreathPoint()
-                }
-                ,
-                className: "font-size-small",
-                children: "Toggle\u70B9\u51FB\u547C\u5438\u70B9"
-            }), jsx("button", {
-                onClick: ()=>{
-                    try {
-                        room.debug.dumpStream(()=>{
-                            toast("\u5F55\u5236\u5B8C\u6210")
-                        }
-                        ),
-                        toast("\u5F00\u59CB\u5F55\u5236")
-                    } catch {
-                        toast("\u7801\u6D41\u5F55\u5236\u4E2D\uFF0C\u8BF7\u7A0D\u7B49")
-                    }
-                }
-                ,
-                className: "font-size-small",
-                children: "\u5F55\u5236\u7801\u6D41\uFF0810s\uFF09"
-            })]
-        }))(), i && jsxs("div", {
-            className: "loading",
-            id: "loading",
-            children: [jsx("img", {
-                src: loadingImage,
-                alt: ""
-            }), jsxs("div", {
-                children: ["\u5373\u5C06\u8FDB\u5165\u573A\u666F ", a]
-            })]
-        })]
-    })
-}