Fix flashback sequence after update (#523)

* Fix flashback sequence, some childs aren't available where we previously reparented them

* Update project version, force Legacy VR installation

* Bump version for release
This commit is contained in:
artum 2022-09-16 20:23:22 +02:00 committed by GitHub
parent f671ff6232
commit a8b49cc6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 18 deletions

View File

@ -1,4 +1,5 @@
using NomaiVR.Helpers;
using System.Collections.Generic;
using UnityEngine;
namespace NomaiVR.EffectFixes
@ -11,6 +12,7 @@ namespace NomaiVR.EffectFixes
public class Patch : NomaiVRPatch
{
private static Transform focus;
private static List<Transform> toReparent;
public override void ApplyPatches()
{
@ -26,10 +28,14 @@ namespace NomaiVR.EffectFixes
Postfix<Flashback>(nameof(Flashback.Start), nameof(PostFlashbackRecorderAwake));
}
private static void PostFlashbackRecorderAwake(Transform ____screenTransform, ref Vector3 ____origScreenScale)
private static void PostFlashbackRecorderAwake(Flashback __instance, Transform ____screenTransform, ref Vector3 ____origScreenScale)
{
var scale = ____screenTransform.localScale;
____origScreenScale = ____screenTransform.localScale = new Vector3(scale.x * 0.75f, scale.y * 1.5f, scale.z);
toReparent = new List<Transform>(__instance.transform.childCount);
foreach (Transform child in __instance.transform)
toReparent.Add(child);
}
private static void PostUpdateMemoryLink()
@ -70,6 +76,8 @@ namespace NomaiVR.EffectFixes
screen.SetParent(focus, false);
screen.localRotation = Quaternion.identity;
screen.localScale = scale;
toReparent = null;
}
private static void PatchTriggerFlashback(Flashback __instance, Transform ____maskTransform, Transform ____screenTransform)
@ -82,6 +90,12 @@ namespace NomaiVR.EffectFixes
parent = new GameObject("VrFlashbackWrapper").transform;
parent.position = __instance.transform.position;
parent.rotation = __instance.transform.rotation;
foreach (Transform child in toReparent)
{
child.parent = parent;
}
foreach (Transform child in __instance.transform)
{
child.parent = parent;
@ -97,6 +111,7 @@ namespace NomaiVR.EffectFixes
parent.rotation = __instance.transform.rotation;
____maskTransform.parent = parent;
toReparent = null;
}
private static void FlashbackUpdate(Flashback __instance, Transform ____maskTransform)

View File

@ -8,7 +8,7 @@
"title": "Before playing NomaiVR, some information:",
"body": "- Click the NomaiVR readme button in the Mod Manager for information about troubleshooting, requirements, performance, how to uninstall, etc.\n\n- Some VR controllers will have missing icons. Message us if you want to help us add icons for these devices.\n\n- If you have the game on Steam:\n--- Right-click Outer Wilds on your Steam library\n--- Select 'Properties...'\n--- Disable 'Use Desktop Game Theatre.'"
},
"version": "2.8.0",
"version": "2.8.2",
"owmlVersion": "2.3.0",
"requireVR": true
}

View File

@ -95,20 +95,7 @@ namespace Valve.VR
private static void ShowDialog()
{
int shouldInstall = UnityEditor.EditorUtility.DisplayDialogComplex("SteamVR", "The SteamVR Unity Plugin can be used with the legacy Unity VR API (Unity 5.4 - 2019) or with the Unity XR API (2019+). Would you like to install in legacy VR mode or for Unity XR?", "Legacy VR", "Cancel", "Unity XR");
switch (shouldInstall)
{
case 0: //legacy vr
SteamVR_AutoEnableVR_UnityPackage.InstallAndEnableUnityVR();
break;
case 1: //cancel
break;
case 2: //unity xr
SteamVR_AutoEnableVR_UnityXR.InstallAndEnableUnityXR();
break;
}
SteamVR_AutoEnableVR_UnityPackage.InstallAndEnableUnityVR();
End();
}

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2019.4.27f1
m_EditorVersionWithRevision: 2019.4.27f1 (23dc10685eb4)
m_EditorVersion: 2019.4.39f1
m_EditorVersionWithRevision: 2019.4.39f1 (78d14dfa024b)