Skip to content

Commit

Permalink
Merge branch 'UI_speedups' of git://github.com/gnivler/BattletechPerf…
Browse files Browse the repository at this point in the history
…ormanceFix into gnivler-UI_speedups
  • Loading branch information
m22spencer committed Oct 10, 2019
2 parents 7cff694 + f320c27 commit 7a39b96
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
25 changes: 25 additions & 0 deletions source/DisableCombatTurnDelays.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using BattleTech.UI;
using Harmony;

namespace BattletechPerformanceFix
{
public class DisableCombatTurnDelays : Feature
{
public void Activate()
{
var fadeOut = "FadeOutNotificationOverSecondsCoroutine";
var showTeam = "ShowTeamNotification";
fadeOut.Pre<TurnEventNotification>();
showTeam.Pre<TurnEventNotification>();
}

[HarmonyPatch(typeof(TurnEventNotification), "FadeOutNotificationOverSecondsCoroutine")]
public class FadeOutNotificationOverSecondsCoroutine_Pre
{
public static void Prefix(ref float seconds)
{
seconds = 0;
}
}
}
}
41 changes: 41 additions & 0 deletions source/DisableSimAnimations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using BattleTech;
using BattleTech.UI;
using Harmony;

namespace BattletechPerformanceFix
{
class DisableSimAnimations : Feature
{
public void Activate()
{
var init = "Init";
var transitionMech = "TransitionMech";

init.Pre<SimGameCameraController>();
transitionMech.Pre<SGRoomController_MechBay>();
}

// disables scene transition animation
[HarmonyPatch(typeof(SimGameCameraController), "Init")]
public static class Init_Pre
{
public static void Prefix(
ref float ___betweenRoomTransitionTime, ref float ___inRoomTransitionTime)
{
___betweenRoomTransitionTime = ___inRoomTransitionTime = 0f;
}
}

// disables mech transition animation
[HarmonyPatch(typeof(SGRoomController_MechBay), "TransitionMech")]
public static class TransitionMech_Pre
{
// ReSharper disable once RedundantAssignment
public static void Prefix(ref float fadeDuration)
{
UnityGameInstance.BattleTechGame.Simulation.CameraController.mechLabSpin = null;
fadeDuration = 0f;
}
}
}
}

0 comments on commit 7a39b96

Please sign in to comment.