-
Notifications
You must be signed in to change notification settings - Fork 88
avoid reload if game is already loaded. #764
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 2 commits
2127976
063ce1d
d3bf225
d21090a
e493ac2
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 |
|---|---|---|
|
|
@@ -41,6 +41,21 @@ public class TrafficManagerMod : IUserMod { | |
|
|
||
| public string Description => "Manage your city's traffic"; | ||
|
|
||
| internal static TrafficManagerMod Instance = null; | ||
|
|
||
| internal bool InGameHotReload { get; private set; } = false; | ||
|
|
||
| internal static AppMode currentMode => SimulationManager.instance.m_ManagersWrapper.loading.currentMode; | ||
|
|
||
| internal static bool InGame() { | ||
|
||
| try { | ||
| return currentMode == AppMode.Game; | ||
| } | ||
| catch { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| [UsedImplicitly] | ||
| public void OnEnabled() { | ||
| Log.InfoFormat( | ||
|
|
@@ -75,6 +90,9 @@ public void OnEnabled() { | |
| Log.InfoFormat("Mono version: {0}", displayName.Invoke(null, null)); | ||
| } | ||
| } | ||
|
|
||
| Instance = this; | ||
|
Member
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. Where is this getting used exaclty? When I look at the code in VS2019, it's not showing any references to it. I can see down on line 110 (in updated Was it supposed to be referenced in line 105 in the
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. see |
||
| InGameHotReload = InGame(); | ||
| } | ||
|
|
||
| [UsedImplicitly] | ||
|
|
@@ -84,11 +102,12 @@ public void OnDisabled() { | |
| LocaleManager.eventLocaleChanged -= Translation.HandleGameLocaleChange; | ||
| Translation.IsListeningToGameLocaleChanged = false; // is this necessary? | ||
|
|
||
| if (LoadingExtension.InGame() && LoadingExtension.Instance != null) { | ||
| if (InGame() && LoadingExtension.Instance != null) { | ||
| //Hot reload Unloading | ||
| LoadingExtension.Instance.OnLevelUnloading(); | ||
| LoadingExtension.Instance.OnReleased(); | ||
| } | ||
| Instance = null; | ||
| } | ||
|
|
||
| [UsedImplicitly] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.