From 2a29b41ab1ce9ceb54122f97375fc33953911232 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 17 Mar 2023 19:47:10 -0500 Subject: [PATCH] added mods list/improved list visual --- .gitignore | 3 +- Changelog.md | 10 +++++ dist/assets/mods/_list.json | 6 +++ dist/assets/organisms/_list.json | 16 ++++---- dist/assets/worlds/_list.json | 18 ++++----- dist/css/style.css | 29 ++++++++++++++- dist/index.html | 29 +++++++++++---- src/Controllers/LoadController.js | 61 +++++++++++++++++++------------ 8 files changed, 122 insertions(+), 50 deletions(-) create mode 100644 dist/assets/mods/_list.json diff --git a/.gitignore b/.gitignore index 91a629f..6853c74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/* -dist/js/bundle.js \ No newline at end of file +dist/js/bundle.js +./package-lock.json \ No newline at end of file diff --git a/Changelog.md b/Changelog.md index c38dcda..5fbdb5b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,15 @@ # Changelog +## 1.0.5 (tbd) + +### UI Enhancements: +- Improved "Community Creations" list panel +- Added Mod list to Community Creations + +### Simulation Enhancements: +- Added links to community mods + + ## 1.0.4 (9/17/2022) ### UI Enhancements: diff --git a/dist/assets/mods/_list.json b/dist/assets/mods/_list.json new file mode 100644 index 0000000..0f3df67 --- /dev/null +++ b/dist/assets/mods/_list.json @@ -0,0 +1,6 @@ +[ + { + "name": "Life Engine Extended", + "value": "https://lifeengineextended.github.io/" + } +] \ No newline at end of file diff --git a/dist/assets/organisms/_list.json b/dist/assets/organisms/_list.json index 0923aa7..8af18ce 100644 --- a/dist/assets/organisms/_list.json +++ b/dist/assets/organisms/_list.json @@ -1,34 +1,34 @@ [ { "name": "Purple Flower", - "file": "purple_flower" + "value": "purple_flower" }, { "name": "Rosa Finalis", - "file": "RosaFinalis" + "value": "RosaFinalis" }, { "name": "Quadratus Anxius", - "file": "The_Anxious_Square" + "value": "The_Anxious_Square" }, { "name": "Hunter", - "file": "hunter" + "value": "hunter" }, { "name": "Small Bush Killer", - "file": "smallbushkiller" + "value": "smallbushkiller" }, { "name": "Fly Catcher", - "file": "flycatcher" + "value": "flycatcher" }, { "name": "Heart Locket", - "file": "HeartLocket" + "value": "HeartLocket" }, { "name": "Napoleon", - "file": "Napoleon" + "value": "Napoleon" } ] \ No newline at end of file diff --git a/dist/assets/worlds/_list.json b/dist/assets/worlds/_list.json index 5640695..0eda7ce 100644 --- a/dist/assets/worlds/_list.json +++ b/dist/assets/worlds/_list.json @@ -1,38 +1,38 @@ [ { "name": "Colony", - "file": "colony" + "value": "colony" }, { "name": "Ephemeral World", - "file": "ephemeral" + "value": "ephemeral" }, { "name": "Trailblazer", - "file": "Trailblazer3" + "value": "Trailblazer3" }, { "name": "Scarcity", - "file": "scarcity" + "value": "scarcity" }, { "name": "High Def Sweepers", - "file": "world_HighDefSweepers_start" + "value": "world_HighDefSweepers_start" }, { "name": "Shrub Swamp", - "file": "shrubland" + "value": "shrubland" }, { "name": "Computer (unprogrammed)", - "file": "computer_unprogrammed" + "value": "computer_unprogrammed" }, { "name": "Computer (fibonacci)", - "file": "compV2_fixed_labeled_fibofancy" + "value": "compV2_fixed_labeled_fibofancy" }, { "name": "Life Engine of Nurgle", - "file": "Life_Engine_of_Nurgle" + "value": "Life_Engine_of_Nurgle" } ] \ No newline at end of file diff --git a/dist/css/style.css b/dist/css/style.css index 48242e9..94262c5 100644 --- a/dist/css/style.css +++ b/dist/css/style.css @@ -308,10 +308,11 @@ input:hover,input:active { } .load-panel { - width: 300px; + width: 800px; background-color: var(--panel-bg); position: fixed; display: none; + text-align: center; left: 50%; top: 50%; transform: translate(-50%, -50%); @@ -324,6 +325,32 @@ input:hover,input:active { padding: 10px; } +.list-title-container { + flex: 1; +} +.list-container { + overflow-y: scroll; + max-height: 300px; +} + +.list-item { + cursor: pointer; + padding: 5px; + border-bottom: 1px solid #ccc; + background-color: var(--btn); +} +.list-item:hover { + background-color: var(--btn-hover); +} +.list-item:active { + background-color: var(--btn-click); +} + +.all-list-container { + display: flex; + width: 100%; +} + #close-load-btn { float: right; } diff --git a/dist/index.html b/dist/index.html index e12b1c5..22204f0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -280,15 +280,28 @@
-

Community Creations

+

Community Creations


- Worlds
- -
- Organisms
- -

- +
+
+

Worlds

+
+
    +
    +
    +
    +

    Organisms

    +
    +
      +
      +
      +
      +

      Mods

      +
      +
        +
        +
        +
        diff --git a/src/Controllers/LoadController.js b/src/Controllers/LoadController.js index 48742ff..6964b31 100644 --- a/src/Controllers/LoadController.js +++ b/src/Controllers/LoadController.js @@ -9,31 +9,45 @@ const LoadController = { $('#community-creations-btn').click(()=>{ this.open(); }); + let panel = this; + $(".load-panel").on('click', '.list-item', async function() { + console.log('howdy') + let list_name = $(this).closest(".list-container").attr('id'); + let value = $(this).find('.hidden-value').text(); + if (list_name === 'worlds-list-container') { + const base = `./assets/worlds/`; + let resp = await fetch(base+value+'.json'); + let json = await resp.json(); + panel.control_panel.loadEnv(json); + panel.close(); + } + else if (list_name === 'organisms-list-container') { + const base = `./assets/organisms/`; + let resp = await fetch(base+value+'.json'); + let json = await resp.json(); + panel.control_panel.editor_controller.loadOrg(json); + panel.close(); + $('#maximize').click(); + $('#editor').click(); + } + else if (list_name === 'mods-list-container') { + window.open(value, '_blank'); + } + }); + $('#load-env-btn').click(async ()=>{ - let file = $('#worlds-load-dropdown').val(); - const base = `./assets/worlds/`; - let resp = await fetch(base+file+'.json'); - let json = await resp.json(); - this.control_panel.loadEnv(json); - this.close(); + }); $('#load-org-btn').click(async ()=>{ - let file = $('#organisms-load-dropdown').val(); - const base = `./assets/organisms/`; - let resp = await fetch(base+file+'.json'); - let json = await resp.json(); - this.control_panel.editor_controller.loadOrg(json); - this.close(); - $('#maximize').click(); - $('#editor').click(); + }); - - this.loadDropdown('worlds'); - this.loadDropdown('organisms'); + this.loadList('worlds'); + this.loadList('organisms'); + this.loadList('mods'); }, - async loadDropdown(name) { + async loadList(name) { const base = `./assets/${name}/`; let list = []; @@ -44,13 +58,14 @@ const LoadController = { console.error('Failed to load list: ', e); } - let id = `#${name}-load-dropdown` + let id = `#${name}-list` $(id).empty(); - for (let opt of list) { + for (let item of list) { $(id).append( - `` + `
      • + ${item.name} + +
      • ` ); } },