mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 06:35:45 +00:00
Merge pull request #169 from Raicuparta/alek/fast-forward-clock
showing clock when fast forwarding
This commit is contained in:
commit
d159733fb4
@ -1,7 +1,6 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.Events;
|
||||
using QSB.GeyserSync;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
@ -180,7 +180,7 @@
|
||||
<Compile Include="TransformSync\PlayerHUDMarker.cs" />
|
||||
<Compile Include="Tools\PlayerToolsManager.cs" />
|
||||
<Compile Include="Utility\Patches.cs" />
|
||||
<Compile Include="Utility\QSBExtensions.cs" />
|
||||
<Compile Include="Tools\ToolExtensions.cs" />
|
||||
<Compile Include="Utility\QuaternionHelper.cs" />
|
||||
<Compile Include="TimeSync\PreserveTimeScale.cs" />
|
||||
<Compile Include="TransformSync\ShipTransformSync.cs" />
|
||||
|
@ -1,8 +1,4 @@
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OWML.ModHelper.Events;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
{
|
||||
@ -10,14 +6,14 @@ namespace QSB.TimeSync
|
||||
{
|
||||
public static void AddPatches()
|
||||
{
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(WakeUpPatches.OnStartOfTimeLoopPrefix));
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(OnStartOfTimeLoopPrefix));
|
||||
}
|
||||
|
||||
public static bool OnStartOfTimeLoopPrefix(ref PlayerCameraEffectController __instance)
|
||||
{
|
||||
if (__instance.gameObject.CompareTag("MainCamera") && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
||||
{
|
||||
__instance.Call("WakeUp");
|
||||
__instance.Invoke("WakeUp");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Events;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
@ -133,7 +133,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
_timeScale = MaxFastForwardSpeed;
|
||||
_state = State.FastForwarding;
|
||||
SpinnerUI.Show();
|
||||
FindObjectOfType<SleepTimerUI>().Invoke("OnStartFastForward");
|
||||
}
|
||||
|
||||
private void StartPausing()
|
||||
@ -159,6 +159,7 @@ namespace QSB.TimeSync
|
||||
_isFirstFastForward = false;
|
||||
Physics.SyncTransforms();
|
||||
SpinnerUI.Hide();
|
||||
FindObjectOfType<SleepTimerUI>().Invoke("OnEndFastForward");
|
||||
GlobalMessenger.FireEvent(EventNames.QSBPlayerStatesRequest);
|
||||
}
|
||||
|
||||
@ -217,8 +218,9 @@ namespace QSB.TimeSync
|
||||
|
||||
if (LoadManager.GetCurrentScene() == OWScene.SolarSystem && _isFirstFastForward)
|
||||
{
|
||||
Locator.GetPlayerTransform().position = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform.position;
|
||||
Locator.GetPlayerTransform().rotation = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform.rotation;
|
||||
var spawnPoint = Locator.GetPlayerBody().GetComponent<PlayerSpawner>().GetInitialSpawnPoint().transform;
|
||||
Locator.GetPlayerTransform().position = spawnPoint.position;
|
||||
Locator.GetPlayerTransform().rotation = spawnPoint.rotation;
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
}
|
||||
|
17
QSB/Tools/ToolExtensions.cs
Normal file
17
QSB/Tools/ToolExtensions.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public static class ToolExtensions
|
||||
{
|
||||
public static void ChangeEquipState(this PlayerTool tool, bool equipState)
|
||||
{
|
||||
if (equipState)
|
||||
{
|
||||
tool.EquipTool();
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.UnequipTool();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Utility
|
||||
{
|
||||
public static class QSBExtensions
|
||||
{
|
||||
public static void ChangeEquipState(this PlayerTool tool, bool equipState)
|
||||
{
|
||||
if (equipState)
|
||||
{
|
||||
tool.EquipTool();
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.UnequipTool();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetHierarchy(this GameObject go)
|
||||
{
|
||||
var name = go.name;
|
||||
while (go.transform.parent != null)
|
||||
{
|
||||
go = go.transform.parent.gameObject;
|
||||
name = go.name + "/" + name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public static object Call(this object obj, string methodName, params object[] args)
|
||||
{
|
||||
var method = obj.GetType().GetMethod(methodName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
return method.Invoke(obj, args);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user