PlayerList world size

This commit is contained in:
Natsumi
2022-03-31 01:51:43 +13:00
parent bb5b58f21b
commit 6db3e6be31
2 changed files with 148 additions and 76 deletions
+127 -59
View File
@@ -8979,8 +8979,9 @@ speechSynthesis.getVoices();
$app.methods.checkPhotonBotJoin = function (photonId, data, gameLogDate) { $app.methods.checkPhotonBotJoin = function (photonId, data, gameLogDate) {
var text = ''; var text = '';
var platforms = []; var platforms = [];
if (typeof this.currentInstanceWorld.unityPackages === 'object') { if (typeof this.currentInstanceWorld.ref.unityPackages === 'object') {
for (var unityPackage of this.currentInstanceWorld.unityPackages) { for (var unityPackage of this.currentInstanceWorld.ref
.unityPackages) {
platforms.push(unityPackage.platform); platforms.push(unityPackage.platform);
} }
} }
@@ -13178,39 +13179,88 @@ speechSynthesis.getVoices();
this.updateTimers(); this.updateTimers();
}; };
$app.data.currentInstanceWorld = {}; $app.data.currentInstanceWorld = {
ref: {},
isPC: false,
isQuest: false,
inCache: false,
cacheSize: '',
fileCreatedAt: '',
fileSize: ''
};
$app.data.currentInstanceLocation = {}; $app.data.currentInstanceLocation = {};
$app.methods.updateCurrentInstanceWorld = function (instanceId) { $app.methods.updateCurrentInstanceWorld = function (instanceId) {
this.currentInstanceWorld = {}; if (!instanceId) {
this.currentInstanceLocation = {}; this.currentInstanceWorld = {
if (instanceId) { ref: {},
isPC: false,
isQuest: false,
inCache: false,
cacheSize: '',
fileCreatedAt: '',
fileSize: ''
};
this.currentInstanceLocation = {};
} else if (
instanceId !== this.currentInstanceLocation.tag &&
this.currentInstanceLocation.tag !==
this.lastLocationDestination
) {
this.currentInstanceWorld = {
ref: {},
isPC: false,
isQuest: false,
inCache: false,
cacheSize: '',
fileCreatedAt: '',
fileSize: ''
};
var L = API.parseLocation(instanceId); var L = API.parseLocation(instanceId);
this.currentInstanceLocation = L; this.currentInstanceLocation = L;
var ref = API.cachedWorlds.get(L.worldId); API.getWorld({
if (!ref) { worldId: L.worldId
API.getCachedWorld({ }).then((args) => {
worldId: L.worldId this.currentInstanceWorld.ref = args.ref;
}).then((args) => { var {isPC, isQuest} = this.getAvailablePlatforms(
this.currentInstanceWorld = args.ref; args.ref.unityPackages
var {isPC, isQuest} = this.getAvailablePlatforms( );
args.ref.unityPackages this.currentInstanceWorld.isPC = isPC;
); this.currentInstanceWorld.isQuest = isQuest;
this.currentInstanceWorld.$isPC = isPC; this.checkVRChatCache(args.ref).then((cacheInfo) => {
this.currentInstanceWorld.$isQuest = isQuest; if (cacheInfo[0] > 0) {
this.currentInstanceWorld.inCache = true;
this.currentInstanceWorld.cacheSize = `${(
cacheInfo[0] / 1048576
).toFixed(2)} MiB`;
}
}); });
} else { this.getBundleDateSize(args.ref).then(
API.getWorld({ ({createdAt, fileSize}) => {
worldId: L.worldId this.currentInstanceWorld.fileCreatedAt = createdAt;
}).then((args) => { this.currentInstanceWorld.fileSize = fileSize;
this.currentInstanceWorld = args.ref; }
var {isPC, isQuest} = this.getAvailablePlatforms( );
args.ref.unityPackages });
); } else {
this.currentInstanceWorld.$isPC = isPC; API.getCachedWorld({
this.currentInstanceWorld.$isQuest = isQuest; worldId: this.currentInstanceLocation.worldId
}).then((args) => {
this.currentInstanceWorld.ref = args.ref;
var {isPC, isQuest} = this.getAvailablePlatforms(
args.ref.unityPackages
);
this.currentInstanceWorld.isPC = isPC;
this.currentInstanceWorld.isQuest = isQuest;
this.checkVRChatCache(args.ref).then((cacheInfo) => {
if (cacheInfo[0] > 0) {
this.currentInstanceWorld.inCache = true;
this.currentInstanceWorld.cacheSize = `${(
cacheInfo[0] / 1048576
).toFixed(2)} MiB`;
}
}); });
} });
} }
}; };
@@ -13726,41 +13776,59 @@ speechSynthesis.getVoices();
return b.users.length - a.users.length || b.occupants - a.occupants; return b.users.length - a.users.length || b.occupants - a.occupants;
}); });
if (D.fileSize === 'Loading') { if (D.fileSize === 'Loading') {
var assetUrl = ''; $app.getBundleDateSize(ref)
for (let i = ref.unityPackages.length - 1; i > -1; i--) { .then(({createdAt, fileSize}) => {
var unityPackage = ref.unityPackages[i]; D.fileCreatedAt = createdAt;
if ( if (fileSize) {
unityPackage.platform === 'standalonewindows' && D.fileSize = fileSize;
$app.compareUnityVersion(unityPackage.unityVersion) } else {
) {
assetUrl = unityPackage.assetUrl;
break;
}
}
var fileId = extractFileId(assetUrl);
var fileVersion = parseInt(extractFileVersion(assetUrl), 10);
if (fileId) {
API.getBundles(fileId)
.then((args2) => {
var {versions} = args2.json;
for (let i = versions.length - 1; i > -1; i--) {
var version = versions[i];
if (version.version === fileVersion) {
D.fileCreatedAt = version.created_at;
D.fileSize = `${(
version.file.sizeInBytes / 1048576
).toFixed(2)} MiB`;
break;
}
}
})
.catch(() => {
D.fileSize = 'Error'; D.fileSize = 'Error';
}); }
} })
.catch(() => {
D.fileSize = 'Error';
});
} }
}); });
$app.methods.getBundleDateSize = async function (ref) {
var assetUrl = '';
var createdAt = '';
var fileSize = '';
for (let i = ref.unityPackages.length - 1; i > -1; i--) {
var unityPackage = ref.unityPackages[i];
if (
unityPackage.platform === 'standalonewindows' &&
this.compareUnityVersion(unityPackage.unityVersion)
) {
assetUrl = unityPackage.assetUrl;
break;
}
}
var fileId = extractFileId(assetUrl);
var fileVersion = parseInt(extractFileVersion(assetUrl), 10);
if (fileId) {
var args = await API.getBundles(fileId);
if (
typeof args.json !== 'undefined' &&
typeof args.json.versions !== 'undefined'
) {
var {versions} = args.json;
for (let i = versions.length - 1; i > -1; i--) {
var version = versions[i];
if (version.version === fileVersion) {
createdAt = version.created_at;
fileSize = `${(
version.file.sizeInBytes / 1048576
).toFixed(2)} MiB`;
break;
}
}
}
}
return {createdAt, fileSize};
};
API.$on('FAVORITE', function (args) { API.$on('FAVORITE', function (args) {
var {ref} = args; var {ref} = args;
var D = $app.worldDialog; var D = $app.worldDialog;
+21 -17
View File
@@ -77,23 +77,28 @@ html
//- playerList //- playerList
.x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'playerList'") .x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'playerList'")
div(style="display:flex;flex-direction:column;height:100%") div(style="display:flex;flex-direction:column;height:100%")
div(v-if="currentInstanceWorld.id" style="display:flex") div(v-if="currentInstanceWorld.ref.id" style="display:flex")
el-popover(placement="right" width="500px" trigger="click" style="height:120px") el-popover(placement="right" width="500px" trigger="click" style="height:120px")
img.x-link(slot="reference" v-lazy="currentInstanceWorld.thumbnailImageUrl" style="flex:none;width:160px;height:120px;border-radius:4px") img.x-link(slot="reference" v-lazy="currentInstanceWorld.ref.thumbnailImageUrl" style="flex:none;width:160px;height:120px;border-radius:4px")
img.x-link(v-lazy="currentInstanceWorld.imageUrl" style="width:500px;height:375px" @click="openExternalLink(currentInstanceWorld.imageUrl)") img.x-link(v-lazy="currentInstanceWorld.ref.imageUrl" style="width:500px;height:375px" @click="openExternalLink(currentInstanceWorld.ref.imageUrl)")
div(style="margin-left:10px;display:flex;flex-direction:column;min-width:320px;width:100%") div(style="margin-left:10px;display:flex;flex-direction:column;min-width:320px;width:100%")
div div
span.x-link(@click="showWorldDialog(currentInstanceWorld.id)" style="font-weight:bold;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1") span.x-link(@click="showWorldDialog(currentInstanceWorld.ref.id)" style="font-weight:bold;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1")
| #[i.el-icon-s-home(v-show="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === currentInstanceWorld.id" style="margin-right:5px")] {{ currentInstanceWorld.name }} | #[i.el-icon-s-home(v-show="API.currentUser.$homeLocation && API.currentUser.$homeLocation.worldId === currentInstanceWorld.ref.id" style="margin-right:5px")] {{ currentInstanceWorld.ref.name }}
div div
span.x-link(v-text="currentInstanceWorld.authorName" @click="showUserDialog(currentInstanceWorld.authorId)" style="color:#909399;font-family:monospace") span.x-link(v-text="currentInstanceWorld.ref.authorName" @click="showUserDialog(currentInstanceWorld.ref.authorId)" style="color:#909399;font-family:monospace")
div(style="margin-top:5px") div(style="margin-top:5px")
el-tag(v-if="currentInstanceWorld.$isLabs" type="primary" effect="plain" size="mini" style="margin-right:5px") Labs el-tag(v-if="currentInstanceWorld.ref.$isLabs" type="primary" effect="plain" size="mini" style="margin-right:5px") Labs
el-tag(v-else-if="currentInstanceWorld.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px") Public el-tag(v-else-if="currentInstanceWorld.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px") Public
el-tag(v-else-if="currentInstanceWorld.releaseStatus === 'private'" type="danger" effect="plain" size="mini" style="margin-right:5px") Private el-tag(v-else-if="currentInstanceWorld.ref.releaseStatus === 'private'" type="danger" effect="plain" size="mini" style="margin-right:5px") Private
el-tag.x-tag-platform-pc(v-if="currentInstanceWorld.$isPC" type="info" effect="plain" size="mini" style="margin-right:5px") PC el-tag.x-tag-platform-pc(v-if="currentInstanceWorld.isPC" type="info" effect="plain" size="mini" style="margin-right:5px") PC
el-tag.x-tag-platform-quest(v-if="currentInstanceWorld.$isQuest" type="info" effect="plain" size="mini" style="margin-right:5px") Quest el-tag.x-tag-platform-quest(v-if="currentInstanceWorld.isQuest" type="info" effect="plain" size="mini" style="margin-right:5px") Quest
span.x-link(@click="showLaunchDialog(lastLocation.location)") el-tag(type="info" effect="plain" size="mini" v-text="currentInstanceWorld.fileSize" style="margin-right:5px")
el-tag(v-if="currentInstanceWorld.inCache" type="info" effect="plain" size="mini" style="margin-right:5px")
span(v-text="currentInstanceWorld.cacheSize")
| Cache
br
span.x-link(v-if="currentInstanceLocation.instanceName" @click="showLaunchDialog(lastLocation.location)")
span \#{{ currentInstanceLocation.instanceName }} {{ currentInstanceLocation.accessType }} span \#{{ currentInstanceLocation.instanceName }} {{ currentInstanceLocation.accessType }}
span.famfamfam-flags(v-if="currentInstanceLocation.region === 'eu'" class="europeanunion" style="display:inline-block;margin-left:5px") span.famfamfam-flags(v-if="currentInstanceLocation.region === 'eu'" class="europeanunion" style="display:inline-block;margin-left:5px")
span.famfamfam-flags(v-else-if="currentInstanceLocation.region === 'jp'" class="jp" style="display:inline-block;margin-left:5px") span.famfamfam-flags(v-else-if="currentInstanceLocation.region === 'jp'" class="jp" style="display:inline-block;margin-left:5px")
@@ -112,22 +117,21 @@ html
span.x-link(v-text="getDisplayNameFromPhotonId(id)" @click="showUserFromPhotonId(id)" style="margin-right:5px") span.x-link(v-text="getDisplayNameFromPhotonId(id)" @click="showUserFromPhotonId(id)" style="margin-right:5px")
span(v-text="photonLobbyBots.length" style="color:red") span(v-text="photonLobbyBots.length" style="color:red")
|  #[timer(v-if="lastLocation.date" :epoch="lastLocation.date")] |  #[timer(v-if="lastLocation.date" :epoch="lastLocation.date")]
//- el-tag(type="info" effect="plain" size="mini" v-text="worldDialog.fileSize" style="margin-right:5px")
div(style="margin-top:5px") div(style="margin-top:5px")
span(v-show="currentInstanceWorld.name !== currentInstanceWorld.description" v-text="currentInstanceWorld.description" style="font-size:12px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2") span(v-show="currentInstanceWorld.ref.name !== currentInstanceWorld.ref.description" v-text="currentInstanceWorld.ref.description" style="font-size:12px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2")
div(style="display:flex;flex-direction:column;margin-left:20px") div(style="display:flex;flex-direction:column;margin-left:20px")
.x-friend-item(style="cursor:default") .x-friend-item(style="cursor:default")
.detail .detail
span.name Capacity span.name Capacity
span.extra {{ currentInstanceWorld.capacity | commaNumber }} ({{ currentInstanceWorld.capacity * 2 | commaNumber }}) span.extra {{ currentInstanceWorld.ref.capacity | commaNumber }} ({{ currentInstanceWorld.ref.capacity * 2 | commaNumber }})
.x-friend-item(style="cursor:default") .x-friend-item(style="cursor:default")
.detail .detail
span.name Last Updated span.name Last Updated
span.extra {{ currentInstanceWorld.updated_at | formatDate('long') }} span.extra {{ currentInstanceWorld.fileCreatedAt | formatDate('long') }}
.x-friend-item(style="cursor:default") .x-friend-item(style="cursor:default")
.detail .detail
span.name Created span.name Created
span.extra {{ currentInstanceWorld.created_at | formatDate('long') }} span.extra {{ currentInstanceWorld.ref.created_at | formatDate('long') }}
div.current-instance-table div.current-instance-table
data-tables(v-bind="currentInstanceUserList" @row-click="selectCurrentInstanceRow" style="margin-top:10px;cursor:pointer") data-tables(v-bind="currentInstanceUserList" @row-click="selectCurrentInstanceRow" style="margin-top:10px;cursor:pointer")
el-table-column(label="Avatar" width="60" prop="photo") el-table-column(label="Avatar" width="60" prop="photo")