quickLoadEquip
This commit is contained in:
parent
63cd2056bb
commit
a778dda4de
@ -372,7 +372,8 @@ items.prototype._realLoadEquip = function (type, loadId, unloadId, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
items.prototype._realLoadEquip_playSound = function () {
|
items.prototype._realLoadEquip_playSound = function () {
|
||||||
core.stopSound(); // 先停止所有音效(为了避免快捷换装很乱)
|
if (core.hasFlag("__quickLoadEquip__")) return;
|
||||||
|
core.stopSound();
|
||||||
core.playSound('equip.mp3');
|
core.playSound('equip.mp3');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,20 +399,30 @@ items.prototype.quickLoadEquip = function (index) {
|
|||||||
if (v && !this.canEquip(v, true))
|
if (v && !this.canEquip(v, true))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
core.setFlag("__quickLoadEquip__", true);
|
||||||
// 快速换装
|
// 快速换装
|
||||||
|
var toEquip = [];
|
||||||
for (var i = 0; i < equipSize; i++) {
|
for (var i = 0; i < equipSize; i++) {
|
||||||
var now = core.status.hero.equipment[i];
|
var now = core.status.hero.equipment[i];
|
||||||
if (now) {
|
// --- 只考虑diff的装备
|
||||||
this.unloadEquip(i);
|
var to = current[i];
|
||||||
core.status.route.push("unEquip:" + i);
|
if (now != to) {
|
||||||
|
toEquip.push(to || null);
|
||||||
|
if (now) {
|
||||||
|
this.unloadEquip(i);
|
||||||
|
core.status.route.push("unEquip:" + i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i = 0; i < equipSize; i++) {
|
for (var i in toEquip) {
|
||||||
var to = current[i];
|
var to = toEquip[i];
|
||||||
if (to) {
|
if (to) {
|
||||||
this.loadEquip(to);
|
this.loadEquip(to);
|
||||||
core.status.route.push("equip:" + to);
|
core.status.route.push("equip:" + to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core.removeFlag("__quickLoadEquip__");
|
||||||
|
this._realLoadEquip_playSound();
|
||||||
|
|
||||||
core.drawTip("成功换上" + index + "号套装");
|
core.drawTip("成功换上" + index + "号套装");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user