Пример #1
0
 /// <summary>
 /// When the telnet client connects but is not associated with a particular kOSProcessor at the moment,
 /// this will attach the welcome menu to it instead of having it attached to a kOSProcessor.  This should
 /// occur BOTH when the telnet client first connects, and whenever it detaches from a kOSProcessor.
 /// (It should go back to this menu, rather than get disconnected).
 /// <br/>
 /// The purpose of the welcome menu is to let the user pick which kOSProcessor to attach to.
 /// </summary>
 private void SpawnWelcomeMenu()
 {
     var gObj = new GameObject( "TelnetWelcomeMenu_" + MySpawnOrder, typeof(TelnetWelcomeMenu) );
     Object.DontDestroyOnLoad(gObj);
     welcomeMenu = (TelnetWelcomeMenu)gObj.GetComponent(typeof(TelnetWelcomeMenu));
     welcomeMenu.Setup(this);
 }
Пример #2
0
 private void ContinuousChecks()
 {
     // Detect if the client closed from its end:
     if ( (!client.Connected) || IsHung() || deadSocket)
     {
         deadSocket = true;
         StopListening();                    
     }
     
     if (welcomeMenu == null)
     {
         if (ConnectedProcessor == null)
             SpawnWelcomeMenu();
     }
     else if (ConnectedProcessor != null) // welcome menu is attached but we now have a processor picked, so detach it.
     {
         welcomeMenu.enabled = false; // turn it off so it stops trying to read the input in its Update().
         welcomeMenu.Detach();
         welcomeMenu = null ; // let it get garbage collected.  Now it's the ConnectedProcessor's turn to do the work.
         // If ConnectedProcessor gets disconnected again, a new welcomeMenu instance should get spawned by the check above.
     }
 }