zhouenguang 3 years ago
parent
commit
02cdeda076
2 changed files with 338 additions and 366 deletions
  1. 323 323
      dist/assets/config.json
  2. 15 43
      src/main.js

File diff suppressed because it is too large
+ 323 - 323
dist/assets/config.json


+ 15 - 43
src/main.js

@@ -1,6 +1,5 @@
 import Xverse from "./Xverse.js"
 import Codes from "./enum/Codes.js"
-import Tip from "./Tip.js";
 
 const xverse = new Xverse({
     env: "DEV",
@@ -20,28 +19,25 @@ const l = async()=>{
     } catch (M) {
         if (console.error(M),
         M.code === Codes.PreloadCanceled) {
-            toast("\u9884\u52A0\u8F7D\u88AB\u53D6\u6D88");   //预加载被取消
+            toast("\u9884\u52A0\u8F7D\u88AB\u53D6\u6D88");
             return
         }
-        toast("\u8FDB\u5165\u5931\u8D25, \u8BF7\u91CD\u8BD5");   //进入失败, 请重试
+        toast("\u8FDB\u5165\u5931\u8D25, \u8BF7\u91CD\u8BD5");
         return
     }
     let nickname = Math.random().toString(16).slice(2)
     try {
- 
+
         let room = await xverse.joinRoom({
             canvas: document.getElementById('canvas'),
-            skinId: '0000000001',
-            avatarId: 'My_Actor',
-            roomId: 'aea5406a-3099-48db-b428-30917872e58a',
+            skinId: '10089',
+            avatarId: 'KGe_Boy',
+            roomId: 'e629ef3e-022d-4e64-8654-703bb96410eb',
             userId: nickname,
-            //wsServerUrl: 'wss://uat-eks.xverse.cn/ws',
-            wsServerUrl: "ws://localhost:6688/ws",
-            //wsServerUrl: "ws://192.168.1.100:6688/ws",
-            //wsServerUrl: "wss://meta-socket.4dage.com/ws",
-            // wsServerUrl: "wss://meta-socket1.4dage.com/ws",
-            //appId: "10016",
-            appId: "0000000003",
+            wsServerUrl: 'wss://uat-eks.xverse.cn/ws',
+            // wsServerUrl: "ws://localhost:6688/ws",
+            // wsServerUrl: "wss://meta-socket.4dage.com/ws",
+            appId: "10016",
             token: " ",
             nickname: nickname,
             firends: ["user1"],
@@ -59,13 +55,11 @@ const l = async()=>{
 
         u();
         c();
-        // f();
         
         //e(!1);
     } catch (M) {
-        M = String(M).split(",")[1]
         console.error(M);
-        new Tip(M)  // alert(M);
+        alert(M);
         return
     }
 }
@@ -81,18 +75,18 @@ const u = ()=>{
 
 const c = ()=>{
     window.room.on("repeatLogin", function() {
-        toast("\u8BE5\u7528\u6237\u5DF2\u7ECF\u5728\u5176\u4ED6\u5730\u70B9\u767B\u5F55", {    //该用户已经在其他地点登录
+        toast("\u8BE5\u7528\u6237\u5DF2\u7ECF\u5728\u5176\u4ED6\u5730\u70B9\u767B\u5F55", {
             duration: 1e4
         })
     }),
     window.room.on("reconnecting", function({count: f}) {
-        toast(`\u5C1D\u8BD5\u7B2C${f}\u6B21\u91CD\u8FDE`)    //尝试第 ${f} 次重连
+        toast(`\u5C1D\u8BD5\u7B2C${f}\u6B21\u91CD\u8FDE`)
     }),
     window.room.on("reconnected", function() {
-        toast("\u91CD\u8FDE\u6210\u529F")                   //重连成功
+        toast("\u91CD\u8FDE\u6210\u529F")
     }),
     window.room.on("disconnected", function() {
-        const f = toast("\u8FDE\u63A5\u5931\u8D25\uFF0C\u624B\u52A8\u70B9\u51FB\u91CD\u8BD5", {    //连接失败,手动点击重试
+        const f = toast("\u8FDE\u63A5\u5931\u8D25\uFF0C\u624B\u52A8\u70B9\u51FB\u91CD\u8BD5", {
             duration: 1e5,
             onClick() {
                 f.hideToast(),
@@ -101,26 +95,4 @@ const c = ()=>{
         })
     })
 }
-
-const f = async ()=>{
-    const T = (await room.modelManager.findAssetList(String(room.skinId))).filter(E=>E.typeName === "MEDIA").map(E=>E.url);
-    // a(T),
-    room.tv && room.tv.setUrl({
-        url: "./assets/xverse_tv_840x480_1K.mp4",
-        loop: !0
-    }).then(async()=>{
-        try {
-            if(room.tv.videoElement) {
-                // room.tv.videoElement.muted = false
-                await room.tv.videoElement.play()
-                console.log("\u64AD\u653E\u6210\u529F")     // 播放成功
-            }
-        } catch (S) {
-            console.log("\u64AD\u653E\u5931\u8D25\uFF1A", S)    // 播放失败
-        }
-    }).catch(E=>{
-        console.error(E)
-    })
-}
-
 l();