public virtual void Remove() { if (MouseObject == this) { MouseObject = null; } if (TargetObject == this) { TargetObject = null; } if (NameLabel != null && !NameLabel.IsDisposed) { NameLabel.Dispose(); } NameLabel = null; MapLayer.ObjectList.Remove(this); }
private static void CreateDebugLabel() { string text; if (MirControl.MouseControl != null) { text = string.Format("FPS: {0}", FPS); if (MirControl.MouseControl is MapControl) { text += string.Format(", Co Ords: {0}", MapControl.MapLocation); } if (MirScene.ActiveScene is GameScene) { text += string.Format(", Objects: {0}", MapControl.Objects.Count); } if (MirScene.ActiveScene is GameScene && !string.IsNullOrEmpty(DebugText)) { text += string.Format(", Debug: {0}", DebugText); } if (MirObjects.MapObject.MouseObject != null) { text += string.Format(", Target: {0}", MirObjects.MapObject.MouseObject.Name); } else { text += string.Format(", Target: none"); } } else { text = string.Format("FPS: {0}", FPS); } text += string.Format(", Ping: {0}", PingTime); text += string.Format(", Sent: {0}, Received: {1}", Functions.ConvertByteSize(BytesSent), Functions.ConvertByteSize(BytesReceived)); if (Settings.FullScreen) { if (DebugBaseLabel == null || DebugBaseLabel.IsDisposed) { DebugBaseLabel = new MirControl { BackColour = Color.FromArgb(50, 50, 50), Border = true, BorderColour = Color.Black, DrawControlTexture = true, Location = new Point(5, 5), NotControl = true, Opacity = 0.5F }; } if (DebugTextLabel == null || DebugTextLabel.IsDisposed) { DebugTextLabel = new MirLabel { AutoSize = true, BackColour = Color.Transparent, ForeColour = Color.White, Parent = DebugBaseLabel, }; DebugTextLabel.SizeChanged += (o, e) => DebugBaseLabel.Size = DebugTextLabel.Size; } DebugTextLabel.Text = text; } else { if (DebugBaseLabel != null && DebugBaseLabel.IsDisposed == false) { DebugBaseLabel.Dispose(); DebugBaseLabel = null; } if (DebugTextLabel != null && DebugTextLabel.IsDisposed == false) { DebugTextLabel.Dispose(); DebugTextLabel = null; } Program.Form.Text = $"{GameLanguage.GameName} - {text}"; } }