-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create skeletons for save-load loading screen
- Loading branch information
Sam Byass
committed
Jul 21, 2021
1 parent
e196972
commit adfbe71
Showing
11 changed files
with
410 additions
and
9 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using HarmonyLib; | ||
using JetBrains.Annotations; | ||
using RimWorld.Planet; | ||
|
||
namespace BetterLoading.Stage.SaveLoad | ||
{ | ||
public class LoadSmallComponents : LoadingStage | ||
{ | ||
private static bool _hasFinished; | ||
|
||
public LoadSmallComponents([NotNull] Harmony instance) : base(instance) | ||
{ | ||
} | ||
|
||
public override string GetStageName() | ||
{ | ||
return "Loading Small Components"; | ||
} | ||
|
||
public override string? GetCurrentStepName() | ||
{ | ||
return null; | ||
} | ||
|
||
public override int GetCurrentProgress() | ||
{ | ||
return _hasFinished ? 1 : 0; | ||
} | ||
|
||
public override int GetMaximumProgress() | ||
{ | ||
return 1; | ||
} | ||
|
||
public override bool IsCompleted() | ||
{ | ||
return _hasFinished; | ||
} | ||
|
||
public override void BecomeInactive() | ||
{ | ||
_hasFinished = false; | ||
} | ||
|
||
public override void DoPatching(Harmony instance) | ||
{ | ||
instance.Patch(AccessTools.Method(typeof(World), nameof(World.ExposeData)), new HarmonyMethod(typeof(LoadSmallComponents), nameof(OnLoadWorldStart))); | ||
} | ||
|
||
public static void OnLoadWorldStart() | ||
{ | ||
_hasFinished = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System.Linq; | ||
using HarmonyLib; | ||
using JetBrains.Annotations; | ||
using RimWorld.Planet; | ||
using Verse; | ||
|
||
namespace BetterLoading.Stage.SaveLoad | ||
{ | ||
public class LoadWorldMap : LoadingStage | ||
{ | ||
private static bool _hasLoadedWorldFromFile; | ||
private static bool _hasFinalizedWorldInit; | ||
private static bool _loadingGeneratorDataFromFile; | ||
|
||
private static WorldGenStep _currentWorldgenStep; | ||
private static int _currentWorldgenStepNum; | ||
private static int _numWorldgenSteps; | ||
|
||
public LoadWorldMap([NotNull] Harmony instance) : base(instance) | ||
{ | ||
} | ||
|
||
public override string GetStageName() | ||
{ | ||
return "Initializing World Map"; | ||
} | ||
|
||
public override string? GetCurrentStepName() | ||
{ | ||
if (!_hasLoadedWorldFromFile) | ||
{ | ||
if (_numWorldgenSteps == 0) | ||
return "Initializing basic world data"; | ||
|
||
if (_loadingGeneratorDataFromFile) | ||
return $"Loading {_numWorldgenSteps} world features from save file"; | ||
|
||
return $"Generating {_numWorldgenSteps} world features"; | ||
} | ||
|
||
return "Finishing world initialization"; | ||
} | ||
|
||
public override int GetCurrentProgress() | ||
{ | ||
return _hasLoadedWorldFromFile ? 1 : 0; | ||
} | ||
|
||
public override int GetMaximumProgress() | ||
{ | ||
return 2; | ||
} | ||
|
||
public override bool IsCompleted() | ||
{ | ||
return _hasFinalizedWorldInit; | ||
} | ||
|
||
public override void BecomeInactive() | ||
{ | ||
_hasFinalizedWorldInit = false; | ||
_hasLoadedWorldFromFile = false; | ||
} | ||
|
||
public override void DoPatching(Harmony instance) | ||
{ | ||
instance.Patch(AccessTools.Method(typeof(World), nameof(World.ExposeData)), postfix: new HarmonyMethod(typeof(LoadWorldMap), nameof(OnLoadWorldEnd))); | ||
instance.Patch(AccessTools.Method(typeof(WorldGenerator), nameof(WorldGenerator.GenerateFromScribe)), new HarmonyMethod(typeof(LoadWorldMap), nameof(OnStartLoadGeneratedData))); | ||
instance.Patch(AccessTools.Method(typeof(WorldGenerator), nameof(WorldGenerator.GenerateWithoutWorldData)), new HarmonyMethod(typeof(LoadWorldMap), nameof(OnStartGenerateFreshData))); | ||
instance.Patch(AccessTools.Method(typeof(World), nameof(World.FinalizeInit)), postfix: new HarmonyMethod(typeof(LoadWorldMap), nameof(OnFinalizeWorldInitEnd))); | ||
} | ||
|
||
public static void OnStartLoadGeneratedData() | ||
{ | ||
_loadingGeneratorDataFromFile = true; | ||
_numWorldgenSteps = WorldGenerator.GenStepsInOrder.Count(); | ||
} | ||
|
||
public static void OnStartGenerateFreshData() | ||
{ | ||
_loadingGeneratorDataFromFile = false; | ||
_numWorldgenSteps = WorldGenerator.GenStepsInOrder.Count(); | ||
} | ||
|
||
public static void OnLoadWorldEnd() | ||
{ | ||
_hasLoadedWorldFromFile = true; | ||
} | ||
|
||
public static void OnFinalizeWorldInitEnd() | ||
{ | ||
_hasFinalizedWorldInit = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using HarmonyLib; | ||
using JetBrains.Annotations; | ||
|
||
namespace BetterLoading.Stage.SaveLoad | ||
{ | ||
public class FinalizeWorld : LoadingStage { | ||
public FinalizeWorld([NotNull] Harmony instance) : base(instance) | ||
{ | ||
} | ||
|
||
public override string GetStageName() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string? GetCurrentStepName() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override int GetCurrentProgress() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override int GetMaximumProgress() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override void DoPatching(Harmony instance) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using HarmonyLib; | ||
using JetBrains.Annotations; | ||
|
||
namespace BetterLoading.Stage.SaveLoad | ||
{ | ||
public class LoadMaps : LoadingStage { | ||
public LoadMaps([NotNull] Harmony instance) : base(instance) | ||
{ | ||
} | ||
|
||
public override string GetStageName() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string? GetCurrentStepName() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override int GetCurrentProgress() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override int GetMaximumProgress() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override void DoPatching(Harmony instance) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using HarmonyLib; | ||
using JetBrains.Annotations; | ||
|
||
namespace BetterLoading.Stage.SaveLoad | ||
{ | ||
public class SetUpCamera : LoadingStage { | ||
public SetUpCamera([NotNull] Harmony instance) : base(instance) | ||
{ | ||
} | ||
|
||
public override string GetStageName() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override string? GetCurrentStepName() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override int GetCurrentProgress() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override int GetMaximumProgress() | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override void DoPatching(Harmony instance) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.