Example #1
0
 public void Stop(string disconnectMsg)
 {
     if (Host.Status == NetPeerStatus.Running)
     {
         Host.Shutdown(disconnectMsg);
         asyncMessageProcessor?.Stop();
     }
     else
     {
         Out.Warn("Unable to stop the server. Server is not running!");
     }
 }
Example #2
0
 private void AnimateFrames(bool animate)
 {
     if (updateLoop == null && animate)
     {
         updateLoop        = new ParallelTaskStarter(TimeSpan.FromMilliseconds(5));
         animationPosition = () => new Vector2(animation.Settings.TileSheetWidth / 2 - animation.Settings.FrameWidth / 2,
                                               animation.Settings.TileSheetHeight / 2 - animation.Settings.FrameHeight / 2);
         updateLoop.Start(() =>
         {
             animation.Update(updateLoop.ElapsedTime);
             ReDraw();
         });
         output.AppendLine(
             $"Animating frames {animation.Settings.StartFrame} - {animation.Settings.LastFrame} with {animation.Settings.FrameDelay * 1000} ms delay");
     }
     if (updateLoop != null && !animate)
     {
         updateLoop.Stop();
         updateLoop = null;
     }
 }
Example #3
0
 public void Disconnect()
 {
     asyncMessageProcessor.Stop();
     client.Disconnect();
 }
Example #4
0
 public void Disconnect()
 {
     asyncMessageProcessor.Stop();
     server.Disconnect();
 }
Example #5
0
 public void SayGoodBye()
 {
     messageAppender.Stop();
     onEvent.Send(" >> " + Name + " has left ");
 }
Example #6
0
 public void Dispose()
 {
     updateLoop?.Stop();
     GraphicsControl.Dispose();
 }