public LocalServerStateViewModel(LocalServerRunner localServerRunner)
        {
            localServerRunner.ServerStateChanged += serverState =>
            {
                // kill is enabled in all states when process is running
                IsKillEnabled = (serverState == LocalServerState.starting) || (serverState == LocalServerState.listening);
                OnPropertyChanged(nameof(IsKillEnabled));

                // run is the opposite
                IsRunEnabled = !IsKillEnabled;
                OnPropertyChanged(nameof(IsRunEnabled));

                State = serverState;
                OnPropertyChanged(nameof(State));

                VerboseMessage = GetMessageByState();
                OnPropertyChanged(nameof(VerboseMessage));
            };

            localServerRunner.ProbeTextChanged += probeText =>
            {
                ProbeText = probeText;
                OnPropertyChanged(nameof(ProbeText));
            };
        }
示例#2
0
 /** Start an offline server within the application and start a game  */
 public void PlayOffline()
 {
     m_offline           = true;
     m_localServerRunner = new LocalServerRunner();
     m_client            = new ClientConnectionManager();
     m_localServerRunner.StartServer(m_client);
     if (m_client.IsConnected() && m_visualManager == null)  // Check for visual manager to know if we are already in-game - Hacky!!
     {
         SceneManager.LoadScene("Scenes/CardGame");
     }
 }