using Godot; using System; public class GameRoot : Node { MenuManager mMenuManager; StalkerCore mStalkerCore; public override void _Ready() { mMenuManager = GetNode("UILayer/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(); } 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); } }