From de0cd12205729bb61cc46d5e1dfc154e36aa0cbd Mon Sep 17 00:00:00 2001 From: SDraw Date: Thu, 25 Aug 2022 11:41:08 +0300 Subject: [PATCH] Game's UI changes --- README.md | 8 ++-- ml_amt/Properties/AssemblyInfo.cs | 6 +-- ml_amt/resources/menu.js | 49 ++++++++++++++++----- ml_fpt/Main.cs | 3 ++ ml_fpt/Properties/AssemblyInfo.cs | 6 +-- ml_fpt/Utils.cs | 13 ------ ml_fpt/ml_fpt.csproj | 5 --- ml_fpt/resources/menu.js | 10 +++-- ml_lme/Properties/AssemblyInfo.cs | 6 +-- ml_lme/resources/menu.js | 71 +++++++++++++++++++++---------- 10 files changed, 110 insertions(+), 67 deletions(-) delete mode 100644 ml_fpt/Utils.cs diff --git a/README.md b/README.md index 3d4046a..dc92b8a 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Merged set of MelonLoader mods for ChilloutVR. | Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Current Status | Notes | |-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------| | Avatar Change Info | ml_aci | 1.0.1 | Yes | Working | -| Avatar Motion Tweaker | ml_amt | 1.0.2 | Pending approval | Working | +| Avatar Motion Tweaker | ml_amt | 1.0.3 | Pending approval | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | -| Four Point Tracking | ml_fpt | 1.0.1 | Yes | Working | -| Leap Motion Extension | ml_lme | 1.1.4 | Pending approval | Working | -| Server Connection Info | ml_sci | 1.0.1 | Pending approval | Working | +| Four Point Tracking | ml_fpt | 1.0.2 | Pending approval | Working | +| Leap Motion Extension | ml_lme | 1.1.5 | Pending approval | Working | +| Server Connection Info | ml_sci | 1.0.1 | Yes | Working | diff --git a/ml_amt/Properties/AssemblyInfo.cs b/ml_amt/Properties/AssemblyInfo.cs index f6efc44..3429308 100644 --- a/ml_amt/Properties/AssemblyInfo.cs +++ b/ml_amt/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("AvatarMotionTweaker")] -[assembly: AssemblyVersion("1.0.2")] -[assembly: AssemblyFileVersion("1.0.2")] +[assembly: AssemblyVersion("1.0.3")] +[assembly: AssemblyFileVersion("1.0.3")] -[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.0.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_amt/resources/menu.js b/ml_amt/resources/menu.js index e1a1eb4..7cfdc7c 100644 --- a/ml_amt/resources/menu.js +++ b/ml_amt/resources/menu.js @@ -21,19 +21,31 @@ function inp_slider_mod_amt(_obj, _callbackName) { this.dragActive = false; this.name = _obj.id; this.type = _obj.getAttribute('data-type'); - this.caption = _obj.getAttribute('data-caption'); + this.stepSize = _obj.getAttribute('data-stepSize') || 0; + this.format = _obj.getAttribute('data-format') || '{value}'; var self = this; + if (this.stepSize != 0) + this.value = Math.round(this.value / this.stepSize) * this.stepSize; + else + this.value = Math.round(this.value); + + this.valueLabelBackground = document.createElement('div'); + this.valueLabelBackground.className = 'valueLabel background'; + this.valueLabelBackground.innerHTML = this.format.replace('{value}', this.value); + this.obj.appendChild(this.valueLabelBackground); + this.valueBar = document.createElement('div'); this.valueBar.className = 'valueBar'; this.valueBar.setAttribute('style', 'width: ' + (((this.value - this.minValue) / (this.maxValue - this.minValue)) * 100) + '%;'); this.obj.appendChild(this.valueBar); - this.valueLabel = document.createElement('div'); - this.valueLabel.className = 'valueLabel'; - this.valueLabel.innerHTML = this.caption + Math.round(this.value); - this.obj.appendChild(this.valueLabel); + this.valueLabelForeground = document.createElement('div'); + this.valueLabelForeground.className = 'valueLabel foreground'; + this.valueLabelForeground.innerHTML = this.format.replace('{value}', this.value); + this.valueLabelForeground.setAttribute('style', 'width: ' + (1.0 / ((this.value - this.minValue) / (this.maxValue - this.minValue)) * 100) + '%;'); + this.valueBar.appendChild(this.valueLabelForeground); this.mouseDown = function (_e) { self.dragActive = true; @@ -49,10 +61,17 @@ function inp_slider_mod_amt(_obj, _callbackName) { var value = self.percent; value *= (self.maxValue - self.minValue); value += self.minValue; - self.value = Math.round(value); + if (self.stepSize != 0) { + value = Math.round(value / self.stepSize); + self.value = value * self.stepSize; + self.percent = (self.value - self.minValue) / (self.maxValue - self.minValue); + } + else + self.value = Math.round(value); self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); - self.valueLabel.innerHTML = self.caption + self.value; + self.valueLabelForeground.setAttribute('style', 'width: ' + (1.0 / self.percent * 100) + '%;'); + self.valueLabelBackground.innerHTML = self.valueLabelForeground.innerHTML = self.format.replace('{value}', self.value); engine.call(self.callbackName, self.name, "" + self.value); self.displayImperial(); @@ -73,10 +92,14 @@ function inp_slider_mod_amt(_obj, _callbackName) { } this.updateValue = function (value) { - self.value = Math.round(value); + if (self.stepSize != 0) + self.value = Math.round(value * self.stepSize) / self.stepSize; + else + self.value = Math.round(value); self.percent = (self.value - self.minValue) / (self.maxValue - self.minValue); self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); - self.valueLabel.innerHTML = self.caption + self.value; + self.valueLabelForeground.setAttribute('style', 'width: ' + (1.0 / self.percent * 100) + '%;'); + self.valueLabelBackground.innerHTML = self.valueLabelForeground.innerHTML = self.format.replace('{value}', self.value); self.displayImperial(); } @@ -104,11 +127,15 @@ function inp_slider_mod_amt(_obj, _callbackName) { { let l_block = document.createElement('div'); l_block.innerHTML = ` -

Avatar Motion Tweaker

+
+
Avatar Motion Tweaker
+
+
+
Legs locomotion upright limit:
-
+
`; diff --git a/ml_fpt/Main.cs b/ml_fpt/Main.cs index cb33c53..4551110 100644 --- a/ml_fpt/Main.cs +++ b/ml_fpt/Main.cs @@ -71,6 +71,9 @@ namespace ml_fpt PlayerSetup.Instance._trackerManager.trackers[m_hipsTrackerIndex].ShowLine(false); CVR_InteractableManager.enableInteractions = true; + if(PlayerSetup.Instance._avatar.GetComponent().avatarUsesAdvancedSettings) + PlayerSetup.Instance.LoadCurrentAvatarSettingsDefault(); + Reset(); ShowHudNotification("Calibration completed"); diff --git a/ml_fpt/Properties/AssemblyInfo.cs b/ml_fpt/Properties/AssemblyInfo.cs index a3576de..b25e69d 100644 --- a/ml_fpt/Properties/AssemblyInfo.cs +++ b/ml_fpt/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("FourPointTracking")] -[assembly: AssemblyVersion("1.0.1")] -[assembly: AssemblyFileVersion("1.0.1")] +[assembly: AssemblyVersion("1.0.2")] +[assembly: AssemblyFileVersion("1.0.2")] -[assembly: MelonLoader.MelonInfo(typeof(ml_fpt.FourPointTracking), "FourPointTracking", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_fpt.FourPointTracking), "FourPointTracking", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_fpt/Utils.cs b/ml_fpt/Utils.cs deleted file mode 100644 index dac0a0b..0000000 --- a/ml_fpt/Utils.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine; - -namespace ml_fpt -{ - static class Utils - { - // Extensions - public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false) - { - return Matrix4x4.TRS(p_pos ? p_transform.position : Vector3.zero, p_rot ? p_transform.rotation : Quaternion.identity, p_scl ? p_transform.localScale : Vector3.one); - } - } -} diff --git a/ml_fpt/ml_fpt.csproj b/ml_fpt/ml_fpt.csproj index 7803988..77ebda4 100644 --- a/ml_fpt/ml_fpt.csproj +++ b/ml_fpt/ml_fpt.csproj @@ -72,11 +72,6 @@ False - - False - C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll - False - diff --git a/ml_fpt/resources/menu.js b/ml_fpt/resources/menu.js index 65cef40..ee02114 100644 --- a/ml_fpt/resources/menu.js +++ b/ml_fpt/resources/menu.js @@ -1,8 +1,12 @@ { - var l_block = document.createElement('div'); + let l_block = document.createElement('div'); l_block.innerHTML = ` -

4-Point Tracking

-
Calibrate
+
+
4-Point Tracking
+
+
+ +
Calibrate
`; document.getElementById('settings-implementation').appendChild(l_block); } \ No newline at end of file diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index 5e2034e..3590c40 100644 --- a/ml_lme/Properties/AssemblyInfo.cs +++ b/ml_lme/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("LeapMotionExtension")] -[assembly: AssemblyVersion("1.1.4")] -[assembly: AssemblyFileVersion("1.1.4")] +[assembly: AssemblyVersion("1.1.5")] +[assembly: AssemblyFileVersion("1.1.5")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_lme/resources/menu.js b/ml_lme/resources/menu.js index f1c41cb..210277c 100644 --- a/ml_lme/resources/menu.js +++ b/ml_lme/resources/menu.js @@ -68,19 +68,31 @@ function inp_slider_mod_lme(_obj, _callbackName) { this.dragActive = false; this.name = _obj.id; this.type = _obj.getAttribute('data-type'); - this.caption = _obj.getAttribute('data-caption'); + this.stepSize = _obj.getAttribute('data-stepSize') || 0; + this.format = _obj.getAttribute('data-format') || '{value}'; var self = this; + if (this.stepSize != 0) + this.value = Math.round(this.value / this.stepSize) * this.stepSize; + else + this.value = Math.round(this.value); + + this.valueLabelBackground = document.createElement('div'); + this.valueLabelBackground.className = 'valueLabel background'; + this.valueLabelBackground.innerHTML = this.format.replace('{value}', this.value); + this.obj.appendChild(this.valueLabelBackground); + this.valueBar = document.createElement('div'); this.valueBar.className = 'valueBar'; this.valueBar.setAttribute('style', 'width: ' + (((this.value - this.minValue) / (this.maxValue - this.minValue)) * 100) + '%;'); this.obj.appendChild(this.valueBar); - this.valueLabel = document.createElement('div'); - this.valueLabel.className = 'valueLabel'; - this.valueLabel.innerHTML = this.caption + Math.round(this.value); - this.obj.appendChild(this.valueLabel); + this.valueLabelForeground = document.createElement('div'); + this.valueLabelForeground.className = 'valueLabel foreground'; + this.valueLabelForeground.innerHTML = this.format.replace('{value}', this.value); + this.valueLabelForeground.setAttribute('style', 'width: ' + (1.0 / ((this.value - this.minValue) / (this.maxValue - this.minValue)) * 100) + '%;'); + this.valueBar.appendChild(this.valueLabelForeground); this.mouseDown = function (_e) { self.dragActive = true; @@ -96,10 +108,17 @@ function inp_slider_mod_lme(_obj, _callbackName) { var value = self.percent; value *= (self.maxValue - self.minValue); value += self.minValue; - self.value = Math.round(value); + if (self.stepSize != 0) { + value = Math.round(value / self.stepSize); + self.value = value * self.stepSize; + self.percent = (self.value - self.minValue) / (self.maxValue - self.minValue); + } + else + self.value = Math.round(value); self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); - self.valueLabel.innerHTML = self.caption + self.value; + self.valueLabelForeground.setAttribute('style', 'width: ' + (1.0 / self.percent * 100) + '%;'); + self.valueLabelBackground.innerHTML = self.valueLabelForeground.innerHTML = self.format.replace('{value}', self.value); engine.call(self.callbackName, self.name, "" + self.value); self.displayImperial(); @@ -120,10 +139,14 @@ function inp_slider_mod_lme(_obj, _callbackName) { } this.updateValue = function (value) { - self.value = Math.round(value); + if (self.stepSize != 0) + self.value = Math.round(value * self.stepSize) / self.stepSize; + else + self.value = Math.round(value); self.percent = (self.value - self.minValue) / (self.maxValue - self.minValue); self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); - self.valueLabel.innerHTML = self.caption + self.value; + self.valueLabelForeground.setAttribute('style', 'width: ' + (1.0 / self.percent * 100) + '%;'); + self.valueLabelBackground.innerHTML = self.valueLabelForeground.innerHTML = self.format.replace('{value}', self.value); self.displayImperial(); } @@ -252,88 +275,92 @@ function inp_dropdown_mod_lme(_obj, _callbackName) { { let l_block = document.createElement('div'); l_block.innerHTML = ` -

Leap Motion tracking

+
+
Leap Motion tracking
+
+
+
Enable tracking:
-
+
Tracking mode:
-
+
Desktop offset X:
-
+
Desktop offset Y:
-
+
Desktop offset Z:
-
+
Attach to head:
- +
Head offset X:
-
+
Head offset Y:
-
+
Head offset Z:
-
+
Offset angle:
-
+
Fingers tracking only:
-
+
Model visibility:
-
+
`;