Pindahkan skrip precache ke tools/, otomatis memuat semua berkas root (feel.js, meta.js)
This commit is contained in:
parent
0b2ccbb090
commit
b9a0a1b06c
|
|
@ -17,7 +17,7 @@ Game fighting 2D canvas, tanpa dependensi dan tanpa langkah build. Semua teks un
|
||||||
- `menu.js`: menu utama (home, pilih karakter, arena, hasil, about) di `#front-menu`; `window.FrontEnd`.
|
- `menu.js`: menu utama (home, pilih karakter, arena, hasil, about) di `#front-menu`; `window.FrontEnd`.
|
||||||
- `touch.js`: kontrol sentuh; tombol memanggil `__game.input(key, down)`.
|
- `touch.js`: kontrol sentuh; tombol memanggil `__game.input(key, down)`.
|
||||||
- `assets/<id>/` atlas sprite (15 state), `manifest.js` (data + metrik), `ui/`; `work/` (di repo induk, luar folder ini) berisi pipeline pembuat karakter.
|
- `assets/<id>/` atlas sprite (15 state), `manifest.js` (data + metrik), `ui/`; `work/` (di repo induk, luar folder ini) berisi pipeline pembuat karakter.
|
||||||
- `precache.js`/`files.json`: **dibuat otomatis** oleh `../work/build_precache.py` — jangan diedit atau di-commit oleh cabang fitur; perintahkan integrator membangun ulang.
|
- `precache.js`/`files.json`: **dibuat otomatis** oleh `tools/build_precache.py` — jangan diedit atau di-commit oleh cabang fitur; perintahkan integrator membangun ulang.
|
||||||
|
|
||||||
## API uji: `window.__game`
|
## API uji: `window.__game`
|
||||||
`startMatch({player,enemy,stage,level,mode})` (mode `versus`|`training`), `advance(detik)` (memajukan simulasi tanpa menunggu waktu nyata), `press(key)`/`release(key)` (a d w s spasi i o p k l j; P2: arrowleft arrowright arrowup n m , .), `setAI(bool)`, `setP2(bool)`, `snapshot()`, `hero`, `dummy`, `projectiles`, `effects`, `draw()`, `receiveHit(dmg)`, `command(id)`. Layar tidak diperbarui saat `advance`; panggil `draw()` sebelum screenshot.
|
`startMatch({player,enemy,stage,level,mode})` (mode `versus`|`training`), `advance(detik)` (memajukan simulasi tanpa menunggu waktu nyata), `press(key)`/`release(key)` (a d w s spasi i o p k l j; P2: arrowleft arrowright arrowup n m , .), `setAI(bool)`, `setP2(bool)`, `snapshot()`, `hero`, `dummy`, `projectiles`, `effects`, `draw()`, `receiveHit(dmg)`, `command(id)`. Layar tidak diperbarui saat `advance`; panggil `draw()` sebelum screenshot.
|
||||||
|
|
|
||||||
92
files.json
92
files.json
|
|
@ -1,54 +1,70 @@
|
||||||
{
|
{
|
||||||
"files": 216,
|
"files": 220,
|
||||||
"bytes": 30960309,
|
"bytes": 31005034,
|
||||||
"list": [
|
"list": [
|
||||||
{
|
|
||||||
"file": "index.html",
|
|
||||||
"bytes": 12724
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "mobile.html",
|
|
||||||
"bytes": 3620
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "style.css",
|
|
||||||
"bytes": 25814
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "menu.css",
|
|
||||||
"bytes": 28655
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "preload.js",
|
|
||||||
"bytes": 4100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "game.js",
|
|
||||||
"bytes": 271760
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "menu.js",
|
|
||||||
"bytes": 22860
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "match.js",
|
|
||||||
"bytes": 4217
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"file": "announcer.js",
|
"file": "announcer.js",
|
||||||
"bytes": 3087
|
"bytes": 3087
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "touch.js",
|
"file": "browo.js",
|
||||||
"bytes": 4816
|
"bytes": 5523
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "feel.css",
|
||||||
|
"bytes": 1590
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "feel.js",
|
||||||
|
"bytes": 11833
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "fenr.js",
|
"file": "fenr.js",
|
||||||
"bytes": 2903
|
"bytes": 2903
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "browo.js",
|
"file": "game.js",
|
||||||
"bytes": 5523
|
"bytes": 273031
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "index.html",
|
||||||
|
"bytes": 12724
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "match.js",
|
||||||
|
"bytes": 4217
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "menu.css",
|
||||||
|
"bytes": 28655
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "menu.js",
|
||||||
|
"bytes": 22860
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "meta.css",
|
||||||
|
"bytes": 5634
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "meta.js",
|
||||||
|
"bytes": 24397
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "mobile.html",
|
||||||
|
"bytes": 3620
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "preload.js",
|
||||||
|
"bytes": 4100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "style.css",
|
||||||
|
"bytes": 25814
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "touch.js",
|
||||||
|
"bytes": 4816
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "assets/anice/form/run/sprite-sheet-alpha.webp",
|
"file": "assets/anice/form/run/sprite-sheet-alpha.webp",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Rebuilds precache.js and files.json. Run from anywhere: python3 tools/build_precache.py
|
||||||
|
import os,json,hashlib,subprocess
|
||||||
|
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..'))
|
||||||
|
# every top-level page, style and script (new files like feel.js/meta.js are picked up automatically)
|
||||||
|
root=sorted(f for f in os.listdir('.') if f.endswith(('.html','.css','.js')) and f not in ('sw.js','precache.js'))
|
||||||
|
tracked=subprocess.run(['git','ls-files','assets'],capture_output=True,text=True).stdout.split('\n')
|
||||||
|
others=subprocess.run(['git','ls-files','--others','--exclude-standard','assets'],capture_output=True,text=True).stdout.split('\n')
|
||||||
|
assets=sorted({f for f in tracked+others if f and os.path.isfile(f)})
|
||||||
|
files=[f for f in root+assets if os.path.isfile(f)]
|
||||||
|
entries=[]
|
||||||
|
for f in files:
|
||||||
|
b=open(f,'rb').read(); entries.append([f,len(b),hashlib.sha1(b).hexdigest()[:12]])
|
||||||
|
total=sum(e[1] for e in entries); ver=hashlib.sha1(''.join(e[0]+e[2] for e in entries).encode()).hexdigest()[:12]
|
||||||
|
open('precache.js','w').write('/* Generated by tools/build_dist.mjs (regenerated by hand for Konoha Fighting): runtime files [path, bytes, sha1] for preload.js and sw.js. Do not edit. */\nself.AETHER_PRECACHE = '+json.dumps({'version':ver,'total':total,'files':entries},separators=(',',':'))+';\n')
|
||||||
|
open('files.json','w').write(json.dumps({'files':len(files),'bytes':total,'list':[{'file':f,'bytes':b} for f,b,_ in entries]},indent=2)+'\n')
|
||||||
|
print(len(files),'files',round(total/1e6,1),'MB; ver',ver)
|
||||||
Loading…
Reference in New Issue