dsh-plugin-token-war 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/index.html +24 -10
- package/lib/client.js +13 -11
- package/lib/game.js +1 -1
- package/lib/ui.js +11 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index.html
CHANGED
|
@@ -245,6 +245,18 @@
|
|
|
245
245
|
.tw-app[data-compact=true] .tw-metric-coins .tw-metric-value{font-size:28px}
|
|
246
246
|
.tw-app[data-compact=true] .tw-metric-stage .tw-metric-value{font-size:16px}
|
|
247
247
|
.tw-app[data-compact=true] .tw-status-actions button{height:23px;padding:0 7px;font-size:9px}
|
|
248
|
+
.tw-app[data-compact=true] .tw-statusbar{min-height:56px}
|
|
249
|
+
.tw-app[data-compact=true] .tw-status-actions button{height:30px;padding:0 9px;font-size:10px}
|
|
250
|
+
.tw-app[data-compact=true] .tw-run{height:28px;font-size:10px}
|
|
251
|
+
.tw-app[data-compact=true] .tw-notice-rail{height:30px}
|
|
252
|
+
.tw-app[data-compact=true] .tw-ws-tabs button{height:34px;font-size:11px;padding:0 12px}
|
|
253
|
+
.tw-app[data-compact=true] .tw-panel-head{height:34px}
|
|
254
|
+
.tw-app[data-compact=true] .tw-task-row{grid-template-columns:18px minmax(0,1fr) 70px 94px;height:40px;gap:7px;padding:0 4px}
|
|
255
|
+
.tw-app[data-compact=true] .tw-task-name{font-size:12px}
|
|
256
|
+
.tw-app[data-compact=true] .tw-task-reward{font-size:10.5px}
|
|
257
|
+
.tw-app[data-compact=true] .tw-task-reward small{font-size:8.5px}
|
|
258
|
+
.tw-app[data-compact=true] .tw-up{height:28px;font-size:9px;padding:0 5px}
|
|
259
|
+
.tw-app[data-compact=true] .tw-panel-title{font-size:12px}
|
|
248
260
|
.tw-app[data-compact=true] .tw-task-lv{display:none}
|
|
249
261
|
.tw-app[data-compact=true] .tw-task-row{grid-template-columns:20px minmax(0,1fr) 60px 80px}
|
|
250
262
|
|
|
@@ -357,7 +369,7 @@ const {amount,fromLog,log,add,subtract,multiply,scale,divide,power,numeric,ratio
|
|
|
357
369
|
const {TASKS,ROSTER,EVENTS} = __twmods["config"];
|
|
358
370
|
|
|
359
371
|
const SAVE_VERSION = 1;
|
|
360
|
-
const GAME_VERSION = '0.4.
|
|
372
|
+
const GAME_VERSION = '0.4.2';
|
|
361
373
|
const MAX_OFFLINE_MS = 30 * 86400000;
|
|
362
374
|
const HP_GROWTH = 1.085;
|
|
363
375
|
const TRAIN_GROWTH = 1.15;
|
|
@@ -945,14 +957,16 @@ function mountGame(root,{assetData={},hostNotice=null}={}) {
|
|
|
945
957
|
for(let x=-100;x<W+200;x+=90){ctx.beginPath();ctx.moveTo(W*.5+(x-W*.5)*.75,groundY+1);ctx.lineTo(x,H);ctx.stroke();}
|
|
946
958
|
const ev=currentEvent(s);
|
|
947
959
|
ctx.textAlign='left';ctx.textBaseline='alphabetic';
|
|
948
|
-
//
|
|
960
|
+
// 左侧:手机/窄屏最多 3 个角色,避免和敌人卡互相遮挡
|
|
949
961
|
const owned=ROSTER.enabledVendors.filter(v=>ROSTER.models.some(m=>m.vendor===v&&s.models.includes(m.id)));
|
|
950
|
-
const
|
|
962
|
+
const compactCanvas=W<520;
|
|
963
|
+
const visibleOwned=compactCanvas?owned.slice(0,3):owned;
|
|
964
|
+
const leftW=W*(compactCanvas?0.66:0.70);
|
|
951
965
|
const charH=Math.max(40,Math.min(H*0.64,groundY-14));
|
|
952
966
|
const scaleC=charH/192;
|
|
953
967
|
const slot=Math.max(56,Math.min(150,leftW/Math.max(1,owned.length)));
|
|
954
|
-
const x0=(leftW-slot*
|
|
955
|
-
|
|
968
|
+
const x0=(leftW-slot*visibleOwned.length)/2+slot/2;
|
|
969
|
+
visibleOwned.forEach((id,i)=>{
|
|
956
970
|
loadCharacter(id);
|
|
957
971
|
const character=CATALOG.characters.find(c=>c.id===id),image=images.get(id),x=x0+i*slot;
|
|
958
972
|
const t=(animationTime+i*550)%2800;
|
|
@@ -964,11 +978,11 @@ function mountGame(root,{assetData={},hostNotice=null}={}) {
|
|
|
964
978
|
if(image)drawFrame(ctx,image,CATALOG,frame,x,groundY+1,scaleC);
|
|
965
979
|
else{ctx.fillStyle=VENDOR_COLORS[id];ctx.fillRect(x-charH*.18,groundY-charH*.7,charH*.36,charH*.7);}
|
|
966
980
|
ctx.save();ctx.shadowColor='#000000';ctx.shadowBlur=3;ctx.shadowOffsetY=1;
|
|
967
|
-
ctx.textAlign='center';ctx.font
|
|
981
|
+
ctx.textAlign='center';ctx.font=`700 ${compactCanvas?10:11}px 'PingFang SC','Heiti SC',system-ui,sans-serif`;ctx.fillStyle=VENDOR_TEXT[id]||VENDOR_COLORS[id];
|
|
968
982
|
ctx.fillText(fitText(VENDOR_LABELS[id],slot-4),x,groundY+14);
|
|
969
983
|
if(H>=112){
|
|
970
984
|
const latest=ROSTER.models.filter(m=>m.vendor===id&&s.models.includes(m.id)).at(-1);
|
|
971
|
-
ctx.globalAlpha=.86;ctx.font
|
|
985
|
+
ctx.globalAlpha=.86;ctx.font=`${compactCanvas?9:10}px 'PingFang SC','Heiti SC',system-ui,sans-serif`;ctx.fillStyle=VENDOR_TEXT[id]||VENDOR_COLORS[id];
|
|
972
986
|
ctx.fillText(fitText(latest?latest.name:'',slot-4),x,groundY+26);
|
|
973
987
|
ctx.globalAlpha=1;
|
|
974
988
|
}
|
|
@@ -980,7 +994,7 @@ function mountGame(root,{assetData={},hostNotice=null}={}) {
|
|
|
980
994
|
}
|
|
981
995
|
});
|
|
982
996
|
// 右侧 26%:敌人 / TODO 任务卡
|
|
983
|
-
const cardW=Math.max(132,Math.round(W*0.26)),cardX=Math.round(W-cardW-12);
|
|
997
|
+
const cardW=Math.max(compactCanvas?96:132,Math.round(W*(compactCanvas?0.27:0.26))),cardX=Math.round(W-cardW-(compactCanvas?8:12));
|
|
984
998
|
const cardTop=Math.max(26,Math.round(H*0.16)),cardH=Math.max(38,groundY-cardTop-26);
|
|
985
999
|
const boss=s.stage%10===0;
|
|
986
1000
|
ctx.save();ctx.shadowColor='#000000';ctx.shadowBlur=3;ctx.shadowOffsetY=1;
|
|
@@ -1008,8 +1022,8 @@ function mountGame(root,{assetData={},hostNotice=null}={}) {
|
|
|
1008
1022
|
const labelY=barY+barH+4,labelH=17;
|
|
1009
1023
|
ctx.fillStyle='#17181D';ctx.fillRect(cardX,labelY,cardW,labelH);
|
|
1010
1024
|
ctx.strokeStyle='#E9E3D6';ctx.lineWidth=1;ctx.strokeRect(cardX+.5,labelY+.5,cardW-1,labelH-1);
|
|
1011
|
-
ctx.textAlign='center';ctx.font
|
|
1012
|
-
ctx.fillText(
|
|
1025
|
+
ctx.textAlign='center';ctx.font=`600 ${compactCanvas?8:10}px 'PingFang SC','Heiti SC',system-ui,sans-serif`;ctx.fillStyle='#E9E3D6';
|
|
1026
|
+
ctx.fillText(compactCanvas?`剩余 ${Math.round(hp*100)}% · ST ${s.stage}`:`剩余工作量 ${Math.round(hp*100)}% · STAGE ${s.stage}`,cardX+cardW/2,labelY+(compactCanvas?11:12));
|
|
1013
1027
|
lastRenderedStage=s.stage;
|
|
1014
1028
|
if(s.paused||!held){
|
|
1015
1029
|
ctx.fillStyle='#0E0F12E6';ctx.fillRect(0,0,W,H);
|