using Godot; using System; public class GameRoot : Node { MenuManager mMenuManager; StalkerCore mStalkerCore; public override void _Ready() { mMenuManager = GetNode("MenuManager"); mStalkerCore = GetNode("StalkerCore"); //mMenuManager.Connect(nameof(MenuManager.SetMouseCapture), this, nameof(Proc_MenuManager_SetMouseCapture)); mMenuManager.Connect(nameof(MenuManager.ExitGame), this, nameof(Proc_MenuManager_ExitGame)); //// raw executing this func //// to set proper status //Proc_MenuManager_SetMouseCapture(); BallanceStalkerCore.StalkerManager.Singleton.EventControllerChanged += Proc_StalkerManager_EventControllerChanged; BallanceStalkerCore.StalkerManager.Singleton.SetEventController(BallanceStalkerCore.EventControllerSource.None); } private void Proc_StalkerManager_EventControllerChanged(BallanceStalkerCore.EventControllerSource obj) { switch (obj) { case BallanceStalkerCore.EventControllerSource.None: Input.SetMouseMode(Input.MouseMode.Captured); break; case BallanceStalkerCore.EventControllerSource.Menu: case BallanceStalkerCore.EventControllerSource.Console: case BallanceStalkerCore.EventControllerSource.Chat: Input.SetMouseMode(Input.MouseMode.Visible); break; } } public override void _Input(InputEvent @event) { } //private void Proc_MenuManager_SetMouseCapture() { // if (mMenuManager.Visible) { // Input.SetMouseMode(Input.MouseMode.Visible); // } else { // Input.SetMouseMode(Input.MouseMode.Captured); // } //} private void Proc_MenuManager_ExitGame() { GetTree().Notification(MainLoop.NotificationWmQuitRequest); } }