diff --git a/抓猪关卡转换/piggy-converter/转换工具.html b/抓猪关卡转换/piggy-converter/转换工具.html index d5992ae..a6cb98d 100644 --- a/抓猪关卡转换/piggy-converter/转换工具.html +++ b/抓猪关卡转换/piggy-converter/转换工具.html @@ -32,7 +32,15 @@ $('mapping').value=JSON.stringify(PiggyConverter.defaults,null,2); const discoveredTypes=new Map(); const groupNames={animalGroup:'动物',obstacleGroup:'机关'}; const animalNames={1:'普通猪',100:'炸弹熊',101:'计时狮子',103:'大象',106:'沉睡河马',107:'魅力羊',108:'撞击牛',109:'羚羊',112:'小鸡'}; -for(const target of PiggyConverter.targetTypes)$('new-target').add(new Option(target.name+' · '+target.id+' · '+target.length+'×'+target.width,String(target.id))); +const obstacleNames={200:'捕猎狼',204:'笼子',205:'推车',206:'地鼠',207:'泡泡',209:'云雾'}; +function targetLabel(target){return target.name+' · '+target.id+'('+target.length+'×'+target.width+')';} +function sourceLabel(collection,type){ + const names=collection==='animalGroup'?animalNames:obstacleNames; + const name=Object.hasOwn(names,type)?' · '+names[type]:''; + const footprint=PiggyConverter.defaults[collection]?.[type]; + return groupNames[collection]+' · '+type+name+(footprint?'('+footprint.length+'×'+footprint.width+')':'(占格待确认)'); +} +for(const target of PiggyConverter.targetTypes)$('new-target').add(new Option(targetLabel(target),String(target.id))); $('add-mapping').onsubmit=event=>{ event.preventDefault(); try{ @@ -54,11 +62,11 @@ function renderMappings(){ const elements=[]; for(const {collection,type} of rows.values()){ const row=document.createElement('div');row.className='mapping-row'; - const heading=document.createElement('strong');heading.textContent=groupNames[collection]+' · '+type+(collection==='animalGroup'&&Object.hasOwn(animalNames,type)?' · '+animalNames[type]:''); + const heading=document.createElement('strong');heading.textContent=sourceLabel(collection,type); const label=document.createElement('label');label.append('目标对象'); const select=document.createElement('select');select.setAttribute('aria-label',collection+' '+type+' 目标对象');select.dataset.group=collection;select.dataset.type=type; select.add(new Option('未适配 / 不转换','')); - for(const target of PiggyConverter.targetTypes)select.add(new Option(target.name+' · '+target.id+' · '+target.length+'×'+target.width,String(target.id))); + for(const target of PiggyConverter.targetTypes)select.add(new Option(targetLabel(target),String(target.id))); const rule=mapping?.[collection]?.[type]; if(rule&&!PiggyConverter.targetTypes.some(target=>target.id===rule.id))select.add(new Option('自定义编号 '+rule.id,String(rule.id))); select.value=rule?String(rule.id):'';