-
Notifications
You must be signed in to change notification settings - Fork 1
Progress panel addition #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
91e7920
add7bb3
70b9f7f
a0e2e09
a48ddf8
448e7ec
10d3a6b
30be3ad
1553fbf
dd2797e
e0cd56a
49a6f6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,18 +138,44 @@ public static void Prefix(ref string fileID) | |
| [HarmonyPatch(typeof(VersionManifestUtilities), "LoadDefaultManifest")] | ||
| public static class VersionManifestUtilities_LoadDefaultManifest_Patch | ||
| { | ||
| public static void Postfix(VersionManifest __result) | ||
| public static bool Prefix(ref VersionManifest __result) | ||
| { | ||
| ModTek.AddModEntries(__result); | ||
| // Return the cached manifest if it exists -- otherwise call the method as normal | ||
| if (ModTek.cachedManifest != null) | ||
| { | ||
| __result = ModTek.cachedManifest; | ||
| return false; | ||
| } | ||
| else | ||
| { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| [HarmonyPatch(typeof(DataManager), new[] { typeof(MessageCenter) })] | ||
| public static class DataManager_CTOR_Patch | ||
| // This will disable activateAfterInit from functioning for the Start() on the "Main" game object which activates the BattleTechGame object | ||
| // This stops the main game object from loading immediately -- so work can be done beforehand | ||
| [HarmonyPatch(typeof(ActivateAfterInit), "Start")] | ||
| public static class ActivateAfterInit_Start_Patch | ||
| { | ||
| public static void Prefix() | ||
| public static bool Prefix(ActivateAfterInit __instance) | ||
| { | ||
| ModTek.LoadMods(); | ||
| Traverse trav = Traverse.Create(__instance); | ||
| if (ActivateAfterInit.ActivateAfter.Start.Equals(trav.Field("activateAfter").GetValue<ActivateAfterInit.ActivateAfter>())) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this code gets called more than once per time the game is started (via save game loads or whatever), should cached the field infos potentially.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is OK -- the Main object activates BattleTechGame once during the initial startup, this is here just to 'pause' the loading so we can animate. I don't believe that BattleTechGame gets activated another time through this mechanism (it can be activated in other ways though) |
||
| { | ||
| GameObject[] gameObjects = trav.Field("activationSet").GetValue<GameObject[]>(); | ||
| foreach (var gameObject in gameObjects) | ||
| { | ||
| if ("BattleTechGame".Equals(gameObject.name)) | ||
| { | ||
| // Don't activate through this call! | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| // Call the method | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we will control the filename, I would be more explicit about like "you need
modtekassetbundlein your Mods directory"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the result after the change I made:
Attempting to load asset bundle: C:\Program Files (x86)\Steam\steamapps\common\BATTLETECH\Mods\modtekassetbundle
8:09:55 PM - Error loading asset bundle modtekassetbundle
Exception caught: System.IO.IOException: Error loading asset bundle modtekassetbundle
at ModTek.ProgressPanel.InitializeAssets (System.String assetDirectory) [0x00000] in :0
at ModTek.ProgressPanel.Initialize (System.String directory, System.String panelTitle) [0x00000] in :0
Failed to load progress bar. Skipping mod loading completely.