宝石排序

master
humingxing 12 hours ago
parent 6e66fefcf0
commit 160b4f298a
  1. 255
      assets/bundles/first/config/Weapon.json
  2. 2
      assets/script/interface/AutoTable.ts
  3. 26
      assets/script/manager/GemDataManager.ts
  4. 14
      assets/script/ui/PanelGemstone/UIPanelGemstone.ts

@ -14,7 +14,8 @@
],
"attritubes": "1,1000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 11
},
{
"id": 1102,
@ -31,7 +32,8 @@
],
"attritubes": "1,1500",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 12
},
{
"id": 1103,
@ -48,7 +50,8 @@
],
"attritubes": "1,2000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 13
},
{
"id": 1104,
@ -65,7 +68,8 @@
],
"attritubes": "1,2500",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 14
},
{
"id": 1105,
@ -80,7 +84,8 @@
"synthesisitem": [],
"attritubes": "1,3000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 15
},
{
"id": 1201,
@ -97,7 +102,8 @@
],
"attritubes": "2,1000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 21
},
{
"id": 1202,
@ -114,7 +120,8 @@
],
"attritubes": "2,1500",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 22
},
{
"id": 1203,
@ -131,7 +138,8 @@
],
"attritubes": "2,2000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 23
},
{
"id": 1204,
@ -148,7 +156,8 @@
],
"attritubes": "2,2500",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 24
},
{
"id": 1205,
@ -163,7 +172,8 @@
"synthesisitem": [],
"attritubes": "2,3000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 25
},
{
"id": 1301,
@ -180,7 +190,8 @@
],
"attritubes": "3,1000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 31
},
{
"id": 1302,
@ -197,7 +208,8 @@
],
"attritubes": "3,2000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 32
},
{
"id": 1303,
@ -214,7 +226,8 @@
],
"attritubes": "3,3000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 33
},
{
"id": 1304,
@ -231,7 +244,8 @@
],
"attritubes": "3,4000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 34
},
{
"id": 1305,
@ -246,7 +260,8 @@
"synthesisitem": [],
"attritubes": "3,5000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 35
},
{
"id": 1401,
@ -263,7 +278,8 @@
],
"attritubes": "4,1000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 41
},
{
"id": 1402,
@ -280,7 +296,8 @@
],
"attritubes": "4,1500",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 42
},
{
"id": 1403,
@ -297,7 +314,8 @@
],
"attritubes": "4,2000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 43
},
{
"id": 1404,
@ -314,7 +332,8 @@
],
"attritubes": "4,2500",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 44
},
{
"id": 1405,
@ -329,7 +348,8 @@
"synthesisitem": [],
"attritubes": "4,3000",
"atk": 0,
"act_skill": 0
"act_skill": 0,
"sort": 45
},
{
"id": 2101,
@ -347,7 +367,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 210101
"act_skill": 210101,
"sort": 101
},
{
"id": 2201,
@ -364,7 +385,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 220101
"act_skill": 220101,
"sort": 102
},
{
"id": 2202,
@ -381,7 +403,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 220201
"act_skill": 220201,
"sort": 112
},
{
"id": 2203,
@ -398,7 +421,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 220301
"act_skill": 220301,
"sort": 122
},
{
"id": 2301,
@ -415,7 +439,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 230101
"act_skill": 230101,
"sort": 103
},
{
"id": 2302,
@ -432,7 +457,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 230201
"act_skill": 230201,
"sort": 113
},
{
"id": 2303,
@ -449,7 +475,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 230301
"act_skill": 230301,
"sort": 123
},
{
"id": 2401,
@ -466,7 +493,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 240101
"act_skill": 240101,
"sort": 104
},
{
"id": 2402,
@ -483,7 +511,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 240201
"act_skill": 240201,
"sort": 114
},
{
"id": 2403,
@ -500,7 +529,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 240301
"act_skill": 240301,
"sort": 124
},
{
"id": 2501,
@ -515,7 +545,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 250101
"act_skill": 250101,
"sort": 105
},
{
"id": 2502,
@ -530,7 +561,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 250201
"act_skill": 250201,
"sort": 115
},
{
"id": 2503,
@ -545,7 +577,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 250301
"act_skill": 250301,
"sort": 125
},
{
"id": 3101,
@ -563,7 +596,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 310101
"act_skill": 310101,
"sort": 201
},
{
"id": 3201,
@ -580,7 +614,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 320101
"act_skill": 320101,
"sort": 202
},
{
"id": 3202,
@ -597,7 +632,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 320201
"act_skill": 320201,
"sort": 212
},
{
"id": 3203,
@ -614,7 +650,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 320301
"act_skill": 320301,
"sort": 222
},
{
"id": 3301,
@ -631,7 +668,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 330101
"act_skill": 330101,
"sort": 203
},
{
"id": 3302,
@ -648,7 +686,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 330201
"act_skill": 330201,
"sort": 213
},
{
"id": 3303,
@ -665,7 +704,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 330301
"act_skill": 330301,
"sort": 223
},
{
"id": 3401,
@ -682,7 +722,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 340101
"act_skill": 340101,
"sort": 204
},
{
"id": 3402,
@ -699,7 +740,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 340201
"act_skill": 340201,
"sort": 214
},
{
"id": 3403,
@ -716,7 +758,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 340301
"act_skill": 340301,
"sort": 224
},
{
"id": 3501,
@ -731,7 +774,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 350101
"act_skill": 350101,
"sort": 205
},
{
"id": 3502,
@ -746,7 +790,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 350201
"act_skill": 350201,
"sort": 215
},
{
"id": 3503,
@ -761,7 +806,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 350301
"act_skill": 350301,
"sort": 225
},
{
"id": 4101,
@ -779,7 +825,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 410101
"act_skill": 410101,
"sort": 301
},
{
"id": 4201,
@ -796,7 +843,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 420101
"act_skill": 420101,
"sort": 302
},
{
"id": 4202,
@ -813,7 +861,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 420201
"act_skill": 420201,
"sort": 312
},
{
"id": 4203,
@ -830,7 +879,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 420301
"act_skill": 420301,
"sort": 322
},
{
"id": 4301,
@ -847,7 +897,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 430101
"act_skill": 430101,
"sort": 303
},
{
"id": 4302,
@ -864,7 +915,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 430201
"act_skill": 430201,
"sort": 313
},
{
"id": 4303,
@ -881,7 +933,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 430301
"act_skill": 430301,
"sort": 323
},
{
"id": 4401,
@ -898,7 +951,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 440101
"act_skill": 440101,
"sort": 304
},
{
"id": 4402,
@ -915,7 +969,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 440201
"act_skill": 440201,
"sort": 314
},
{
"id": 4403,
@ -932,7 +987,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 440301
"act_skill": 440301,
"sort": 324
},
{
"id": 4501,
@ -947,7 +1003,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 450101
"act_skill": 450101,
"sort": 305
},
{
"id": 4502,
@ -962,7 +1019,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 450201
"act_skill": 450201,
"sort": 315
},
{
"id": 4503,
@ -977,7 +1035,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 450301
"act_skill": 450301,
"sort": 325
},
{
"id": 5101,
@ -995,7 +1054,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 510101
"act_skill": 510101,
"sort": 401
},
{
"id": 5201,
@ -1012,7 +1072,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 520101
"act_skill": 520101,
"sort": 402
},
{
"id": 5202,
@ -1029,7 +1090,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 520201
"act_skill": 520201,
"sort": 412
},
{
"id": 5203,
@ -1046,7 +1108,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 520301
"act_skill": 520301,
"sort": 422
},
{
"id": 5301,
@ -1063,7 +1126,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 530101
"act_skill": 530101,
"sort": 403
},
{
"id": 5302,
@ -1080,7 +1144,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 530201
"act_skill": 530201,
"sort": 413
},
{
"id": 5303,
@ -1097,7 +1162,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 530301
"act_skill": 530301,
"sort": 423
},
{
"id": 5401,
@ -1114,7 +1180,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 540101
"act_skill": 540101,
"sort": 404
},
{
"id": 5402,
@ -1131,7 +1198,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 540201
"act_skill": 540201,
"sort": 414
},
{
"id": 5403,
@ -1148,7 +1216,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 540301
"act_skill": 540301,
"sort": 424
},
{
"id": 5501,
@ -1163,7 +1232,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 550101
"act_skill": 550101,
"sort": 405
},
{
"id": 5502,
@ -1178,7 +1248,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 550201
"act_skill": 550201,
"sort": 415
},
{
"id": 5503,
@ -1193,7 +1264,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 550301
"act_skill": 550301,
"sort": 425
},
{
"id": 6101,
@ -1211,7 +1283,8 @@
],
"attritubes": "5,3300",
"atk": 0,
"act_skill": 610101
"act_skill": 610101,
"sort": 501
},
{
"id": 6201,
@ -1228,7 +1301,8 @@
],
"attritubes": "5,5000",
"atk": 0,
"act_skill": 620101
"act_skill": 620101,
"sort": 502
},
{
"id": 6202,
@ -1245,7 +1319,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 620201
"act_skill": 620201,
"sort": 512
},
{
"id": 6203,
@ -1262,7 +1337,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 620301
"act_skill": 620301,
"sort": 522
},
{
"id": 6301,
@ -1279,7 +1355,8 @@
],
"attritubes": "5,10000",
"atk": 0,
"act_skill": 630101
"act_skill": 630101,
"sort": 503
},
{
"id": 6302,
@ -1296,7 +1373,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 630201
"act_skill": 630201,
"sort": 513
},
{
"id": 6303,
@ -1313,7 +1391,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 630301
"act_skill": 630301,
"sort": 523
},
{
"id": 6401,
@ -1330,7 +1409,8 @@
],
"attritubes": "5,15000",
"atk": 0,
"act_skill": 640101
"act_skill": 640101,
"sort": 504
},
{
"id": 6402,
@ -1347,7 +1427,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 640201
"act_skill": 640201,
"sort": 514
},
{
"id": 6403,
@ -1364,7 +1445,8 @@
],
"attritubes": "",
"atk": 0,
"act_skill": 640301
"act_skill": 640301,
"sort": 524
},
{
"id": 6501,
@ -1379,7 +1461,8 @@
"synthesisitem": [],
"attritubes": "5,20000",
"atk": 0,
"act_skill": 650101
"act_skill": 650101,
"sort": 505
},
{
"id": 6502,
@ -1394,7 +1477,8 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 650201
"act_skill": 650201,
"sort": 515
},
{
"id": 6503,
@ -1409,6 +1493,7 @@
"synthesisitem": [],
"attritubes": "",
"atk": 0,
"act_skill": 650301
"act_skill": 650301,
"sort": 525
}
]

@ -134,6 +134,8 @@ declare global {
readonly atk: number;
/** 技能id */
readonly act_skill: number;
/** 排序 */
readonly sort: number;
}
/**
* Hero 配置数据

@ -86,10 +86,24 @@ export class GemDataManager extends Singleton {
if (free <= 0) continue;
list.push({ gemId, count: free });
}
list.sort((a, b) => this._compareBag(a, b));
list.sort((a, b) => this.compareBagEntry(a, b));
return list;
}
/**
* 仓库条目比较:Weapon.sort 升序,同值 id 升序。
* @param a 条目 A
* @param b 条目 B
*/
compareBagEntry(a: IGemBagEntry, b: IGemBagEntry): number {
const ca = this.getGem(a.gemId);
const cb = this.getGem(b.gemId);
const sa = Math.floor(Number(ca?.sort) || 0);
const sb = Math.floor(Number(cb?.sort) || 0);
if (sa !== sb) return sa - sb;
return a.gemId - b.gemId;
}
/** 五行 4 槽宝石 id(长度固定 4,空为 0) */
getElementSlots(element: number): number[] {
const e = Math.floor(Number(element) || 0);
@ -373,16 +387,6 @@ export class GemDataManager extends Singleton {
}
}
/** 仓库排序:品质降序,id 升序 */
private _compareBag(a: IGemBagEntry, b: IGemBagEntry): number {
const ca = this.getGem(a.gemId);
const cb = this.getGem(b.gemId);
const qa = Math.floor(Number(ca?.quality) || 0);
const qb = Math.floor(Number(cb?.quality) || 0);
if (qa !== qb) return qb - qa;
return a.gemId - b.gemId;
}
/** 卸掉非法镶嵌 */
private _stripIllegalWears(): void {
let dirty = false;

@ -389,8 +389,18 @@ export class UIPanelGemstone extends Auto_PanelGemstone {
continue;
}
const entry: IGemBagEntry = { gemId, count: free };
this._bagList.push(entry);
this._bagItems.push(this._spawnBagItem(entry));
let insertAt = this._bagList.length;
for (let j = 0; j < this._bagList.length; j++) {
if (gg.gem.compareBagEntry(entry, this._bagList[j]) < 0) {
insertAt = j;
break;
}
}
this._bagList.splice(insertAt, 0, entry);
const node = this._spawnBagItem(entry);
this._bagItems.splice(insertAt, 0, node);
const parent = node.parent;
if (parent?.isValid) node.setSiblingIndex(insertAt);
}
}

Loading…
Cancel
Save