|
|
@@ -232,9 +232,13 @@ async function loadLibrary(game){
|
|
|
const lib = await (await fetch(url)).json();
|
|
|
LIB = lib; ASSET = lib.assetBase || "";
|
|
|
const sel = $('#gameSel'); sel.innerHTML='';
|
|
|
- (lib.games||[]).forEach(g=>{ const o=document.createElement('option');
|
|
|
- o.value=g;o.textContent=g; if(g===lib.game)o.selected=true; sel.appendChild(o); });
|
|
|
- if(!(lib.games||[]).length){ const o=document.createElement('option');o.textContent='(暂无)';sel.appendChild(o); }
|
|
|
+ const games = [...(lib.games||[])];
|
|
|
+ const pending = lib.game && !games.includes(lib.game);
|
|
|
+ if(pending) games.push(lib.game);
|
|
|
+ games.forEach(g=>{ const o=document.createElement('option');
|
|
|
+ o.value=g;o.textContent=g+(pending&&g===lib.game?'(待生成)':''); if(g===lib.game)o.selected=true; sel.appendChild(o); });
|
|
|
+ if(!games.length){ const o=document.createElement('option');o.textContent='(暂无)';sel.appendChild(o); }
|
|
|
+ if(pending) opMsg(`已载入 ${lib.game} 的 manifest,但还没有图片资源;点“开始生成”后才会进入资源库。`, false);
|
|
|
render();
|
|
|
}
|
|
|
|
|
|
@@ -420,7 +424,10 @@ document.querySelectorAll('.tabs button').forEach(b=>b.onclick=()=>{
|
|
|
b.classList.add('active'); TAB=b.dataset.tab; render();
|
|
|
});
|
|
|
$('#gameSel').onchange=e=>loadLibrary(e.target.value);
|
|
|
-$('#reloadBtn').onclick=()=>loadLibrary($('#gameSel').value);
|
|
|
+function currentManifestGame(){
|
|
|
+ try{ return JSON.parse($('#manifest').value||'{}').game || ''; }catch(e){ return ''; }
|
|
|
+}
|
|
|
+$('#reloadBtn').onclick=()=>loadLibrary(currentManifestGame() || $('#gameSel').value);
|
|
|
|
|
|
function opMsg(t,ok=true){ const m=$('#opMsg'); m.textContent=t; m.style.color=ok?'#7ee8ff':'#ff9d9d'; }
|
|
|
function workflowMsg(t,ok=true){ const m=$('#workflowMsg'); m.textContent=t; m.style.color=ok?'#a99ccb':'#ff9d9d'; }
|
|
|
@@ -495,6 +502,7 @@ $('#buildWorkflowBtn').onclick=async()=>{
|
|
|
if(!d.ok){ workflowMsg('生成失败: '+(d.error||'未知错误'),false); }
|
|
|
else{
|
|
|
$('#manifest').value=JSON.stringify(d.manifest,null,2);
|
|
|
+ await loadLibrary(d.manifest.game);
|
|
|
const cfg=d.slot_config||d.manifest.slot_config||{};
|
|
|
const reels=cfg.reels?`${cfg.reels.columns}×${cfg.reels.rows}`:'';
|
|
|
const minMatch=cfg.winRules?cfg.winRules.minMatch:'';
|
|
|
@@ -559,6 +567,7 @@ $('#aiWorkflowBtn').onclick=async()=>{
|
|
|
if(!d.ok){ msg.textContent='AI 生成失败: '+(d.error||'未知错误'); msg.style.color='#ff9d9d'; }
|
|
|
else{
|
|
|
$('#manifest').value=JSON.stringify(d.manifest,null,2);
|
|
|
+ await loadLibrary(d.manifest.game);
|
|
|
const req=d.creative_request||{};
|
|
|
$('#wfGameId').value=req.gameId||$('#wfGameId').value;
|
|
|
$('#wfTitle').value=req.title||$('#wfTitle').value;
|