2022-07-02 21:23:45 +08:00
|
|
|
using Godot;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
public class GameRoot : Node {
|
|
|
|
|
|
|
|
MenuManager mMenuManager;
|
|
|
|
StalkerCore mStalkerCore;
|
|
|
|
|
|
|
|
public override void _Ready() {
|
2022-07-21 00:23:20 +08:00
|
|
|
mMenuManager = GetNode<MenuManager>("MenuManager");
|
2022-07-02 21:23:45 +08:00
|
|
|
mStalkerCore = GetNode<StalkerCore>("StalkerCore");
|
|
|
|
|
2022-07-21 00:23:20 +08:00
|
|
|
//mMenuManager.Connect(nameof(MenuManager.SetMouseCapture), this, nameof(Proc_MenuManager_SetMouseCapture));
|
2022-07-02 21:23:45 +08:00
|
|
|
mMenuManager.Connect(nameof(MenuManager.ExitGame), this, nameof(Proc_MenuManager_ExitGame));
|
|
|
|
|
2022-07-21 00:23:20 +08:00
|
|
|
//// 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;
|
|
|
|
}
|
2022-07-02 21:23:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void _Input(InputEvent @event) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-07-21 00:23:20 +08:00
|
|
|
//private void Proc_MenuManager_SetMouseCapture() {
|
|
|
|
// if (mMenuManager.Visible) {
|
|
|
|
// Input.SetMouseMode(Input.MouseMode.Visible);
|
|
|
|
// } else {
|
|
|
|
// Input.SetMouseMode(Input.MouseMode.Captured);
|
|
|
|
// }
|
|
|
|
//}
|
2022-07-02 21:23:45 +08:00
|
|
|
private void Proc_MenuManager_ExitGame() {
|
|
|
|
GetTree().Notification(MainLoop.NotificationWmQuitRequest);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|