void WaitForInput() { Time.WaitUntil(() => Input.Keys.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) && Input.Keys.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.OemTilde), () => { //Keys Pressed Down if (!DebugOpen) { // Show Debug Menu OpenMenu(); } else { Parent.Dispose(true); } DebugOpen = !DebugOpen; Time.WaitUntil(() => !Input.Keys.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) && !Input.Keys.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.OemTilde), () => { // Keys Released WaitForInput(); }); }); }
public static void Save(Object2D instance, string path, bool Dispose = false) { JsonSerializerSettings settings = new JsonSerializerSettings(); settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; settings.Formatting = Formatting.None; settings.TypeNameHandling = TypeNameHandling.Auto; JsonSerializer Json = JsonSerializer.Create(settings); if (!Directory.Exists(Path.GetDirectoryName(path))) { Directory.CreateDirectory(Path.GetDirectoryName(path)); } TextWriter writer = File.CreateText(path); Json.Serialize(writer, instance); writer.Dispose(); if (Dispose) { instance.Dispose(true); } }
public static void PlacePoint(Vector2 point, Color color, int displayTime) { Object2D obj = new Object2D("DebugPoint_" + Rand.RandomFloat(0, float.MaxValue), point, new Vector2(2, 2), 0, new Component2D[] { new Image2DComponent(DefaultValues.PixelTexture, color, 0) }, Alignment.Center, 1); Time.Wait(displayTime, () => obj.Dispose(true)); }