|
@@ -1,6 +1,5 @@
|
|
import Xverse from "./Xverse.js"
|
|
import Xverse from "./Xverse.js"
|
|
import Codes from "./enum/Codes.js"
|
|
import Codes from "./enum/Codes.js"
|
|
-import Tip from "./Tip.js";
|
|
|
|
|
|
|
|
const xverse = new Xverse({
|
|
const xverse = new Xverse({
|
|
env: "DEV",
|
|
env: "DEV",
|
|
@@ -20,28 +19,25 @@ const l = async()=>{
|
|
} catch (M) {
|
|
} catch (M) {
|
|
if (console.error(M),
|
|
if (console.error(M),
|
|
M.code === Codes.PreloadCanceled) {
|
|
M.code === Codes.PreloadCanceled) {
|
|
- toast("\u9884\u52A0\u8F7D\u88AB\u53D6\u6D88"); //预加载被取消
|
|
|
|
|
|
+ toast("\u9884\u52A0\u8F7D\u88AB\u53D6\u6D88");
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- toast("\u8FDB\u5165\u5931\u8D25, \u8BF7\u91CD\u8BD5"); //进入失败, 请重试
|
|
|
|
|
|
+ toast("\u8FDB\u5165\u5931\u8D25, \u8BF7\u91CD\u8BD5");
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let nickname = Math.random().toString(16).slice(2)
|
|
let nickname = Math.random().toString(16).slice(2)
|
|
try {
|
|
try {
|
|
-
|
|
|
|
|
|
+
|
|
let room = await xverse.joinRoom({
|
|
let room = await xverse.joinRoom({
|
|
canvas: document.getElementById('canvas'),
|
|
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,
|
|
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: " ",
|
|
token: " ",
|
|
nickname: nickname,
|
|
nickname: nickname,
|
|
firends: ["user1"],
|
|
firends: ["user1"],
|
|
@@ -59,13 +55,11 @@ const l = async()=>{
|
|
|
|
|
|
u();
|
|
u();
|
|
c();
|
|
c();
|
|
- // f();
|
|
|
|
|
|
|
|
//e(!1);
|
|
//e(!1);
|
|
} catch (M) {
|
|
} catch (M) {
|
|
- M = String(M).split(",")[1]
|
|
|
|
console.error(M);
|
|
console.error(M);
|
|
- new Tip(M) // alert(M);
|
|
|
|
|
|
+ alert(M);
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -81,18 +75,18 @@ const u = ()=>{
|
|
|
|
|
|
const c = ()=>{
|
|
const c = ()=>{
|
|
window.room.on("repeatLogin", function() {
|
|
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
|
|
duration: 1e4
|
|
})
|
|
})
|
|
}),
|
|
}),
|
|
window.room.on("reconnecting", function({count: f}) {
|
|
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() {
|
|
window.room.on("reconnected", function() {
|
|
- toast("\u91CD\u8FDE\u6210\u529F") //重连成功
|
|
|
|
|
|
+ toast("\u91CD\u8FDE\u6210\u529F")
|
|
}),
|
|
}),
|
|
window.room.on("disconnected", function() {
|
|
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,
|
|
duration: 1e5,
|
|
onClick() {
|
|
onClick() {
|
|
f.hideToast(),
|
|
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();
|
|
l();
|