/// <summary> /// GetInstance Method /// </summary> /// <param name="uiStateModel"></param> /// <returns>An instance of GameLobbyViewModel </returns> public static GameLobbyViewModel getInstance(UiStateModel uiStateModel) { if (instance == null) { instance = new GameLobbyViewModel(uiStateModel); } return(instance); }
/// <summary> /// Constructor which initializes the viewmodels with a uIStateModel /// </summary> public MainViewModel() { viewmodels.Add("Login", new LoginViewModel(uiStateModel)); viewmodels.Add("ServerList", ServerListViewModel.getInstance(uiStateModel)); viewmodels.Add("GameLobby", GameLobbyViewModel.getInstance(uiStateModel)); viewmodels.Add("CreateSession", CreateSessionViewModel.getInstance(uiStateModel)); viewmodels.Add("Game", GameViewModel.getInstance(uiStateModel)); viewmodels.Add("Editor", EditorViewModel.getInstance(uiStateModel)); viewmodels.Add("GameEnd", GameEndViewModel.getInstance(uiStateModel)); uiStateModel.OnUiStateChanged += changeToView; CurrentViewModel = viewmodels["Login"]; }