Skip to content

Commit a29a92c

Browse files
committed
Fix more V73 stuff, and spectator stuff
1 parent 0945e5d commit a29a92c

File tree

5 files changed

+71
-6
lines changed

5 files changed

+71
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
**Fixes**:
77
- Fixed voting only being available once before having to restart the game
8+
- Fixed late join players not showing up in the spectating menu
89
- Unity's Input System crashing when trying to resolve missing soft dependencies
910

1011
# 1.4.0

LCVR.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<PackageReference Include="Unity.Animation.Rigging" Version="1.2.1" />
4444
<PackageReference Include="Unity.InputSystem" Version="1.14.0" />
4545
<PackageReference Include="Unity.Netcode.Runtime" Version="1.6.0" />
46-
<PackageReference Include="Unity.RenderPipelines.Core" Version="14.0.8" />
47-
<PackageReference Include="Unity.RenderPipelines.HighDefinition" Version="14.0.8" />
46+
<PackageReference Include="Unity.RenderPipelines.Core" Version="14.0.12" />
47+
<PackageReference Include="Unity.RenderPipelines.HighDefinition" Version="14.0.12" />
4848
<PackageReference Include="Unity.TextMeshPro" Version="3.0.6" />
4949
<PackageReference Include="Unity.XR.CoreUtils" Version="2.2.3" />
5050
<PackageReference Include="Unity.XR.Interaction.Toolkit" Version="2.5.3" />

Source/Managers/SpectatingManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ internal void PlayerRevive()
174174
ToggleLights(false);
175175
StopSpectatingPlayer();
176176

177-
VRSession.Instance.HUD.SpectatingMenu.enabled = false;
177+
VRSession.Instance.HUD.SpectatingMenu.PlayerRevived();
178178
}
179179

180180
internal void CastVote() => TimeOfDay.Instance.VoteShipToLeaveEarly();
@@ -199,8 +199,8 @@ internal void SpectatePlayer(PlayerControllerB targetPlayer)
199199

200200
HUDManager.Instance.SetSpectatingTextToPlayer(SpectatedPlayer);
201201

202-
if (Compat.IsLoaded(Compat.MoreCompany))
203-
MoreCompanyCompatibility.EnablePlayerCosmetics(SpectatedPlayer, false);
202+
// if (Compat.IsLoaded(Compat.MoreCompany))
203+
// MoreCompanyCompatibility.EnablePlayerCosmetics(SpectatedPlayer, false);
204204
}
205205

206206
// ReSharper disable Unity.PerformanceAnalysis
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using HarmonyLib;
6+
using UnityEngine.Rendering;
7+
8+
namespace LCVR.Patches;
9+
10+
[LCVRPatch(LCVRPatchTarget.Universal)]
11+
[HarmonyPatch]
12+
internal static class AssemblyTypePatches
13+
{
14+
[HarmonyPatch(typeof(CoreUtils), nameof(CoreUtils.GetAllAssemblyTypes))]
15+
[HarmonyPrefix]
16+
private static bool ReplaceGetAllAssemblyTypes(ref IEnumerable<Type> __result)
17+
{
18+
__result = GetAllAssemblyTypes();
19+
return false;
20+
}
21+
22+
private static IEnumerable<Type> GetAllAssemblyTypes()
23+
{
24+
CoreUtils.m_AssemblyTypes ??= AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly a)
25+
{
26+
try
27+
{
28+
return a.GetTypes();
29+
}
30+
catch (ReflectionTypeLoadException ex)
31+
{
32+
return ex.Types.Where(t => t != null);
33+
}
34+
});
35+
36+
return CoreUtils.m_AssemblyTypes;
37+
}
38+
}

Source/UI/Spectating/SpectatingMenu.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,37 @@ public void UpdateBoxes()
152152
Destroy(go);
153153
}
154154

155+
// Check for players that joined (late join)
156+
foreach (var player in StartOfRound.Instance.allPlayerScripts)
157+
{
158+
var playerExists = player.isPlayerDead || player.isPlayerControlled;
159+
var idx = playerBoxes.FindIndex(box => box.IsPlayer(player));
160+
161+
if (!playerExists || idx != -1)
162+
continue;
163+
164+
var box = Instantiate(spectatingPlayerPrefab, playersContainer).GetComponent<SpectatingPlayer>();
165+
box.Setup(player);
166+
167+
playerBoxes.Add(box);
168+
}
169+
155170
// Update all boxes
156171
foreach (var box in playerBoxes)
157172
box.UpdateState();
158173
}
159174

175+
public void PlayerRevived()
176+
{
177+
voteProgress = 0;
178+
voteProgressBar.localScale = new Vector3(0, 1, 1);
179+
180+
voteButton.GetComponentInChildren<TextMeshProUGUI>().text = "VOTE TO LEAVE";
181+
voteButton.interactable = true;
182+
183+
enabled = false;
184+
}
185+
160186
private void HandleGaze()
161187
{
162188
if (UnityEngine.Physics.Raycast(new Ray(raySource.position - raySource.forward * 0.5f, raySource.forward),
@@ -183,7 +209,7 @@ private void HandleVoting()
183209
if (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.currentLevel.planetHasTime)
184210
return;
185211

186-
voteProgress += Time.deltaTime * (isVoting ? 0.2f : -0.4f);
212+
voteProgress += Time.deltaTime * (isVoting ? 0.3f : -0.5f);
187213
voteProgress = Mathf.Clamp01(voteProgress);
188214

189215
voteProgressBar.localScale = new Vector3(Mathf.SmoothStep(0, 1, voteProgress), 1, 1);

0 commit comments

Comments
 (0)