优化changeSkin换肤的流畅感,添加changeSkin的录像回放功能
This commit is contained in:
parent
74bed7b8a1
commit
648c9854e1
|
@ -2721,6 +2721,18 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
},
|
||||
changeSkin: function (player, map) {
|
||||
if (!player || !map) return;
|
||||
player.tempname.remove(map.from);
|
||||
player.tempname.add(map.to);
|
||||
player.skin[name] = map.to;
|
||||
const goon = (!lib.character[map.to]);
|
||||
if (goon) lib.character[map.to] = ['', '', 0, [], (map.list.find(i => i[0] == map.to) || [map.to, []])[1]];
|
||||
player.smoothAvatar(map.avatar2);
|
||||
player.node['avatar' + map.name.slice(4)].setBackground(map.to, 'character');
|
||||
player.node['avatar' + map.name.slice(4)].show();
|
||||
if (goon) delete lib.character[map.to];
|
||||
},
|
||||
skill: function (player, content) {
|
||||
if (typeof content == 'string') {
|
||||
if (lib.skill[content]) lib.skill[content].video(player);
|
||||
|
|
|
@ -2335,16 +2335,25 @@ export class Player extends HTMLDivElement {
|
|||
if ((get.character(this[i], 3) || []).includes(skill)) {
|
||||
const name = (i == 'name2' ? 'name2' : 'name');
|
||||
if (this.skin[name] != character) {
|
||||
game.broadcastAll((player, name, character, list) => {
|
||||
player.tempname.remove(player.skin[name]);
|
||||
const origin = this.skin[name];
|
||||
game.broadcastAll((player, name, character, list, origin) => {
|
||||
player.tempname.remove(origin);
|
||||
player.tempname.add(character);
|
||||
player.skin[name] = character;
|
||||
const goon = (!lib.character[character]);
|
||||
if (goon) lib.character[character] = ['', '', 0, [], (list.find(i => i[0] == character) || [character, []])[1]];
|
||||
player.smoothAvatar(name == 'name2');
|
||||
player.node['avatar' + name.slice(4)].setBackground(character, 'character');
|
||||
player.node['avatar' + name.slice(4)].show();
|
||||
if (goon) delete lib.character[character];
|
||||
}, this, name, character, list);
|
||||
}, this, name, character, list, origin);
|
||||
game.addVideo('changeSkin', this, {
|
||||
from: origin,
|
||||
to: character,
|
||||
name: name,
|
||||
list: list,
|
||||
avatar2: name == 'name2',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue