Exemplo n.º 1
0
 public WindowedConsoleRenderer(Actor actor, Scrollbar scrollbar) : base(actor)
 {
     this.font      = MachinaClient.Assets.GetSpriteFont("DefaultFontSmall");
     this.scrollbar = scrollbar;
     Runtime.CurrentCartridge.PushLogger(this);
     MachinaClient.Print("Logger pushed");
 }
Exemplo n.º 2
0
 public void LoadSavedSettingsIfExist(MachinaFileSystem fileSystem, WindowInterface window)
 {
     try
     {
         var json = fileSystem.ReadTextAppDataThenLocal("settings.json").Result;
         var data = JsonConvert.DeserializeObject <GameSettings>(json);
         LoadFromData(data);
         Apply(window);
     }
     catch (Exception e)
     {
         MachinaClient.Print("Failed to load settings", e.Message);
     }
 }
Exemplo n.º 3
0
        public void SaveSnapshotAndDisposeTexture(SpriteBatch spriteBatch)
        {
            var texture     = Runtime.CurrentCartridge.SceneLayers.RenderToTexture(spriteBatch);
            var currentTime = DateTime.Now;

            Directory.CreateDirectory(this.screenshotPath);
            using (var destStream =
                       File.Create(Path.Combine(this.screenshotPath, currentTime.ToFileTimeUtc() + ".png")))
            {
                texture.SaveAsPng(destStream, texture.Width, texture.Height);
                MachinaClient.Print("Snapshot taken", this.screenshotPath);
            }

            texture.Dispose();
        }
Exemplo n.º 4
0
        public override void OnKey(Keys key, ButtonState buttonState, ModifierKeys modifiers)
        {
            if (this.keyCombo.key == key && this.keyCombo.modifiers == modifiers && buttonState == ButtonState.Pressed)
            {
                if (Runtime.DebugLevel == DebugLevel.Passive)
                {
                    Runtime.DebugLevel = DebugLevel.Active;
                }
                else
                {
                    Runtime.DebugLevel = DebugLevel.Passive;
                }

                MachinaClient.Print("DebugLevel set to ", Runtime.DebugLevel);
            }
        }
Exemplo n.º 5
0
 public override void OnDeleteFinished()
 {
     Runtime.CurrentCartridge.PopLogger();
     MachinaClient.Print("Logger popped");
 }