diff --git a/VRCXVR.cs b/VRCXVR.cs index 5ce30d70..3a84ec42 100644 --- a/VRCXVR.cs +++ b/VRCXVR.cs @@ -302,6 +302,12 @@ namespace VRCX { batteryPercentage = 1f; } + err = ETrackedPropertyError.TrackedProp_Success; + var isCharging = system.GetBoolTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceIsCharging_Bool, ref err); + if (err != ETrackedPropertyError.TrackedProp_Success) + { + isCharging = false; + } sb.Clear(); system.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_TrackingSystemName_String, sb, (uint)sb.Capacity, ref err); var isOculus = sb.ToString().IndexOf("oculus", StringComparison.OrdinalIgnoreCase) >= 0; @@ -364,7 +370,10 @@ namespace VRCX system.IsTrackedDeviceConnected(i) ? "connected" : "disconnected", - (batteryPercentage * 100).ToString() + isCharging + ? "charging" + : "discharging", + (batteryPercentage * 100).ToString(), }; _deviceListLock.EnterWriteLock(); try diff --git a/html/images/controller_status_ready_charging.png b/html/images/controller_status_ready_charging.png new file mode 100644 index 00000000..f7e65ecd Binary files /dev/null and b/html/images/controller_status_ready_charging.png differ diff --git a/html/images/left_controller_status_off.png b/html/images/left_controller_status_off.png new file mode 100644 index 00000000..1233eb68 Binary files /dev/null and b/html/images/left_controller_status_off.png differ diff --git a/html/images/left_controller_status_ready.png b/html/images/left_controller_status_ready.png new file mode 100644 index 00000000..135ccacc Binary files /dev/null and b/html/images/left_controller_status_ready.png differ diff --git a/html/images/left_controller_status_ready_charging.png b/html/images/left_controller_status_ready_charging.png new file mode 100644 index 00000000..404176bc Binary files /dev/null and b/html/images/left_controller_status_ready_charging.png differ diff --git a/html/images/left_controller_status_ready_low.png b/html/images/left_controller_status_ready_low.png new file mode 100644 index 00000000..65f47581 Binary files /dev/null and b/html/images/left_controller_status_ready_low.png differ diff --git a/html/images/other_status_ready_charging.png b/html/images/other_status_ready_charging.png new file mode 100644 index 00000000..c3d7a02b Binary files /dev/null and b/html/images/other_status_ready_charging.png differ diff --git a/html/images/right_controller_status_off.png b/html/images/right_controller_status_off.png new file mode 100644 index 00000000..ee3615bf Binary files /dev/null and b/html/images/right_controller_status_off.png differ diff --git a/html/images/right_controller_status_ready.png b/html/images/right_controller_status_ready.png new file mode 100644 index 00000000..f758615b Binary files /dev/null and b/html/images/right_controller_status_ready.png differ diff --git a/html/images/right_controller_status_ready_charging.png b/html/images/right_controller_status_ready_charging.png new file mode 100644 index 00000000..b206e3c9 Binary files /dev/null and b/html/images/right_controller_status_ready_charging.png differ diff --git a/html/images/right_controller_status_ready_low.png b/html/images/right_controller_status_ready_low.png new file mode 100644 index 00000000..aecce873 Binary files /dev/null and b/html/images/right_controller_status_ready_low.png differ diff --git a/html/images/tracker_status_ready_charging.png b/html/images/tracker_status_ready_charging.png new file mode 100644 index 00000000..eca30c70 Binary files /dev/null and b/html/images/tracker_status_ready_charging.png differ diff --git a/html/src/app.js b/html/src/app.js index 6265a4b0..d61e472a 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -5051,7 +5051,7 @@ speechSynthesis.getVoices(); } return 0; }); - wristFeed.splice(15); + wristFeed.splice(16); AppApi.ExecuteVrFeedFunction( 'wristFeedUpdate', JSON.stringify(wristFeed) diff --git a/html/src/localization/strings/en.json b/html/src/localization/strings/en.json index 6f7de5b2..137f3bf0 100644 --- a/html/src/localization/strings/en.json +++ b/html/src/localization/strings/en.json @@ -1369,11 +1369,7 @@ "timer": "Timer:", "players": "Players:", "cpu": "CPU:", - "online": "Online:", - "devices": { - "left": "L:", - "right": "R:" - } + "online": "Online:" } } } diff --git a/html/src/localization/strings/ko.json b/html/src/localization/strings/ko.json index 8cc48ba7..0b0106e4 100644 --- a/html/src/localization/strings/ko.json +++ b/html/src/localization/strings/ko.json @@ -1369,11 +1369,7 @@ "timer": "시간:", "players": "인원수:", "cpu": "CPU:", - "online": "온라인:", - "devices": { - "left": "왼쪽:", - "right": "오른쪽:" - } + "online": "온라인:" } } } diff --git a/html/src/localization/strings/zh_TW.json b/html/src/localization/strings/zh_TW.json index d5ab5ac9..72e8e4b7 100644 --- a/html/src/localization/strings/zh_TW.json +++ b/html/src/localization/strings/zh_TW.json @@ -1366,11 +1366,7 @@ "timer": "時長:", "players": "玩家人數:", "cpu": "CPU:", - "online": "線上:", - "devices": { - "left": "左:", - "right": "右:" - } + "online": "線上:" } } } diff --git a/html/src/vr.js b/html/src/vr.js index 23cb3d01..7c5b072d 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -324,6 +324,7 @@ Vue.component('marquee-text', MarqueeText); this.hudTimeout = []; this.setDatetimeFormat(); this.setAppLanguage(this.config.appLanguage); + this.updateFeedLength(); }; $app.methods.updateOnlineFriendCount = function (count) { @@ -347,6 +348,7 @@ Vue.component('marquee-text', MarqueeText); circle.style.opacity = 0; } } + this.updateFeedLength(); }; $app.methods.lastLocationUpdate = function (json) { @@ -355,6 +357,27 @@ Vue.component('marquee-text', MarqueeText); $app.methods.wristFeedUpdate = function (json) { this.wristFeed = JSON.parse(json); + this.updateFeedLength(); + }; + + $app.methods.updateFeedLength = function () { + if (this.appType === '2' || this.wristFeed.length === 0) { + return; + } + var length = 16; + if (!this.config.hideDevicesFromFeed) { + length -= 2; + if (this.devices.length > 7) { + length -= 1; + } + } + if (this.nowPlaying.playing) { + length -= 1; + } + if (!this.config.hideFriendsFromFeed && this.nowPlaying.playing) { + length -= 1; + } + this.wristFeed.length = length; }; $app.methods.updateStatsLoop = async function () { @@ -396,7 +419,7 @@ Vue.component('marquee-text', MarqueeText); var deviceList = []; var baseStations = 0; devices.forEach((device) => { - device[2] = parseInt(device[2], 10); + device[3] = parseInt(device[3], 10); if (device[0] === 'base' && device[1] === 'connected') { baseStations++; } else { @@ -428,7 +451,12 @@ Vue.component('marquee-text', MarqueeText); return 0; }); if (baseStations > 0) { - deviceList.push(['base', 'connected', baseStations]); + deviceList.push([ + 'base', + 'connected', + '', + baseStations + ]); } this.devices = deviceList; }); diff --git a/html/src/vr.pug b/html/src/vr.pug index 9ca7aa26..690b0038 100644 --- a/html/src/vr.pug +++ b/html/src/vr.pug @@ -415,34 +415,39 @@ html div(style="display:flex;flex-direction:row;flex-wrap:wrap") div(v-for="device in devices" class="tracker-container") template(v-if="device[0] === 'leftController'") - img(v-if="device[1] !== 'connected'" src="images/controller_status_off.png" class="tracker-device") - img(v-else-if="device[2] < 20" src="images/controller_status_ready_low.png" class="tracker-device") - img(v-else src="images/controller_status_ready.png" class="tracker-device") - span {{ $t('vr.status.devices.left') }}{{ device[2] }}% + img(v-if="device[1] !== 'connected'" src="images/left_controller_status_off.png" class="tracker-device") + img(v-else-if="device[2] === 'charging'" src="images/left_controller_status_ready_charging.png" class="tracker-device") + img(v-else-if="device[3] < 20" src="images/left_controller_status_ready_low.png" class="tracker-device") + img(v-else src="images/left_controller_status_ready.png" class="tracker-device") + span {{ device[3] }}% template(v-else-if="device[0] === 'rightController'") - img(v-if="device[1] !== 'connected'" src="images/controller_status_off.png" class="tracker-device") - img(v-else-if="device[2] < 20" src="images/controller_status_ready_low.png" class="tracker-device") - img(v-else src="images/controller_status_ready.png" class="tracker-device") - span {{ $t('vr.status.devices.right') }}{{ device[2] }}% + img(v-if="device[1] !== 'connected'" src="images/right_controller_status_off.png" class="tracker-device") + img(v-else-if="device[2] === 'charging'" src="images/right_controller_status_ready_charging.png" class="tracker-device") + img(v-else-if="device[3] < 20" src="images/right_controller_status_ready_low.png" class="tracker-device") + img(v-else src="images/right_controller_status_ready.png" class="tracker-device") + span {{ device[3] }}% template(v-else-if="device[0] === 'controller'") img(v-if="device[1] !== 'connected'" src="images/controller_status_off.png" class="tracker-device") - img(v-else-if="device[2] < 20" src="images/controller_status_ready_low.png" class="tracker-device") + img(v-else-if="device[2] === 'charging'" src="images/controller_status_ready_charging.png" class="tracker-device") + img(v-else-if="device[3] < 20" src="images/controller_status_ready_low.png" class="tracker-device") img(v-else src="images/controller_status_ready.png" class="tracker-device") - span {{ device[2] }}% + span {{ device[3] }}% template(v-else-if="device[0] === 'tracker'") img(v-if="device[1] !== 'connected'" src="images/tracker_status_off.png" class="tracker-device") - img(v-else-if="device[2] < 20" src="images/tracker_status_ready_low.png" class="tracker-device") + img(v-else-if="device[2] === 'charging'" src="images/tracker_status_ready_charging.png" class="tracker-device") + img(v-else-if="device[3] < 20" src="images/tracker_status_ready_low.png" class="tracker-device") img(v-else src="images/tracker_status_ready.png" class="tracker-device") - span {{ device[2] }}% + span {{ device[3] }}% template(v-else-if="device[0] === 'base'") img(v-if="device[1] !== 'connected'" src="images/base_status_off.png" class="tracker-device") img(v-else src="images/base_status_ready.png" class="tracker-device") - span(v-if="device[2] !== 100") {{ device[2] }}x + span(v-if="device[3] !== 100") {{ device[3] }}x template(v-else) img(v-if="device[1] !== 'connected'" src="images/other_status_off.png" class="tracker-device") - img(v-else-if="device[2] < 20" src="images/other_status_ready_low.png" class="tracker-device") + img(v-else-if="device[2] === 'charging'" src="images/other_status_ready_charging.png" class="tracker-device") + img(v-else-if="device[3] < 20" src="images/other_status_ready_low.png" class="tracker-device") img(v-else src="images/other_status_ready.png" class="tracker-device") - span {{ device[2] }}% + span {{ device[3] }}% .x-containerbottom template(v-if="nowPlaying.playing") span(style="float:right;padding-left:10px") {{ nowPlaying.remainingText }} diff --git a/html/src/vr.scss b/html/src/vr.scss index b9547c47..4e54378d 100644 --- a/html/src/vr.scss +++ b/html/src/vr.scss @@ -203,7 +203,7 @@ button { .x-container { position: relative; flex: none; - padding: 10px; + padding: 2px 10px 0 10px; overflow: hidden; } @@ -400,7 +400,8 @@ i.x-user-status.busy { .tracker-container { flex: 1 1 auto; text-align: center; - line-height: 16px; + line-height: 18px; + width: 55px; } .tracker-device img {