Class LoadProgressReporter
- Namespace
- MonkeyLoader.Resonite
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Contains methods to update Resonite's loading progress indicator with custom phases.
[HarmonyPatch]
[HarmonyPatchCategory("LoadProgressReporter")]
public sealed class LoadProgressReporter : Monkey<LoadProgressReporter>, IMonkey, IRun, IShutdown, IComparable<IMonkey>, INestedIdentifiable<Mod>, INestedIdentifiable, IIdentifiable, IAuthorable, IDisplayable
- Inheritance
-
LoadProgressReporter
- Implements
- Inherited Members
- Extension Methods
Properties
Available
Gets whether the progress indicator is available, determining the availability of the methods and properties of this class.
[MemberNotNullWhen(true, new string[] { "LoadProgressIndicator", "FixedPhaseIndex", "CanProgressToReady" })]
public static bool Available { get; }
Property Value
FixedPhaseIndex
Gets the index of the current fixed phase, if the progress indicator is available.
public static int? FixedPhaseIndex { get; }
Property Value
- int?
IsActive
Gets whether the load progress reporter will be active for the current launch.
public static bool IsActive { get; }
Property Value
Remarks
This isolates it against changes of the HijackLoadProgressIndicator setting during the launch.
IsRendererInitProgressWrapperAvailable
Gets whether the renderer's progressbar style init progress is available.
If not, there is no "done" maximum progress to set.
[MemberNotNullWhen(true, new string[] { "OriginalTotalFixedPhaseCount", "TotalFixedPhaseCount" })]
public static bool IsRendererInitProgressWrapperAvailable { get; }
Property Value
OriginalTotalFixedPhaseCount
Gets the original total fixed phase count of the FrooxEngine.RendererInitProgressWrapper, if it is available.
public static int? OriginalTotalFixedPhaseCount { get; set; }
Property Value
- int?
TotalFixedPhaseCount
Gets the number of fixed phases, if the FrooxEngine.RendererInitProgressWrapper is available.
public static int? TotalFixedPhaseCount { get; }
Property Value
- int?
Methods
AddFixedPhase()
Increments the TotalFixedPhaseCount to make space for an additional phase, if the progress indicator is available..
public static bool AddFixedPhase()
Returns
- bool
trueif the count was incremented successfully, otherwisefalse.
Remarks
Should be used as early as possible, to make sure the progress bar doesn't go backwards.
AddFixedPhases(int)
Increments the TotalFixedPhaseCount by count
to make space for additional phases, if the count has a value.
public static bool AddFixedPhases(int count)
Parameters
countint
Returns
- bool
trueif the count was incremented successfully, otherwisefalse.
Remarks
Should be used as early as possible, to make sure the progress bar doesn't go backwards.
AdvanceFixedPhase(string)
Increments the FixedPhaseIndex and sets the fixed phase to advance the progress bar, if the progress indicator is available.
public static bool AdvanceFixedPhase(string phase)
Parameters
phasestringThe name of the phase to advance to.
Returns
- bool
trueif the phase was advanced successfully, otherwisefalse.
ExitSubphase()
Unsets the subphase, if the progress indicator is available.
[Obsolete("Do not exit subphases, just set the next one.")]
public static bool ExitSubphase()
Returns
- bool
trueif the subphase was changed successfully, otherwisefalse.
OnLoaded()
Called right after the game tooling packs and all the game's assemblies have been loaded.
Use this to apply any patching and return true if it was successful.
protected override bool OnLoaded()
Returns
- bool
trueif it ran successfully; otherwise,false.
Remarks
By default: Applies the Harmony patches of the
category with this patcher's type's name.
Easy to apply by using [HarmonyPatchCategory(nameof(MyPatcher))] attribute.
RunForPrettySplashAsync(int, Action, CancellationToken)
Runs the given action
and waits for at least the specified time before completing,
if the progress indicator is available and
pretty splash progress is enabled.
public static Task RunForPrettySplashAsync(int milliseconds, Action action, CancellationToken cancellationToken = default)
Parameters
millisecondsintHow long to wait under the right conditions, in milliseconds.
actionActionThe action to run.
cancellationTokenCancellationTokenThe cancellation token that will be checked prior to completing the returned task.
Returns
- Task
A task that represents the completion of the
actionand optionalmilliseconds-long wait.
RunForPrettySplashAsync(int, Func<Task>, CancellationToken)
Runs the given taskFunc
and waits for at least the specified time before completing,
if the progress indicator is available and
pretty splash progress is enabled.
public static Task RunForPrettySplashAsync(int milliseconds, Func<Task> taskFunc, CancellationToken cancellationToken = default)
Parameters
millisecondsintHow long to wait under the right conditions, in milliseconds.
taskFuncFunc<Task>cancellationTokenCancellationTokenThe cancellation token that will be checked prior to completing the returned task.
Returns
- Task
A task that represents the completion of the
taskFuncand optionalmilliseconds-long wait.
RunForPrettySplashAsync(int, Task, CancellationToken)
Waits for the given task to complete,
but at least for the specified time before itself completing,
if the progress indicator is available and
pretty splash progress is enabled.
public static Task RunForPrettySplashAsync(int milliseconds, Task task, CancellationToken cancellationToken = default)
Parameters
millisecondsintHow long to wait under the right conditions, in milliseconds.
taskTaskThe to wait for the completion of.
cancellationTokenCancellationTokenThe cancellation token that will be checked prior to completing the returned task.
Returns
- Task
A task that represents the completion of the
taskand optionalmilliseconds-long wait.
RunForPrettySplashAsync<T>(int, Func<Task<T>>, CancellationToken)
Runs the given taskFunc
and waits for at least the specified time before completing,
if the progress indicator is available and
pretty splash progress is enabled.
public static Task<T> RunForPrettySplashAsync<T>(int milliseconds, Func<Task<T>> taskFunc, CancellationToken cancellationToken = default)
Parameters
millisecondsintHow long to wait under the right conditions, in milliseconds.
taskFuncFunc<Task<T>>cancellationTokenCancellationTokenThe cancellation token that will be checked prior to completing the returned task.
Returns
- Task<T>
A task that represents the completion of the
taskFuncand optionalmilliseconds-long wait.
Type Parameters
T
RunForPrettySplashAsync<T>(int, Func<T>, CancellationToken)
Runs the given func
and waits for at least the specified time before completing,
if the progress indicator is available and
pretty splash progress is enabled.
public static Task<T> RunForPrettySplashAsync<T>(int milliseconds, Func<T> func, CancellationToken cancellationToken = default)
Parameters
millisecondsintHow long to wait under the right conditions, in milliseconds.
funcFunc<T>The function to run.
cancellationTokenCancellationTokenThe cancellation token that will be checked prior to completing the returned task.
Returns
- Task<T>
A task that represents the completion of the
funcand optionalmilliseconds-long wait.
Type Parameters
T
RunForPrettySplashAsync<T>(int, Task<T>, CancellationToken)
Waits for the given task to complete,
but at least for the specified time before itself completing,
if the progress indicator is available and
pretty splash progress is enabled.
public static Task<T> RunForPrettySplashAsync<T>(int milliseconds, Task<T> task, CancellationToken cancellationToken = default)
Parameters
millisecondsintHow long to wait under the right conditions, in milliseconds.
taskTask<T>The to wait for the completion of.
cancellationTokenCancellationTokenThe cancellation token that will be checked prior to completing the returned task.
Returns
- Task<T>
A task that represents the completion of the
taskand optionalmilliseconds-long wait.
Type Parameters
T
SetSubphase(string)
Sets the subphase, if the progress indicator is available.
public static bool SetSubphase(string subphase)
Parameters
subphasestringThe name of the subphase.
Returns
Remarks
Calls SetSubphase(.subphase, false)
SetSubphase(string, bool)
Sets the subphase, if the progress indicator is available.
public static bool SetSubphase(string subphase, bool alwaysShow = false)
Parameters
subphasestringThe name of the subphase.
alwaysShowboolShould the subphase be always shown to the user.