xushiting 3 年之前
父節點
當前提交
f0d30a2076
共有 4 個文件被更改,包括 27 次插入2096 次删除
  1. 1 2082
      dist/assets/config.json
  2. 1 1
      dist/index.html
  3. 20 8
      src/XverseAvatarManager.js
  4. 5 5
      src/main.js

文件差異過大導致無法顯示
+ 1 - 2082
dist/assets/config.json


+ 1 - 1
dist/index.html

@@ -69,7 +69,7 @@
     const VERSION$1 = "1.0.75"
     , ENV = "production";
   
-    const nickname = "1f7acca1db9d5";
+    let nickname = "8e2515a18f449";
 
     const COMPONENT_LIST_PREFIX = "/component_list.json";
     const isFunction = i=>typeof i == "function";

+ 20 - 8
src/XverseAvatarManager.js

@@ -107,13 +107,12 @@ export default class XverseAvatarManager extends EventEmitter {
             }
             if (t.event && [SyncEventType.Appear, SyncEventType.Reset].includes(t.event.type) || !t.event) {
                 let d = this.avatars.get(t.userId);
-                if (t.playerState.avatarId && (d == null ? void 0 : d.avatarId) !== t.playerState.avatarId && (d = void 0,
-                this.removeAvatar(t.userId)),
-                d) {
-                    if (d.disconnected && d.setConnectionStatus(!1),
-                    (u = t.event) != null && u.id && this._room.actionsHandler.confirmEvent(t.event.id),
-                    t.playerState.nickName && (d == null || d._setNickname(t.playerState.nickName)),
-                    t.playerState.avatarComponents && !d.isSelf && d.xAvatar) {
+                t.playerState.avatarId && (d == null ? void 0 : d.avatarId) !== t.playerState.avatarId && (d = void 0,this.removeAvatar(t.userId));
+                if (d) {
+                    d.disconnected && d.setConnectionStatus(!1);
+                    (u = t.event) != null && u.id && this._room.actionsHandler.confirmEvent(t.event.id);
+                    t.playerState.nickName && (d == null || d._setNickname(t.playerState.nickName));
+                    if (t.playerState.avatarComponents && !d.isSelf && d.xAvatar) {
                         const _ = safeParseComponents(t.playerState.avatarComponents);
                         d._changeComponents({
                             avatarComponents: _,
@@ -130,6 +129,7 @@ export default class XverseAvatarManager extends EventEmitter {
                     const b = safeParseComponents(t.playerState.avatarComponents)
                       , T = safeDecodeURIComponent(t.playerState.nickName)
                       , C = this.calculatePriority(t.userId, y);
+                    
                     this.addAvatar({
                         userId: t.userId,
                         isHost: t.playerState.isHost,
@@ -180,7 +180,19 @@ export default class XverseAvatarManager extends EventEmitter {
     }
     calculatePriority(e, t) {
         var n;
-        return e === this._room.userId ? EAvatarRelationRank.Self : (n = this._room.options.firends) != null && n.includes(e) ? EAvatarRelationRank.Friend : EAvatarRelationRank.Stranger
+        if(e === this._room.userId){
+            return EAvatarRelationRank.Self
+        }
+        else{
+            n = this._room.options.firends
+            if(n != null && n.includes(e) ){
+                return EAvatarRelationRank.Friend
+            }
+            else{
+                return EAvatarRelationRank.Stranger
+            }
+        }
+        //return e === this._room.userId ? EAvatarRelationRank.Self : (n = this._room.options.firends) != null && n.includes(e) ? EAvatarRelationRank.Friend : EAvatarRelationRank.Stranger
     }
     updateAvatarPositionAndRotation(e) {
         var t, r;

+ 5 - 5
src/main.js

@@ -5,7 +5,7 @@ import Codes from "./enum/Codes.js";
 const xverse = new Xverse({
   env: "DEV",
   appId: "10016",
-  releaseId: "2203120033_29769e",
+  releaseId: "2203181838_1375a0",
 });
 
 const l = async () => {
@@ -26,18 +26,18 @@ const l = async () => {
     toast("\u8FDB\u5165\u5931\u8D25, \u8BF7\u91CD\u8BD5");
     return;
   }
-
+  //nickname = Math.random().toString(16).slice(2)
   try {
     let room = await xverse.joinRoom({
       canvas: document.getElementById("canvas"),
-      skinId: "10092",
+      skinId: "10089",
       avatarId: "KGe_Boy",
       roomId: "e629ef3e-022d-4e64-8654-703bb96410eb",
-      userId: "1f7acca1db9d5",
+      userId: "8e2515a18f449",//nickname,
       wsServerUrl: "wss://uat-eks.xverse.cn/ws",
       appId: "10016",
       token: " ",
-      nickname: "1f7acca1db9d5",
+      nickname: "8e2515a18f449",//nickname,
       firends: ["user1"],
       viewMode: "full",
       resolution: {