Photon logging join/leave

This commit is contained in:
Natsumi
2021-12-11 01:21:46 +13:00
parent 85a6304053
commit 5d0efe104b
3 changed files with 36 additions and 12 deletions

View File

@@ -338,7 +338,7 @@ namespace VRCX
return true; return true;
} }
if (line.Contains("] Joining ") && !line.Contains("or Creating Room: ")) if (line.Contains("] Joining ") && !line.Contains("] Joining or Creating Room: ") && !line.Contains("] Joining friend: "))
{ {
var lineOffset = line.LastIndexOf("] Joining "); var lineOffset = line.LastIndexOf("] Joining ");
if (lineOffset < 0) if (lineOffset < 0)

View File

@@ -8759,18 +8759,18 @@ speechSynthesis.getVoices();
$app.methods.checkPhotonBotLeave = function (photonId, gameLogDate) { $app.methods.checkPhotonBotLeave = function (photonId, gameLogDate) {
var text = ''; var text = '';
var lobbyJointime = this.photonLobbyJointime.get(photonId); var lobbyJointime = this.photonLobbyJointime.get(photonId);
if ( if (this.photonLobbyBots.includes(photonId)) {
typeof lobbyJointime !== 'undefined' &&
!lobbyJointime.hasInstantiated
) {
var time = timeToText(Date.now() - lobbyJointime.joinTime);
text = `Left without instantiating ${time}`;
} else if (this.photonLobbyBots.includes(photonId)) {
var text = 'Photon bot has left'; var text = 'Photon bot has left';
if (typeof lobbyJointime !== 'undefined') { if (typeof lobbyJointime !== 'undefined') {
var time = timeToText(Date.now() - lobbyJointime.joinTime); var time = timeToText(Date.now() - lobbyJointime.joinTime);
text = `Photon bot has left ${time}`; text = `Photon bot has left ${time}`;
} }
} else if (
typeof lobbyJointime !== 'undefined' &&
!lobbyJointime.hasInstantiated
) {
var time = timeToText(Date.now() - lobbyJointime.joinTime);
text = `Left without instantiating ${time}`;
} }
if (text) { if (text) {
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
@@ -8824,6 +8824,9 @@ speechSynthesis.getVoices();
}; };
this.photonLobby.set(photonId, photonUser); this.photonLobby.set(photonId, photonUser);
this.photonLobbyCurrent.set(photonId, photonUser); this.photonLobbyCurrent.set(photonId, photonUser);
if (!hasJoined) {
this.photonUserJoin(photonId, photonUser, gameLogDate);
}
var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min
if (bias > Date.now()) { if (bias > Date.now()) {
@@ -8868,13 +8871,14 @@ speechSynthesis.getVoices();
this.photonModerationUpdate(ref, block, mute, gameLogDate); this.photonModerationUpdate(ref, block, mute, gameLogDate);
} }
} }
if (!hasJoined) {
this.photonUserJoin(photonId, ref, gameLogDate);
}
}; };
$app.methods.photonUserJoin = function (photonId, ref, gameLogDate) { $app.methods.photonUserJoin = function (photonId, ref, gameLogDate) {
if (ref.id === API.currentUser.id) { if (
typeof ref === 'undefined' ||
ref.id === API.currentUser.id ||
!this.photonEventOverlayJoinLeave
) {
return; return;
} }
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
@@ -8885,6 +8889,9 @@ speechSynthesis.getVoices();
}; };
$app.methods.photonUserLeave = function (photonId, gameLogDate) { $app.methods.photonUserLeave = function (photonId, gameLogDate) {
if (!this.photonEventOverlayJoinLeave) {
return;
}
this.addEntryPhotonEvent({ this.addEntryPhotonEvent({
photonId, photonId,
text: 'has left', text: 'has left',
@@ -10932,6 +10939,9 @@ speechSynthesis.getVoices();
$app.data.photonEventOverlayFilter = configRepository.getString( $app.data.photonEventOverlayFilter = configRepository.getString(
'VRCX_PhotonEventOverlayFilter' 'VRCX_PhotonEventOverlayFilter'
); );
$app.data.photonEventOverlayJoinLeave = configRepository.getBool(
'VRCX_PhotonEventOverlayJoinLeave'
);
$app.methods.saveEventOverlay = function () { $app.methods.saveEventOverlay = function () {
configRepository.setBool( configRepository.setBool(
'VRCX_PhotonEventOverlay', 'VRCX_PhotonEventOverlay',
@@ -10949,6 +10959,10 @@ speechSynthesis.getVoices();
'VRCX_PhotonEventOverlayFilter', 'VRCX_PhotonEventOverlayFilter',
this.photonEventOverlayFilter this.photonEventOverlayFilter
); );
configRepository.setBool(
'VRCX_PhotonEventOverlayJoinLeave',
this.photonEventOverlayJoinLeave
);
if (!this.timeoutHudOverlay) { if (!this.timeoutHudOverlay) {
AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]'); AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]');
} }
@@ -11066,6 +11080,13 @@ speechSynthesis.getVoices();
$app.data.photonEventOverlayFilter $app.data.photonEventOverlayFilter
); );
} }
if (!configRepository.getBool('VRCX_PhotonEventOverlayJoinLeave')) {
$app.data.photonEventOverlayJoinLeave = false;
configRepository.setBool(
'VRCX_PhotonEventOverlayJoinLeave',
$app.data.photonEventOverlayJoinLeave
);
}
if (!configRepository.getString('sharedFeedFilters')) { if (!configRepository.getString('sharedFeedFilters')) {
var sharedFeedFilters = { var sharedFeedFilters = {
noty: { noty: {

View File

@@ -1099,6 +1099,9 @@ html
div.options-container-item div.options-container-item
span.name Enable span.name Enable
el-switch(v-model="photonEventOverlay" @change="saveEventOverlay" :disabled="!openVR") el-switch(v-model="photonEventOverlay" @change="saveEventOverlay" :disabled="!openVR")
div.options-container-item
span.name Show Join/Leave
el-switch(v-model="photonEventOverlayJoinLeave" @change="saveEventOverlay" :disabled="!openVR")
div.options-container-item div.options-container-item
span.name Filter span.name Filter
el-radio-group(v-model="photonEventOverlayFilter" @change="saveEventOverlay" size="mini" :disabled="!openVR || !photonEventOverlay") el-radio-group(v-model="photonEventOverlayFilter" @change="saveEventOverlay" size="mini" :disabled="!openVR || !photonEventOverlay")