diff --git a/html/src/app.js b/html/src/app.js index 043f76e9..d5b43f57 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -5190,6 +5190,7 @@ speechSynthesis.getVoices(); ipcTimeout: 0, nextClearVRCXCacheCheck: 0, nextDiscordUpdate: 0, + nextAutoStateChange: 0, isDiscordActive: false, isGameRunning: false, isGameNoVR: configRepository.getBool('isGameNoVR'), @@ -5400,6 +5401,10 @@ speechSynthesis.getVoices(); this.updateDiscord(); } } + if (--this.nextAutoStateChange <= 0) { + this.nextAutoStateChange = 7; + this.updateAutoStateChange(); + } } } catch (err) { API.isRefreshFriendsLoading = false; @@ -12405,6 +12410,51 @@ speechSynthesis.getVoices(); } }; + $app.methods.updateAutoStateChange = function () { + if ( + !this.isGameRunning || + !this.lastLocation.playerList.size || + this.lastLocation.location === '' || + this.lastLocation.location === 'traveling' + ) { + return; + } + + const otherPeopleExists = this.lastLocation.playerList.size > 1; + const prevStatus = API.currentUser.status; + let nextStatus = prevStatus; + + switch (this.autoStateChange) { + case 'Active or Ask Me': + nextStatus = otherPeopleExists ? 'ask me' : 'active'; + break; + + case 'Active or Busy': + nextStatus = otherPeopleExists ? 'busy' : 'active'; + break; + + case 'Join Me or Ask Me': + nextStatus = otherPeopleExists ? 'ask me' : 'join me'; + break; + + case 'Join Me or Busy': + nextStatus = otherPeopleExists ? 'busy' : 'join me'; + break; + + case 'Ask Me or Busy': + nextStatus = otherPeopleExists ? 'ask me' : 'busy'; + break; + } + + if (prevStatus === nextStatus) { + return; + } + + API.saveCurrentUser({ + status: nextStatus + }); + }; + $app.methods.lookupUser = async function (ref) { if (ref.userId) { this.showUserDialog(ref.userId); @@ -14262,6 +14312,16 @@ speechSynthesis.getVoices(); $app.methods.saveGameLogOptions = function () { configRepository.setBool('VRCX_logResourceLoad', this.logResourceLoad); }; + $app.data.autoStateChange = configRepository.getString( + 'VRCX_autoStateChange', + 'Off' + ); + $app.methods.saveAutomationOptions = function () { + configRepository.setString( + 'VRCX_autoStateChange', + this.autoStateChange + ); + }; $app.data.orderFriendsGroup0 = configRepository.getBool( 'orderFriendGroup0', true diff --git a/html/src/localization/strings/en.json b/html/src/localization/strings/en.json index c0d7b530..0b19acc9 100644 --- a/html/src/localization/strings/en.json +++ b/html/src/localization/strings/en.json @@ -211,6 +211,17 @@ "header": "Game Log", "resource_load": "Log Udon resource load" }, + "automation": { + "header": "Automation", + "auto_state_change": "Auto State Change", + "auto_state_change_tooltip": "Automatically change state when there are other people in instance", + "auto_state_change_off": "Off", + "auto_state_change_active_or_ask_me": "Active / Ask Me", + "auto_state_change_active_or_busy": "Active / Busy", + "auto_state_change_join_me_or_ask_me": "Join Me / Ask Me", + "auto_state_change_join_me_or_busy": "Join Me / Busy", + "auto_state_change_ask_me_or_busy": "Ask Me / Busy" + }, "legal_notice": { "header": "Legal Notice", "info": "VRCX is an assistant application for VRChat that provides information about and managing friendship. This application makes use of the unofficial VRChat API SDK.", diff --git a/html/src/localization/strings/ko.json b/html/src/localization/strings/ko.json index 6b5d2bd3..49ea01cc 100644 --- a/html/src/localization/strings/ko.json +++ b/html/src/localization/strings/ko.json @@ -211,6 +211,17 @@ "header": "VRChat 로그", "resource_load": "Udon 리소스 로드 기록" }, + "automation": { + "header": "자동화", + "auto_state_change": "자동 상태 변경", + "auto_state_change_tooltip": "인스턴스에 다른 사람이 있을 때 상태를 자동으로 바꿉니다", + "auto_state_change_off": "끄기", + "auto_state_change_active_or_ask_me": "초록불(Active) / 주황불(Ask Me)", + "auto_state_change_active_or_busy": "초록불(Active) / 빨간불(Busy)", + "auto_state_change_join_me_or_ask_me": "파란불(Join Me) / 주황불(Ask Me)", + "auto_state_change_join_me_or_busy": "파란불(Join Me) / 빨간불(Busy)", + "auto_state_change_ask_me_or_busy": "주황불(Ask Me) / 빨간불(Busy)" + }, "legal_notice": { "header": "법적 공지", "info": "VRCX는 친구 관계에 도움을 줄 만한 정보를 제공하는 보조 프로그램입니다. 비공식 VRChat API SDK를 사용합니다", diff --git a/html/src/mixins/tabs/settings.pug b/html/src/mixins/tabs/settings.pug index 8841c8d5..5272a801 100644 --- a/html/src/mixins/tabs/settings.pug +++ b/html/src/mixins/tabs/settings.pug @@ -27,6 +27,16 @@ mixin simpleRadioGroup(nameTrKey, model, options, onChange="") each option in options el-radio-button(label=option.label) {{ $t('#{option.translationKey}') }} +mixin simpleRadioGroupWithTooltip(nameTrKey, tooltipContent, model, options, onChange="") + div.options-container-item + span.name {{ $t('#{nameTrKey}') }} + el-tooltip(placement="top" style="margin-left:5px" :content=tooltipContent) + i.el-icon-warning + br + el-radio-group(v-model=model @change=onChange size="mini") + each option in options + el-radio-button(label=option.label) {{ $t('#{option.translationKey}') }} + mixin settingsTab() .x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'settings'") div.options-container(style="margin-top:0;padding:5px") @@ -77,6 +87,16 @@ mixin settingsTab() //- General | Game Log +simpleSettingsCategory("view.settings.general.game_log.header") +simpleSwitch("view.settings.general.game_log.resource_load", "logResourceLoad", "saveGameLogOptions") + //- General | Automation + +simpleSettingsCategory("view.settings.general.automation.header") + +simpleRadioGroupWithTooltip("view.settings.general.automation.auto_state_change", "$t('view.settings.general.automation.auto_state_change_tooltip')", "autoStateChange", [ + { label: "Off", translationKey: "view.settings.general.automation.auto_state_change_off" }, + { label: "Active or Ask Me", translationKey: "view.settings.general.automation.auto_state_change_active_or_ask_me" }, + { label: "Active or Busy", translationKey: "view.settings.general.automation.auto_state_change_active_or_busy" }, + { label: "Join Me or Ask Me", translationKey: "view.settings.general.automation.auto_state_change_join_me_or_ask_me" }, + { label: "Join Me or Busy", translationKey: "view.settings.general.automation.auto_state_change_join_me_or_busy" }, + { label: "Ask Me or Busy", translationKey: "view.settings.general.automation.auto_state_change_ask_me_or_busy" }, + ], "saveAutomationOptions") //- General | Legal Notice div.options-container(style="margin-top:45px;border-top:1px solid #eee;padding-top:30px") span.header {{ $t("view.settings.general.legal_notice.header" )}}