From 85d6e70ff691c70ec2aa29a3d0848d0af6b93a9d Mon Sep 17 00:00:00 2001 From: mnvdk Date: Tue, 14 Apr 2020 23:01:47 +0200 Subject: [PATCH] Dynamic songskin loading for categories --- app.py | 10 +++++-- public/assets/img/bg_genre_def.png | Bin 0 -> 16418 bytes public/src/js/assets.js | 4 ++- public/src/js/loader.js | 4 +++ public/src/js/songselect.js | 45 ++++++++++++++++++++++++----- 5 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 public/assets/img/bg_genre_def.png diff --git a/app.py b/app.py index b167014..3641875 100644 --- a/app.py +++ b/app.py @@ -188,8 +188,9 @@ def route_admin(): @admin_required(level=50) def route_admin_songs(): songs = db.songs.find({}) + categories = db.categories.find({}) user = db.users.find_one({'username': session['username']}) - return render_template('admin_songs.html', songs=list(songs), admin=user) + return render_template('admin_songs.html', songs=list(songs), admin=user, categories=list(categories)) @app.route('/admin/songs/') @@ -358,7 +359,7 @@ def route_api_songs(): song['category'] = db.categories.find_one({'id': song['category_id']})['title'] else: song['category'] = None - del song['category_id'] + #del song['category_id'] if song['skin_id']: song['song_skin'] = db.song_skins.find_one({'id': song['skin_id']}, {'_id': False, 'id': False}) @@ -368,6 +369,11 @@ def route_api_songs(): return jsonify(songs) +@app.route('/api/categories') +@app.cache.cached(timeout=15) +def route_api_categories(): + categories = list(db.categories.find({},{'_id': False})) + return jsonify(categories) @app.route('/api/config') @app.cache.cached(timeout=15) diff --git a/public/assets/img/bg_genre_def.png b/public/assets/img/bg_genre_def.png new file mode 100644 index 0000000000000000000000000000000000000000..37be238ffeb2fb9bddf271d26a0b32415620a0e3 GIT binary patch literal 16418 zcmX9_cQ~8x`we2RP_xtsYL8kmiXiq%?NPH8R>d+RF z6@5YCUwD?UDJQ;bHDQl zo193QvY5%c(m+EYvMQP;@=2(J^UmSt;KfO4ZR8u0JN@duJRKR@FGnHpNRDMm?ted_ zVfz1IZ|GElpZ}{86psyf;qVT?9=-^1mc}1!D?{EJo+3gLF7wQ1C<_$S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+!RW}oEn$8r|_xU?vU@2~<58(}&=1)v79Z58c_TPJ~d2+2Y zCco1aVh7W9AypwjK`%ZeK?<8Zq4pA)LBv7qTlY(VaPu&&>>_!SnQ~KygP;gQ)bCd> zm(%~@DscMvx3QOA+^s!I%<|oV0nM<#0V*$QiufUqcMm4ot6rH^+Q)Bwh;T1?Dq1OM zt%8$VgX%ko%E3J69B|Z%FDR zbvTi&_P6lhQjh6{%&j@XWTP^*ON!O_CUOU6Vvw?8{ROCdd4ZvA z5qEg!7XbXhO)X6pT8dCsy!Om*O^tr&nwiGAvA}0#Vm+$3BIVhWUz~P}{A?ElUH<5- zn9p<-ekCH=*h+-M>NLZDK5U%1{OG1Kez`a42h^quF4<0n*afrKK z)s0XouDsI)x9+Q&o9hQr+K2rAlb~38raVy-8Mjj}Nql&*Nl>NOG^6F+s|44n!3$z7 z672y!J4}XDegiC7_0KtyHGlF4Kq7Ai{XF%Sopf{HK@Zh3Kd$y4prxh{`>bLY`G5Dm B`H%nr literal 0 HcmV?d00001 diff --git a/public/src/js/assets.js b/public/src/js/assets.js index 919b5f3..9616776 100644 --- a/public/src/js/assets.js +++ b/public/src/js/assets.js @@ -83,6 +83,7 @@ var assets = { "bg_genre_5.png", "bg_genre_6.png", "bg_genre_7.png", + "bg_genre_def.png", "bg_score_p1.png", "bg_score_p2.png", "bg_settings.png", @@ -157,7 +158,8 @@ var assets = { "songs": [], "sounds": {}, "image": {}, - "pages": {} + "pages": {}, + "categories": {} } var gameConfig = {} diff --git a/public/src/js/loader.js b/public/src/js/loader.js index e574b00..96b332b 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -104,6 +104,10 @@ class Loader{ assets.pages[id] = page }), url) }) + + this.addPromise(this.ajax("/api/categories").then(categories => { + assets.categories = JSON.parse(categories) + }), "/api/categories") this.addPromise(this.ajax("/api/songs").then(songs => { assets.songsDefault = JSON.parse(songs) diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 4532057..d319afb 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -96,14 +96,29 @@ class SongSelect{ background: "#ff5716", border: ["#ffa66b", "#b53000"], outline: "#9c2000" - }, - "default": { - sort: 7, - background: "#ececec", - border: ["#fbfbfb", "#8b8b8b"], - outline: "#656565" } } + + let sortCount = 7; + + for(let category of assets.categories){ + if(!this.songSkin[category.title] && category.songSkin){ + if(!category.songSkin.sort){ + category.songSkin.sort = sortCount + sortCount += 1 + } + + this.songSkin[category.title] = category.songSkin + } + } + + this.songSkin.default = { + sort: Object.keys(this.songSkin).length + 1, + background: "#ececec", + border: ["#fbfbfb", "#8b8b8b"], + outline: "#656565" + } + this.font = strings.font this.songs = [] @@ -118,6 +133,7 @@ class SongSelect{ skin: song.category in this.songSkin ? this.songSkin[song.category] : this.songSkin.default, courses: song.courses, category: song.category, + category_id: song.category_id, preview: song.preview || 0, type: song.type, offset: song.offset, @@ -292,7 +308,7 @@ class SongSelect{ this.songSelect = document.getElementById("song-select") var cat = this.songs[this.selectedSong].category var sort = cat in this.songSkin ? this.songSkin[cat].sort : 7 - this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_" + sort].src + "')" + this.drawBackground(cat, sort) this.previewId = 0 this.previewList = Array(5) @@ -1201,7 +1217,8 @@ class SongSelect{ if(this.songs[this.selectedSong].action !== "back"){ var cat = this.songs[this.selectedSong].category var sort = cat in this.songSkin ? this.songSkin[cat].sort : 7 - this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_" + sort].src + "')" + + this.drawBackground(cat, sort) } } if(this.state.moveMS && ms < this.state.moveMS + changeSpeed){ @@ -2306,6 +2323,18 @@ class SongSelect{ scoreStorage.eventLoop() } } + + drawBackground(cat, sort){ + if(this.songSkin[cat] && this.songSkin[cat].bg_img){ + this.songSelect.style.backgroundImage = "url('assets/img/" + this.songSkin[cat].bg_img + "')" + }else{ + if(assets.image["bg_genre_" + sort]){ + this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_" + sort].src + "')" + }else{ + this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_def"].src + "')" + } + } + } drawClosedSong(config){ var ctx = config.ctx