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!"); } }
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; } }
public void Disconnect() { asyncMessageProcessor.Stop(); client.Disconnect(); }
public void Disconnect() { asyncMessageProcessor.Stop(); server.Disconnect(); }
public void SayGoodBye() { messageAppender.Stop(); onEvent.Send(" >> " + Name + " has left "); }
public void Dispose() { updateLoop?.Stop(); GraphicsControl.Dispose(); }