Skip to content

Commit

Permalink
防止Update()在禁用摄像机时触发
Browse files Browse the repository at this point in the history
  • Loading branch information
will258012 committed Dec 14, 2024
1 parent e8eceb3 commit 9d86002
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions FPSCamera/Code/Cam/Controller/FPSCamController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void EnableCam(bool IsPlugin = false)
private void DisableCam()
{
Logging.KeyMessage("Disabling FPS Camera");
Status = CamStatus.Disabling;
FPSCam?.DisableCam();
FPSCam = null;
if (ModSettings.ShowInfoPanel)
Expand Down Expand Up @@ -179,14 +180,17 @@ private void Update()
}
catch (Exception e)
{
if (Status == CamStatus.Enabled || Status == CamStatus.PluginEnabled)
{
Logging.Error("FPS Camera is about to exit due to some issues (Update)");
DisableCam();
}

var notification = NotificationBase.ShowNotification<ListNotification>();
notification.AddParas(Translations.Translate("ERROR"));
notification.AddSpacer();
notification.AddParas(e.ToString());

Logging.Error();
Logging.LogException(e, "FPS Camera is about to exit due to some issues (Update)");
DisableCam();
Logging.LogException(e);
}
}

Expand Down Expand Up @@ -515,7 +519,8 @@ public enum CamStatus
Disabled,
Enabled,
PluginEnabled,
Transitioning
Transitioning,
Disabling
}
private static Transform CameraTransform => GameCamController.Instance.MainCamera.transform;
private bool _isScrollTransitioning = false;
Expand Down

0 comments on commit 9d86002

Please sign in to comment.