Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Commit 335344e

Browse files
committed
v1.1.1
1 parent 4890d99 commit 335344e

3 files changed

Lines changed: 29 additions & 30 deletions

File tree

Main.cs

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static class ModBuildInfo {
1616
public const string Name = "DesktopCamera";
1717
public const string Author = "nitro.";
1818
public const string Company = null;
19-
public const string Version = "1.1.0";
19+
public const string Version = "1.1.1";
2020
public const string DownloadLink = "https://github.com/nitrog0d/DesktopCamera/releases/latest/download/DesktopCamera.dll";
2121
public const string GameDeveloper = "VRChat";
2222
public const string Game = "VRChat";
@@ -34,23 +34,22 @@ public class Main : MelonMod {
3434
private static float CameraSpeed = 0.005f;
3535
private static float CameraSpeedAlt = 0.020f;
3636

37-
public override void OnApplicationStart()
38-
{
39-
MelonModLogger.Log("Mod loaded.");
40-
ModPrefs.RegisterCategory(ModCategory, "Desktop Camera");
41-
ModPrefs.RegisterPrefInt(ModCategory, CameraSpeedPref, 5, "Basic camera speed");
42-
ModPrefs.RegisterPrefInt(ModCategory, CameraSpeedAltPref, 20, "Alt camera speed (ALT pressed)");
37+
public override void OnApplicationStart() {
38+
MelonLogger.Log("Mod loaded.");
39+
MelonPrefs.RegisterCategory(ModCategory, "DesktopCamera");
40+
MelonPrefs.RegisterInt(ModCategory, CameraSpeedPref, 5, "Basic camera speed");
41+
MelonPrefs.RegisterInt(ModCategory, CameraSpeedAltPref, 20, "Alt camera speed (ALT pressed)");
4342
OnModSettingsApplied();
4443
}
45-
4644

47-
public override void OnModSettingsApplied()
48-
{
49-
CameraSpeed = ModPrefs.GetInt(ModCategory, CameraSpeedPref);
50-
CameraSpeedAlt = ModPrefs.GetInt(ModCategory, CameraSpeedAltPref);
45+
46+
public override void OnModSettingsApplied() {
47+
CameraSpeed = MelonPrefs.GetInt(ModCategory, CameraSpeedPref);
48+
CameraSpeedAlt = MelonPrefs.GetInt(ModCategory, CameraSpeedAltPref);
5149

5250
CameraSpeed /= 1000;
5351
CameraSpeedAlt /= 1000;
52+
}
5453

5554
public override void VRChat_OnUiManagerInit() {
5655
MelonCoroutines.Start(Setup());
@@ -108,7 +107,7 @@ private IEnumerator Setup() {
108107
var qmBoxCollider = quickMenu.GetComponent<BoxCollider>();
109108

110109
// Thank you Janni9009#1751 <3
111-
if (qmBoxCollider.size.y < 3769) qmBoxCollider.size += new Vector3(0f, 840f, 0f);
110+
if (qmBoxCollider.size.y < 3768) qmBoxCollider.size += new Vector3(0f, 840f, 0f);
112111
quickMenu.transform.Find("QuickMenu_NewElements/_CONTEXT/QM_Context_ToolTip/_ToolTipPanel/Text").GetComponent<Text>().supportRichText = true;
113112

114113
var photoModeButton = cameraMenu.Find("PhotoMode");
@@ -359,16 +358,15 @@ public override void OnUpdate() {
359358
: CameraSpeed;
360359
if (Input.GetKey(KeyCode.DownArrow)) {
361360
if (Settings.moveCamera) {
362-
if (Settings.allowCameraMovement)
363-
{
361+
if (Settings.allowCameraMovement) {
364362
if (Settings.rotateAroundUserCamera)
365363
CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position,
366364
VRCUtils.GetMainCamera().transform.up,
367365
(Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
368366
else
369367
CameraUtils.worldCameraVector -= new Vector3(
370-
(float) Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
371-
(float) Math.Cos(cameraRotation.y) * actualCameraSpeed);
368+
(float)Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
369+
(float)Math.Cos(cameraRotation.y) * actualCameraSpeed);
372370
}
373371
} else {
374372
VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f);
@@ -379,8 +377,8 @@ public override void OnUpdate() {
379377
if (Settings.allowCameraMovement) {
380378
if (Settings.rotateAroundUserCamera) CameraUtils.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
381379
else CameraUtils.worldCameraVector += new Vector3(
382-
(float) Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
383-
(float) Math.Cos(cameraRotation.y) * actualCameraSpeed);
380+
(float)Math.Sin(cameraRotation.y) * actualCameraSpeed, 0f,
381+
(float)Math.Cos(cameraRotation.y) * actualCameraSpeed);
384382
}
385383
} else {
386384
VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3(0f, 0f, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f);
@@ -411,8 +409,8 @@ public override void OnUpdate() {
411409
if (Input.GetKey(KeyCode.LeftArrow)) {
412410
if (Settings.moveCamera) {
413411
if (Settings.allowCameraMovement) CameraUtils.worldCameraVector -= new Vector3(
414-
(float) Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
415-
(float) -Math.Sin(cameraRotation.y) * actualCameraSpeed);
412+
(float)Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
413+
(float)-Math.Sin(cameraRotation.y) * actualCameraSpeed);
416414
} else {
417415
if (Settings.rotateAroundUserCamera) VRCUtils.GetUserCameraController().viewFinder.transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -2f : -1f);
418416
else VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? -0.01f : -0.005f, 0f, 0f);
@@ -421,8 +419,8 @@ public override void OnUpdate() {
421419
if (Input.GetKey(KeyCode.RightArrow)) {
422420
if (Settings.moveCamera) {
423421
if (Settings.allowCameraMovement) CameraUtils.worldCameraVector += new Vector3(
424-
(float) Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
425-
(float) -Math.Sin(cameraRotation.y) * actualCameraSpeed);
422+
(float)Math.Cos(cameraRotation.y) * actualCameraSpeed, 0f,
423+
(float)-Math.Sin(cameraRotation.y) * actualCameraSpeed);
426424
} else {
427425
if (Settings.rotateAroundUserCamera) VRCUtils.GetUserCameraController().viewFinder.transform.RotateAround(VRCUtils.GetMainCamera().transform.position, VRCUtils.GetMainCamera().transform.up, (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 2f : 1f);
428426
else VRCUtils.GetUserCameraController().viewFinder.transform.localPosition += new Vector3((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) ? 0.01f : 0.005f, 0f, 0f);
@@ -502,6 +500,6 @@ public override void OnUpdate() {
502500
}
503501
}
504502
}
505-
}
506-
}
503+
}
504+
}
507505
}

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ A mod that allows Desktop users use the VRChat Camera feature, yay!
66
* **USE IT AT YOUR OWN RISK**, I am not responsible for any bans or any punishments you may get by using this mod!
77

88
## Installation
9-
* **Make sure you have run the [MelonLoader Installer](https://github.com/HerpDerpinstine/MelonLoader/releases/latest/download/MelonLoader.Installer.exe) by [HerpDerpinstine](https://github.com/HerpDerpinstine) first (please check [MelonLoader Wiki](https://melonwiki.xyz) for more help!).**
9+
* **Make sure you have run the [MelonLoader Installer](https://github.com/HerpDerpinstine/MelonLoader/releases/latest/download/MelonLoader.Installer.exe) by [HerpDerpinstine](https://github.com/HerpDerpinstine) first (feel free to join the [VRChat Modding Group Discord](https://discord.gg/jgvc9Fd) for help!).**
1010
* Download the [latest version](https://github.com/nitrog0d/DesktopCamera/releases/latest/download/DesktopCamera.dll) of the mod.
1111
* Drag/copy the DLL file that you have downloaded into the Mods folder.
1212
* That's it! Now just run the game and the mod should be installed!
13+
* Optional: You can install the mod `UIExpansionKit` to edit Camera Movement speed in-game. Manually changing without `UIExpansionKit` is possible through `UserData/modprefs.ini`.
1314

1415
## How to use
1516
* Click the Camera button in the ESC menu, you will have new options.
1617
* The explanation below can be confusing, I recommend you to just try it in-game after reading. If you can improve it, please send a pull request.
1718

1819
### **Arrow Keys feature explanation:**
19-
* You can move the camera/viewer position using the arrow keys **(TIP: if you hold alt it moves 2x faster)**.
20-
* You can change the camera's proximity using Page Up (moves away) and Page Down (moves close) buttons.
20+
* You can move the camera/viewer position using the arrow keys **(TIP: if you hold alt it moves 2x faster (configurable))**.
21+
* You can also move the camera/viewer up and down using Page Up and Page Down buttons.
2122

2223
#### If you have a numpad:
2324
* You can rotate it pressing 2 and 8 (tilt up and down), 4 and 6 (tilt left and right), 7 and 9 (orientation).
@@ -30,7 +31,7 @@ A mod that allows Desktop users use the VRChat Camera feature, yay!
3031

3132
### **Camera Movement feature explanation:**
3233
* Remember the arrow keys feature above? So, this is a toggle, you can toggle between the actual Camera and the Viewer, if you have it on the Camera, the arrow/numpad keys will move the Camera, if you have it on the Viewer, then the Viewer will move instead.
33-
* The Viewer is the Camera view, if it's not obvious.
34+
* Observation: The Viewer is the Camera view.
3435
* **Warning: The Camera Space must be in "World" mode, or else the camera won't move**.
3536

3637
*Thanks to everyone in the VRChat Modding community!*

Utils/VRCUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static VRCUiManager GetVRCUiManager() {
6464
}
6565

6666
public static void QueueHudMessage(string message) {
67-
GetVRCUiManager().Method_Public_Void_String_0(message);
67+
GetVRCUiManager().Method_Public_Void_String_PDM_0(message);
6868
}
6969
}
7070
}

0 commit comments

Comments
 (0)