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

Commit

Permalink
Fixes for #231 and #221
Browse files Browse the repository at this point in the history
  • Loading branch information
jessefreeman committed May 2, 2020
1 parent 44c00ac commit 39c5be9
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function PixelVisionOS:CreateTilemapPicker(rect, itemSize, columns, rows, colorO
data.name = "TilemapPicker" .. data.name
data.mode = 1
data.layerCache = {}
data.maxPerLoop = 100
data.maxPerLoop = 400
data.paintTileIndex = 0
data.paintFlagIndex = 0
data.paintColorOffset = 0
Expand Down
16 changes: 1 addition & 15 deletions Disks/PixelVisionOS/System/Tools/ColorTool/saves.json
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
{

"GameChip":
{
"savedData":{
"selectedPalettePage": "0",
"selectedSpritePage": "1",
"sessionID": "202004300651588082",
"rootDirectory": "/Workspace/NewProjectB/",
"selectedColor": "-1",
"selectedPalette": "-1",
"selectedSprite": "-1"
}
}
}
{"GameChip":{"savedData":{"selectedSprite": "-1","selectedPalette": "-1","selectedColor": "-1","rootDirectory": "/Workspace/Test/TestB/","sessionID": "202005020933213666","selectedSpritePage": "1","selectedPalettePage": "0"}}}
15 changes: 1 addition & 14 deletions Disks/PixelVisionOS/System/Tools/SpriteTool/saves.json
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
{

"GameChip":
{
"savedData":{
"spriteSize": "1",
"SpriteSize": "undefined",
"selectedSprite": "0",
"rootDirectory": "/Workspace/MyFirstGame/",
"sessionID": "202004241019252252",
"editing": "undefined"
}
}
}
{"GameChip":{"savedData":{"spriteSize": "1","SpriteSize": "undefined","selectedSprite": "0","rootDirectory": "/Workspace/Test/TestB/","sessionID": "202005020933213666","editing": "undefined"}}}
10 changes: 1 addition & 9 deletions Disks/PixelVisionOS/System/Tools/TilemapTool/saves.json
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
{

"GameChip":
{
"savedData":{
"editing": "undefined"
}
}
}
{"GameChip":{"savedData":{"editing": "undefined"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ function WorkspaceTool:OnRunFileAction(srcPath, destPath, action, duplicate)

local success = RunBackgroundScript("code-process-file-actions.lua", args)

print("Total Files", ReadMetadata("tmpFileCount"))
-- print("success", success)

if(success) then
Expand Down Expand Up @@ -273,10 +272,10 @@ function WorkspaceTool:UpdateFileActionProgress(data)
end

-- Get the current percentage
local percent = ReadExportPercent()
local percent = ReadExportPercent()/100

local fileActionActiveTotal = self.progressModal.totalFiles
local fileActionCounter = math.floor(fileActionActiveTotal * (percent / 100))
local fileActionActiveTotal = tonumber(BackgroundScriptData("tmpFileCount"))
local fileActionCounter = math.floor(fileActionActiveTotal * percent)
local pad = #tostring(fileActionActiveTotal)

local message = string.format("%s %0" .. pad .. "d of %0" .. pad .. "d.\n\n\nDo not restart or shut down Pixel Vision 8.", self.progressModal.fileAction, fileActionCounter, fileActionActiveTotal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function CalculateSteps()

end

-- WriteMetadata( "tmpFileCount", tostring(#filesToCopy) )
BackgroundScriptData( "tmpFileCount", tostring(#filesToCopy) )

end

Expand Down
5 changes: 1 addition & 4 deletions Disks/PixelVisionOS/System/Tools/WorkspaceTool/saves.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"GameChip":
{
"savedData":{
"sessionID": "202005020932457470",
"scrollPos": "0",
"selection": "0",
"lastPath": "/Workspace/MyFirstGame/NewProject/"

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public BackgroundScriptRunner(string scriptName, LuaServicePlus luaService, stri
LuaScript.Globals["AddStep"] = new Action<string>(AddStep);
LuaScript.Globals["SetStringAsData"] = new Action<string>(SetStringAsData);
LuaScript.Globals["SetImageAsData"] = new Action<Image, string>(SetImageAsData);
LuaScript.Globals["BackgroundScriptData"] = new Func<string, string, string>(luaService.BackgroundScriptData);

}

Expand Down
28 changes: 28 additions & 0 deletions Runners/PixelVision8/Runner/Services/LuaServicePlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@ public LuaServicePlus(PixelVision8Runner runner) : base(runner)

//public WorkspaceService workspace => desktopRunner.workspaceService;

private Dictionary<string, string> bgScriptData = new Dictionary<string, string>();

public string BackgroundScriptData(string key, string value = null)
{

if (value != null)
{
if (bgScriptData.ContainsKey(key))
{
bgScriptData[key] = value;
}
else
{
bgScriptData.Add(key, value);
}
}

if (bgScriptData.ContainsKey(key))
{
return bgScriptData[key];
}

return "undefined";
}

public override void ConfigureScript(Script luaScript)
{
base.ConfigureScript(luaScript);
Expand All @@ -73,6 +98,7 @@ public override void ConfigureScript(Script luaScript)
workspace.GetEntitiesRecursive(path).ToList());

luaScript.Globals["RunBackgroundScript"] = new Func<string, string[], bool>(RunBackgroundScript);
luaScript.Globals["BackgroundScriptData"] = new Func<string, string, string>(BackgroundScriptData);
luaScript.Globals["CancelExport"] = new Action(CancelExport);

luaScript.Globals["PlayWav"] = new Action<WorkspacePath>(PlayWav);
Expand Down Expand Up @@ -147,6 +173,8 @@ public bool RunBackgroundScript(string scriptName, string[] args = null)
{
exportService.Restart();

bgScriptData.Clear();

exportService.AddExporter(new BackgroundScriptRunner(scriptName, this, args));
//
exportService.StartExport();
Expand Down

0 comments on commit 39c5be9

Please sign in to comment.