优化changeSkin换肤的流畅感,添加changeSkin的录像回放功能

This commit is contained in:
mengxinzxz 2024-03-11 00:00:42 +08:00
parent 74bed7b8a1
commit 648c9854e1
2 changed files with 24 additions and 3 deletions

View File

@ -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);

View File

@ -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',
});
}
}
}