void Load(ref ClientMenuState state, ClientMenuState.Menu menu, FixedString128 name)
 {
     state.IsLoading           = true;
     state.LastLoadingMenu     = menu;
     state.LastLoadingMenuName = name;
     SceneManager.LoadScene(name.ToString(), LoadSceneMode.Additive);
 }
 void InitiateJoinGame(ref ClientMenuState state, ushort port)
 {
     ClientConnectionSystem.CreateConnectionEvent(ClientWorld.EntityManager, new ClientConnectionEvent {
         EventName = ClientConnectionEvent.Name.Connect,
         Port      = port
     });
     UnityEngine.Debug.Log($"Client initiated join game on port {port}.");
     state.CurrentMenu = ClientMenuState.Menu.JoiningGame;
 }
 void CheckIfInGame(ref ClientMenuState state)
 {
     if (TryGetSingletonFromOtherWorld(ClientWorld, out ClientConnection connection))
     {
         if (connection.CurrentState == ClientConnection.State.InGame)
         {
             Unload("Main Menu");
             state.CurrentMenu = ClientMenuState.Menu.InGame;
         }
     }
 }
    void ProcessMainMenuActions(ref ClientMenuState state, List <MenuAction> actions)
    {
        foreach (var action in actions)
        {
            switch (action)
            {
            case MenuAction.JoinGame:
                InitiateJoinGame(ref state, NetPongClientServerBootstrap.DEFAULT_PORT);
                break;

            case MenuAction.ExitGame:
                Debug.Log("You quit!");
                QuitGame();
                break;
            }
        }
    }
    void ProcessTitleScreenActions(ref ClientMenuState state, List <MenuAction> actions)
    {
        foreach (var action in actions)
        {
            switch (action)
            {
            case MenuAction.ExitTitleScreen:
                Unload("Title Screen");
                Load(ref state, ClientMenuState.Menu.MainMenu, "Main Menu");
                break;

            case MenuAction.ExitGame:
                Debug.Log("You quit!");
                QuitGame();
                break;
            }
        }
    }