Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Removing old script loading logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessefreeman committed Feb 4, 2020
1 parent 4f3be8a commit cf9d9bc
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 244 deletions.
27 changes: 27 additions & 0 deletions Runners/PixelVision8/Runner/PixelVision8Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using MoonSharp.Interpreter;
using PixelVision8.Engine;
using PixelVision8.Engine.Chips;
using PixelVision8.Runner.Editors;
using PixelVision8.Runner.Services;
using PixelVision8.Runner.Workspace;

Expand Down Expand Up @@ -644,6 +645,32 @@ public override void ShutdownActiveEngine()
}


private GameEditor _editor;

public GameEditor Editor
{
get
{
if (_editor == null)
{
_editor = new GameEditor(this, serviceManager);
}

return _editor;
}
}

public override void ConfigureEngine(Dictionary<string, string> metaData = null)
{
base.ConfigureEngine(metaData);

var luaGameChip = tmpEngine.GameChip as LuaGameChip;

// Register the game editor with the lua service
UserData.RegisterType<GameEditor>();
luaGameChip.LuaScript.Globals["gameEditor"] = Editor;
}

public override void RunGame()
{
// TODO This should be moved into the desktop runner?
Expand Down
24 changes: 12 additions & 12 deletions Runners/PixelVision8/Runner/Services/ExportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ public void ExportGame(string path, IEngine engine, SaveFlags saveFlags)
AddExporter(new SystemExporter(path + "data.json", targetEngine));

// Step 2 (optional). Load up the Lua script
if ((saveFlags & SaveFlags.Code) == SaveFlags.Code)
{
// //var scriptExtension = ".lua";
//
// var paths = files.Keys.Where(s => textExtensions.Any(x => s.EndsWith(x))).ToList();
//
// foreach (var fileName in paths)
// {
// parser = LoadScript(fileName, files[fileName]);
// AddExporter(parser);
// }
}
// if ((saveFlags & SaveFlags.Code) == SaveFlags.Code)
// {
// // //var scriptExtension = ".lua";
// //
// // var paths = files.Keys.Where(s => textExtensions.Any(x => s.EndsWith(x))).ToList();
// //
// // foreach (var fileName in paths)
// // {
// // parser = LoadScript(fileName, files[fileName]);
// // AddExporter(parser);
// // }
// }

// Step 3 (optional). Look for new colors
if ((saveFlags & SaveFlags.Colors) == SaveFlags.Colors)
Expand Down
12 changes: 0 additions & 12 deletions Runners/PixelVision8/Runner/Services/LuaServicePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,11 @@ public override void ConfigureScript(Script luaScript)
luaScript.Globals["SaveText"] = new Action<WorkspacePath, string>(SaveText);
luaScript.Globals["SaveImage"] = new Action<WorkspacePath, Image>(SaveImage);

//
// // Expose Bios APIs
// luaScript.Globals["ReadBiosData"] = new Func<string, string, string>((key, defaultValue) =>
// desktopRunner.bios.ReadBiosData(key, defaultValue));
// luaScript.Globals["WriteBiosData"] = new Action<string, string>(desktopRunner.bios.UpdateBiosData);

// luaScript.Globals["RemapKey"] = new Action<string, int>(RemapKey);

luaScript.Globals["NewWorkspacePath"] = new Func<string, WorkspacePath>(WorkspacePath.Parse);

UserData.RegisterType<WorkspacePath>();
UserData.RegisterType<Image>();

// Register the game editor with the lua service
gameEditor = new GameEditor(desktopRunner, locator);
UserData.RegisterType<GameEditor>();
luaScript.Globals["gameEditor"] = gameEditor;
}

public void PlayWav(WorkspacePath workspacePath)
Expand Down
6 changes: 0 additions & 6 deletions SDK/Engine/PixelVisionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public PixelVisionEngine(IServiceLocator serviceLocator, string[] chips = null,

Name = name;
ServiceLocator = serviceLocator;
//this.canWrite = readOnly;

Init();
}
Expand Down Expand Up @@ -173,11 +172,6 @@ public virtual void Shutdown()
// Shutdown chips
foreach (var chip in Chips) chip.Value.Shutdown();

// // Remove chips
// chips.Clear();
//
// // Removed references to services
// _services.Clear();
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion SDK/Runner/DesktopRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
using System.Text;
using Microsoft.Xna.Framework;
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Loaders;
using PixelVision8.Engine;
using PixelVision8.Engine.Chips;
using PixelVision8.Runner.Data;
Expand Down
1 change: 0 additions & 1 deletion SDK/Runner/GameRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ protected void ParseFiles(Dictionary<string, string> files, SaveFlags? flags = n
if (!flags.HasValue)
{
flags = SaveFlags.System;
flags |= SaveFlags.Code;
flags |= SaveFlags.Colors;
flags |= SaveFlags.ColorMap;
flags |= SaveFlags.Sprites;
Expand Down

0 comments on commit cf9d9bc

Please sign in to comment.