Просмотр исходного кода

Finished up the first part of UI for NameTables. They can now be added, removed, and saved in project files. No editing as of yet.

dev
Bryan Miller 5 лет назад
Родитель
Сommit
553cf3ad7b
2 измененных файлов: 10 добавлений и 3 удалений
  1. +8
    -2
      app/js/ctrls/CTRLIO.js
  2. +2
    -1
      views/modal.html

+ 8
- 2
app/js/ctrls/CTRLIO.js Просмотреть файл

@@ -5,7 +5,7 @@ import NESBank from "/app/js/models/NESBank.js";
import NESPalette from "/app/js/models/NESPalette.js";
import CTRLPalettesStore from "/app/js/ctrls/CTRLPalettesStore.js";
import CTRLBanksStore from "/app/js/ctrls/CTRLBanksStore.js";
import CTRLNameTablesStore from "/app/js/ctrls/CTRLNameTablesStore.js";


const SUPPORTED_PROJECT_VERSIONS=[
@@ -27,7 +27,8 @@ JSONSchema.add({
"pattern":"^[0-9]{1,}\.[0-9]{1,}$"
},
"paletteStore":{"$ref":"http://nespaint/PalettesStoreSchema.json"},
"bankStore":{"$ref":"http://nespaint/BanksStoreSchema.json"}
"bankStore":{"$ref":"http://nespaint/BanksStoreSchema.json"},
"nametableStore":{"$ref":"http://nespaint/NametableStoreSchema.json"}
},
"required":["id","version","paletteStore","bankStore"]
});
@@ -43,6 +44,8 @@ function JSONFromProject(){
paletteStore:CTRLPalettesStore.obj,
bankStore:CTRLBanksStore.obj
};
if (CTRLNameTablesStore.keys.length > 0)
proj.nametableStore = CTRLNameTablesStore.obj;
return JSON.stringify(proj);
}

@@ -155,6 +158,8 @@ function HANDLE_LoadProject(e){
// TODO: Validate 'id' and 'version' properties.
CTRLPalettesStore.obj = o.paletteStore;
CTRLBanksStore.obj = o.bankStore;
if ("nametableStore" in o)
CTRLNametablesStore.obj = o.nametableStore;
}
if (this.parentNode.nodeName.toLowerCase() === "form"){
this.parentNode.reset();
@@ -206,6 +211,7 @@ class CTRLIO{

CTRLPalettesStore.initialize();
CTRLBanksStore.initialize();
CTRLNameTablesStore.initialize();
}
}


+ 2
- 1
views/modal.html Просмотреть файл

@@ -6,7 +6,8 @@

<%- include("modals/storeadd.html", {stores:[
{"modalclass":"palettes-store-add", "title":"New Palette Name", "addevent":"palstore-add"},
{"modalclass":"banks-store-add", "title":"New Bank Name", "addevent":"bankstore-add"}
{"modalclass":"banks-store-add", "title":"New Bank Name", "addevent":"bankstore-add"},
{"modalclass":"nt-store-add", "title":"New Nametable Name", "addevent":"ntstore-add"}
]}); %>

<div id="LoadProject" class="modal">

Загрузка…
Отмена
Сохранить