player.$throw(cards)
+ );
+ Mixin.replace(
+ 'lib.element.content.gain',
+ /\s*var\s*sort\s*;[\s\S]*=\s*document\s*\.\s*createDocumentFragment\s*\(\s*\)\s*;/,
+ player => {
+ var handcards = player.node.handcards1;
+ var fragment = document.createDocumentFragment();
+ },
+ /\s*sort\s*=\s*lib\s*\.\s*config\s*\.\s*sort_card\s*\(\s*cards\s*\[\s*num\s*\]\s*\)\s*;\s*if\s*\(\s*lib\s*\.\s*config\s*\.\s*reverse_sort\s*\)\s*sort\s*=-\s*sort\s*;/,
+ '',
+ /\s*cards\s*\[\s*num\s*\]\s*\.\s*style\s*\.\s*transform\s*=\s*''\s*;/,
+ '',
+ /(?=\s*if\s*\(\s*_status\s*\.\s*discarded\s*\)\s*{)/,
+ (fragment, cards, num) => {
+ fragment.insertBefore(cards[num], fragment.firstChild);
+ },
+ /\s*if\s*\(\s*player\s*==\s*game\s*\.\s*me\s*\)\s*{[\s\S]*else\s*frag2\s*\.\s*appendChild\s*\(\s*cards\s*\[\s*num\s*\]\s*\)\s*;/,
+ '',
+ /\s*var\s*addv\s*=\s*function\s*\(\s*\)\s*{[\s\S]*?}\s*;/,
+ '',
+ /(?=\s*if\s*\(\s*event\s*\.\s*animate\s*==\s*'draw'\s*\)\s*{)/,
+ (event, player, dui, fragment, handcards, broadcast) => {
+ var gainTo = function (cards, nodelay) {
+ cards.duiMod = event.source;
+ if (player == game.me) {
+ dui.layoutHandDraws(cards.reverse());
+ dui.queueNextFrameTick(dui.layoutHand, dui);
+ game.addVideo('gain12', player, [get.cardsInfo(fragment.childNodes), event.gaintag]);
+ }
+
+ var s = player.getCards('s');
+ if (s.length)
+ handcards.insertBefore(fragment, s[0]);
+ else
+ handcards.appendChild(fragment);
+
+ broadcast();
+
+ if (nodelay !== true) {
+ setTimeout(function (player) {
+ player.update();
+ game.resume();
+ }, get.delayx(400, 400) + 66, player);
+ } else {
+ player.update();
+ }
+ };
+ },
+ /\s*setTimeout\s*\(\s*function\s*\(\s*\)\s*{[\s\S]*?}\s*,\s*get\s*\.\s*delayx\s*\([\s\S]*?,\s*[\s\S]*?\s*\)\s*\)\s*;/g,
+ (gainTo, cards) => {
+ gainTo(cards);
+ },
+ /\s*addv\s*\(\s*\)\s*;[\s\S]*?broadcast\s*\(\s*\)\s*;/,
+ (gainTo, cards) => {
+ gainTo(cards, true);
+ },
+ /\s*game\s*\.\s*delayx\s*\(\s*\)\s*;(?=\s*if\s*\(\s*event\s*\.\s*updatePile\s*\)\s*game\s*\.\s*updateRoundNumber\s*\(\s*\)\s*;)/
+ );
+ lib.element.Player = class extends lib.element.Player {
+ constructor(){
+ let player = super(...arguments);
+ Object.setPrototypeOf(player,lib.element.Player.prototype);
+ return player;
+ }
+ get group() {
+ return this._decadeGroup;
+ }
+ set group(group) {
+ this._decadeGroup = group;
+ this.node.campWrap.dataset.camp = get.bordergroup(this.name, true) || group;
+ if (!group) return;
+ if (!decadeUI.config.campIdentityImageMode) {
+ this.node.campWrap.node.campName.innerHTML = group ? get.translation(group)[0] : '';
+ return;
+ }
+ const image = new Image();
+ const url = lib.decade_extGroupImage && lib.decade_extGroupImage[group] || `${decadeUIPath}image/decoration/name_${group}.png`;
+ this._finalGroup = group;
+ image.onerror = () => this.node.campWrap.node.campName.innerHTML = this._finalGroup ? get.translation(this._finalGroup)[0] : '';
+ this.node.campWrap.node.campName.style.backgroundImage = `url("${url}")`;
+ image.src = url;
+ }
+ buildNode() {
+ super.buildNode();
+ this.node.avatar.className = 'primary-avatar';
+ this.node.avatar2.className = 'deputy-avatar';
+ this.node.avatar2.hide();
+ this.node.turnedover.className = 'turned-over';
+ this.node.turnedover.textContent = '';
+ this.node.count.show().className = 'card-count';
+ this.node.marks.className = 'dui-marks';
+ this.node.chain.textContent = '';
+ const chainImg = new Image();
+ chainImg.onerror = () => {
+ const chainBack = ui.create.div('.chain-back', this.node.chain);
+
+ for (let chainLink = 0; chainLink < 40; chainLink++) {
+ ui.create.div('.cardbg', chainBack).style.transform = `translateX(${chainLink * 5 - 5}px)`;
+ }
+
+ delete chainImg.onerror;
+ };
+ chainImg.src = `${decadeUIPath}assets/image/tie_suo.png`;
+ this.$cardCount = this.node.count;
+ this.$dynamicWrap = ui.create.div('.dynamic-wrap');
+ const realIdentity = ui.create.div(this.node.identity);
+ realIdentity.player = this;
+ Object.defineProperty(realIdentity, 'innerHTML', {
+ configurable: true,
+ get() {
+ return this.innerText;
+ },
+ set(innerHTML) {
+ if (get.mode() == 'guozhan' || _status.mode == 'jiange' || _status.mode == 'siguo') {
+ this.style.display = 'none';
+ this.innerText = innerHTML;
+ this.parentNode.classList.add('guozhan-mode');
+ return;
+ }
+
+ let filename;
+ let checked;
+ const identity = this.parentNode.dataset.color;
+ const gameMode = get.mode();
+ let isExt = false;
+
+ if (lib.decade_extIdentity && (lib.decade_extIdentity[this.player.identity] || lib.decade_extIdentity[innerHTML]) && innerHTML != '猜') {
+ if (lib.decade_extIdentity[innerHTML]) filename = lib.decade_extIdentity[innerHTML];
+ else filename = lib.decade_extIdentity[this.player.identity];
+
+ isExt = true;
+ } else switch (innerHTML) {
+ case '先':
+ filename = 'xianshou';
+ break;
+ case '后':
+ filename = 'houshou';
+ break;
+ case '猜':
+ filename = 'cai';
+
+ if (_status.mode == 'purple' && identity == 'cai') {
+ filename += '_blue';
+ checked = true;
+ }
+
+ break;
+ case '友':
+ filename = 'friend';
+ break;
+ case '敌':
+ filename = 'enemy';
+ break;
+ case '反':
+ filename = 'fan';
+
+ if (get.mode() == 'doudizhu') {
+ filename = 'nongmin';
+ checked = true;
+ }
+
+ break;
+ case '主':
+ filename = 'zhu';
+
+ if (get.mode() == 'versus' && get.translation(`${this.player.side}Color`) == 'wei') {
+ filename += '_blue';
+ this.player.classList.add('opposite-camp');
+ checked = true;
+ } else if (get.mode() == 'doudizhu') {
+ filename = 'dizhu';
+ checked = true;
+ }
+
+ break;
+ case '忠':
+ filename = 'zhong';
+
+ if (gameMode == 'identity' && _status.mode == 'purple') filename = 'qianfeng';
+ else if (get.mode() == 'versus' && get.translation(`${this.player.side}Color`) == 'wei') {
+ filename += '_blue';
+ this.player.classList.add('opposite-camp');
+ checked = true;
+ }
+
+ break;
+ case '内':
+ if (_status.mode == 'purple') {
+ filename = identity == 'rNei' ? 'xizuo' : 'xizuo_blue';
+ checked = true;
+ } else filename = 'nei';
+
+ break;
+ case '野':
+ filename = 'ye';
+ break;
+ case '首':
+ filename = 'zeishou';
+ break;
+ case '帅':
+ filename = 'zhushuai';
+ break;
+ case '将':
+ filename = 'dajiang';
+ if (_status.mode == 'three' || get.translation(this.player.side + 'Color') == 'wei') {
+ filename = 'zhushuai_blue';
+ checked = true;
+ }
+ break;
+ case '兵':
+ case '卒':
+ filename = this.player.side === false ? 'qianfeng_blue' : 'qianfeng';
+ checked = true;
+ break;
+ case '师':
+ filename = 'junshi';
+ break;
+ case '盟':
+ filename = 'mengjun';
+ break;
+ case '神':
+ filename = 'boss';
+ break;
+ case '从':
+ filename = 'suicong';
+ break;
+ default:
+ this.innerText = innerHTML;
+ this.style.visibility = '';
+ this.parentNode.style.backgroundImage = '';
+ return;
+ }
+
+ if (!checked && this.parentNode.dataset.color && !isExt) {
+ if (this.parentNode.dataset.color[0] == 'b') {
+ filename += '_blue';
+ this.player.classList.add('opposite-camp');
+ }
+ }
+
+ this.innerText = innerHTML;
+
+ if (decadeUI.config.campIdentityImageMode) {
+ this.style.visibility = 'hidden';
+ const image = new Image();
+ image.onerror = () => this.style.visibility = '';
+
+ if (isExt) image.src = filename;
+ else image.src = `${decadeUIPath}image/decoration/identity_${filename}.png`;
+
+ this.parentNode.style.backgroundImage = `url("${image.src}")`;
+ } else this.style.visibility = '';
+ }
+ });
+ Object.defineProperty(this.node.count, 'innerHTML', {
+ configurable: true,
+ get() {
+ return this.textContent;
+ },
+ set(innerHTML) {
+ if (this.textContent == innerHTML) return;
+
+ this.textContent = innerHTML;
+ this.dataset.text = innerHTML;
+ }
+ });
+ const campWrap = ui.create.div('.camp-wrap');
+ const hpWrap = ui.create.div('.hp-wrap');
+ this.insertBefore(campWrap, this.node.name);
+ this.insertBefore(hpWrap, this.node.hp);
+ this.node.campWrap = campWrap;
+ this.node.hpWrap = hpWrap;
+ hpWrap.appendChild(this.node.hp);
+ campWrap.node = {
+ back: ui.create.div('.camp-back', campWrap),
+ border: ui.create.div('.camp-border', campWrap),
+ campName: ui.create.div('.camp-name', campWrap),
+ avatarName: this.node.name,
+ avatarDefaultName: ui.create.div('.avatar-name-default', campWrap)
+ };
+ campWrap.appendChild(this.node.name);
+ campWrap.node.avatarName.className = 'avatar-name';
+ campWrap.node.avatarDefaultName.innerHTML = '主将';
+ this.node.mask = this.insertBefore(ui.create.div('.mask'), this.node.identity);
+ this.node.gainSkill = ui.create.div('.gain-skill', this);
+ this.node.gainSkill.player = this;
+ this.node.gainSkill.gain = function (skill) {
+ if (!this.skills) this.skills = [];
+
+ if (this.skills.includes(skill) || !lib.translate[skill]) return;
+
+ const info = lib.skill[skill];
+
+ if (!info || info.charlotte || info.sub || (info.mark && !info.limited) || (info.nopop || info.popup === false)) return;
+
+ if (info.onremove && game.me != this.player.storage[skill]) return;
+
+ this.skills.push(skill);
+ this.innerHTML = this.skills.reduce((html, senderSkill) => `${html}[${lib.translate[senderSkill]}]`, '');
+ };
+ this.node.gainSkill.lose = function (skill) {
+ const index = this.skills.indexOf(skill);
+
+ if (index == -1) return;
+
+ this.skills.splice(index, 1);
+ this.innerHTML = this.skills.reduce((html, senderSkill) => `${html}[${get.translation(senderSkill)}]`, '');
+ };
+ }
+ buildExtra() {
+ void 0;
+ }
+ $syncExpand() {
+ super.$syncExpand(...arguments);
+ const back = ui.equipSolts.back;
+
+ while (back.firstChild) {
+ back.removeChild(back.lastChild);
+ }
+
+ const numberOfSlots = 5 + Object.values(this.expandedSlots).reduce((numberOfExpandedSlots, numberOfExpandedSubtypeSlots) => numberOfExpandedSlots + numberOfExpandedSubtypeSlots, 0);
+
+ for (let repetition = 0; repetition < numberOfSlots; repetition++) {
+ back.appendChild(document.createElement('div'));
+ }
+ }
+ setSeatNum() {
+ super.setSeatNum(...arguments);
+ this.seat = this.getSeatNum();
+ this.node.seat.innerHTML = get.cnNumber(this.seat, true);
+ }
+ $init(character, character2) {
+ super.$init(...arguments);
+ this.doubleAvatar = (character2 && lib.character[character2]) != undefined;
+ let currentDynamic = decadeUI.CUR_DYNAMIC;
+ let maximumDynamic = decadeUI.MAX_DYNAMIC;
+
+ if (typeof currentDynamic != 'number') decadeUI.CUR_DYNAMIC = currentDynamic = 0;
+
+ if (typeof maximumDynamic != 'number') {
+ maximumDynamic = decadeUI.isMobile() ? 2 : 10;
+
+ if (window.OffscreenCanvas) maximumDynamic += 8;
+
+ decadeUI.MAX_DYNAMIC = maximumDynamic;
+ }
+
+ if (this.dynamic) this.stopDynamic();
+
+ const showDynamic = (this.dynamic || currentDynamic < maximumDynamic) && duicfg.dynamicSkin;
+
+ if (showDynamic && _status.mode != null) {
+ const dynamicSkins = decadeUI.dynamicSkin;
+ const avatars = this.doubleAvatar ? [character, character2] : [character];
+ let increased;
+ avatars.forEach(avatar => {
+ const skins = dynamicSkins[avatar];
+
+ if (!skins) return;
+
+ const keys = Object.keys(skins);
+
+ if (keys.length == 0) {
+ console.error(`player.init: ${avatar} 没有设置动皮参数`);
+ return;
+ }
+
+ const skin = skins[Object.keys(skins)[0]];
+
+ if (typeof skin.speed != 'number') skin.speed = 1;
+
+ this.playDynamic({
+ /**
+ * 骨骼文件名,一般是assets/dynamic 下的动皮文件,也可以使用.. 来寻找其他文件目录
+ * @type {string}
+ */
+ name: skin.name,
+ /**
+ * 播放动作 不填为默认
+ * @type {string}
+ */
+ action: skin.action,
+ /**
+ * 是否循环播放
+ * @type {boolean}
+ */
+ loop: true,
+ /**
+ * 循环次数,只有loop为true时生效
+ * @type {number}
+ */
+ loopCount: -1,
+ /**
+ * 播放速度
+ * @type {number}
+ */
+ speed: skin.speed,
+ /**
+ * 水平镜像
+ * @type {boolean}
+ */
+ filpX: null,
+ /**
+ * 垂直翻转
+ * @type {boolean}
+ */
+ filpY: null,
+ /**
+ * 0~1
+ *
+ * 不透明度
+ * @type {number}
+ */
+ opacity: null,
+ /**
+ * 相对于父节点坐标x,不填为居中
+ *
+ * (1) x: 10, 相当于 left: 10px;
+ *
+ * (2) x: [10, 0.5], 相当于 left: calc(50% + 10px);
+ * @type {number | [number, number]}
+ */
+ x: skin.x,
+ /**
+ * 相对于父节点坐标y,不填为居中
+ *
+ * (1) y: 10,相当于 top: 10px;
+ *
+ * (2) y: [10, 0.5],相当于 top: calc(50% + 10px);
+ * @type {number | [number, number]}
+ */
+ y: skin.y,
+ /**
+ * 缩放
+ * @type {number}
+ */
+ scale: skin.scale,
+ /**
+ * 角度
+ * @type {number}
+ */
+ angle: skin.angle,
+ /**
+ * 隐藏不需要的部件,想知道具体部件名称请使用SpineAltasSplit工具查看
+ */
+ hideSlots: skin.hideSlots,
+ /**
+ * 剪掉超出头的部件,仅针对露头动皮,其他勿用
+ */
+ clipSlots: skin.clipSlots,
+ }, i == 1);
+ this.$dynamicWrap.style.backgroundImage = `url("${decadeUIPath}assets/dynamic/${skin.background}")`;
+
+ if (increased) return;
+
+ increased = true;
+ decadeUI.CUR_DYNAMIC++;
+ });
+ }
+
+ let refreshPrefix;
+
+ if (character && duicfg.showJieMark) {
+ if (lib.characterPack.refresh) refreshPrefix = lib.characterPack.refresh[character];
+
+ if (!refreshPrefix) refreshPrefix = character.substr(0, 3);
+
+ if (refreshPrefix) {
+ refreshPrefix = lib.translate[character] && lib.translate[character][0];
+
+ if (refreshPrefix == '界') {
+ if (!this.$jieMark) this.$jieMark = dui.element.create('jie-mark', this);
+ else this.appendChild(this.$jieMark);
+ }
+ }
+ }
+
+ if (refreshPrefix == '界') {
+ let text = this.node.name.innerText;
+
+ if (text[1] == '\n') text = text.substr(2);
+ else text = text.substr(1);
+
+ this.node.name.innerText = text;
+ }
+
+ return this;
+ }
+ $uninit() {
+ if (this.$jieMark) this.$jieMark.remove();
+
+ this.stopDynamic();
+ this.doubleAvatar = false;
+ delete this.node.campWrap.dataset.camp;
+ const campName = this.node.campWrap.node.campName;
+
+ while (campName.firstChild) {
+ campName.removeChild(campName.lastChild);
+ }
+
+ campName.style.removeProperty('background-image');
+ super.$uninit(...arguments);
+ }
+ getState() {
+ const state = super.getState(...arguments);
+ state.seat = this.seat;
+ return state;
+ }
+ $update() {
+ const hpMax = this.maxHp;
+
+ if (this.hp >= hpMax) this.hp = hpMax;
+
+ const count = this.countCards('h');
+ const hp = this.hp;
+
+ if (!_status.video) {
+ if (this.hujia) this.markSkill('ghujia');
+ else this.unmarkSkill('ghujia');
+ }
+
+ const hpNode = this.node.hp;
+
+ if (!this.storage.nohp) {
+ if (hpMax > 5) {
+ hpNode.innerHTML = `${isNaN(hp) ? '×' : hp == Infinity ? '∞' : hp}
/
${(isNaN(hpMax) ? '×' : hpMax == Infinity ? '∞' : hpMax)}`;
+
+ if (hp == 0) hpNode.lastChild.classList.add('lost');
+
+ hpNode.classList.add('textstyle');
+ } else {
+ hpNode.innerHTML = '';
+ hpNode.classList.remove('textstyle');
+
+ while (hpMax > hpNode.childNodes.length) {
+ ui.create.div(hpNode);
+ }
+
+ while (hpNode.childNodes.length && hpMax < hpNode.childNodes.length) {
+ hpNode.lastChild.remove();
+ }
+
+ for (var i = 0; i < hpMax; i++) {
+ if (i < hp) hpNode.childNodes[i].classList.remove('lost');
+ else hpNode.childNodes[i].classList.add('lost');
+ }
+ }
+
+ if (hpNode.classList.contains('room')) hpNode.dataset.condition = 'high';
+ else if (hp == 0) hpNode.dataset.condition = '';
+ else if (hp > Math.round(hpMax / 2) || hp === hpMax) hpNode.dataset.condition = 'high';
+ else if (hp > Math.floor(hpMax / 3)) hpNode.dataset.condition = 'mid';
+ else hpNode.dataset.condition = 'low';
+ }
+
+ this.node.count.innerHTML = count;
+
+ if (count >= 10) this.node.count.dataset.condition = 'low';
+ else if (count > 5) this.node.count.dataset.condition = 'higher';
+ else if (count > 2) this.node.count.dataset.condition = 'high';
+ else if (count > 0) this.node.count.dataset.condition = 'mid';
+ else this.node.count.dataset.condition = 'none';
+
+ this.dataset.maxHp = hpMax;
+
+ if (this.updates) for (var i = 0; i < this.updates.length; i++) {
+ this.updates[i](this);
+ }
+
+ if (!_status.video) game.addVideo('update', this, [this.countCards('h'), this.hp, this.maxHp, this.hujia]);
+
+ this.updateMarks();
+ return this;
+ }
+ line(target, config) {
+ if (get.itemtype(target) == 'players') super.line(...arguments);
+ else if (get.itemtype(target) == 'player') {
+ if (target == this)
+ return;
+
+ var player = this;
+ game.broadcast(function (player, target, config) {
+ player.line(target, config);
+ }, player, target, config);
+ game.addVideo('line', player, [target.dataset.position, config]);
+
+ player.checkBoundsCache(true);
+ target.checkBoundsCache(true);
+ var x1, y1;
+ var x2, y2;
+ var hand = dui.boundsCaches.hand;
+ if (player == game.me) {
+ hand.check();
+ x1 = hand.x + hand.width / 2;
+ y1 = hand.y;
+ } else {
+ x1 = player.cacheLeft + player.cacheWidth / 2;
+ y1 = player.cacheTop + player.cacheHeight / 2;
+ }
+
+ if (target == game.me) {
+ hand.check();
+ x2 = hand.x + hand.width / 2;
+ y2 = hand.y;
+ } else {
+ x2 = target.cacheLeft + target.cacheWidth / 2;
+ y2 = target.cacheTop + target.cacheHeight / 2;
+ }
+
+ game.linexy([x1, y1, x2, y2], config, true);
+ }
+ }
+ setIdentity(identity) {
+ if (!identity) identity = this.identity;
+
+ if (get.mode() == 'guozhan') {
+ this.node.identity.dataset.color = identity;
+ if (identity == 'ye' && get.is.jun(this)) this.identity = identity = lib.character[this.name1][1];
+ this.group = identity;
+ this.node.identity.firstChild.innerHTML = get.translation(identity);
+ return this;
+ }
+
+ return super.setIdentity(identity);
+ }
+ chooseToRespond() {
+ const chooseToRespond = super.chooseToRespond(...arguments);
+ if (/^请打出.*张/.test(chooseToRespond.prompt)) delete chooseToRespond.prompt;
+ return chooseToRespond;
+ }
+ useCard() {
+ const useCard = super.useCard(...arguments);
+ useCard.pushHandler((event, option) => {
+ if (event.step == 0 && option.state == 'end') {
+ const player = event.player;
+ event.targets.forEach(current => {
+ if (current != player) current.classList.add('target');
+ });
+ } else if (event.finished) event.targets.forEach(current => {
+ const classList = current.classList;
+ if (classList.contains('target')) classList.remove('target');
+ });
+ });
+ return useCard;
+ }
+ directgain(cards) {
+ super.directgain(...arguments);
+
+ if (this == game.me) {
+ if (cards && cards.length) dui.layoutHandDraws(cards.reverse());
+
+ dui.queueNextFrameTick(dui.layoutHand, dui);
+ }
+
+ return this;
+ }
+ lose() {
+ const event = get.event(), lose = super.lose(...arguments);
+
+ if (event.name == 'useCard') {
+ lose.animate = true;
+ lose.blameEvent = event;
+ }
+
+ lose.pushHandler((event, option) => {
+ const step = event.step;
+
+ if (step == 0) {
+ const state = option.state;
+
+ if (state == 'begin') {
+ const playerCards = event.player.getCards('hejsx');
+ const cards = event.cards.filter(card => playerCards.includes(card));
+ game.broadcastAll(cards => cards.duiMod = true, cards);
+ cards.filter(card => playerCards.includes(card)).forEach(card => {
+ const parentNode = card.parentNode;
+
+ if (!parentNode) return;
+
+ const classList = parentNode.classList;
+
+ if (classList.contains('equips')) card.throwWith = 'e';
+ else if (classList.contains('judges')) card.throwWith = 'j';
+ else if (classList.contains('expansions')) card.throwWith = 'x';
+ else if (!classList.contains('handcards')) return;
+
+ if (card.classList.contains('glows')) card.throwWith = 's';
+ else card.throwWith = 'h';
+ });
+ }
+ else if (state == 'end') {
+ const parent = event.getParent();
+
+ if (!event.blameEvent && (parent.name != 'discard' || event.type != 'discard') && (parent.name != 'loseToDiscardpile' || event.type != 'loseToDiscardpile')) event.animate = false;
+ else if (typeof event.animate != 'boolean') {
+ const parentAnimate = parent.animate;
+
+ if (typeof parentAnimate == 'boolean') event.animate = parentAnimate;
+ }
+ }
+ } else if (step == 1 && option.state == 'end') {
+ event.cards.forEach(card => {
+ const style = card.style, transform = style.transform;
+
+ if (transform.endsWith(' scale(0.2)')) style.transform = transform.slice(0, -11);
+ });
+
+ if (event.player == game.me) dui.queueNextFrameTick(dui.layoutHand, dui);
+ }
+ });
+ return lose;
+ }
+ changeHp() {
+ const changeHp = super.changeHp(...arguments);
+ changeHp.pushHandler((event, option) => {
+ if (event.finished) dui.delay(68);
+ });
+ return changeHp;
+ }
+ equip() {
+ const equip = super.equip(...arguments);
+ equip.pushHandler((event, option) => {
+ if (event.step == 0 && option.state == 'end') {
+ const lose = event.next[0];
+ if (!lose || lose.name != 'lose') return;
+ lose.animate = true;
+ lose.blameEvent = event;
+ }
+ });
+ return equip;
+ }
+ prompt() {
+ super.prompt(...arguments);
+ const prompt = this.node.prompt;
+ prompt.dataset.text = prompt.innerText;
+ prompt.style.animation = 'open-fade-in 0.6s';
+ }
+ addSkill() {
+ const skill = super.addSkill(...arguments);
+
+ if (!Array.isArray(skill)) {
+ const character1 = lib.character[this.name];
+ const character2 = lib.character[this.name2];
+
+ if ((!character1 || !character1[3].includes(skill)) && (!character2 || !character2[3].includes(skill))) this.node.gainSkill.gain(skill);
+ }
+
+ return skill;
+ }
+ removeSkill() {
+ const skill = super.removeSkill(...arguments);
+
+ if (!Array.isArray(skill)) {
+ const gainSkill = this.node.gainSkill;
+ const skills = gainSkill.skills;
+
+ if (skills && skills.includes(skill)) gainSkill.lose(skill);
+ }
+
+ return skill;
+ }
+ $draw(num, init, config) {
+ if (game.chess)
+ return super.$draw(...arguments);
+
+ if (init !== false && init !== 'nobroadcast') {
+ game.broadcast(function (player, num, init, config) {
+ player.$draw(num, init, config);
+ }, this, num, init, config);
+ }
+
+ var cards;
+ var isDrawCard;
+ if (get.itemtype(num) == 'cards') {
+ cards = num.concat();
+ isDrawCard = true;
+ } else if (get.itemtype(num) == 'card') {
+ cards = [num];
+ isDrawCard = true;
+ } else if (typeof num == 'number') {
+ cards = new Array(num);
+ } else {
+ cards = new Array(1);
+ }
+
+ if (init !== false) {
+ if (isDrawCard) {
+ game.addVideo('drawCard', this, get.cardsInfo(cards));
+ } else {
+ game.addVideo('draw', this, num);
+ }
+ }
+
+ if (game.me == this)
+ return;
+
+ var fragment = document.createDocumentFragment();
+ var card;
+ for (var i = 0; i < cards.length; i++) {
+ card = cards[i];
+ if (card == null)
+ card = dui.element.create('card thrown drawingcard');
+ else
+ card = card.copy('thrown', 'drawingcard', false);
+
+ card.fixed = true;
+ cards[i] = card;
+ fragment.appendChild(card);
+ }
+
+ var player = this;
+ dui.layoutDrawCards(cards, player, true);
+ ui.arena.appendChild(fragment);
+ dui.queueNextFrameTick(function () {
+ dui.layoutDrawCards(cards, player);
+ dui.delayRemoveCards(cards, 460, 220);
+ });
+ }
+ $compare(card1, target, card2) {
+ game.broadcast(function (player, target, card1, card2) {
+ player.$compare(card1, target, card2);
+ }, this, target, card1, card2);
+ game.addVideo('compare', this, [get.cardInfo(card1), target.dataset.position, get.cardInfo(card2)]);
+ var player = this;
+ target.$throwordered2(card2.copy(false));
+ player.$throwordered2(card1.copy(false));
+ }
+ $throw(cards, time, record, nosource) {
+ var itemtype;
+ var duiMod = (cards.duiMod && game.me == this && !nosource);
+ if (typeof cards == 'number') {
+ itemtype = 'number';
+ cards = new Array(cards);
+ } else {
+ itemtype = get.itemtype(cards);
+ if (itemtype == 'cards') {
+ cards = cards.concat();
+ } else if (itemtype == 'card') {
+ cards = [cards];
+ } else {
+ return;
+ }
+ }
+
+ var card;
+ var clone;
+ var player = this;
+ var hand = dui.boundsCaches.hand;
+ hand.check();
+
+ for (var i = 0; i < cards.length; i++) {
+ card = cards[i];
+ if (card) {
+ clone = card.copy('thrown');
+ if (duiMod && (card.throwWith == 'h' || card.throwWith == 's')) {
+ clone.tx = Math.round(hand.x + card.tx);
+ clone.ty = Math.round(hand.y + 30 + card.ty);
+ clone.scaled = true;
+ clone.throwordered = true;
+ clone.style.transform = 'translate(' + clone.tx + 'px,' + clone.ty + 'px) scale(' + hand.cardScale + ')';
+ }
+ card = clone;
+ } else {
+ card = dui.element.create('card infohidden infoflip');
+ card.moveTo = lib.element.Card.prototype.moveTo;
+ card.moveDelete = lib.element.Card.prototype.moveDelete;
+ }
+
+ cards[i] = card;
+ }
+
+ if (record !== false) {
+ if (record !== 'nobroadcast') {
+ game.broadcast(function (player, cards, time, record, nosource) {
+ player.$throw(cards, time, record, nosource);
+ }, this, cards, 0, record, nosource);
+ }
+
+ game.addVideo('throw', this, [get.cardsInfo(cards), 0, nosource]);
+ }
+
+ if (duiMod && cards.length > 2) {
+ cards.sort(function (a, b) {
+ if (a.tx == undefined && b.tx == undefined)
+ return 0;
+
+ if (a.tx == undefined)
+ return duicfg.rightLayout ? -1 : 1;
+
+ if (b.tx == undefined)
+ return duicfg.rightLayout ? 1 : -1;
+
+ return b.tx - a.tx;
+ });
+ }
+
+ for (var i = 0; i < cards.length; i++)
+ player.$throwordered2(cards[i], nosource);
+
+ if (game.chess)
+ this.chessFocus();
+
+ return cards[cards.length - 1];
+ }
+ $throwordered2(card, nosource) {
+ if (_status.connectMode)
+ ui.todiscard = [];
+
+ if (card.throwordered == undefined) {
+ var x, y;
+ var bounds = dui.boundsCaches.arena;
+ if (!bounds.updated)
+ bounds.update();
+
+ this.checkBoundsCache();
+ if (nosource) {
+ x = ((bounds.width - bounds.cardWidth) / 2 - bounds.width * 0.08);
+ y = ((bounds.height - bounds.cardHeight) / 2);
+ } else {
+ x = ((this.cacheWidth - bounds.cardWidth) / 2 + this.cacheLeft);
+ y = ((this.cacheHeight - bounds.cardHeight) / 2 + this.cacheTop);
+ }
+
+ x = Math.round(x);
+ y = Math.round(y);
+
+ card.tx = x;
+ card.ty = y;
+ card.scaled = true;
+ card.classList.add('thrown');
+ card.style.transform = 'translate(' + x + 'px, ' + y + 'px)' + 'scale(' + bounds.cardScale + ')';
+ } else {
+ card.throwordered = undefined;
+ }
+
+ if (card.fixed)
+ return ui.arena.appendChild(card);
+
+ var before;
+ for (var i = 0; i < ui.thrown; i++) {
+ if (ui.thrown[i].parentNode == ui.arena) {
+ before = ui.thrown[i];
+ break;
+ }
+ }
+
+ var tagNode = card.querySelector('.used-info');
+ if (tagNode == null)
+ tagNode = card.appendChild(dui.element.create('used-info'));
+
+ card.$usedtag = tagNode;
+ ui.thrown.unshift(card);
+ if (before)
+ ui.arena.insertBefore(before, card);
+ else
+ ui.arena.appendChild(card);
+
+ dui.tryAddPlayerCardUseTag(card, this, _status.event);
+ dui.queueNextFrameTick(dui.layoutDiscard, dui);
+ return card;
+ }
+ $give(cards, target, log, record) {
+ var itemtype;
+ var duiMod = (cards.duiMod && game.me == target);
+ if (typeof cards == 'number') {
+ itemtype = 'number';
+ cards = new Array(cards);
+ } else {
+ itemtype = get.itemtype(cards);
+ if (itemtype == 'cards') {
+ cards = cards.concat();
+ } else if (itemtype == 'card') {
+ cards = [cards];
+ } else {
+ return;
+ }
+ }
+
+ if (record !== false) {
+ var cards2 = cards;
+ if (itemtype == 'number') {
+ cards2 = cards.length;
+ game.addVideo('give', this, [cards2, target.dataset.position]);
+ } else {
+ game.addVideo('giveCard', this, [get.cardsInfo(cards2), target.dataset.position]);
+ }
+
+ game.broadcast(function (source, cards2, target, record) {
+ source.$give(cards2, target, false, record);
+ }, this, cards2, target, record);
+ }
+
+ if (log != false) {
+ if (itemtype == 'number')
+ game.log(target, '从', this, '获得了' + get.cnNumber(cards.length) + '张牌');
+ else
+ game.log(target, '从', this, '获得了', cards);
+ }
+
+ if (this.$givemod) {
+ this.$givemod(cards, target);
+ return;
+ }
+
+ if (duiMod)
+ return;
+
+ var card;
+ var hand = dui.boundsCaches.hand;
+ hand.check();
+
+ var draws = [];
+ var player = this;
+ var fragment = document.createDocumentFragment();
+ for (var i = 0; i < cards.length; i++) {
+ card = cards[i];
+ if (card) {
+ var cp = card.copy('card', 'thrown', 'gainingcard', false);
+ var hs = player == game.me;
+ if (hs) {
+ if (card.throwWith)
+ hs = card.throwWith == 'h' || card.throwWith == 's';
+ else
+ hs = card.parentNode == player.node.handcards1;
+ }
+
+ if (hs) {
+ cp.tx = Math.round(hand.x + card.tx);
+ cp.ty = Math.round(hand.y + 30 + card.ty);
+ cp.scaled = true;
+ cp.style.transform = 'translate(' + cp.tx + 'px,' + cp.ty + 'px) scale(' + hand.cardScale + ')';
+ } else {
+ draws.push(cp);
+ }
+ card = cp;
+ } else {
+ card = dui.element.create('card thrown gainingcard');
+ draws.push(card);
+ }
+
+ cards[i] = card;
+ cards[i].fixed = true;
+ fragment.appendChild(cards[i]);
+ }
+
+ if (draws.length)
+ dui.layoutDrawCards(draws, player);
+
+ ui.arena.appendChild(fragment);
+ dui.queueNextFrameTick(function () {
+ dui.layoutDrawCards(cards, target);
+ dui.delayRemoveCards(cards, 460, 220);
+ });
+ }
+ $gain2(cards, log) {
+ var type = get.itemtype(cards);
+ if (type != 'cards') {
+ if (type != 'card')
+ return;
+
+ type = 'cards';
+ cards = [cards];
+ }
+
+ if (log === true)
+ game.log(this, '获得了', cards);
+
+ game.broadcast(function (player, cards) {
+ player.$gain2(cards);
+ }, this, cards);
+
+ var gains = [];
+ var draws = [];
+
+ var card;
+ var clone;
+ for (var i = 0; i < cards.length; i++) {
+ clone = cards[i].clone;
+ card = cards[i].copy('thrown', 'gainingcard');
+ card.fixed = true;
+ if (clone && clone.parentNode == ui.arena) {
+ card.scaled = true;
+ card.style.transform = clone.style.transform;
+ gains.push(card);
+ } else {
+ draws.push(card);
+ }
+ }
+
+ if (gains.length)
+ game.addVideo('gain2', this, get.cardsInfo(gains));
+
+ if (draws.length)
+ game.addVideo('drawCard', this, get.cardsInfo(draws));
+
+ if (cards.duiMod && this == game.me)
+ return;
+
+ cards = gains.concat(draws);
+ dui.layoutDrawCards(draws, this, true);
+
+ var player = this;
+ var fragment = document.createDocumentFragment();
+ for (var i = 0; i < cards.length; i++)
+ fragment.appendChild(cards[i]);
+
+ ui.arena.appendChild(fragment);
+ dui.queueNextFrameTick(function () {
+ dui.layoutDrawCards(cards, player);
+ dui.delayRemoveCards(cards, 460, 220);
+ });
+ }
+ $skill(name, type, color, avatar) {
+ if (!decadeUI.config.gameAnimationEffect || !decadeUI.animation.gl) return super.$skill(...arguments);
+ var _this = this;
+ if (typeof type != 'string') type = 'legend';
+
+ game.addVideo('skill', this, [name, type, color, avatar]);
+ game.broadcastAll(function (player, type, name, color, avatar) {
+ if (window.decadeUI == void 0) {
+ game.delay(2.5);
+ if (name) player.$fullscreenpop(name, color, avatar);
+ return;
+ }
+
+ decadeUI.delay(2500);
+ if (name) decadeUI.effect.skill(player, name, avatar);
+ }, _this, type, name, color, avatar);
+ }
+ $damagepop(num, nature, font, nobroadcast) {
+ if (typeof num == 'number' || typeof num == 'string') {
+ game.addVideo('damagepop', this, [num, nature, font]);
+ if (nobroadcast !== false) {
+ game.broadcast(function (player, num, nature, font) {
+ player.$damagepop(num, nature, font);
+ }, this, num, nature, font);
+ }
+
+ var node;
+ if (this.popupNodeCache && this.popupNodeCache.length) {
+ node = this.popupNodeCache.shift();
+ } else {
+ node = decadeUI.element.create('damage');
+ }
+
+ if (font) {
+ node.classList.add('normal-font');
+ } else {
+ node.classList.remove('normal-font');
+ }
+
+ if (typeof num == 'number') {
+ node.popupNumber = num;
+ if (num == Infinity) {
+ num = '+∞'
+ } else if (num == -Infinity) {
+ num = '-∞';
+ } else if (num > 0) {
+ num = '+' + num;
+ }
+
+ } else {
+ node.popupNumber = null;
+ }
+
+ node.innerHTML = num;
+ node.dataset.text = node.innerText;
+ node.nature = nature || 'soil';
+ this.damagepopups.push(node);
+ }
+
+ if (this.damagepopups.length && !this.damagepopLocked) {
+ var node = this.damagepopups.shift();
+ this.damagepopLocked = true;
+ if (this != node.parentNode) this.appendChild(node);
+
+ var player = this;
+ if (typeof node.popupNumber == 'number') {
+ var popupNum = node.popupNumber;
+ if (popupNum < 0) {
+ switch (node.nature) {
+ case 'thunder':
+ if (popupNum <= -2) {
+ decadeUI.animation.playSpine({ name: 'effect_shoujidonghua', action: 'play6' }, { scale: 0.8, parent: player });
+ } else {
+ decadeUI.animation.playSpine({ name: 'effect_shoujidonghua', action: 'play5' }, { scale: 0.8, parent: player });
+ }
+ break;
+ case 'fire':
+ if (popupNum <= -2) {
+ decadeUI.animation.playSpine({ name: 'effect_shoujidonghua', action: 'play4' }, { scale: 0.8, parent: player });
+ } else {
+ decadeUI.animation.playSpine({ name: 'effect_shoujidonghua', action: 'play3' }, { scale: 0.8, parent: player });
+ }
+ break;
+ case 'water':
+ break;
+ default:
+ if (popupNum <= -2) {
+ decadeUI.animation.playSpine({ name: 'effect_shoujidonghua', action: 'play2' }, { scale: 0.8, parent: player });
+ } else {
+ decadeUI.animation.playSpine({ name: 'effect_shoujidonghua', action: 'play1' }, { scale: 0.8, parent: player });
+ }
+ break;
+ }
+ } else {
+ if (node.nature == 'wood') {
+ decadeUI.animation.playSpine('effect_zhiliao', { scale: 0.7, parent: player });
+ }
+ }
+ }
+
+ node.style.animation = 'open-fade-in-out 1.2s';
+ setTimeout(function (player, node) {
+ if (!player.popupNodeCache) player.popupNodeCache = [];
+ node.style.animation = '';
+ player.popupNodeCache.push(node);
+ }, 1210, player, node);
+
+ setTimeout(function (player) {
+ player.damagepopLocked = false;
+ player.$damagepop();
+ }, 500, player);
+ }
+ }
+ $damage(source) {
+ if (get.itemtype(source) == 'player') {
+ game.addVideo('damage', this, source.dataset.position);
+ } else {
+ game.addVideo('damage', this);
+ }
+ game.broadcast(function (player, source) {
+ player.$damage(source);
+ }, this, source);
+
+ this.queueCssAnimation('player-hurt 0.3s');
+ }
+ $dieflip() {
+ if (!decadeUI.config.playerDieEffect) super.$dieflip(...arguments);
+ }
+ $phaseJudge(card) {
+ game.addVideo('phaseJudge', this, get.cardInfo(card));
+ this.$throw(card);
+ dui.delay(451);
+ }
+ $dieAfter() {
+ this.stopDynamic();
+
+ if (!decadeUI.config.playerDieEffect) {
+ if (super.$dieAfter) super.$dieAfter(...arguments);
+ return;
+ }
+
+ if (!this.node.dieidentity) this.node.dieidentity = ui.create.div('died-identity', this);
+ this.node.dieidentity.classList.add('died-identity');
+
+ var that = this;
+ var image = new Image();
+ var identity = decadeUI.getPlayerIdentity(this);
+ var url = decadeUIPath + 'image/decoration/dead_' + identity + '.png';
+ image.onerror = function () {
+ that.node.dieidentity.innerHTML = decadeUI.getPlayerIdentity(that, that.identity, true) + '
阵亡';
+ };
+
+ that.node.dieidentity.innerHTML = '';
+ that.node.dieidentity.style.backgroundImage = 'url("' + url + '")';
+ image.src = url;
+ setTimeout(function () {
+ var rect = that.getBoundingClientRect();
+ decadeUI.animation.playSpine('effect_zhenwang', {
+ x: rect.left + rect.width / 2 - 7,
+ y: decadeUI.get.bodySize().height - rect.top - rect.height / 2 + 1,
+ scale: 0.8,
+ });
+ }, 250);
+ }
+ setModeState(info) {
+ if (info && info.seat) {
+ if (!this.node.seat) this.node.seat = ui.create.div('.seat', this);
+
+ this.node.seat.innerHTML = get.cnNumber(info.seat, true);
+ }
+
+ return super.setModeState ? super.setModeState(...arguments) : this.init(info.name, info.name2);
+ }
+ checkBoundsCache(forceUpdate) {
+ var update;
+ var refer = dui.boundsCaches.arena;
+ refer.check();
+
+ if (this.cacheReferW != refer.width ||
+ this.cacheReferH != refer.height ||
+ this.cachePosition != this.dataset.position)
+ update = true;
+
+ this.cacheReferW = refer.width;
+ this.cacheReferH = refer.height;
+ this.cachePosition = this.dataset.position;
+ if (this.cacheLeft == null)
+ update = true;
+
+ if (update || forceUpdate) {
+ this.cacheLeft = this.offsetLeft;
+ this.cacheTop = this.offsetTop;
+ this.cacheWidth = this.offsetWidth;
+ this.cacheHeight = this.offsetHeight;
+ }
+ }
+ queueCssAnimation(animation) {
+ var current = this.style.animation;
+ var animations = this._cssanimations;
+ if (animations == undefined) {
+ animations = [];
+ this._cssanimations = animations;
+ this.addEventListener('animationend', function (e) {
+ if (this.style.animationName != e.animationName)
+ return;
+
+ var current = this.style.animation;
+ var animations = this._cssanimations;
+ while (animations.length) {
+ this.style.animation = animations.shift();
+ if (this.style.animation != current)
+ return;
+
+ animations.current = this.style.animation;
+ }
+
+ animations.current = '';
+ this.style.animation = '';
+ });
+ }
+
+ if (animations.current || animations.length) {
+ animations.push(animation);
+ return;
+ }
+
+ animations.current = animation;
+ this.style.animation = animation;
+ }
+ };
+ lib.element.Card = class extends lib.element.Card {
+ constructor(){
+ let card = super(...arguments);
+ Object.setPrototypeOf(card,lib.element.Card.prototype);
+ return card;
+ }
+ buildNode() {
+ super.buildNode();
+ const node = this.node;
+ this.removeChild(node.info);
+ const suitNumber = this.$suitnum = node.suitnum = ui.create.div('.suit-num', this);
+ this.$gaintag = node.gaintag = ui.create.div('.gaintag.info', this);
+ const judgeMark = node.judgeMark = ui.create.div('.judge-mark', this);
+ node.cardMask = ui.create.div('.card-mask', this);
+ this.$name = ui.create.div('.top-name', this);
+ this.$vertname = node.name;
+ const equip = this.$equip = node.name2;
+ this.$range = node.range;
+ const numberNode = suitNumber.$num = decadeUI.element.create(null, suitNumber, 'span');
+ numberNode.style.fontFamily = '"STHeiti","SimHei","Microsoft JhengHei","Microsoft YaHei","WenQuanYi Micro Hei",Helvetica,Arial,sans-serif';
+ const suitNode = suitNumber.$suit = decadeUI.element.create('suit', suitNumber, 'span');
+ suitNode.style.fontFamily = '"STHeiti","SimHei","Microsoft JhengHei","Microsoft YaHei","WenQuanYi Micro Hei",Helvetica,Arial,sans-serif';
+ equip.$suitnum = decadeUI.element.create(null, equip, 'span');
+ equip.$name = decadeUI.element.create(null, equip, 'span');
+ judgeMark.node = {
+ back: ui.create.div('.back', judgeMark),
+ mark: ui.create.div('.mark', judgeMark),
+ judge: ui.create.div('.judge', judgeMark)
+ };
+ }
+ $init() {
+ super.$init(...arguments);
+ const verticalName = this.$vertname;
+ this.$name.innerHTML = verticalName.innerHTML;
+ let cardNumber = this.number || '';
+ const parsedCardNumber = parseInt(cardNumber);
+
+ if (parsedCardNumber == cardNumber) cardNumber = parsedCardNumber;
+
+ switch (cardNumber) {
+ case 1:
+ this.$suitnum.$num.innerHTML = 'A';
+ break;
+ case 11:
+ this.$suitnum.$num.innerHTML = 'J';
+ break;
+ case 12:
+ this.$suitnum.$num.innerHTML = 'Q';
+ break;
+ case 13:
+ this.$suitnum.$num.innerHTML = 'K';
+ break;
+ default: this.$suitnum.$num.innerHTML = cardNumber.toString();
+ }
+
+ this.$suitnum.$suit.innerHTML = get.translation(this.dataset.suit = this.suit);
+ const equip = this.$equip;
+ const innerHTML = equip.innerHTML;
+ equip.$suitnum.innerHTML = innerHTML.slice(0, innerHTML.indexOf(' '));
+ equip.$name.innerHTML = innerHTML.slice(innerHTML.indexOf(' '));
+ const node = this.node;
+ const background = node.background;
+ node.judgeMark.node.judge.innerHTML = background.innerHTML;
+ const classList = background.classList;
+
+ if (classList.contains('tight')) classList.remove('tight');
+
+ const cardStyle = this.style;
+
+ if (cardStyle.color) cardStyle.removeProperty('color');
+
+ if (cardStyle.textShadow) cardStyle.removeProperty('text-shadow');
+
+ const info = node.info;
+ const infoStyle = info.style;
+
+ if (infoStyle.opacity) infoStyle.removeProperty('opacity');
+
+ const verticalNameStyle = verticalName.style;
+
+ if (verticalNameStyle.opacity) verticalNameStyle.removeProperty('opacity');
+
+ if (info.childElementCount) while (info.firstChild) {
+ info.removeChild(info.lastChild);
+ }
+
+ if (equip.childElementCount) while (equip.firstChild) {
+ equip.removeChild(equip.lastChild);
+ }
+
+ if (decadeUI.config.cardPrettify) {
+ const decadeExtCardImage = lib.decade_extCardImage || (lib.decade_extCardImage = {});
+ const cardNature = this.nature;
+ const cardName = this.name;
+ const fileName = cardNature ? `${cardName}_${get.natureList(cardNature).sort(lib.sort.nature).join('_')}` : cardName;
+ let decadeCardSource = decadeExtCardImage[fileName];
+ if (!decadeCardSource && cardName != fileName) decadeCardSource = decadeExtCardImage[cardName];
+
+ if (decadeCardSource) {
+ this.classList.add('decade-card');
+
+ if (!this.classList.contains('infohidden')) this.style.backgroundImage = `url('${this.decadeCardSource = decadeCardSource}')`;
+
+ const avatar = this.node.avatar;
+
+ if (avatar) avatar.remove();
+
+ const frameBackground = this.node.framebg;
+
+ if (frameBackground) frameBackground.remove();
+
+ new MutationObserver(mutationRecords => mutationRecords.forEach(mutationRecord => {
+ const target = mutationRecord.target;
+ const informationHidden = target.classList.contains('infohidden');
+
+ if (informationHidden == mutationRecord.oldValue.split(' ').includes('infohidden')) return;
+
+ if (informationHidden) target.style.removeProperty('background-image');
+ else target.style.backgroundImage = `url('${target.decadeCardSource}')`;
+ })).observe(this, {
+ attributeFilter: ['class'],
+ attributeOldValue: true
+ });
+ }
+ }
+
+ return this;
+ }
+ moveDelete(player) {
+ this.fixed = true;
+ this.moveTo(player);
+ setTimeout(function (card) {
+ card.delete();
+ }, 460, this);
+ }
+ moveTo(player) {
+ if (!player)
+ return;
+
+ var arena = dui.boundsCaches.arena;
+ if (!arena.updated)
+ arena.update();
+
+ player.checkBoundsCache();
+ this.fixed = true;
+ var x = Math.round((player.cacheWidth - arena.cardWidth) / 2 + player.cacheLeft);
+ var y = Math.round((player.cacheHeight - arena.cardHeight) / 2 + player.cacheTop);
+ var scale = arena.cardScale;
+
+ this.tx = x;
+ this.ty = y;
+ this.scaled = true;
+ this.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + scale + ')';
+ return this;
+ }
+ copy() {
+ const node = super.copy(...arguments);
+ node.decadeCardSource = this.decadeCardSource;
+
+ if (this.clone && node.classList.contains('decade-card')) new MutationObserver(mutationRecords => mutationRecords.forEach(mutationRecord => {
+ const target = mutationRecord.target, informationHidden = target.classList.contains('infohidden');
+
+ if (informationHidden == mutationRecord.oldValue.split(' ').includes('infohidden')) return;
+
+ if (informationHidden) target.style.removeProperty('background-image');
+ else target.style.backgroundImage = `url('${target.decadeCardSource}')`;
+ })).observe(node, {
+ attributeFilter: ['class'],
+ attributeOldValue: true
+ });
+
+ return node;
+ }
+ };
+ lib.element.GameEvent = class extends lib.element.GameEvent {
+ addMessageHook(message, callback) {
+ if (this._messages == undefined)
+ this._messages = {};
+
+ message = message.toLowerCase();
+ if (this._messages[message] == undefined)
+ this._messages[message] = [];
+
+ message = this._messages[message];
+ message.push(callback);
+ }
+ triggerMessage(message) {
+ if (this._messages == undefined)
+ return;
+
+ message = message.toLowerCase();
+ if (this._messages[message] == undefined)
+ return;
+
+ message = this._messages[message];
+ for (var i = 0; i < message.length; i++) {
+ if (typeof message[i] == 'function')
+ message[i].call(this);
+ }
+
+ this._messages[message] = [];
+ }
+ };
+ lib.element.Dialog = class extends lib.element.Dialog {
+ constructor() {
+ const dialog = super(...arguments);
+ dialog.bar1.remove();
+ delete dialog.bar1;
+ dialog.bar2.remove();
+ delete dialog.bar2;
+ Object.setPrototypeOf(dialog,lib.element.Dialog.prototype);
+ return dialog;
+ }
+ };
+ Mixin.replace(
+ 'lib.element.Dialog.prototype.add | lib.element.dialog.add',
+ /(?=\s*this\s*\.\s*buttons\s*=\s*this\s*\.\s*buttons\s*\.\s*concat\s*\(\s*ui\s*\.\s*create\s*\.\s*buttons\s*\(\s*item\s*\[\s*0\s*\]\s*,\s*item\[\s*1\s*\]\s*,\s*buttons\s*,\s*noclick\s*\)\s*\)\s*;)/,
+ function (item, buttons) {
+ if (typeof item[1] == 'string' && item[1].includes('character')) {
+ if (this.intersection == undefined && self.IntersectionObserver) this.intersection = new IntersectionObserver((intersectionObserverEntries, intersectionObserver) => intersectionObserverEntries.forEach(intersectionObserverEntry => {
+ if (intersectionObserverEntry.intersectionRatio <= 0) return;
+
+ const target = intersectionObserverEntry.target;
+ target.setBackground(target.awaitItem, 'character');
+ intersectionObserver.unobserve(target);
+ }), {
+ root: this,
+ rootMargin: '0px',
+ thresholds: 0.01,
+ });
+ buttons.intersection = this.intersection;
+ }
+ }
+ );
+ Mixin.replace(
+ 'lib.skill._discard.content',
+ /(?=\s*var\s*todiscard\s*=\s*ui\s*\.\s*todiscard\s*\[\s*id\s*\]\s*;)/,
+ () => {
+ if (window.decadeUI) {
+ ui.todiscard = [];
+ ui.clear();
+ return;
+ }
+ }
+ );
+ const uiCreateIdentityCard = ui.create.identityCard;
+ ui.create.identityCard = function (identity) {
+ const identityCard = uiCreateIdentityCard(...arguments);
+ const decadeExtCardImage = lib.decade_extCardImage || (lib.decade_extCardImage = {});
+ const decadeCardSource = decadeExtCardImage[`identity_${identity}`];
+
+ if (decadeCardSource) {
+ identityCard.classList.add('decade-card');
+
+ if (!identityCard.classList.contains('infohidden')) identityCard.style.backgroundImage = `url('${identityCard.decadeCardSource = decadeCardSource}')`;
+
+ const avatar = identityCard.node.avatar;
+
+ if (avatar) avatar.remove();
+
+ const frameBackground = identityCard.node.framebg;
+
+ if (frameBackground) frameBackground.remove();
+
+ new MutationObserver(mutationRecords => mutationRecords.forEach(mutationRecord => {
+ const target = mutationRecord.target;
+ const informationHidden = target.classList.contains('infohidden');
+
+ if (informationHidden == mutationRecord.oldValue.split(' ').includes('infohidden')) return;
+
+ if (informationHidden) target.style.removeProperty('background-image');
+ else target.style.backgroundImage = `url('${target.decadeCardSource}')`;
+ })).observe(identityCard, {
+ attributeFilter: ['class'],
+ attributeOldValue: true
+ });
+ }
+
+ return identityCard;
+ }
+ ui.updateRoundNumber = (roundNumber, cardPileNumber) => {
+ if (ui.cardPileNumber && window.decadeUI) ui.cardPileNumber.textContent = `牌堆${cardPileNumber} 第${roundNumber}轮`;
+ };
+ },
+ dialog: {
+ create: function (className, parentNode, tagName) {
+ var element = !tagName ? document.createElement('div') : document.createElement(tagName);
+ for (var i in decadeUI.dialog) {
+ if (decadeUI.dialog[i]) element[i] = decadeUI.dialog[i];
+ }
+
+ element.listens = {};
+ for (var i in decadeUI.dialog.listens) {
+ if (decadeUI.dialog.listens[i]) element.listens[i] = decadeUI.dialog.listens[i];
+ }
+
+ element.listens._dialog = element;
+ element.listens._list = [];
+
+ if (className) element.className = className;
+ if (parentNode) parentNode.appendChild(element);
+
+ return element;
+ },
+ open: function () {
+ if (this == decadeUI.dialog) return console.error('undefined');
+ },
+ show: function () {
+ if (this == decadeUI.dialog) return console.error('undefined');
+
+ this.classList.remove('hidden');
+ },
+ hide: function () {
+ if (this == decadeUI.dialog) return console.error('undefined');
+
+ this.classList.add('hidden');
+ },
+ animate: function (property, duration, toArray, fromArrayOptional) {
+ if (this == decadeUI.dialog) return console.error('undefined');
+ if (property == null || duration == null || toArray == null) return console.error('arguments');
+
+ var propArray = property.replace(/\s*/g, '').split(',');
+ if (!propArray || propArray.length == 0) return console.error('property');
+
+ var realDuration = 0;
+ if (duration.lastIndexOf('s') != -1) {
+ if (duration.lastIndexOf('ms') != -1) {
+ duration = duration.replace(/ms/, '');
+ duration = parseInt(duration);
+ if (isNaN(duration)) return console.error('duration');
+ realDuration = duration;
+ } else {
+ duration = duration.replace(/s/, '');
+ duration = parseFloat(duration);
+ if (isNaN(duration)) return console.error('duration');
+ realDuration = duration * 1000;
+ }
+ } else {
+ duration = parseInt(duration);
+ if (isNaN(duration)) return console.error('duration');
+ realDuration = duration;
+ }
+
+ if (fromArrayOptional) {
+ for (var i = 0; i < propArray.length; i++) {
+ this.style.setProperty(propArray[i], fromArrayOptional[i]);
+ }
+ }
+
+ var duraBefore = this.style.transitionDuration;
+ var propBefore = this.style.transitionProperty;
+ this.style.transitionDuration = realDuration + 'ms';
+ this.style.transitionProperty = property;
+
+ ui.refresh(this);
+ for (var i = 0; i < propArray.length; i++) {
+ this.style.setProperty(propArray[i], toArray[i]);
+ }
+
+ var restore = this;
+ setTimeout(function () {
+ restore.style.transitionDuration = duraBefore;
+ restore.style.transitionProperty = propBefore;
+ }, realDuration);
+ },
+ close: function (delayTime, fadeOut) {
+ if (this == decadeUI.dialog) return console.error('undefined');
+ this.listens.clear();
+
+ if (!this.parentNode) return;
+
+ if (fadeOut === true && delayTime) {
+ this.animate('opacity', delayTime, 0);
+ }
+
+ if (delayTime) {
+ var remove = this;
+ delayTime = (typeof delayTime == 'number') ? delayTime : parseInt(delayTime);
+ setTimeout(function () {
+ if (remove.parentNode) remove.parentNode.removeChild(remove);
+ }, delayTime);
+ return;
+ }
+
+ this.parentNode.removeChild(this);
+ return;
+ },
+ listens: {
+ add: function (listenElement, event, func, useCapture) {
+ if (!this._dialog || !this._list) return console.error('undefined');
+ if (!(listenElement instanceof HTMLElement) || !event || (typeof func !== 'function')) return console.error('arguments');
+
+ this._list.push(new Array(listenElement, event, func));
+ listenElement.addEventListener(event, func);
+ },
+ remove: function (listenElementOptional, eventOptional, funcOptional) {
+ if (!this._dialog || !this._list) return console.error('undefined');
+
+ var list = this._list;
+ if (listenElementOptional && eventOptional && funcOptional) {
+ var index = list.indexOf(new Array(listenElementOptional, eventOptional, funcOptional));
+ if (index != -1) {
+ list[index][0].removeEventListener(list[index][1], list[index][2]);
+ list.splice(index, 1);
+ return;
+ }
+ } else if (listenElementOptional && eventOptional) {
+ for (var i = list.length - 1; i >= 0; i--) {
+ if (list[i][0] == listenElementOptional && list[i][1] == eventOptional) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list.splice(i, 1);
+ }
+ }
+ } else if (listenElementOptional && funcOptional) {
+ for (var i = list.length - 1; i >= 0; i--) {
+ if (list[i][0] == listenElementOptional && list[i][2] == funcOptional) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list.splice(i, 1);
+ }
+ }
+ } else if (eventOptional && funcOptional) {
+ for (var i = list.length - 1; i >= 0; i--) {
+ if (list[i][1] == eventOptional && list[i][2] == funcOptional) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list.splice(i, 1);
+ }
+ }
+ } else if (listenElementOptional) {
+ for (var i = list.length - 1; i >= 0; i--) {
+ if (list[i][0] == listenElementOptional) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list.splice(i, 1);
+ }
+ }
+ } else if (eventOptional) {
+ for (var i = list.length - 1; i >= 0; i--) {
+ if (list[i][1] == eventOptional) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list.splice(i, 1);
+ }
+ }
+ } else if (funcOptional) {
+ for (var i = list.length - 1; i >= 0; i--) {
+ if (list[i][2] == funcOptional) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list.splice(i, 1);
+ }
+ }
+ }
+ },
+ clear: function () {
+ if (!this._dialog || !this._list) return console.error('undefined');
+
+ var list = this._list;
+ for (var i = list.length - 1; i >= 0; i--) {
+ list[i][0].removeEventListener(list[i][1], list[i][2]);
+ list[i] = undefined;
+ }
+ list.length = 0;
+ }
+ }
+ },
+ animate: {
+ check: function () {
+ if (!ui.arena) return false;
+ if (this.updates == undefined) this.updates = [];
+ if (this.canvas == undefined) {
+ this.canvas = ui.arena.appendChild(document.createElement('canvas'));
+ this.canvas.id = 'decadeUI-canvas-arena';
+ }
+
+ return true;
+ },
+ add: function (frameFunc) {
+ if (typeof frameFunc != 'function') return;
+ if (!this.check()) return;
+
+ var obj = {
+ inits: [],
+ update: frameFunc,
+ id: decadeUI.getRandom(0, 100),
+ };
+
+ if (arguments.length > 2) {
+ obj.inits = new Array(arguments.length - 2);
+ for (var i = 2; i < arguments.length; i++) {
+ obj.inits[i - 2] = arguments[i];
+ }
+ }
+
+ this.updates.push(obj);
+ if (this.frameId == undefined) this.frameId = requestAnimationFrame(this.update.bind(this));
+ },
+ update: function () {
+ var frameTime = performance.now();
+ var delta = frameTime - (this.frameTime == undefined ? frameTime : this.frameTime);
+
+ this.frameTime = frameTime;
+ var e = {
+ canvas: this.canvas,
+ context: this.canvas.getContext('2d'),
+ deltaTime: delta,
+ save: function () {
+ this.context.save();
+ return this.context;
+ },
+ restore: function () {
+ this.context.restore();
+ return this.context;
+ },
+ drawLine: function (x1, y1, x2, y2, color, lineWidth) {
+ if (x1 == null || y1 == null) throw 'arguments';
+
+ var context = this.context;
+ context.beginPath();
+
+ if (color) context.strokeStyle = color;
+ if (lineWidth) context.lineWidth = lineWidth;
+
+ if (x2 == null || y2 == null) {
+ context.lineTo(x1, y1);
+ } else {
+ context.moveTo(x1, y1);
+ context.lineTo(x2, y2);
+ }
+
+ context.stroke();
+ },
+ drawRect: function (x, y, width, height, color, lineWidth) {
+ if (x == null || y == null || width == null || height == null) throw 'arguments';
+
+ var ctx = this.context;
+ ctx.beginPath();
+
+ if (color) ctx.strokeStyle = color;
+ if (lineWidth) ctx.lineWidth = lineWidth;
+ ctx.rect(x, y, width, height);
+ ctx.stroke();
+ },
+ drawText: function (text, font, color, x, y, textAlign, textBaseline, stroke) {
+ if (!text) return;
+ if (x == null || y == null) throw 'x or y';
+ var context = this.context;
+
+ if (font) context.font = font;
+ if (textAlign) context.textAlign = textAlign;
+ if (textBaseline) context.textBaseline = textBaseline;
+ if (color) {
+ if (!stroke) context.fillStyle = color;
+ else context.strokeStyle = color;
+ }
+
+ if (!stroke) context.fillText(text, x, y);
+ else context.strokeText(text, x, y);
+ },
+ drawStrokeText: function (text, font, color, x, y, textAlign, textBaseline) {
+ this.drawText(text, font, color, x, y, textAlign, textBaseline, true);
+ },
+ fillRect: function (x, y, width, height, color) {
+ if (color) this.context.fillStyle = color;
+ this.context.fillRect(x, y, width, height);
+ },
+ }
+
+ if (!decadeUI.dataset.animSizeUpdated) {
+ decadeUI.dataset.animSizeUpdated = true;
+ e.canvas.width = e.canvas.parentNode.offsetWidth;
+ e.canvas.height = e.canvas.parentNode.offsetHeight;
+ }
+
+ e.canvas.height = e.canvas.height;
+ var args;
+ var task;
+ for (var i = 0; i < this.updates.length; i++) {
+ task = this.updates[i];
+ args = Array.from(task.inits);
+ args.push(e);
+ e.save();
+ if (task.update.apply(task, args)) {
+ this.updates.remove(task); i--;
+ }
+ e.restore();
+ }
+
+ if (this.updates.length == 0) {
+ this.frameId = undefined;
+ this.frameTime = undefined;
+ return;
+ }
+
+ this.frameId = requestAnimationFrame(this.update.bind(this));
+ },
+ },
+ ResizeSensor: (function () {
+ function ResizeSensor(element) {
+ this.element = element;
+ this.width = element.clientWidth || 1;
+ this.height = element.clientHeight || 1;
+ this.maximumWidth = 10000 * (this.width);
+ this.maximumHeight = 10000 * (this.height);
+ this.events = [];
+
+ var expand = document.createElement('div');
+ expand.style.cssText = 'position:absolute;top:0;bottom:0;left:0;right:0;z-index=-10000;overflow:hidden;visibility:hidden;transition:all 0s;';
+ var shrink = expand.cloneNode(false);
+
+ var expandChild = document.createElement('div');
+ expandChild.style.cssText = 'transition: all 0s !important; animation: none !important;';
+ var shrinkChild = expandChild.cloneNode(false);
+
+ expandChild.style.width = this.maximumWidth + 'px';
+ expandChild.style.height = this.maximumHeight + 'px';
+ shrinkChild.style.width = '250%';
+ shrinkChild.style.height = '250%';
+
+ expand.appendChild(expandChild);
+ shrink.appendChild(shrinkChild);
+ element.appendChild(expand);
+ element.appendChild(shrink);
+ if (expand.offsetParent != element) {
+ element.style.position = 'relative';
+ }
+
+ expand.scrollTop = shrink.scrollTop = this.maximumHeight;
+ expand.scrollLeft = shrink.scrollLeft = this.maximumWidth;
+
+ var sensor = this;
+ sensor.onscroll = function (e) {
+ sensor.w = sensor.element.clientWidth || 1;
+ sensor.h = sensor.element.clientHeight || 1;
+
+ if (sensor.w != sensor.width || sensor.h != sensor.height) {
+ sensor.width = sensor.w;
+ sensor.height = sensor.h;
+ sensor.dispatchEvent();
+ }
+
+ expand.scrollTop = shrink.scrollTop = sensor.maximumHeight;
+ expand.scrollLeft = shrink.scrollLeft = sensor.maximumWidth;
+ };
+
+ expand.addEventListener('scroll', sensor.onscroll);
+ shrink.addEventListener('scroll', sensor.onscroll);
+ sensor.expand = expand;
+ sensor.shrink = shrink;
+ }
+
+ ResizeSensor.prototype.addListener = function (callback, capture) {
+ if (this.events == undefined) this.events = [];
+ this.events.push({
+ callback: callback,
+ capture: capture,
+ });
+ };
+
+ ResizeSensor.prototype.dispatchEvent = function () {
+ var capture = true;
+ var evt;
+
+ for (var i = 0; i < this.events.length; i++) {
+ evt = this.events[i];
+ if (evt.capture) {
+ evt.callback();
+ } else {
+ capture = false;
+ }
+ }
+
+ if (!capture) {
+ requestAnimationFrame(this.dispatchFrameEvent.bind(this));
+ }
+ };
+
+ ResizeSensor.prototype.dispatchFrameEvent = function () {
+ var evt;
+ for (var i = 0; i < this.events.length; i++) {
+ evt = this.events[i];
+ if (!evt.capture)
+ evt.callback();
+ }
+ };
+
+ ResizeSensor.prototype.close = function () {
+ this.expand.removeEventListener('scroll', this.onscroll);
+ this.shrink.removeEventListener('scroll', this.onscroll);
+
+ if (!this.element) {
+ this.element.removeChild(this.expand);
+ this.element.removeChild(this.shrink);
+ }
+
+ this.events = null;
+ };
+
+ return ResizeSensor;
+ })(),
+ sheet: {
+ init: function () {
+ if (!this.sheetList) {
+ this.sheetList = [];
+ for (var i = 0; i < document.styleSheets.length; i++) {
+ if (document.styleSheets[i].href && document.styleSheets[i].href.indexOf('extension/' + encodeURI(decadeUIName)) != -1) {
+ this.sheetList.push(document.styleSheets[i]);
+ }
+ }
+ }
+
+ if (this.sheetList) delete this.init;
+ },
+ getStyle: function (selector, cssName) {
+ if (!this.sheetList) this.init();
+ if (!this.sheetList) throw 'sheet not loaded';
+ if ((typeof selector != 'string') || !selector) throw 'parameter "selector" error';
+ if (!this.cachedSheet) this.cachedSheet = {};
+ if (this.cachedSheet[selector]) return this.cachedSheet[selector];
+
+
+ var sheetList = this.sheetList;
+ var sheet;
+ var shouldBreak = false;
+
+ for (var j = sheetList.length - 1; j >= 0; j--) {
+ if (typeof cssName == 'string') {
+ cssName = cssName.replace(/.css/, '') + '.css';
+ for (var k = j; k >= 0; k--) {
+ if (sheetList[k].href.indexOf(cssName) != -1) {
+ sheet = sheetList[k];
+ }
+ }
+
+ shouldBreak = true;
+ if (!sheet) throw 'cssName not found';
+ } else {
+ sheet = sheetList[j];
+ }
+
+ for (var i = 0; i < sheet.cssRules.length; i++) {
+ if (!(sheet.cssRules[i] instanceof CSSMediaRule)) {
+ if (sheet.cssRules[i].selectorText == selector) {
+ this.cachedSheet[selector] = sheet.cssRules[i].style;
+ return sheet.cssRules[i].style;
+ }
+ } else {
+ var rules = sheet.cssRules[i].cssRules;
+ for (var j = 0; j < rules.length; j++) {
+ if (rules[j].selectorText == selector) {
+ return rules[j].style;
+ }
+ }
+ }
+ }
+
+
+ if (shouldBreak) break;
+ }
+
+ return null;
+ },
+ insertRule: function (rule, index, cssName) {
+ if (!this.sheetList) this.init();
+ if (!this.sheetList) throw 'sheet not loaded';
+ if ((typeof rule != 'string') || !rule) throw 'parameter "rule" error';
+
+ var sheet;
+ if (typeof cssName == 'string') {
+ for (var j = sheetList.length - 1; j >= 0; j--) {
+ cssName = cssName.replace(/.css/, '') + '.css';
+ if (sheetList[j].href.indexOf(cssName) != -1) {
+ sheet = sheetList[k];
+ }
+ }
+
+ if (!sheet) throw 'cssName not found';
+ }
+
+ if (!sheet) sheet = this.sheetList[this.sheetList.length - 1];
+ var inserted = 0;
+ if (typeof index == 'number') {
+ inserted = sheet.insertRule(rule, index);
+ } else {
+ inserted = sheet.insertRule(rule, sheet.cssRules.length);
+ }
+
+ return sheet.cssRules[inserted].style;
+ }
+ },
+ layout: {
+ update: function () {
+ this.updateHand();
+ this.updateDiscard();
+
+ },
+ updateHand: function () {
+ if (!game.me)
+ return;
+
+ var handNode = ui.handcards1;
+ if (!handNode)
+ return console.error('hand undefined');
+
+ var card;
+ var cards = [];
+ var childs = handNode.childNodes;
+ for (var i = 0; i < childs.length; i++) {
+ card = childs[i];
+ if (!card.classList.contains('removing')) {
+ cards.push(card);
+ } else {
+ card.scaled = false;
+ }
+ }
+
+ if (!cards.length)
+ return;
+
+ var bounds = dui.boundsCaches.hand;
+ bounds.check();
+
+ var pw = bounds.width;
+ var ph = bounds.height;
+ var cw = bounds.cardWidth;
+ var ch = bounds.cardHeight;
+ var cs = bounds.cardScale;
+
+ var csw = cw * cs;
+ var x;
+ var y = Math.round((ch * cs - ch) / 2);
+
+ var xMargin = csw + 2;
+ var xStart = (csw - cw) / 2;
+ var totalW = cards.length * csw + (cards.length - 1) * 2;
+ var limitW = pw;
+ var expand;
+
+ if (totalW > limitW) {
+ xMargin = csw - Math.abs(limitW - csw * cards.length) / (cards.length - 1);
+ if (lib.config.fold_card) {
+ var foldCardMinWidth = lib.config['extension_十周年UI_foldCardMinWidth'];
+ var min = cs;
+ if (foldCardMinWidth == 'cardWidth') {
+ min *= cw;
+ } else {
+ min *= (foldCardMinWidth && foldCardMinWidth.length ? parseInt(foldCardMinWidth) : 81);
+ }
+ if (xMargin < min) {
+ expand = true;
+ xMargin = min;
+ }
+ }
+ } else {
+ xStart += (limitW - totalW) / 2;
+ }
+
+ var card;
+ for (var i = 0; i < cards.length; i++) {
+ x = Math.round(xStart + i * xMargin);
+ card = cards[i];
+ card.tx = x;
+ card.ty = y;
+ card.scaled = true;
+ card.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + cs + ')';
+ card._transform = card.style.transform;
+ }
+
+ if (expand) {
+ ui.handcards1Container.style.overflowX = 'scroll';
+ ui.handcards1Container.style.overflowY = 'hidden';
+ handNode.style.width = Math.round(cards.length * xMargin + (csw - xMargin)) + 'px';
+ } else {
+ ui.handcards1Container.style.overflowX = '';
+ ui.handcards1Container.style.overflowY = '';
+ handNode.style.width = '100%';
+ }
+ },
+ updateDiscard: function () {
+ if (!ui.thrown)
+ ui.thrown = [];
+
+ for (var i = ui.thrown.length - 1; i >= 0; i--) {
+ if (ui.thrown[i].classList.contains('drawingcard') ||
+ ui.thrown[i].classList.contains('removing') ||
+ ui.thrown[i].parentNode != ui.arena || ui.thrown[i].fixed) {
+ ui.thrown.splice(i, 1);
+ } else {
+ ui.thrown[i].classList.remove('removing');
+ }
+ }
+
+ if (!ui.thrown.length)
+ return;
+
+ var cards = ui.thrown;
+ var bounds = dui.boundsCaches.arena;
+ bounds.check();
+
+ var pw = bounds.width;
+ var ph = bounds.height;
+ var cw = bounds.cardWidth;
+ var ch = bounds.cardHeight;
+ var cs = bounds.cardScale;
+
+ var csw = cw * cs;
+ var x;
+ var y = Math.round((ph - ch) / 2);
+
+ var xMargin = csw + 2;
+ var xStart = (csw - cw) / 2;
+ var totalW = cards.length * csw + (cards.length - 1) * 2;
+ var limitW = pw;
+
+ if (totalW > limitW) {
+ xMargin = csw - Math.abs(limitW - csw * cards.length) / (cards.length - 1);
+ } else {
+ xStart += (limitW - totalW) / 2;
+ }
+
+ var card;
+ for (var i = 0; i < cards.length; i++) {
+ x = Math.round(xStart + i * xMargin);
+ card = cards[i];
+ card.tx = x;
+ card.ty = y;
+ card.scaled = true;
+ card.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + cs + ')';
+ }
+ },
+ clearout: function (card) {
+ if (!card)
+ return;
+
+ if (card.fixed || card.classList.contains('removing'))
+ return;
+
+ if (ui.thrown.indexOf(card) == -1) {
+ ui.thrown.splice(0, 0, card);
+ dui.queueNextFrameTick(dui.layoutDiscard, dui);
+ }
+
+ card.classList.add('invalided');
+ setTimeout(function (card) {
+ card.remove();
+ dui.queueNextFrameTick(dui.layoutDiscard, dui);
+ }, 2333, card);
+ },
+ delayClear: function () {
+ var timestamp = 500;
+ var nowTime = new Date().getTime();
+ if (this._delayClearTimeout) {
+ clearTimeout(this._delayClearTimeout);
+ timestamp = nowTime - this._delayClearTimeoutTime;
+ if (timestamp > 1000) {
+ this._delayClearTimeout = null;
+ this._delayClearTimeoutTime = null;
+ ui.clear();
+ return;
+ }
+ } else {
+ this._delayClearTimeoutTime = nowTime;
+ }
+
+ this._delayClearTimeout = setTimeout(function () {
+ decadeUI.layout._delayClearTimeout = null;
+ decadeUI.layout._delayClearTimeoutTime = null;
+ ui.clear();
+ }, timestamp);
+ },
+ invalidate: function () {
+ this.invalidateHand();
+ this.invalidateDiscard();
+ },
+ invalidateHand: function (debugName) {
+ //和上下面的有点重复,有空合并
+ var timestamp = 40;
+ var nowTime = new Date().getTime();
+ if (this._handcardTimeout) {
+ clearTimeout(this._handcardTimeout);
+ timestamp = nowTime - this._handcardTimeoutTime;
+ if (timestamp > 180) {
+ this._handcardTimeout = null;
+ this._handcardTimeoutTime = null;
+ this.updateHand();
+ return;
+ }
+ } else {
+ this._handcardTimeoutTime = nowTime;
+ }
+
+ this._handcardTimeout = setTimeout(function () {
+ decadeUI.layout._handcardTimeout = null;
+ decadeUI.layout._handcardTimeoutTime = null;
+ decadeUI.layout.updateHand();
+ }, timestamp);
+ },
+ invalidateDiscard: function () {
+ var timestamp = (ui.thrown && ui.thrown.length > 15) ? 80 : 40;
+ var nowTime = new Date().getTime();
+ if (this._discardTimeout) {
+ clearTimeout(this._discardTimeout);
+ timestamp = nowTime - this._discardTimeoutTime;
+ if (timestamp > 180) {
+ this._discardTimeout = null;
+ this._discardTimeoutTime = null;
+ this.updateDiscard();
+ return;
+ }
+ } else {
+ this._discardTimeoutTime = nowTime;
+ }
+
+ this._discardTimeout = setTimeout(function () {
+ decadeUI.layout._discardTimeout = null;
+ decadeUI.layout._discardTimeoutTime = null;
+ decadeUI.layout.updateDiscard();
+ }, timestamp);
+ },
+ resize: function () {
+ if (decadeUI.isMobile()) {
+ ui.arena.classList.add('dui-mobile');
+ ui.window.classList.add('dui-mobile');
+ }
+ else {
+ ui.arena.classList.remove('dui-mobile');
+ ui.window.classList.remove('dui-mobile');
+ }
+
+ var set = decadeUI.dataset;
+ set.animSizeUpdated = false;
+ set.bodySize.updated = false;
+
+ var caches = decadeUI.boundsCaches;
+ for (var key in caches)
+ caches[key].updated = false;
+
+ var buttonsWindow = decadeUI.sheet.getStyle('#window > .dialog.popped .buttons:not(.smallzoom)');
+ if (!buttonsWindow) {
+ buttonsWindow = decadeUI.sheet.insertRule('#window > .dialog.popped .buttons:not(.smallzoom) { zoom: 1; }');
+ }
+
+ var buttonsArena = decadeUI.sheet.getStyle('#arena:not(.choose-character) .buttons:not(.smallzoom)');
+ if (!buttonsArena) {
+ buttonsArena = decadeUI.sheet.insertRule('#arena:not(.choose-character) .buttons:not(.smallzoom) { zoom: 1; }');
+ }
+
+ decadeUI.zooms.card = decadeUI.getCardBestScale();
+ if (ui.me) {
+ var height = Math.round(decadeUI.getHandCardSize().height * decadeUI.zooms.card + 30.4) + 'px';
+ ui.me.style.height = height;
+ }
+
+ if (buttonsArena) {
+ buttonsArena.zoom = decadeUI.zooms.card;
+ }
+
+ if (buttonsWindow) {
+ buttonsWindow.zoom = decadeUI.zooms.card;
+ }
+
+ decadeUI.layout.invalidate();
+ },
+
+ },
+ handler: {
+ handMousewheel: function (e) {
+ if (!ui.handcards1Container) return console.error('ui.handcards1Container');
+
+ var hand = ui.handcards1Container;
+ if (hand.scrollNum == void 0) hand.scrollNum = 0;
+ if (hand.lastFrameTime == void 0) hand.lastFrameTime = performance.now();
+
+ function handScroll() {
+ var now = performance.now();
+ var delta = now - hand.lastFrameTime;
+ var num = Math.round(delta / 16 * 16);
+ hand.lastFrameTime = now;
+
+ if (hand.scrollNum > 0) {
+ num = Math.min(hand.scrollNum, num);
+ hand.scrollNum -= num;
+ } else {
+ num = Math.min(-hand.scrollNum, num);
+ hand.scrollNum += num;
+ num = -num;
+ }
+
+ if (hand.scrollNum == 0) {
+ hand.frameId = void 0;
+ hand.lastFrameTime = void 0;
+ } else {
+ hand.frameId = requestAnimationFrame(handScroll);
+ ui.handcards1Container.scrollLeft += num;
+ }
+ }
+
+ if (e.wheelDelta > 0) {
+ hand.scrollNum -= 84;
+ } else {
+ hand.scrollNum += 84;
+ }
+
+ if (hand.frameId == void 0) {
+ hand.frameId = requestAnimationFrame(handScroll);
+ }
+ },
+ touchScroll: function (e) {
+ if (_status.mousedragging) return;
+ if (_status.draggingtouchdialog) return;
+ if (!_status.dragged) {
+ if (Math.abs(e.touches[0].clientX / game.documentZoom - this.startX) > 10 ||
+ Math.abs(e.touches[0].clientY / game.documentZoom - this.startY) > 10) {
+ _status.dragged = true;
+ }
+ }
+ if ((this == ui.handcards1Container || this == ui.handcards2Container) && !this.style.overflowX == 'scroll') {
+ e.preventDefault();
+ } else if (lib.device == 'ios' && this.scrollHeight <= this.offsetHeight + 5 && this.scrollWidth <= this.offsetWidth + 5) {
+ e.preventDefault();
+ } else {
+ delete _status._swipeorigin;
+ e.stopPropagation();
+ }
+ },
+ },
+ zooms: {
+ body: 1,
+ card: 1,
+ },
+ isMobile: function () {
+ return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|OperaMini/i.test(navigator.userAgent));
+ },
+ delay: function (milliseconds) {
+ if (typeof milliseconds != 'number') throw 'milliseconds is not number';
+ if (_status.paused) return;
+ game.pause();
+ _status.timeout = setTimeout(game.resume, milliseconds);
+ },
+
+ queueNextTick: function (callback, ctx) {
+ if (!dui._tickEntries)
+ dui._tickEntries = [];
+
+ dui._tickEntries.push({
+ ctx: ctx,
+ callback: callback
+ });
+
+ if (dui._queueTick)
+ return;
+
+ dui._queueTick = Promise.resolve().then(function () {
+ dui._queueTick = null;
+ var entries = dui._tickEntries;
+ dui._tickEntries = [];
+ for (var i = 0; i < entries.length; i++)
+ entries[i].callback.call(entries[i].ctx);
+ });
+ },
+ queueNextFrameTick: function (callback, ctx) {
+ if (!dui._frameTickEntries)
+ dui._frameTickEntries = [];
+
+ dui._frameTickEntries.push({
+ ctx: ctx,
+ callback: callback
+ });
+
+ if (dui._queueFrameTick)
+ return;
+
+ dui._queueFrameTick = requestAnimationFrame(function () {
+ dui._queueFrameTick = null;
+ setTimeout(function (entries) {
+ for (var i = 0; i < entries.length; i++)
+ entries[i].callback.call(entries[i].ctx);
+
+ }, 0, dui._frameTickEntries);
+ dui._frameTickEntries = [];
+ })
+ },
+
+ layoutHand: function () {
+ dui.layout.updateHand();
+ },
+
+ layoutHandDraws: function (cards) {
+ var bounds = dui.boundsCaches.hand;
+ bounds.check();
+
+ var x, y;
+ var pw = bounds.width;
+ var ph = bounds.height;
+ var cw = bounds.cardWidth;
+ var ch = bounds.cardHeight;
+ var cs = bounds.cardScale;
+ var csw = cw * cs;
+ var xStart, xMargin;
+
+ var draws = [];
+ var card;
+ var clone;
+ var source = cards.duiMod;
+ if (source && source != game.me) {
+ source.checkBoundsCache();
+ xMargin = 27;
+ xStart = source.cacheLeft - bounds.x - csw / 2 - (cw - csw) / 2;
+ var totalW = xMargin * cards.length + (csw - xMargin);
+ var limitW = source.cacheWidth + csw;
+ if (totalW > limitW) {
+ xMargin = csw - Math.abs(limitW - csw * cards.length) / (cards.length - 1);
+ } else {
+ xStart += (limitW - totalW) / 2;
+ }
+
+ y = Math.round((source.cacheTop - bounds.y - 30 + (source.cacheHeight - ch) / 2));
+ for (var i = 0; i < cards.length; i++) {
+ x = Math.round(xStart + i * xMargin);
+ card = cards[i];
+ card.tx = x;
+ card.ty = y;
+ card.fixed = true;
+ card.scaled = true;
+ card.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + cs + ')';
+ }
+ return;
+ } else {
+ for (var i = 0; i < cards.length; i++) {
+ card = cards[i];
+ clone = card.clone;
+ if (clone && !clone.fixed && clone.parentNode == ui.arena) {
+ x = Math.round(clone.tx - bounds.x);
+ y = Math.round(clone.ty - (bounds.y + 30));
+ card.tx = x;
+ card.ty = y;
+ card.scaled = true;
+ card.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + cs + ')';
+ } else {
+ draws.push(card);
+ }
+ }
+ }
+
+ y = Math.round(-ch * cs * 2);
+ xMargin = csw * 0.5;
+ xStart = (pw - xMargin * (draws.length + 1)) / 2 - (cw - csw) / 2;
+
+ for (var i = 0; i < draws.length; i++) {
+ x = Math.round(xStart + i * xMargin);
+ card = draws[i];
+ card.tx = x;
+ card.ty = y;
+ card.scaled = true;
+ card.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + cs + ')';
+ }
+ },
+
+ layoutDrawCards: function (cards, player, center) {
+ var bounds = dui.boundsCaches.arena;
+ if (!bounds.updated)
+ bounds.update();
+
+ player.checkBoundsCache();
+ var playerX = player.cacheLeft;
+ var playerY = player.cacheTop;
+ var playerW = player.cacheWidth;
+ var playerH = player.cacheHeight;
+
+ var pw = bounds.width;
+ var ph = bounds.height;
+ var cw = bounds.cardWidth;
+ var ch = bounds.cardHeight;
+ var cs = bounds.cardScale;
+ var csw = cw * cs;
+
+ var xMargin = 27;
+ var xStart = (center ? (pw - playerW) / 2 : playerX) - csw / 2 - (cw - csw) / 2;
+ var totalW = xMargin * cards.length + (csw - xMargin);
+ var limitW = playerW + csw;
+
+ if (totalW > limitW) {
+ xMargin = csw - Math.abs(limitW - csw * cards.length) / (cards.length - 1);
+ } else {
+ xStart += (limitW - totalW) / 2;
+ }
+
+ var x;
+ var y;
+ if (center)
+ y = Math.round((ph - ch) / 2);
+ else
+ y = Math.round(playerY + (playerH - ch) / 2);
+
+ var card;
+ for (var i = 0; i < cards.length; i++) {
+ x = Math.round(xStart + i * xMargin);
+ card = cards[i];
+ card.tx = x;
+ card.ty = y;
+ card.scaled = true;
+ card.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + cs + ')';
+ }
+ },
+
+ layoutDiscard: function () {
+ dui.layout.updateDiscard();
+ },
+
+ delayRemoveCards: function (cards, delay, delay2) {
+ if (!Array.isArray(cards))
+ cards = [cards];
+
+ setTimeout(function (cards, delay2) {
+ var remove = function (cards) {
+ for (var i = 0; i < cards.length; i++)
+ cards[i].remove();
+ };
+
+ if (delay2 == null) {
+ remove(cards);
+ return;
+ }
+
+ for (var i = 0; i < cards.length; i++)
+ cards[i].classList.add('removing');
+
+ setTimeout(remove, delay2, cards)
+ }, delay, cards, delay2)
+ },
+
+ tryAddPlayerCardUseTag: function (card, player, event) {
+ if (!card)
+ return;
+
+ if (!player)
+ return;
+
+ if (!event)
+ return;
+
+ var noname;
+ var tagText = '';
+ var tagNode = card.querySelector('.used-info');
+ if (tagNode == null)
+ tagNode = card.appendChild(dui.element.create('used-info'));
+
+ card.$usedtag = tagNode;
+
+ if (event.blameEvent)
+ event = event.blameEvent;
+
+ switch (event.name.toLowerCase()) {
+ case 'usecard':
+ if (event.targets.length == 1) {
+ if (event.targets[0] == player)
+ tagText = '对自己';
+ else
+ tagText = '对' + get.translation(event.targets[0]);
+ } else {
+ tagText = '使用';
+ }
+ case 'respond':
+ if (tagText == '')
+ tagText = '打出';
+
+ var cardname = event.card.name;
+ var cardnature = event.card.nature;
+ if ((lib.config.cardtempname != 'off') && (card.name != cardname || !get.is.sameNature(card.nature, cardnature, true))) {
+ if (!card._tempName) card._tempName = ui.create.div('.temp-name', card);
+
+ var tempname = get.translation(cardname);
+ if (cardnature) {
+ card._tempName.dataset.nature = cardnature;
+ if (cardname == 'sha') {
+ tempname = get.translation(cardnature) + tempname;
+ }
+ }
+
+
+ card._tempName.textContent = tempname;
+ card._tempName.tempname = tempname;
+ }
+
+ if (duicfg.cardUseEffect && event.card && (!event.card.cards || event.card.cards.length == 1)) {
+ var name = event.card.name;
+ var nature = event.card.nature;
+
+ switch (name) {
+ case 'effect_caochuanjiejian':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_caochuanjiejian');
+ break;
+ case 'sha':
+ switch (nature) {
+ case 'thunder':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_leisha');
+ break;
+ case 'fire':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_huosha');
+ break;
+ default:
+ if (get.color(card) == 'red') {
+ decadeUI.animation.cap.playSpineTo(card, 'effect_hongsha');
+ } else {
+ decadeUI.animation.cap.playSpineTo(card, 'effect_heisha');
+ }
+ break;
+ }
+ break;
+ case 'shan':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_shan');
+ break;
+ case 'tao':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_tao', { scale: 0.9 });
+ break;
+ case 'tiesuo':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_tiesuolianhuan', { scale: 0.9 });
+ break;
+ case 'jiu':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_jiu', { y: [-30, 0.5] });
+ break;
+ case 'kaihua':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_shushangkaihua');
+ break;
+ case 'wuzhong':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_wuzhongshengyou');
+ break;
+ case 'wuxie':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_wuxiekeji', { y: [10, 0.5], scale: 0.9 });
+ break;
+ // case 'nanman':
+ // decadeUI.animation.cap.playSpineTo(card, 'effect_nanmanruqin', { scale: 0.45 });
+ // break;
+ case 'wanjian':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_wanjianqifa', { scale: 0.78 });
+ break;
+ case 'wugu':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_wugufengdeng', { y: [10, 0.5] });
+ break;
+ // case 'taoyuan':
+ // decadeUI.animation.cap.playSpineTo(card, 'effect_taoyuanjieyi', { y:[10, 0.5] });
+ // break;
+ case 'shunshou':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_shunshouqianyang');
+ break;
+ case 'huogong':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_huogong', { x: [8, 0.5], scale: 0.5 });
+ break;
+ case 'guohe':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_guohechaiqiao', { y: [10, 0.5] });
+ break;
+ case 'yuanjiao':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_yuanjiaojingong');
+ break;
+ case 'zhibi':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_zhijizhibi');
+ break;
+ case 'zhulu_card':
+ decadeUI.animation.cap.playSpineTo(card, 'effect_zhulutianxia');
+ break;
+ }
+ }
+ break;
+ case 'useskill':
+ tagText = '发动';
+ break;
+ case 'die':
+ tagText = '弃置';
+ card.classList.add('invalided');
+ dui.layout.delayClear();
+ break;
+ case 'lose':
+ if (event.parent && event.parent.name == 'discard' && event.parent.parent) {
+ var skillEvent = event.parent.parent.parent;
+ if (skillEvent) {
+ tagText = lib.translate[skillEvent.name != 'useSkill' ? skillEvent.name : skillEvent.skill];
+ if (!tagText)
+ tagText = '';
+
+ tagText += '弃置';
+ break;
+ }
+ }
+ case 'discard':
+ tagText = '弃置';
+ break;
+ case 'phaseJudge':
+ tagText = '即将生效';
+ break;
+ case 'judge':
+ noname = true;
+ tagText = event.judgestr + '的判定牌';
+ event.addMessageHook('judgeResult', function () {
+ var event = this;
+ var card = event.result.card.clone;
+ var apcard = event.apcard;
+
+ var tagText = '';
+ var tagNode = card.querySelector('.used-info');
+ if (tagNode == null)
+ tagNode = card.appendChild(dui.element.create('used-info'));
+
+ var action;
+ var judgeValue;
+ var getEffect = event.judge2;
+ if (getEffect) {
+ judgeValue = getEffect(event.result);
+ } else {
+ judgeValue = decadeUI.get.judgeEffect(event.judgestr, event.result.judge);
+ }
+
+ if ((typeof judgeValue == 'boolean')) {
+ judgeValue = judgeValue ? 1 : -1;
+ } else {
+ judgeValue = event.result.judge;
+ }
+
+ if (judgeValue >= 0) {
+ action = 'play4';
+ tagText = '判定生效';
+ } else {
+ action = 'play5';
+ tagText = '判定失效';
+ }
+
+ if (apcard && apcard._ap)
+ apcard._ap.stopSpineAll();
+ if (apcard && apcard._ap && apcard == card) {
+ apcard._ap.playSpine({
+ name: 'effect_panding',
+ action: action
+ });
+ } else {
+ decadeUI.animation.cap.playSpineTo(card, {
+ name: 'effect_panding',
+ action: action
+ });
+ }
+
+ event.apcard = undefined;
+ tagNode.textContent = get.translation(event.judgestr) + tagText;
+ });
+
+ if (duicfg.cardUseEffect) {
+ decadeUI.animation.cap.playSpineTo(card, {
+ name: 'effect_panding',
+ action: 'play',
+ loop: true
+ });
+
+ event.apcard = card;
+ }
+ break;
+ default:
+ tagText = get.translation(event.name);
+ if (tagText == event.name)
+ tagText = '';
+ break;
+ }
+
+ tagNode.textContent = (noname ? '' : get.translation(player)) + tagText;
+ },
+
+ getRandom: function (min, max) {
+ if (min == null) {
+ min = -2147483648;
+ }
+
+ if (max == null) {
+ max = 2147483648;
+ }
+
+ if (min > max) {
+ min = min + max;
+ max = min - max;
+ min = min - max;
+ }
+
+ var diff = 0;
+ if (min < 0) {
+ diff = min;
+ min = 0;
+ max -= diff;
+ }
+
+ return Math.floor(Math.random() * (max + 1 - min)) + min + diff;
+ },
+ getCardBestScale: function (size) {
+ if (!(size && size.height)) size = decadeUI.getHandCardSize();
+
+ var bodySize = decadeUI.get.bodySize();
+ return Math.min(bodySize.height * (decadeUI.isMobile() ? 0.23 : 0.18) / size.height, 1);
+ },
+ getHandCardSize: function (canUseDefault) {
+ var style = decadeUI.sheet.getStyle('.media_defined > .card');
+ if (style == null) style = decadeUI.sheet.getStyle('.hand-cards > .handcards > .card');
+ if (style == null) return canUseDefault ? { width: 108, height: 150 } : { width: 0, height: 0 };
+ var size = { width: parseFloat(style.width), height: parseFloat(style.height) };
+ return size;
+ },
+ getMapElementPos: function (elementFrom, elementTo) {
+ if (!(elementFrom instanceof HTMLElement) || !(elementTo instanceof HTMLElement)) return console.error('arguments');
+ var rectFrom = elementFrom.getBoundingClientRect();
+ var rectTo = elementTo.getBoundingClientRect();
+ var pos = { x: rectFrom.left - rectTo.left, y: rectFrom.top - rectTo.top };
+ pos.left = pos.x;
+ pos.top = pos.y;
+ return pos;
+ },
+ getPlayerIdentity: function (player, identity, chinese, isMark) {
+ if (!(player instanceof HTMLElement && get.itemtype(player) == 'player')) throw 'player';
+ if (!identity) identity = player.identity;
+
+
+ var mode = get.mode();
+ var translated = false;
+ if (!chinese) {
+ switch (mode) {
+ case 'identity': case 'huanhuazhizhan':
+ if (!player.isAlive() || player.identityShown || player == game.me) {
+ identity = (player.special_identity ? player.special_identity : identity).replace(/identity_/, '');
+ }
+
+ break;
+
+ case 'guozhan':
+ if (identity == 'unknown') {
+ identity = player.wontYe() ? lib.character[player.name1][1] : 'ye';
+ }
+
+ if (get.is.jun(player)) identity += 'jun';
+ break;
+
+ case 'versus':
+ if (!game.me) break;
+ switch (_status.mode) {
+ case 'standard':
+ switch (identity) {
+ case 'trueZhu': return 'shuai';
+ case 'trueZhong': return 'bing';
+ case 'falseZhu': return 'jiang';
+ case 'falseZhong': return 'zu';
+ }
+ break;
+ case 'three':
+ case 'four':
+ case 'guandu':
+ if (get.translation(player.side + 'Color') == 'wei') identity += '_blue';
+ break;
+
+ case 'two':
+ var side = player.finalSide ? player.finalSide : player.side;
+ identity = game.me.side == side ? 'friend' : 'enemy';
+ break;
+ }
+
+ break;
+ case 'doudizhu':
+ identity = identity == 'zhu' ? 'dizhu' : 'nongmin';
+ break;
+ case 'boss':
+ switch (identity) {
+ case 'zhu': identity = 'boss'; break;
+ case 'zhong': identity = 'cong'; break;
+ case 'cai': identity = 'meng'; break;
+ }
+ break;
+ }
+ } else {
+ switch (mode) {
+ case 'identity': case 'huanhuazhizhan':
+ if (identity.indexOf('cai') < 0) {
+ if (isMark) {
+ if (player.special_identity) identity = player.special_identity + '_bg';
+ } else {
+ identity = player.special_identity ? player.special_identity : identity + '2';
+ }
+ }
+
+ // ok
+ break;
+
+ case 'guozhan':
+ if (identity == 'unknown') {
+ identity = player.wontYe() ? lib.character[player.name1][1] : 'ye';
+ }
+
+ if (get.is.jun(player)) {
+ identity = isMark ? '君' : get.translation(identity) + '君';
+ } else {
+ identity = identity == 'ye' ? '野心家' : (identity == 'qun' ? '群雄' : get.translation(identity) + '将');
+ }
+ translated = true;
+ break;
+
+ case 'versus':
+ translated = true;
+ if (!game.me) break;
+ switch (_status.mode) {
+ case 'three':
+ case 'standard':
+ case 'four':
+ case 'guandu':
+ switch (identity) {
+ case 'zhu': identity = '主公'; break;
+ case 'zhong': identity = '忠臣'; break;
+ case 'fan': identity = '反贼'; break;
+ default: translated = false; break;
+ }
+ break;
+
+ case 'two':
+ var side = player.finalSide ? player.finalSide : player.side;
+ identity = game.me.side == side ? '友方' : '敌方';
+ break;
+
+ case 'siguo':
+ case 'jiange':
+ identity = get.translation(identity) + '将';
+ break;
+
+ default:
+ translated = false;
+ break;
+ }
+ break;
+
+ case 'doudizhu':
+ identity += '2';
+ break;
+ case 'boss':
+ translated = true;
+ switch (identity) {
+ case 'zhu': identity = 'BOSS'; break;
+ case 'zhong': identity = '仆从'; break;
+ case 'cai': identity = '盟军'; break;
+ default: translated = false; break;
+ }
+ break;
+ }
+
+ if (!translated) identity = get.translation(identity);
+ if (isMark) identity = identity[0];
+ }
+
+ return identity;
+ },
+
+ create: {
+ skillDialog: function () {
+ var dialog = document.createElement('div');
+ dialog.className = 'skill-dialog';
+
+ var extend = {
+ caption: undefined,
+ tip: undefined,
+
+ open: function (customParent) {
+ if (!customParent) {
+ var size = decadeUI.get.bodySize();
+ this.style.minHeight = (parseInt(size.height * 0.42)) + 'px';
+ if (this.parentNode != ui.arena) ui.arena.appendChild(this);
+ }
+
+ this.style.animation = 'open-dialog 0.4s';
+ return this;
+ },
+ show: function () {
+ this.style.animation = 'open-dialog 0.4s';;
+ },
+ hide: function () {
+ this.style.animation = 'close-dialog 0.1s forwards';
+ },
+ close: function () {
+ var func = function (e) {
+ if (e.animationName != 'close-dialog') return;
+ this.remove();
+ this.removeEventListener('animationend', func);
+ };
+
+ var animation = 'close-dialog';
+ if (this.style.animationName == animation) {
+ setTimeout(function (dialog) {
+ dialog.remove();
+ }, 100, this);
+ } else {
+ this.style.animation = animation + ' 0.1s forwards';
+ this.addEventListener('animationend', func);
+ }
+ },
+
+ appendControl: function (text, clickFunc) {
+ var control = document.createElement('div');
+ control.className = 'control-button';
+ control.textContent = text;
+ if (clickFunc) {
+ control.addEventListener('click', clickFunc);
+ }
+
+ return this.$controls.appendChild(control);
+ },
+
+ $caption: decadeUI.element.create('caption', dialog),
+ $content: decadeUI.element.create('content', dialog),
+ $tip: decadeUI.element.create('tip', dialog),
+ $controls: decadeUI.element.create('controls', dialog),
+ }; decadeUI.get.extend(dialog, extend);
+
+ Object.defineProperties(dialog, {
+ caption: {
+ configurable: true,
+ get: function () {
+ return this.$caption.innerHTML;
+ },
+ set: function (value) {
+ if (this.$caption.innerHTML == value) return;
+ this.$caption.innerHTML = value;
+ },
+ },
+ tip: {
+ configurable: true,
+ get: function () {
+ return this.$tip.innerHTML;
+ },
+ set: function (value) {
+ if (this.$tip.innerHTML == value) return;
+ this.$tip.innerHTML = value;
+ },
+ },
+ });
+
+ return dialog;
+ },
+
+ compareDialog: function (player, target) {
+ var dialog = decadeUI.create.skillDialog();
+ dialog.classList.add('compare');
+ dialog.$content.classList.add('buttons');
+
+ var extend = {
+ player: undefined,
+ target: undefined,
+ playerCard: undefined,
+ targetCard: undefined,
+
+ $player: decadeUI.element.create('player-character player1', dialog.$content),
+ $target: decadeUI.element.create('player-character player2', dialog.$content),
+ $playerCard: decadeUI.element.create('player-card', dialog.$content),
+ $targetCard: decadeUI.element.create('target-card', dialog.$content),
+ $vs: decadeUI.element.create('vs', dialog.$content),
+ }; decadeUI.get.extend(dialog, extend);
+
+ decadeUI.element.create('image', dialog.$player),
+ decadeUI.element.create('image', dialog.$target),
+
+ Object.defineProperties(dialog, {
+ player: {
+ configurable: true,
+ get: function () {
+ return this._player;
+ },
+ set: function (value) {
+ if (this._player == value) return;
+ this._player = value;
+
+ if (value == null || value.isUnseen()) {
+ this.$player.firstChild.style.backgroundImage = '';
+ } else {
+ this.$player.firstChild.style.backgroundImage = (value.isUnseen(0) ? value.node.avatar2 : value.node.avatar).style.backgroundImage;
+ }
+
+ if (value) this.$playerCard.dataset.text = `${get.translation(value).replace(/
/g, '\n')}发起`;
+ },
+ },
+ target: {
+ configurable: true,
+ get: function () {
+ return this._target;
+ },
+ set: function (value) {
+ if (this._target == value) return;
+ this._target = value;
+ if (value == null || value.isUnseen()) {
+ this.$target.firstChild.style.backgroundImage = '';
+ } else {
+ this.$target.firstChild.style.backgroundImage = (value.isUnseen(0) ? value.node.avatar2 : value.node.avatar).style.backgroundImage;
+ }
+
+ if (value) this.$targetCard.dataset.text = get.translation(value).replace(/
/g, '\n');
+ },
+ },
+ playerCard: {
+ configurable: true,
+ get: function () {
+ return this._playerCard;
+ },
+ set: function (value) {
+ if (this._playerCard == value) return;
+ if (this._playerCard) this._playerCard.remove();
+ this._playerCard = value;
+ if (value) this.$playerCard.appendChild(value);
+ },
+ },
+ targetCard: {
+ configurable: true,
+ get: function () {
+ return this._targetCard;
+ },
+ set: function (value) {
+ if (this._targetCard == value) return;
+ if (this._targetCard) this._targetCard.remove();
+ this._targetCard = value;
+ if (value) this.$targetCard.appendChild(value);
+ },
+ },
+ });
+
+ if (player) dialog.player = player;
+ if (target) dialog.target = target;
+
+ return dialog;
+ },
+
+ },
+
+ get: {
+
+
+ judgeEffect: function (name, value) {
+ switch (name) {
+ case 'caomu': case '草木皆兵':
+ case 'fulei': case '浮雷':
+ case 'shandian': case '闪电':
+ case 'bingliang': case '兵粮寸断':
+ case 'lebu': case '乐不思蜀':
+ return value < 0 ? true : false;
+ }
+
+ return value;
+ },
+
+ isWebKit: function () {
+ return document.body.style.webkitBoxShadow !== undefined;
+ },
+
+ lerp: function (min, max, fraction) {
+ return (max - min) * fraction + min;
+ },
+
+ ease: function (fraction) {
+ if (!decadeUI.get._bezier3) decadeUI.get._bezier3 = new duilib.CubicBezierEase(0.25, 0.1, 0.25, 1);
+ return decadeUI.get._bezier3.ease(fraction);
+ },
+
+ extend: function (target, source) {
+ if (source === null || typeof source !== 'object') return target;
+
+ var keys = Object.keys(source);
+ var i = keys.length;
+ while (i--) {
+ target[keys[i]] = source[keys[i]];
+ }
+
+ return target;
+ },
+
+ bodySize: function () {
+ var size = decadeUI.dataset.bodySize;
+ if (!size.updated) {
+ var body = document.body;
+ size.updated = true;
+ size.height = body.clientHeight;
+ size.width = body.clientWidth;
+ }
+
+ return size;
+ },
+
+ bestValueCards: function (cards, player) {
+ if (!player) player = _status.event.player;
+
+ var matchs = [];
+ var basics = [];
+ var equips = [];
+ var hasEquipSkill = player.hasSkill('xiaoji');
+ cards.sort(function (a, b) {
+ return get.value(b, player) - get.value(a, player);
+ });
+
+ for (var i = 0; i >= 0 && i < cards.length; i++) {
+ var limited = false;
+ switch (get.type(cards[i])) {
+ case 'basic':
+ for (var j = 0; j < basics.length; j++) {
+ if (!cards[i].toself && basics[j].name == cards[i].name) {
+ limited = true;
+ break;
+ }
+ }
+
+ if (!limited) basics.push(cards[i]);
+ break;
+
+ case 'equip':
+ if (hasEquipSkill) break;
+ for (var j = 0; j < equips.length; j++) {
+ if (get.subtype(equips[j]) == get.subtype(cards[i])) {
+ limited = true;
+ break;
+ }
+ }
+
+ if (!limited) equips.push(cards[i]);
+ break;
+ }
+
+ if (!limited) {
+ matchs.push(cards[i]);
+ cards.splice(i--, 1);
+ }
+ }
+
+ cards.sort(function (a, b) {
+ return get.value(b, player) - get.value(a, player);
+ });
+
+ cards = matchs.concat(cards);
+ return cards;
+ },
+ cheatJudgeCards: function (cards, judges, friendly) {
+ if (!cards || !judges) throw arguments;
+
+ var cheats = [];
+ var judgeCost;
+ for (var i = 0; i < judges.length; i++) {
+ var judge = get.judge(judges[i]);
+ if (typeof judge != 'function') {
+ judge = function () {
+ return 1;
+ };
+ }
+ cards.sort(function (a, b) {
+ return friendly ? judge(b) - judge(a) : judge(a) - judge(b);
+ });
+
+ judgeCost = judge(cards[0]);
+ if ((friendly && judgeCost >= 0) || (!friendly && judgeCost < 0)) {
+ cheats.push(cards.shift());
+ } else {
+ break;
+ }
+ }
+
+ return cheats;
+ },
+ elementLeftFromWindow: function (element) {
+ var left = element.offsetLeft;
+ var current = element.offsetParent;
+
+ while (current != null) {
+ left += current.offsetLeft;
+ current = current.offsetParent;
+ }
+
+ return left;
+ },
+ elementTopFromWindow: function (element) {
+ var top = element.offsetTop;
+ var current = element.offsetParent;
+
+ while (current != null) {
+ top += current.offsetTop;
+ current = current.offsetParent;
+ }
+
+ return top;
+ },
+ handcardInitPos: function () {
+ var hand = dui.boundsCaches.hand;
+ if (!hand.updated)
+ hand.update();
+
+ var cardW = hand.cardWidth;
+ var cardH = hand.cardHeight;
+ var scale = hand.cardScale;
+
+ var x = -Math.round((cardW - cardW * scale) / 2);
+ var y = ((cardH * scale - cardH) / 2);
+
+ return {
+ x: x,
+ y: y,
+ scale: scale
+ };
+ },
+ },
+
+ set: (function (set) {
+ set.activeElement = function (element) {
+ var deactive = dui.$activeElement;
+ dui.$activeElement = element;
+ if (deactive && deactive != element && (typeof deactive.ondeactive == 'function')) {
+ deactive.ondeactive();
+ }
+
+ if (element && element != deactive && (typeof element.onactive == 'function')) {
+ element.onactive();
+ }
+ };
+ return set;
+ })({}),
+ statics: {
+ handTips: []
+ },
+
+ dataset: {
+ animSizeUpdated: false,
+ bodySizeUpdated: false,
+ bodySize: {
+ height: 1,
+ width: 1,
+ updated: false,
+ },
+ },
+ };
+
+
+ dui.showHandTip = function (text) {
+ var tip;
+ var tips = this.statics.handTips;
+ for (var i = 0; i < tips.length; i++) {
+ if (tip == undefined && tips[i].closed) {
+ tip = tips[i];
+ tip.closed = false;
+ } else {
+ tips[i].hide();
+ }
+ }
+
+ if (tip == undefined) {
+ tip = dui.element.create('hand-tip', ui.arena);
+ tips.unshift(tip);
+ tip.clear = function () {
+ var nodes = this.childNodes;
+ for (var i = 0; i < nodes.length; i++)
+ nodes[i].textContent = '';
+
+ this.dataset.text = '';
+ };
+ tip.setText = function (text, type) {
+ this.clear();
+ this.appendText(text, type);
+ };
+ tip.setInfomation = function (text) {
+ if (this.$info == null)
+ this.$info = dui.element.create('hand-tip-info', ui.arena);
+
+ this.$info.innerHTML = text;
+ };
+ tip.appendText = function (text, type) {
+ if (text == undefined || text === '')
+ return;
+ text = String(text).replace(/^###[\s\S]*###/, "");
+ if (type == undefined)
+ type = '';
+
+ var nodes = this.childNodes;
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].textContent == '') {
+ nodes[i].textContent = text;
+ nodes[i].dataset.type = type;
+ return nodes[i];
+ }
+ }
+
+ var span = document.createElement('span');
+ span.textContent = text;
+ span.dataset.type = type;
+ return this.appendChild(span);
+ };
+ tip.strokeText = function () {
+ this.dataset.text = this.innerText;
+ };
+ tip.show = function () {
+ this.classList.remove('hidden');
+ if (this.$info && this.$info.innerHTML)
+ this.$info.show();
+ };
+ tip.hide = function () {
+ this.classList.add('hidden');
+ if (this.$info)
+ this.$info.hide();
+ };
+ tip.close = function () {
+ this.closed = true;
+ this.hide();
+ if (tip.$info)
+ tip.$info.innerHTML = '';
+ var tips = dui.statics.handTips;
+ for (var i = 0; i < tips.length; i++) {
+ if (tips[i].closed)
+ continue;
+
+ tips[i].show();
+ return;
+ }
+ };
+ tip.isEmpty = function () {
+ var nodes = this.childNodes;
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].textContent != '')
+ return false;
+ }
+
+ return true;
+ };
+ }
+ tip.setText(text);
+ tip.show();
+ return tip;
+ };
+
+ decadeUI.BoundsCache = (function () {
+ function BoundsCache(element, updateBefore) {
+ this.element = element;
+ this.updateBefore = updateBefore;
+ this.updated = false;
+ Object.defineProperties(this, {
+ x: {
+ configurable: true,
+ get: function () {
+ if (!this.updated) this.update();
+ return this._x;
+ },
+ set: function (value) {
+ this._x == value;
+ }
+ },
+ y: {
+ configurable: true,
+ get: function () {
+ if (!this.updated) this.update();
+ return this._y;
+ },
+ set: function (value) {
+ this._y == value;
+ }
+ },
+ width: {
+ configurable: true,
+ get: function () {
+ if (!this.updated) this.update();
+ return this._width;
+ },
+ set: function (value) {
+ this._width == value;
+ }
+ },
+ height: {
+ configurable: true,
+ get: function () {
+ if (!this.updated) this.update();
+ return this._height;
+ },
+ set: function (value) {
+ this._height == value;
+ }
+ },
+ });
+ };
+
+ BoundsCache.prototype.check = function () {
+ if (!this.updated)
+ this.update();
+ };
+ BoundsCache.prototype.update = function () {
+ if (this.updateBefore)
+ this.updateBefore();
+
+ var element = this.element;
+ this.updated = true;
+ if (element == undefined) return;
+ this._x = element.offsetLeft;
+ this._y = element.offsetTop;
+ this._width = element.offsetWidth;
+ this._height = element.offsetHeight;
+ };
+
+ return BoundsCache;
+ })();
+
+ decadeUI.boundsCaches = (function (boundsCaches) {
+ boundsCaches.window = new decadeUI.BoundsCache(null, function () {
+ this.element = ui.window;
+ });
+ boundsCaches.arena = new decadeUI.BoundsCache(null, function () {
+ this.element = ui.arena;
+ if (ui.arena == null)
+ return;
+
+ this.cardScale = dui.getCardBestScale();
+ if (this.cardWidth != null)
+ return;
+
+ var childs = ui.arena.childNodes;
+ for (var i = 0; i < childs.length; i++) {
+ if (childs[i].classList.contains('card')) {
+ this.cardWidth = childs[i].offsetWidth;
+ this.cardHeight = childs[i].offsetHeight;
+ return;
+ }
+ }
+
+ var card = dui.element.create('card');
+ card.style.opacity = 0;
+ ui.arena.appendChild(card);
+ this.cardWidth = card.offsetWidth;
+ this.cardHeight = card.offsetHeight;
+ card.remove();
+ });
+ boundsCaches.hand = new decadeUI.BoundsCache(null, function () {
+ this.element = ui.me;
+ if (ui.handcards1 == null)
+ return;
+
+ this.cardScale = dui.getCardBestScale();
+ if (this.cardWidth != null)
+ return;
+
+ var childs = ui.handcards1.childNodes;
+ for (var i = 0; i < childs.length; i++) {
+ if (childs[i].classList.contains('card')) {
+ this.cardWidth = childs[i].offsetWidth;
+ this.cardHeight = childs[i].offsetHeight;
+ return;
+ }
+ }
+
+ var card = dui.element.create('card');
+ card.style.opacity = 0;
+ ui.handcards1.appendChild(card);
+ this.cardWidth = card.offsetWidth;
+ this.cardHeight = card.offsetHeight;
+ card.remove();
+ });
+
+ return boundsCaches;
+ })({});
+
+ decadeUI.element = {
+ base: {
+ removeSelf: function (milliseconds) {
+ var remove = this;
+ if (milliseconds) {
+ milliseconds = (typeof milliseconds == 'number') ? milliseconds : parseInt(milliseconds);
+ setTimeout(function () {
+ if (remove.parentNode) remove.parentNode.removeChild(remove);
+ }, milliseconds);
+ return;
+ }
+
+ if (remove.parentNode) remove.parentNode.removeChild(remove);
+ return;
+ }
+ },
+ create: function (className, parentNode, tagName) {
+ var tag = tagName == void 0 ? 'div' : tagName;
+ var element = document.createElement(tag);
+ element.view = {};
+
+ for (var key in this.base) {
+ element[key] = this.base[key];
+ }
+
+ if (className)
+ element.className = className;
+
+ if (parentNode)
+ parentNode.appendChild(element);
+
+ return element;
+ },
+ clone: function (element) {
+
+ },
+ };
+
+ decadeUI.game = {
+ wait: function () {
+ game.pause();
+ },
+
+ resume: function () {
+ if (!game.loopLocked) {
+ var ok = false;
+ try {
+ if (decadeUI.eventDialog && !decadeUI.eventDialog.finished && !decadeUI.eventDialog.finishing) {
+ decadeUI.eventDialog.finish();
+ decadeUI.eventDialog = undefined;
+ ok = true;
+ }
+ } finally {
+ if (!ok) game.resume();
+ }
+ } else {
+ _status.paused = false;
+ }
+ }
+ };
+
+
+ decadeUI.config = config;
+ duicfg.update = () => Object.values(lib.extensionMenu[`extension_${decadeUIName}`]).forEach(value => {
+ if (value && typeof value == 'object' && typeof value.update == 'function') value.update();
+ });
+
+ decadeUI.init();
+ console.timeEnd(decadeUIName);
+ },
+ precontent:async function(){
+ if (['tafang', 'chess'].includes(get.mode()) && lib.config.extension_十周年UI_closeWhenChess) return;
+ lib.decade_isXingchengVersion = true;
+ lib.decade_isShowKVersion = true;
+ if (lib.config[`extension_${decadeUIName}_eruda`]) {
+ const script = document.createElement('script');
+ script.src = 'https://npm.onmicrosoft.cn/eruda/eruda.js';
+ document.body.appendChild(script);
+ script.onload = () => eruda.init();
+ }
+
+ const extension = lib.extensionMenu[`extension_${decadeUIName}`];
+ if (!(extension && extension.enable && extension.enable.init)) return;
+
+ if (window.require && !window.fs) window.fs = require('fs');
+
+ lib.configMenu.appearence.config.layout.visualMenu = (node, link) => {
+ node.className = `button character themebutton ${lib.config.theme}`;
+ node.classList.add(link);
+ if (node.created) return;
+ node.created = true;
+ node.style.overflow = 'scroll';
+
+ const list = ['re_caocao', 're_liubei', 'sp_zhangjiao', 'sunquan'];
+ while (list.length) {
+ ui.create.div('.avatar', ui.create.div('.seat-player.fakeplayer', node)).setBackground(list.randomRemove(), 'character');
+ }
+ };
+
+ window.decadeModule = function (decadeModule) {
+ if (ui.css.layout && (!ui.css.layout.href || ui.css.layout.href.indexOf('long2') < 0)) ui.css.layout.href = `${lib.assetURL}layout/long2/layout.css`;
+
+ decadeModule.init = function () {
+ this.css(`${decadeUIPath}decadeLayout.css`);
+ this.css(`${decadeUIPath}layout.css`);
+ this.css(`${decadeUIPath}player.css`);
+ const decadeExtCardImage = lib.decade_extCardImage || (lib.decade_extCardImage = {});
+ if (window.fs) new Promise((resolve, reject) => fs.readdir(`${__dirname}/${decadeUIPath}image/card/`, (errnoException, files) => {
+ if (errnoException) reject(errnoException);
+ else resolve(files);
+ })).then(files => files.forEach(file => {
+ const fileName = lib.path.parse(file).name;
+ if (!decadeExtCardImage[fileName]) decadeExtCardImage[fileName] = `${decadeUIPath}image/card/${file}`;
+ }));
+ else if (typeof resolveLocalFileSystemURL == 'function') new Promise((resolve, reject) => {
+ resolveLocalFileSystemURL(`${decadeUIResolvePath}image/card/`, resolve, reject);
+ }).then(directoryEntry => new Promise((resolve, reject) => {
+ directoryEntry.createReader().readEntries(resolve, reject);
+ })).then(entries => entries.forEach(entry => {
+ const entryName = entry.name, fileName = lib.path.parse(entryName).name;
+ if (!decadeExtCardImage[fileName]) decadeExtCardImage[fileName] = `${decadeUIPath}image/card/${entryName}`;
+ }));
+ return this;
+ };
+ decadeModule.init2 = function(){
+ return Promise.all([
+ this.asyncJs(`${decadeUIPath}animation.js`),
+ this.asyncJs(`${decadeUIPath}component.js`),
+ this.asyncJs(`${decadeUIPath}content.js`),
+ this.asyncJs(`${decadeUIPath}dynamicSkin.js`),
+ this.asyncJs(`${decadeUIPath}dynamicSkinTemplate.js`),
+ this.asyncJs(`${decadeUIPath}effect.js`),
+ this.asyncJs(`${decadeUIPath}menu.js`),
+ this.asyncJs(`${decadeUIPath}skill.js`),
+ this.asyncJs(`${decadeUIPath}spine.js`)
+ ]);
+ };
+ decadeModule.asyncJs = async function(path){
+ return new Promise((resolve,reject)=>{
+ decadeModule.js(path,ret=>{
+ resolve();
+ });
+ });
+ };
+ decadeModule.asyncCss = async function(path){
+ return new Promise((resolve,reject)=>{
+ decadeModule.css(path,ret=>{
+ resolve();
+ });
+ });
+ };
+ decadeModule.js = function (path,callback) {
+ if (!path) {
+ //alert(path+"加载失败!");
+ if(callback)callback(false);
+ return console.error('path');
+ }
+
+ const script = document.createElement('script');
+ script.onload = function () {
+ this.remove();
+ if(callback)callback(true);
+ };
+ script.onerror = function () {
+ this.remove();
+ //alert(path+"加载失败!");
+ console.error(`${this.src}not found`);
+ if(callback)callback(false);
+ };
+ script.src = `${path}?v=${version}`;
+ document.head.appendChild(script);
+ return script;
+ };
+ decadeModule.css = function (path,callback) {
+ if (!path){
+ if(callback){
+ callback(false);
+ }
+ return console.error('path');
+ }
+ const link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.href = `${path}?v=${version}`;
+ document.head.appendChild(link);
+ link.onload = function(){
+ if(callback)callback(true);
+ };
+ link.onerror = function(){
+ if(callback)callback(false);
+ }
+ return link;
+ };
+ decadeModule.import = function (module) {
+ if (!this.modules) this.modules = [];
+ if (typeof module != 'function') return console.error('import failed');
+ this.modules.push(module);
+ };
+ return decadeModule.init();
+ }({});
+ await window.decadeModule.init2();
+ Object.defineProperties(_status, {
+ connectMode: {
+ configurable: true,
+ get: function () {
+ return this._connectMode;
+ },
+ set: function (value) {
+ this._connectMode = value;
+ if (!value || !lib.extensions) return;
+ const decadeExtension = lib.extensions.find(value => value[0] == decadeUIName);
+ if (!decadeExtension) return;
+
+ const startBeforeFunction = lib.init.startBefore;
+ lib.init.startBefore = function () {
+ try {
+ _status.extension = decadeExtension[0];
+ _status.evaluatingExtension = decadeExtension[3];
+ decadeExtension[1](decadeExtension[2], decadeExtension[4]);
+ delete _status.extension;
+ delete _status.evaluatingExtension;
+ console.log(`%c${decadeUIName}: 联机成功`, 'color:blue');
+ } catch (e) {
+ console.log(e);
+ }
+
+ if (startBeforeFunction) startBeforeFunction.apply(this, arguments);
+ };
+ }
+ },
+ _connectMode: {
+ value: false,
+ writable: true
+ }
+ });
+
+ },
+ config: {
+ eruda: {
+ name: '调试助手(开发用)',
+ init: false,
+ },
+ rightLayout: {
+ name: '右手布局',
+ init: false,
+ update: () => {
+ if (window.decadeUI) ui.arena.dataset.rightLayout = lib.config.extension_十周年UI_rightLayout ? 'on' : 'off';
+ }
+ },
+ cardPrettify: {
+ name: '卡牌美化(需重启)',
+ init: true
+ },
+ dynamicBackground: {
+ name: '动态背景',
+ init: 'off',
+ item: {
+ off: '关闭',
+ skin_xiaosha_default: '小杀',
+ skin_baosanniang_漫花剑俏: '鲍三娘-漫花剑俏',
+ skin_baosanniang_舞剑铸缘: '鲍三娘-舞剑铸缘',
+ skin_caiwenji_才颜双绝: '蔡文姬-才颜双绝',
+ skin_caojie_凤历迎春: '曹 节-凤历迎春',
+ skin_caojie_战场绝版: '曹 节-战场绝版',
+ skin_caoying_巾帼花舞: '曹 婴-巾帼花舞',
+ skin_daqiao_清萧清丽: '大 乔-清萧清丽',
+ skin_daqiao_衣垂绿川: '大 乔-衣垂绿川',
+ skin_daqiao_战场绝版: '大 乔-战场绝版',
+ skin_daqiaoxiaoqiao_战场绝版: '大乔小乔-战场绝版',
+ skin_diaochan_玉婵仙子: '貂 蝉-玉婵仙子',
+ skin_diaochan_战场绝版: '貂 蝉-战场绝版',
+ skin_dongbai_娇俏伶俐: '董 白-娇俏伶俐',
+ skin_fuhuanghou_万福千灯: '伏皇后-万福千灯',
+ skin_fanyufeng_斟酒入情: '樊玉凤-斟酒入情',
+ skin_guozhao_雍容尊雅: '郭 照-雍容尊雅',
+ skin_huaman_花俏蛮娇: '花 鬘-花俏蛮娇',
+ skin_huaman_经典形象: '花 鬘-经典形象',
+ skin_hetaihou_鸩毒除患: '何太后-鸩毒除患',
+ skin_hetaihou_蛇蝎为心: '何太后-蛇蝎为心',
+ skin_hetaihou_耀紫迷幻: '何太后-耀紫迷幻',
+ skin_lukang_毁堰破晋: '陆 抗-毁堰破晋',
+ skin_luxun_谋定天下: '陆 逊-谋定天下',
+ skin_luxunlvmeng_清雨踏春: '陆逊吕蒙-清雨踏春',
+ skin_mayunlu_战场绝版: '马云騄-战场绝版',
+ skin_simashi_桀骜睥睨: '司马师-桀骜睥睨',
+ skin_sundengzhoufei_鹊星夕情: '孙登周妃-鹊星夕情',
+ skin_sunluban_宵靥谜君: '孙鲁班-宵靥谜君',
+ skin_sunluyu_娇俏伶俐: '孙鲁育-娇俏伶俐',
+ skin_shuxiangxiang_花好月圆: '蜀香香-花好月圆',
+ skin_shuxiangxiang_花曳心牵: '蜀香香-花曳心牵',
+ skin_wangrong_云裳花容: '王 荣-云裳花容',
+ skin_wangyi_绝色异彩: '王 异-绝色异彩',
+ skin_wangyi_战场绝版: '王 异-战场绝版',
+ skin_wolongzhuge_隆中陇亩: '卧龙诸葛-隆中陇亩',
+ skin_wuxian_锦运福绵: '吴 苋-锦运福绵',
+ skin_wuxian_金玉满堂: '吴 苋-金玉满堂',
+ skin_xiahoushi_端华夏莲: '夏侯氏-端华夏莲',
+ skin_xiahoushi_战场绝版: '夏侯氏-战场绝版',
+ skin_xiaoqiao_花好月圆: '小 乔-花好月圆',
+ skin_xiaoqiao_采莲江南: '小 乔-采莲江南',
+ skin_xinxianying_英装素果: '辛宪英-英装素果',
+ skin_xushi_拈花思君: '徐 氏-拈花思君',
+ skin_xushi_为夫弑敌: '徐 氏-为夫弑敌',
+ skin_zhangchangpu_钟桂香蒲: '张昌蒲-钟桂香蒲',
+ skin_zhangchunhua_花好月圆: '张春华-花好月圆',
+ skin_zhangchunhua_战场绝版: '张春华-战场绝版',
+ skin_zhoufei_晴空暖鸢: '周 妃-晴空暖鸢',
+ skin_zhangqiying_逐鹿天下: '张琪瑛-逐鹿天下',
+ skin_zhangqiying_岁稔年丰: '张琪瑛-岁稔年丰',
+ skin_zhenji_才颜双绝: '甄 姬-才颜双绝',
+ skin_zhenji_洛神御水: '甄 姬-洛神御水',
+ skin_zhugeguo_兰荷艾莲: '诸葛果-兰荷艾莲',
+ skin_zhugeguo_仙池起舞: '诸葛果-仙池起舞',
+ skin_zhugeguo_英装素果: '诸葛果-英装素果',
+ skin_zhugeliang_空城退敌: '诸葛亮-空城退敌',
+ skin_zhouyi_剑舞浏漓: '周 夷-剑舞浏漓',
+ skin_zhangxingcai_凯旋星花: '张星彩-凯旋星花',
+ },
+ update: () => {
+ if (!window.decadeUI) return;
+
+ const item = lib.config.extension_十周年UI_dynamicBackground;
+ if (!item || item == 'off') return decadeUI.backgroundAnimation.stopSpineAll();
+ const name = item.split('_'), skin = name.splice(name.length - 1, 1)[0];
+ decadeUI.backgroundAnimation.play(name.join('_'), skin);
+ }
+ },
+ dynamicSkin: {
+ name: '动态皮肤',
+ init: false,
+ },
+ dynamicSkinOutcrop: {
+ name: '动皮露头',
+ init: true,
+ update: () => {
+ if (!window.decadeUI) return;
+ const enable = lib.config.extension_十周年UI_dynamicSkinOutcrop;
+ ui.arena.dataset.dynamicSkinOutcrop = enable ? 'on' : 'off';
+ const players = game.players;
+ if (!players) return;
+ players.forEach(value => {
+ if (!value.dynamic) return;
+ value.dynamic.outcropMask = enable;
+ value.dynamic.update(false);
+ });
+ }
+ },
+ showJieMark: {
+ name: '界标记显示',
+ init: true,
+ },
+ cardAlternateNameVisible: {
+ name: '牌名辅助显示',
+ init: false,
+ update: () => {
+ if (window.decadeUI) ui.window.dataset.cardAlternateNameVisible = lib.config.extension_十周年UI_cardAlternateNameVisible ? 'on' : 'off';
+ }
+ },
+ campIdentityImageMode: {
+ name: '势力身份美化',
+ init: true,
+ },
+ playerKillEffect: {
+ name: '玩家击杀特效',
+ init: true,
+ onclick: value => {
+ game.saveConfig('extension_十周年UI_playerKillEffect', value);
+ if (window.decadeUI) decadeUI.config.playerKillEffect = value;
+ },
+ },
+ gameAnimationEffect: {
+ name: '游戏动画特效',
+ init: true,
+ },
+ playerDieEffect: {
+ name: '玩家阵亡特效',
+ init: true,
+ onclick: value => {
+ game.saveConfig('extension_十周年UI_playerDieEffect', value);
+ if (window.decadeUI) decadeUI.config.playerDieEffect = value;
+ },
+ },
+ cardUseEffect: {
+ name: '卡牌使用特效',
+ init: true,
+ onclick: value => {
+ game.saveConfig('extension_十周年UI_cardUseEffect', value);
+ if (window.decadeUI) decadeUI.config.cardUseEffect = value;
+ },
+ },
+ playerLineEffect: {
+ name: '玩家指示线特效',
+ init: true,
+ onclick: value => {
+ game.saveConfig('extension_十周年UI_playerLineEffect', value);
+ if (window.decadeUI) decadeUI.config.playerLineEffect = value;
+ },
+ },
+ outcropSkin: {
+ name: '露头皮肤(需对应素材)',
+ init: false,
+ update: () => {
+ if (window.decadeUI) ui.arena.dataset.outcropSkin = lib.config.extension_十周年UI_outcropSkin ? 'on' : 'off';
+ }
+ },
+ borderLevel: {
+ name: '玩家边框等阶',
+ init: 'five',
+ item: {
+ one: '一阶',
+ two: '二阶',
+ three: '三阶',
+ four: '四阶',
+ five: '五阶',
+ },
+ update: () => {
+ if (window.decadeUI) ui.arena.dataset.borderLevel = lib.config.extension_十周年UI_borderLevel;
+ }
+ },
+ gainSkillsVisible: {
+ name: '获得技能显示',
+ init: 'on',
+ item: {
+ on: '显示',
+ off: '不显示',
+ othersOn: '显示他人',
+ },
+ update: () => {
+ if (window.decadeUI) ui.arena.dataset.gainSkillsVisible = lib.config.extension_十周年UI_gainSkillsVisible;
+ }
+ },
+ playerMarkStyle: {
+ name: '人物标记样式',
+ init: 'yellow',
+ item: {
+ red: '红色',
+ yellow: '黄色',
+ decade: '十周年',
+ normal: '原版',
+ },
+ update: () => {
+ if (window.decadeUI) ui.arena.dataset.playerMarkStyle = lib.config.extension_十周年UI_playerMarkStyle;
+ }
+ },
+ closeWhenChess: {
+ name: '战棋模式关闭UI',
+ init: false,
+ },
+ foldCardMinWidth: {
+ name: '折叠手牌最小宽度',
+ intro: '设置当手牌过多时,折叠手牌露出部分的最小宽度(默认值为81)',
+ init: '81',
+ item: {
+ '9': '9',
+ '18': '18',
+ '27': '27',
+ '36': '36',
+ '45': '45',
+ '54': '54',
+ '63': '63',
+ '72': '72',
+ '81': '81',
+ '90': '90',
+ 'cardWidth': '卡牌宽度'
+ },
+ update: () => {
+ if (window.decadeUI) decadeUI.layout.updateHand();
+ }
+ }
+ },
+ package: {
+ get intro() {
+ const p = document.createElement("p"), style = p.style;
+ style.color = 'rgb(210, 210, 000)';
+ style.fontSize = '12px';
+ style.lineHeight = '14px';
+ style.textShadow = '0 0 2px black';
+ const generateAHTML = (href, innerHTML, download) => {
+ const a = document.createElement('a');
+ if (download) a.download = true;
+ a.href = href;
+ a.target = '_blank';
+ a.style.color = 'currentcolor';
+ a.innerHTML = innerHTML;
+ return a.outerHTML;
+ };
+ let changelog;
+ try {
+ changelog = lib.init.reqSync(`local:${decadeUIPath}CHANGELOG.md`).trim().split(/\r\n|\r|\n/);
+ }
+ catch (ignored) {
+ changelog = [];
+ }
+ p.innerHTML = [
+ '有bug先检查其他扩展,不行再关闭UI重试,最后再联系作者。',
+ '反馈问题建议前往:',
+ generateAHTML('https://github.com/Tipx-L/decade-ui/issues', formatURL('https://github.com/Tipx-L/decade-ui/issues')),
+ `${generateAHTML('https://hub.fgit.cf/Tipx-L/decade-ui/issues', formatURL('https://hub.fgit.cf/Tipx-L/decade-ui/issues'))} (更容易访问)`,
+ `当前版本:${version}(Show-K修复版)`,
+ `更新日期:${updateDate}`,
+ ...changelog,
+ '《十周年UI》采用GNU通用公共许可证v3.0授权',
+ '仓库链接:',
+ generateAHTML('https://github.com/Tipx-L/decade-ui', formatURL('https://github.com/Tipx-L/decade-ui')),
+ `${generateAHTML('https://hub.fgit.cf/Tipx-L/decade-ui', formatURL('https://hub.fgit.cf/Tipx-L/decade-ui'))} (更容易访问)`,
+ '最新版下载链接:',
+ generateAHTML('https://github.com/Tipx-L/decade-ui/releases/latest/download/decade-ui.zip', 'GitHub', true),
+ generateAHTML('https://ghproxy.com/https://github.com/Tipx-L/decade-ui/releases/latest/download/decade-ui.zip', 'GitHub Proxy(更容易访问)', true),
+ generateAHTML('https://hub.fgit.cf/Tipx-L/decade-ui/releases/latest/download/decade-ui.zip', 'FastGit(更容易访问)', true),
+ '最新版(无动态背景和动态皮肤)下载链接:',
+ generateAHTML('https://github.com/Tipx-L/decade-ui/releases/latest/download/decade-ui-no-dynamics.zip', 'GitHub', true),
+ generateAHTML('https://ghproxy.com/https://github.com/Tipx-L/decade-ui/releases/latest/download/decade-ui-no-dynamics.zip', 'GitHub Proxy(更容易访问)', true),
+ generateAHTML('https://hub.fgit.cf/Tipx-L/decade-ui/releases/latest/download/decade-ui-no-dynamics.zip', 'FastGit(更容易访问)', true),
+ '或者关注微信公众号“无名杀扩展交流”,及时获取《十周年UI》最新版',
+ /*
+ '- 新增动皮及背景:[曹节-凤历迎春]、[曹婴-巾帼花舞]、[貂蝉-战场绝版]、[何太后-耀紫迷幻]、[王荣-云裳花容]、[吴苋-金玉满堂]、[周夷-剑舞浏漓];',
+ '- 新增动皮oncomplete支持(函数内部只能调用this.xxx代码);',
+ '- 优化了主玩家攻击指示线的位置显示;',
+ '- 优化了主玩家出牌摸牌相关呈现动画;',
+ '- 优化折叠手牌,开关跟随系统的设置;',
+ '- 优化部分代码,提升游戏整体流畅度;',
+ '- 修复关闭界包后因界标记弹窗的问题;',
+ '- 修复挑战模式下界武将名丢失的问题;',
+ '- 修复挑战模式下动皮异常拉伸的问题;',
+ '- 修复了加载其他目录的特效文件问题;',
+ '- 修复低版本窗口改动后动皮模糊问题;'*/
+ ].join(document.createElement('br').outerHTML);
+ return p.outerHTML;
+ },
+ author: 'Show-K←寰宇星城←disgrace2013←短歌 QQ464598631',
+ diskURL: 'https://github.com/Tipx-L/decade-ui/releases/latest/download/decade-ui.zip',
+ forumURL: 'https://github.com/Tipx-L/decade-ui/issues',
+ version: version,
+ },
+ editable: false
+ };
+});
diff --git a/icon.css b/icon.css
new file mode 100644
index 0000000..5e1e5c8
--- /dev/null
+++ b/icon.css
@@ -0,0 +1,101 @@
+/*所以图标均为正方形素材*/
+.icon.feichu,
+.icon.feichu:before,
+.icon.feichu:after {
+ opacity: 0.8;
+ background: white;
+}
+
+.icon-background {
+ width: 50px;
+ height: 50px;
+ border: solid 1px gray;
+}
+
+.icon-treasure {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ background: transparent !important;
+}
+
+.icon-treasure:before {
+ content: "";
+ position: absolute;
+ display: block;
+ top: 10%;
+ left: 10%;
+ width: 80%;
+ height: 60%;
+ border-radius: 20% 20% 0 0;
+ background: linear-gradient(to right, #ED6E6E 0%, #ec8c69 100%) top no-repeat, linear-gradient(to right, #ED6E6E 0%, #ec8c69 100%) bottom no-repeat;
+ background-size: 100% 60%, 100% 30% !important;
+ clip-path: polygon(0 0, 100% 0, 100% 70%, 62% 70%, 62% 100%, 38% 100%, 38% 70%, 0 70%);
+ -webkit-clip-path: polygon(0 0, 100% 0, 100% 70%, 62% 70%, 62% 100%, 38% 100%, 38% 70%, 0 70%);
+}
+
+.icon-treasure.feichu:before {
+ background: linear-gradient(to right, white 0%, white 100%) top no-repeat, linear-gradient(to right, white 0%, white 100%) bottom no-repeat;
+}
+
+.icon-treasure:after {
+ content: "";
+ position: absolute;
+ display: block;
+ top: 50%;
+ left: 10%;
+ width: 80%;
+ height: 40%;
+ border-radius: 0 0 25% 25%;
+ background: linear-gradient(to right, #ED6E6E 0%, #ec8c69 100%);
+ clip-path: polygon(0 0, 29% 0, 29% 60%, 71% 60%, 71% 0, 100% 0, 100% 100%, 0 100%);
+ -webkit-clip-path: polygon(0 0, 29% 0, 29% 60%, 71% 60%, 71% 0, 100% 0, 100% 100%, 0 100%);
+}
+
+.icon-saber {
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(to right, #ED6E6E 0%, #ec8c69 100%);
+ transform: rotate(-45deg);
+ clip-path: polygon(50% 0, 65% 15%, 60% 70%, 75% 70%, 72% 80%, 56% 82%, 56% 100%, 44% 100%, 44% 82%, 28% 80%, 25% 70%, 40% 70%, 35% 15%, 50% 0);
+ -webkit-clip-path: polygon(50% 0, 65% 15%, 60% 70%, 75% 70%, 72% 80%, 56% 82%, 56% 100%, 44% 100%, 44% 82%, 28% 80%, 25% 70%, 40% 70%, 35% 15%, 50% 0);
+}
+
+.icon-shield {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ background: transparent !important;
+}
+
+.icon-shield:before,
+.icon-shield:after {
+ content: "";
+ position: absolute;
+ display: block;
+ top: 8%;
+ left: 15%;
+ width: 70%;
+ height: 70%;
+ background: linear-gradient(to right, #ED6E6E 0%, #ec8c69 100%);
+}
+
+.icon-shield:before {
+ border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
+}
+
+.icon-shield:after {
+ width: 70%;
+ height: 84%;
+ border-radius: 15% 15% 0 0 / 20% 20% 0 0;
+ clip-path: polygon(0 0, 100% 0, 100% 30%, 82% 72%, 50% 100%, 18% 72%, 0 30%, 0 0);
+ -webkit-clip-path: polygon(0 0, 100% 0, 100% 30%, 82% 72%, 50% 100%, 18% 72%, 0 30%, 0 0);
+}
+
+.icon-mount {
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(to right, #ED6E6E 0%, #ec8c69 100%);
+ clip-path: polygon(50% 5%, 55% 20%, 80% 60%, 75% 65%, 75% 75%, 80% 90%, 15% 90%, 50% 70%, 50% 55%, 45% 50%, 22% 65%, 10% 50%, 45% 20%, 50% 5%);
+ -webkit-clip-path: polygon(50% 5%, 55% 20%, 80% 60%, 75% 65%, 75% 75%, 80% 90%, 15% 90%, 50% 70%, 50% 55%, 45% 50%, 22% 65%, 10% 50%, 45% 20%, 50% 5%);
+}
\ No newline at end of file
diff --git a/image/card/bagua.webp b/image/card/bagua.webp
new file mode 100644
index 0000000..0c04bcc
Binary files /dev/null and b/image/card/bagua.webp differ
diff --git a/image/card/baiyidujiang.webp b/image/card/baiyidujiang.webp
new file mode 100644
index 0000000..f5e63bf
Binary files /dev/null and b/image/card/baiyidujiang.webp differ
diff --git a/image/card/baiyin.webp b/image/card/baiyin.webp
new file mode 100644
index 0000000..86f3f01
Binary files /dev/null and b/image/card/baiyin.webp differ
diff --git a/image/card/bingliang.webp b/image/card/bingliang.webp
new file mode 100644
index 0000000..f3c85d1
Binary files /dev/null and b/image/card/bingliang.webp differ
diff --git a/image/card/binglinchengxia.webp b/image/card/binglinchengxia.webp
new file mode 100644
index 0000000..fc59b13
Binary files /dev/null and b/image/card/binglinchengxia.webp differ
diff --git a/image/card/binglinchengxiax.webp b/image/card/binglinchengxiax.webp
new file mode 100644
index 0000000..6d2efcc
Binary files /dev/null and b/image/card/binglinchengxiax.webp differ
diff --git a/image/card/bintieshuangji.webp b/image/card/bintieshuangji.webp
new file mode 100644
index 0000000..60bdf0d
Binary files /dev/null and b/image/card/bintieshuangji.webp differ
diff --git a/image/card/boss_mengpohuihun.webp b/image/card/boss_mengpohuihun.webp
new file mode 100644
index 0000000..792cf01
Binary files /dev/null and b/image/card/boss_mengpohuihun.webp differ
diff --git a/image/card/caochuan.webp b/image/card/caochuan.webp
new file mode 100644
index 0000000..2278dac
Binary files /dev/null and b/image/card/caochuan.webp differ
diff --git a/image/card/caochuanjiejian.webp b/image/card/caochuanjiejian.webp
new file mode 100644
index 0000000..2278dac
Binary files /dev/null and b/image/card/caochuanjiejian.webp differ
diff --git a/image/card/caomu.webp b/image/card/caomu.webp
new file mode 100644
index 0000000..3bef85d
Binary files /dev/null and b/image/card/caomu.webp differ
diff --git a/image/card/changandajian_equip1.webp b/image/card/changandajian_equip1.webp
new file mode 100644
index 0000000..6b1f23e
Binary files /dev/null and b/image/card/changandajian_equip1.webp differ
diff --git a/image/card/changandajian_equip2.webp b/image/card/changandajian_equip2.webp
new file mode 100644
index 0000000..e3dfd3a
Binary files /dev/null and b/image/card/changandajian_equip2.webp differ
diff --git a/image/card/changandajian_equip3.webp b/image/card/changandajian_equip3.webp
new file mode 100644
index 0000000..36adb1b
Binary files /dev/null and b/image/card/changandajian_equip3.webp differ
diff --git a/image/card/changandajian_equip4.webp b/image/card/changandajian_equip4.webp
new file mode 100644
index 0000000..bcd8053
Binary files /dev/null and b/image/card/changandajian_equip4.webp differ
diff --git a/image/card/changandajian_equip5.webp b/image/card/changandajian_equip5.webp
new file mode 100644
index 0000000..1825eac
Binary files /dev/null and b/image/card/changandajian_equip5.webp differ
diff --git a/image/card/changandajian_equip6.webp b/image/card/changandajian_equip6.webp
new file mode 100644
index 0000000..6f9c6c1
Binary files /dev/null and b/image/card/changandajian_equip6.webp differ
diff --git a/image/card/cheliji_feilunzhanyu.webp b/image/card/cheliji_feilunzhanyu.webp
new file mode 100644
index 0000000..362524a
Binary files /dev/null and b/image/card/cheliji_feilunzhanyu.webp differ
diff --git a/image/card/cheliji_sichengliangyu.webp b/image/card/cheliji_sichengliangyu.webp
new file mode 100644
index 0000000..a3f5eb3
Binary files /dev/null and b/image/card/cheliji_sichengliangyu.webp differ
diff --git a/image/card/cheliji_tiejixuanyu.webp b/image/card/cheliji_tiejixuanyu.webp
new file mode 100644
index 0000000..8afdfb8
Binary files /dev/null and b/image/card/cheliji_tiejixuanyu.webp differ
diff --git a/image/card/chenghuodajie.webp b/image/card/chenghuodajie.webp
new file mode 100644
index 0000000..1b8f6bf
Binary files /dev/null and b/image/card/chenghuodajie.webp differ
diff --git a/image/card/chenhuodajie.webp b/image/card/chenhuodajie.webp
new file mode 100644
index 0000000..34b53a3
Binary files /dev/null and b/image/card/chenhuodajie.webp differ
diff --git a/image/card/chiling.webp b/image/card/chiling.webp
new file mode 100644
index 0000000..b5ee229
Binary files /dev/null and b/image/card/chiling.webp differ
diff --git a/image/card/chitu.webp b/image/card/chitu.webp
new file mode 100644
index 0000000..052d4be
Binary files /dev/null and b/image/card/chitu.webp differ
diff --git a/image/card/chixueqingfeng.webp b/image/card/chixueqingfeng.webp
new file mode 100644
index 0000000..95102f5
Binary files /dev/null and b/image/card/chixueqingfeng.webp differ
diff --git a/image/card/chiyanzhenhunqin.webp b/image/card/chiyanzhenhunqin.webp
new file mode 100644
index 0000000..8f9133f
Binary files /dev/null and b/image/card/chiyanzhenhunqin.webp differ
diff --git a/image/card/chuanguoyuxi.webp b/image/card/chuanguoyuxi.webp
new file mode 100644
index 0000000..2845fc2
Binary files /dev/null and b/image/card/chuanguoyuxi.webp differ
diff --git a/image/card/chuqibuyi.webp b/image/card/chuqibuyi.webp
new file mode 100644
index 0000000..0db3ef2
Binary files /dev/null and b/image/card/chuqibuyi.webp differ
diff --git a/image/card/cixiong.webp b/image/card/cixiong.webp
new file mode 100644
index 0000000..7f8bd10
Binary files /dev/null and b/image/card/cixiong.webp differ
diff --git a/image/card/dagongche.webp b/image/card/dagongche.webp
new file mode 100644
index 0000000..dea3105
Binary files /dev/null and b/image/card/dagongche.webp differ
diff --git a/image/card/dawan.webp b/image/card/dawan.webp
new file mode 100644
index 0000000..7b18617
Binary files /dev/null and b/image/card/dawan.webp differ
diff --git a/image/card/diaobingqianjiang.webp b/image/card/diaobingqianjiang.webp
new file mode 100644
index 0000000..5068a74
Binary files /dev/null and b/image/card/diaobingqianjiang.webp differ
diff --git a/image/card/diaohulishan.webp b/image/card/diaohulishan.webp
new file mode 100644
index 0000000..c5d17c5
Binary files /dev/null and b/image/card/diaohulishan.webp differ
diff --git a/image/card/dilu.webp b/image/card/dilu.webp
new file mode 100644
index 0000000..5eccf02
Binary files /dev/null and b/image/card/dilu.webp differ
diff --git a/image/card/dinglanyemingzhu.webp b/image/card/dinglanyemingzhu.webp
new file mode 100644
index 0000000..5294981
Binary files /dev/null and b/image/card/dinglanyemingzhu.webp differ
diff --git a/image/card/diqi.webp b/image/card/diqi.webp
new file mode 100644
index 0000000..681009f
Binary files /dev/null and b/image/card/diqi.webp differ
diff --git a/image/card/dongzhuxianji.webp b/image/card/dongzhuxianji.webp
new file mode 100644
index 0000000..8fdf3d3
Binary files /dev/null and b/image/card/dongzhuxianji.webp differ
diff --git a/image/card/douzhuanxingyi.webp b/image/card/douzhuanxingyi.webp
new file mode 100644
index 0000000..caf91ab
Binary files /dev/null and b/image/card/douzhuanxingyi.webp differ
diff --git a/image/card/du.webp b/image/card/du.webp
new file mode 100644
index 0000000..be3fd56
Binary files /dev/null and b/image/card/du.webp differ
diff --git a/image/card/duanjian.webp b/image/card/duanjian.webp
new file mode 100644
index 0000000..67b7a59
Binary files /dev/null and b/image/card/duanjian.webp differ
diff --git a/image/card/dz_mantianguohai.webp b/image/card/dz_mantianguohai.webp
new file mode 100644
index 0000000..0ea26f1
Binary files /dev/null and b/image/card/dz_mantianguohai.webp differ
diff --git a/image/card/fangtian.webp b/image/card/fangtian.webp
new file mode 100644
index 0000000..c4835b0
Binary files /dev/null and b/image/card/fangtian.webp differ
diff --git a/image/card/feilongduofeng.webp b/image/card/feilongduofeng.webp
new file mode 100644
index 0000000..27bdb57
Binary files /dev/null and b/image/card/feilongduofeng.webp differ
diff --git a/image/card/fengchu_card.webp b/image/card/fengchu_card.webp
new file mode 100644
index 0000000..9298ece
Binary files /dev/null and b/image/card/fengchu_card.webp differ
diff --git a/image/card/fudichouxin.webp b/image/card/fudichouxin.webp
new file mode 100644
index 0000000..0aa52a2
Binary files /dev/null and b/image/card/fudichouxin.webp differ
diff --git a/image/card/fulei.webp b/image/card/fulei.webp
new file mode 100644
index 0000000..86b33d1
Binary files /dev/null and b/image/card/fulei.webp differ
diff --git a/image/card/geanguanhuo.webp b/image/card/geanguanhuo.webp
new file mode 100644
index 0000000..ade10bf
Binary files /dev/null and b/image/card/geanguanhuo.webp differ
diff --git a/image/card/gongshoujianbei.webp b/image/card/gongshoujianbei.webp
new file mode 100644
index 0000000..44e09ab
Binary files /dev/null and b/image/card/gongshoujianbei.webp differ
diff --git a/image/card/gs_chitu.webp b/image/card/gs_chitu.webp
new file mode 100644
index 0000000..6b06569
Binary files /dev/null and b/image/card/gs_chitu.webp differ
diff --git a/image/card/gs_chixiaojian.webp b/image/card/gs_chixiaojian.webp
new file mode 100644
index 0000000..e938eea
Binary files /dev/null and b/image/card/gs_chixiaojian.webp differ
diff --git a/image/card/gs_chixueqingfeng.webp b/image/card/gs_chixueqingfeng.webp
new file mode 100644
index 0000000..5ce248b
Binary files /dev/null and b/image/card/gs_chixueqingfeng.webp differ
diff --git a/image/card/gs_dawan.webp b/image/card/gs_dawan.webp
new file mode 100644
index 0000000..abc098e
Binary files /dev/null and b/image/card/gs_dawan.webp differ
diff --git a/image/card/gs_dilu.webp b/image/card/gs_dilu.webp
new file mode 100644
index 0000000..1ee0b32
Binary files /dev/null and b/image/card/gs_dilu.webp differ
diff --git a/image/card/gs_fangtianji.webp b/image/card/gs_fangtianji.webp
new file mode 100644
index 0000000..5e9086f
Binary files /dev/null and b/image/card/gs_fangtianji.webp differ
diff --git a/image/card/gs_fapao.webp b/image/card/gs_fapao.webp
new file mode 100644
index 0000000..c43b291
Binary files /dev/null and b/image/card/gs_fapao.webp differ
diff --git a/image/card/gs_gouxiang.webp b/image/card/gs_gouxiang.webp
new file mode 100644
index 0000000..f71d3fc
Binary files /dev/null and b/image/card/gs_gouxiang.webp differ
diff --git a/image/card/gs_gs_masuo.webp b/image/card/gs_gs_masuo.webp
new file mode 100644
index 0000000..dcc08ce
Binary files /dev/null and b/image/card/gs_gs_masuo.webp differ
diff --git a/image/card/gs_guanshifu.webp b/image/card/gs_guanshifu.webp
new file mode 100644
index 0000000..7621d61
Binary files /dev/null and b/image/card/gs_guanshifu.webp differ
diff --git a/image/card/gs_hualiu.webp b/image/card/gs_hualiu.webp
new file mode 100644
index 0000000..23f2d78
Binary files /dev/null and b/image/card/gs_hualiu.webp differ
diff --git a/image/card/gs_huanshoudao.webp b/image/card/gs_huanshoudao.webp
new file mode 100644
index 0000000..72fb955
Binary files /dev/null and b/image/card/gs_huanshoudao.webp differ
diff --git a/image/card/gs_huxinjing.webp b/image/card/gs_huxinjing.webp
new file mode 100644
index 0000000..c9896a0
Binary files /dev/null and b/image/card/gs_huxinjing.webp differ
diff --git a/image/card/gs_jueying.webp b/image/card/gs_jueying.webp
new file mode 100644
index 0000000..3623f44
Binary files /dev/null and b/image/card/gs_jueying.webp differ
diff --git a/image/card/gs_lengyanju.webp b/image/card/gs_lengyanju.webp
new file mode 100644
index 0000000..5ffc082
Binary files /dev/null and b/image/card/gs_lengyanju.webp differ
diff --git a/image/card/gs_mashuo.webp b/image/card/gs_mashuo.webp
new file mode 100644
index 0000000..3433657
Binary files /dev/null and b/image/card/gs_mashuo.webp differ
diff --git a/image/card/gs_mingguangjia.webp b/image/card/gs_mingguangjia.webp
new file mode 100644
index 0000000..d5efe3e
Binary files /dev/null and b/image/card/gs_mingguangjia.webp differ
diff --git a/image/card/gs_nu.webp b/image/card/gs_nu.webp
new file mode 100644
index 0000000..2f72339
Binary files /dev/null and b/image/card/gs_nu.webp differ
diff --git a/image/card/gs_qinggangjian.webp b/image/card/gs_qinggangjian.webp
new file mode 100644
index 0000000..5c5046a
Binary files /dev/null and b/image/card/gs_qinggangjian.webp differ
diff --git a/image/card/gs_qixingpao.webp b/image/card/gs_qixingpao.webp
new file mode 100644
index 0000000..268f232
Binary files /dev/null and b/image/card/gs_qixingpao.webp differ
diff --git a/image/card/gs_quehuagong.webp b/image/card/gs_quehuagong.webp
new file mode 100644
index 0000000..23a3ffe
Binary files /dev/null and b/image/card/gs_quehuagong.webp differ
diff --git a/image/card/gs_shesha.webp b/image/card/gs_shesha.webp
new file mode 100644
index 0000000..3f16b84
Binary files /dev/null and b/image/card/gs_shesha.webp differ
diff --git a/image/card/gs_shoumiandun.webp b/image/card/gs_shoumiandun.webp
new file mode 100644
index 0000000..807ec62
Binary files /dev/null and b/image/card/gs_shoumiandun.webp differ
diff --git a/image/card/gs_sizhaodao.webp b/image/card/gs_sizhaodao.webp
new file mode 100644
index 0000000..c6979c5
Binary files /dev/null and b/image/card/gs_sizhaodao.webp differ
diff --git a/image/card/gs_tongxiukai.webp b/image/card/gs_tongxiukai.webp
new file mode 100644
index 0000000..9322598
Binary files /dev/null and b/image/card/gs_tongxiukai.webp differ
diff --git a/image/card/gs_yao.webp b/image/card/gs_yao.webp
new file mode 100644
index 0000000..7b4a96d
Binary files /dev/null and b/image/card/gs_yao.webp differ
diff --git a/image/card/gs_yitianjian.webp b/image/card/gs_yitianjian.webp
new file mode 100644
index 0000000..f45394b
Binary files /dev/null and b/image/card/gs_yitianjian.webp differ
diff --git a/image/card/gs_yuanyangjian.webp b/image/card/gs_yuanyangjian.webp
new file mode 100644
index 0000000..4a9486a
Binary files /dev/null and b/image/card/gs_yuanyangjian.webp differ
diff --git a/image/card/gs_yulinjia.webp b/image/card/gs_yulinjia.webp
new file mode 100644
index 0000000..0dabb87
Binary files /dev/null and b/image/card/gs_yulinjia.webp differ
diff --git a/image/card/gs_yuzhui.webp b/image/card/gs_yuzhui.webp
new file mode 100644
index 0000000..1c33cf6
Binary files /dev/null and b/image/card/gs_yuzhui.webp differ
diff --git a/image/card/gs_zhanmajian.webp b/image/card/gs_zhanmajian.webp
new file mode 100644
index 0000000..b1c0740
Binary files /dev/null and b/image/card/gs_zhanmajian.webp differ
diff --git a/image/card/gs_zhugenu.webp b/image/card/gs_zhugenu.webp
new file mode 100644
index 0000000..d92fffa
Binary files /dev/null and b/image/card/gs_zhugenu.webp differ
diff --git a/image/card/gs_zixing.webp b/image/card/gs_zixing.webp
new file mode 100644
index 0000000..087f3d2
Binary files /dev/null and b/image/card/gs_zixing.webp differ
diff --git a/image/card/guaguliaodu.webp b/image/card/guaguliaodu.webp
new file mode 100644
index 0000000..8578254
Binary files /dev/null and b/image/card/guaguliaodu.webp differ
diff --git a/image/card/guanshi.webp b/image/card/guanshi.webp
new file mode 100644
index 0000000..655cff8
Binary files /dev/null and b/image/card/guanshi.webp differ
diff --git a/image/card/gubuzifeng.webp b/image/card/gubuzifeng.webp
new file mode 100644
index 0000000..8093ca5
Binary files /dev/null and b/image/card/gubuzifeng.webp differ
diff --git a/image/card/guding.webp b/image/card/guding.webp
new file mode 100644
index 0000000..028d549
Binary files /dev/null and b/image/card/guding.webp differ
diff --git a/image/card/guilongzhanyuedao.webp b/image/card/guilongzhanyuedao.webp
new file mode 100644
index 0000000..0868a9b
Binary files /dev/null and b/image/card/guilongzhanyuedao.webp differ
diff --git a/image/card/guofengyupao.webp b/image/card/guofengyupao.webp
new file mode 100644
index 0000000..027ae6a
Binary files /dev/null and b/image/card/guofengyupao.webp differ
diff --git a/image/card/guohe.webp b/image/card/guohe.webp
new file mode 100644
index 0000000..5000a07
Binary files /dev/null and b/image/card/guohe.webp differ
diff --git a/image/card/gx_chongyingshenfu.webp b/image/card/gx_chongyingshenfu.webp
new file mode 100644
index 0000000..3f0da00
Binary files /dev/null and b/image/card/gx_chongyingshenfu.webp differ
diff --git a/image/card/gx_lingbaoxianhu.webp b/image/card/gx_lingbaoxianhu.webp
new file mode 100644
index 0000000..1618e9b
Binary files /dev/null and b/image/card/gx_lingbaoxianhu.webp differ
diff --git a/image/card/gx_taijifuchen.webp b/image/card/gx_taijifuchen.webp
new file mode 100644
index 0000000..a770cba
Binary files /dev/null and b/image/card/gx_taijifuchen.webp differ
diff --git a/image/card/gz_guguoanbang.webp b/image/card/gz_guguoanbang.webp
new file mode 100644
index 0000000..77c950d
Binary files /dev/null and b/image/card/gz_guguoanbang.webp differ
diff --git a/image/card/gz_haolingtianxia.webp b/image/card/gz_haolingtianxia.webp
new file mode 100644
index 0000000..99aa326
Binary files /dev/null and b/image/card/gz_haolingtianxia.webp differ
diff --git a/image/card/gz_kefuzhongyuan.webp b/image/card/gz_kefuzhongyuan.webp
new file mode 100644
index 0000000..ca2fe6c
Binary files /dev/null and b/image/card/gz_kefuzhongyuan.webp differ
diff --git a/image/card/gz_wenheluanwu.webp b/image/card/gz_wenheluanwu.webp
new file mode 100644
index 0000000..2cfbcb7
Binary files /dev/null and b/image/card/gz_wenheluanwu.webp differ
diff --git a/image/card/hanbing.webp b/image/card/hanbing.webp
new file mode 100644
index 0000000..ed264ef
Binary files /dev/null and b/image/card/hanbing.webp differ
diff --git a/image/card/heiguangkai.webp b/image/card/heiguangkai.webp
new file mode 100644
index 0000000..b393c12
Binary files /dev/null and b/image/card/heiguangkai.webp differ
diff --git a/image/card/hhzz_fudichouxin.webp b/image/card/hhzz_fudichouxin.webp
new file mode 100644
index 0000000..0aa52a2
Binary files /dev/null and b/image/card/hhzz_fudichouxin.webp differ
diff --git a/image/card/hhzz_toulianghuanzhu.webp b/image/card/hhzz_toulianghuanzhu.webp
new file mode 100644
index 0000000..1d91183
Binary files /dev/null and b/image/card/hhzz_toulianghuanzhu.webp differ
diff --git a/image/card/honghuangzhili.webp b/image/card/honghuangzhili.webp
new file mode 100644
index 0000000..976ff7e
Binary files /dev/null and b/image/card/honghuangzhili.webp differ
diff --git a/image/card/hongmianbaihuapao.webp b/image/card/hongmianbaihuapao.webp
new file mode 100644
index 0000000..ba05091
Binary files /dev/null and b/image/card/hongmianbaihuapao.webp differ
diff --git a/image/card/hongshui.webp b/image/card/hongshui.webp
new file mode 100644
index 0000000..5b18a13
Binary files /dev/null and b/image/card/hongshui.webp differ
diff --git a/image/card/hualiu.webp b/image/card/hualiu.webp
new file mode 100644
index 0000000..888deb4
Binary files /dev/null and b/image/card/hualiu.webp differ
diff --git a/image/card/huihun.webp b/image/card/huihun.webp
new file mode 100644
index 0000000..d57f203
Binary files /dev/null and b/image/card/huihun.webp differ
diff --git a/image/card/huogong.webp b/image/card/huogong.webp
new file mode 100644
index 0000000..7b87943
Binary files /dev/null and b/image/card/huogong.webp differ
diff --git a/image/card/huoshan.webp b/image/card/huoshan.webp
new file mode 100644
index 0000000..0c71fb6
Binary files /dev/null and b/image/card/huoshan.webp differ
diff --git a/image/card/huoshaolianying.webp b/image/card/huoshaolianying.webp
new file mode 100644
index 0000000..0444b9a
Binary files /dev/null and b/image/card/huoshaolianying.webp differ
diff --git a/image/card/huxinjing.webp b/image/card/huxinjing.webp
new file mode 100644
index 0000000..2778ef5
Binary files /dev/null and b/image/card/huxinjing.webp differ
diff --git a/image/card/identity_enemy.webp b/image/card/identity_enemy.webp
new file mode 100644
index 0000000..ce6733d
Binary files /dev/null and b/image/card/identity_enemy.webp differ
diff --git a/image/card/identity_fan.webp b/image/card/identity_fan.webp
new file mode 100644
index 0000000..e7c31c5
Binary files /dev/null and b/image/card/identity_fan.webp differ
diff --git a/image/card/identity_friend.webp b/image/card/identity_friend.webp
new file mode 100644
index 0000000..4c415ba
Binary files /dev/null and b/image/card/identity_friend.webp differ
diff --git a/image/card/identity_nei.webp b/image/card/identity_nei.webp
new file mode 100644
index 0000000..d7c58f2
Binary files /dev/null and b/image/card/identity_nei.webp differ
diff --git a/image/card/identity_zhong.webp b/image/card/identity_zhong.webp
new file mode 100644
index 0000000..e010e85
Binary files /dev/null and b/image/card/identity_zhong.webp differ
diff --git a/image/card/identity_zhu.webp b/image/card/identity_zhu.webp
new file mode 100644
index 0000000..1560323
Binary files /dev/null and b/image/card/identity_zhu.webp differ
diff --git a/image/card/jiedao.webp b/image/card/jiedao.webp
new file mode 100644
index 0000000..9311499
Binary files /dev/null and b/image/card/jiedao.webp differ
diff --git a/image/card/jiejia.webp b/image/card/jiejia.webp
new file mode 100644
index 0000000..72fc695
Binary files /dev/null and b/image/card/jiejia.webp differ
diff --git a/image/card/jinchan.webp b/image/card/jinchan.webp
new file mode 100644
index 0000000..ecced95
Binary files /dev/null and b/image/card/jinchan.webp differ
diff --git a/image/card/jingfanma.webp b/image/card/jingfanma.webp
new file mode 100644
index 0000000..bdd74d3
Binary files /dev/null and b/image/card/jingfanma.webp differ
diff --git a/image/card/jinhe.webp b/image/card/jinhe.webp
new file mode 100644
index 0000000..d1d9184
Binary files /dev/null and b/image/card/jinhe.webp differ
diff --git a/image/card/jintuiziru.webp b/image/card/jintuiziru.webp
new file mode 100644
index 0000000..6deb90f
Binary files /dev/null and b/image/card/jintuiziru.webp differ
diff --git a/image/card/jinwuluorigong.webp b/image/card/jinwuluorigong.webp
new file mode 100644
index 0000000..37d1a0a
Binary files /dev/null and b/image/card/jinwuluorigong.webp differ
diff --git a/image/card/jiu.webp b/image/card/jiu.webp
new file mode 100644
index 0000000..65d1a53
Binary files /dev/null and b/image/card/jiu.webp differ
diff --git a/image/card/jiuwei.webp b/image/card/jiuwei.webp
new file mode 100644
index 0000000..737444f
Binary files /dev/null and b/image/card/jiuwei.webp differ
diff --git a/image/card/jiwangkailai.webp b/image/card/jiwangkailai.webp
new file mode 100644
index 0000000..7055f42
Binary files /dev/null and b/image/card/jiwangkailai.webp differ
diff --git a/image/card/juechenjinge.webp b/image/card/juechenjinge.webp
new file mode 100644
index 0000000..d944421
Binary files /dev/null and b/image/card/juechenjinge.webp differ
diff --git a/image/card/juedou.webp b/image/card/juedou.webp
new file mode 100644
index 0000000..a61677b
Binary files /dev/null and b/image/card/juedou.webp differ
diff --git a/image/card/jueying.webp b/image/card/jueying.webp
new file mode 100644
index 0000000..c4cd293
Binary files /dev/null and b/image/card/jueying.webp differ
diff --git a/image/card/kaihua.webp b/image/card/kaihua.webp
new file mode 100644
index 0000000..31be5a2
Binary files /dev/null and b/image/card/kaihua.webp differ
diff --git a/image/card/kuwu.webp b/image/card/kuwu.webp
new file mode 100644
index 0000000..d05b5eb
Binary files /dev/null and b/image/card/kuwu.webp differ
diff --git a/image/card/lanyinjia.webp b/image/card/lanyinjia.webp
new file mode 100644
index 0000000..472f05c
Binary files /dev/null and b/image/card/lanyinjia.webp differ
diff --git a/image/card/lebu.webp b/image/card/lebu.webp
new file mode 100644
index 0000000..c20c437
Binary files /dev/null and b/image/card/lebu.webp differ
diff --git a/image/card/lianjunshengyan.webp b/image/card/lianjunshengyan.webp
new file mode 100644
index 0000000..a6b40d3
Binary files /dev/null and b/image/card/lianjunshengyan.webp differ
diff --git a/image/card/linglongshimandai.webp b/image/card/linglongshimandai.webp
new file mode 100644
index 0000000..2498208
Binary files /dev/null and b/image/card/linglongshimandai.webp differ
diff --git a/image/card/lingsheji.webp b/image/card/lingsheji.webp
new file mode 100644
index 0000000..9dd0398
Binary files /dev/null and b/image/card/lingsheji.webp differ
diff --git a/image/card/liulongcanjia.webp b/image/card/liulongcanjia.webp
new file mode 100644
index 0000000..23eb073
Binary files /dev/null and b/image/card/liulongcanjia.webp differ
diff --git a/image/card/lizhengshangyou.webp b/image/card/lizhengshangyou.webp
new file mode 100644
index 0000000..2f6c740
Binary files /dev/null and b/image/card/lizhengshangyou.webp differ
diff --git a/image/card/longfenghemingjian.webp b/image/card/longfenghemingjian.webp
new file mode 100644
index 0000000..b975dee
Binary files /dev/null and b/image/card/longfenghemingjian.webp differ
diff --git a/image/card/lulitongxin.webp b/image/card/lulitongxin.webp
new file mode 100644
index 0000000..b656e4b
Binary files /dev/null and b/image/card/lulitongxin.webp differ
diff --git a/image/card/luojingxiashi.webp b/image/card/luojingxiashi.webp
new file mode 100644
index 0000000..eb603e8
Binary files /dev/null and b/image/card/luojingxiashi.webp differ
diff --git a/image/card/ly_piliche.webp b/image/card/ly_piliche.webp
new file mode 100644
index 0000000..2a35be2
Binary files /dev/null and b/image/card/ly_piliche.webp differ
diff --git a/image/card/meiyingqiang.webp b/image/card/meiyingqiang.webp
new file mode 100644
index 0000000..1ae770b
Binary files /dev/null and b/image/card/meiyingqiang.webp differ
diff --git a/image/card/mianju.webp b/image/card/mianju.webp
new file mode 100644
index 0000000..36b3137
Binary files /dev/null and b/image/card/mianju.webp differ
diff --git a/image/card/minguangkai.webp b/image/card/minguangkai.webp
new file mode 100644
index 0000000..1e998cf
Binary files /dev/null and b/image/card/minguangkai.webp differ
diff --git a/image/card/monkey.webp b/image/card/monkey.webp
new file mode 100644
index 0000000..3089336
Binary files /dev/null and b/image/card/monkey.webp differ
diff --git a/image/card/mtg_bingheyaosai.webp b/image/card/mtg_bingheyaosai.webp
new file mode 100644
index 0000000..122a1cc
Binary files /dev/null and b/image/card/mtg_bingheyaosai.webp differ
diff --git a/image/card/mtg_cangbaohaiwan.webp b/image/card/mtg_cangbaohaiwan.webp
new file mode 100644
index 0000000..d696685
Binary files /dev/null and b/image/card/mtg_cangbaohaiwan.webp differ
diff --git a/image/card/mtg_duzhao.webp b/image/card/mtg_duzhao.webp
new file mode 100644
index 0000000..42f5b5c
Binary files /dev/null and b/image/card/mtg_duzhao.webp differ
diff --git a/image/card/mtg_feixu.webp b/image/card/mtg_feixu.webp
new file mode 100644
index 0000000..dfa545c
Binary files /dev/null and b/image/card/mtg_feixu.webp differ
diff --git a/image/card/mtg_haidao.webp b/image/card/mtg_haidao.webp
new file mode 100644
index 0000000..a05cf59
Binary files /dev/null and b/image/card/mtg_haidao.webp differ
diff --git a/image/card/mtg_lindixiliu.webp b/image/card/mtg_lindixiliu.webp
new file mode 100644
index 0000000..c02a2ed
Binary files /dev/null and b/image/card/mtg_lindixiliu.webp differ
diff --git a/image/card/mtg_linzhongjianta.webp b/image/card/mtg_linzhongjianta.webp
new file mode 100644
index 0000000..42ffc49
Binary files /dev/null and b/image/card/mtg_linzhongjianta.webp differ
diff --git a/image/card/mtg_longlushanfeng.webp b/image/card/mtg_longlushanfeng.webp
new file mode 100644
index 0000000..9214869
Binary files /dev/null and b/image/card/mtg_longlushanfeng.webp differ
diff --git a/image/card/mtg_shamolvzhou.webp b/image/card/mtg_shamolvzhou.webp
new file mode 100644
index 0000000..1c78642
Binary files /dev/null and b/image/card/mtg_shamolvzhou.webp differ
diff --git a/image/card/mtg_shuimomuxue.webp b/image/card/mtg_shuimomuxue.webp
new file mode 100644
index 0000000..b47808a
Binary files /dev/null and b/image/card/mtg_shuimomuxue.webp differ
diff --git a/image/card/mtg_yixialan.webp b/image/card/mtg_yixialan.webp
new file mode 100644
index 0000000..dac4927
Binary files /dev/null and b/image/card/mtg_yixialan.webp differ
diff --git a/image/card/mtg_youlin.webp b/image/card/mtg_youlin.webp
new file mode 100644
index 0000000..1c20b93
Binary files /dev/null and b/image/card/mtg_youlin.webp differ
diff --git a/image/card/muniu.webp b/image/card/muniu.webp
new file mode 100644
index 0000000..3ff0312
Binary files /dev/null and b/image/card/muniu.webp differ
diff --git a/image/card/nanman.webp b/image/card/nanman.webp
new file mode 100644
index 0000000..7f922d5
Binary files /dev/null and b/image/card/nanman.webp differ
diff --git a/image/card/nsf_bagua.webp b/image/card/nsf_bagua.webp
new file mode 100644
index 0000000..566fe05
Binary files /dev/null and b/image/card/nsf_bagua.webp differ
diff --git a/image/card/nsf_baiyin.webp b/image/card/nsf_baiyin.webp
new file mode 100644
index 0000000..63134c7
Binary files /dev/null and b/image/card/nsf_baiyin.webp differ
diff --git a/image/card/nsf_bingliang.webp b/image/card/nsf_bingliang.webp
new file mode 100644
index 0000000..f3c85d1
Binary files /dev/null and b/image/card/nsf_bingliang.webp differ
diff --git a/image/card/nsf_caochuan.webp b/image/card/nsf_caochuan.webp
new file mode 100644
index 0000000..2278dac
Binary files /dev/null and b/image/card/nsf_caochuan.webp differ
diff --git a/image/card/nsf_cixiong.webp b/image/card/nsf_cixiong.webp
new file mode 100644
index 0000000..f46d62f
Binary files /dev/null and b/image/card/nsf_cixiong.webp differ
diff --git a/image/card/nsf_dajiang.webp b/image/card/nsf_dajiang.webp
new file mode 100644
index 0000000..bfea461
Binary files /dev/null and b/image/card/nsf_dajiang.webp differ
diff --git a/image/card/nsf_danwei.webp b/image/card/nsf_danwei.webp
new file mode 100644
index 0000000..f0e44fe
Binary files /dev/null and b/image/card/nsf_danwei.webp differ
diff --git a/image/card/nsf_dongfeng.webp b/image/card/nsf_dongfeng.webp
new file mode 100644
index 0000000..5bc868d
Binary files /dev/null and b/image/card/nsf_dongfeng.webp differ
diff --git a/image/card/nsf_fengzui.webp b/image/card/nsf_fengzui.webp
new file mode 100644
index 0000000..5e05350
Binary files /dev/null and b/image/card/nsf_fengzui.webp differ
diff --git a/image/card/nsf_fudi.webp b/image/card/nsf_fudi.webp
new file mode 100644
index 0000000..0aa52a2
Binary files /dev/null and b/image/card/nsf_fudi.webp differ
diff --git a/image/card/nsf_guofeng.webp b/image/card/nsf_guofeng.webp
new file mode 100644
index 0000000..42b3cd7
Binary files /dev/null and b/image/card/nsf_guofeng.webp differ
diff --git a/image/card/nsf_guohe.webp b/image/card/nsf_guohe.webp
new file mode 100644
index 0000000..5000a07
Binary files /dev/null and b/image/card/nsf_guohe.webp differ
diff --git a/image/card/nsf_hanbing.webp b/image/card/nsf_hanbing.webp
new file mode 100644
index 0000000..17b2949
Binary files /dev/null and b/image/card/nsf_hanbing.webp differ
diff --git a/image/card/nsf_hundu.webp b/image/card/nsf_hundu.webp
new file mode 100644
index 0000000..e684ea8
Binary files /dev/null and b/image/card/nsf_hundu.webp differ
diff --git a/image/card/nsf_huogong.webp b/image/card/nsf_huogong.webp
new file mode 100644
index 0000000..7b87943
Binary files /dev/null and b/image/card/nsf_huogong.webp differ
diff --git a/image/card/nsf_juedou.webp b/image/card/nsf_juedou.webp
new file mode 100644
index 0000000..a61677b
Binary files /dev/null and b/image/card/nsf_juedou.webp differ
diff --git a/image/card/nsf_kanpo.webp b/image/card/nsf_kanpo.webp
new file mode 100644
index 0000000..9bd3a11
Binary files /dev/null and b/image/card/nsf_kanpo.webp differ
diff --git a/image/card/nsf_liannu.webp b/image/card/nsf_liannu.webp
new file mode 100644
index 0000000..a3d4513
Binary files /dev/null and b/image/card/nsf_liannu.webp differ
diff --git a/image/card/nsf_longlin.webp b/image/card/nsf_longlin.webp
new file mode 100644
index 0000000..6414ae3
Binary files /dev/null and b/image/card/nsf_longlin.webp differ
diff --git a/image/card/nsf_longya.webp b/image/card/nsf_longya.webp
new file mode 100644
index 0000000..aa423ff
Binary files /dev/null and b/image/card/nsf_longya.webp differ
diff --git a/image/card/nsf_nufa.webp b/image/card/nsf_nufa.webp
new file mode 100644
index 0000000..1fdf5ab
Binary files /dev/null and b/image/card/nsf_nufa.webp differ
diff --git a/image/card/nsf_qinggang.webp b/image/card/nsf_qinggang.webp
new file mode 100644
index 0000000..1a0e314
Binary files /dev/null and b/image/card/nsf_qinggang.webp differ
diff --git a/image/card/nsf_qingmei.webp b/image/card/nsf_qingmei.webp
new file mode 100644
index 0000000..8cf8ba7
Binary files /dev/null and b/image/card/nsf_qingmei.webp differ
diff --git a/image/card/nsf_renwang.webp b/image/card/nsf_renwang.webp
new file mode 100644
index 0000000..df1cf41
Binary files /dev/null and b/image/card/nsf_renwang.webp differ
diff --git a/image/card/nsf_sanjian.webp b/image/card/nsf_sanjian.webp
new file mode 100644
index 0000000..41f6eb1
Binary files /dev/null and b/image/card/nsf_sanjian.webp differ
diff --git a/image/card/nsf_sha.webp b/image/card/nsf_sha.webp
new file mode 100644
index 0000000..20a0740
Binary files /dev/null and b/image/card/nsf_sha.webp differ
diff --git a/image/card/nsf_shan.webp b/image/card/nsf_shan.webp
new file mode 100644
index 0000000..0365fe2
Binary files /dev/null and b/image/card/nsf_shan.webp differ
diff --git a/image/card/nsf_shandian.webp b/image/card/nsf_shandian.webp
new file mode 100644
index 0000000..79b6478
Binary files /dev/null and b/image/card/nsf_shandian.webp differ
diff --git a/image/card/nsf_shunshou.webp b/image/card/nsf_shunshou.webp
new file mode 100644
index 0000000..802b60a
Binary files /dev/null and b/image/card/nsf_shunshou.webp differ
diff --git a/image/card/nsf_tao.webp b/image/card/nsf_tao.webp
new file mode 100644
index 0000000..5628a27
Binary files /dev/null and b/image/card/nsf_tao.webp differ
diff --git a/image/card/nsf_wanjian.webp b/image/card/nsf_wanjian.webp
new file mode 100644
index 0000000..cce33ad
Binary files /dev/null and b/image/card/nsf_wanjian.webp differ
diff --git a/image/card/nsf_weishi.webp b/image/card/nsf_weishi.webp
new file mode 100644
index 0000000..afe209c
Binary files /dev/null and b/image/card/nsf_weishi.webp differ
diff --git a/image/card/nsf_xietian.webp b/image/card/nsf_xietian.webp
new file mode 100644
index 0000000..2fc5dfd
Binary files /dev/null and b/image/card/nsf_xietian.webp differ
diff --git a/image/card/nsf_xinge.webp b/image/card/nsf_xinge.webp
new file mode 100644
index 0000000..8d14eed
Binary files /dev/null and b/image/card/nsf_xinge.webp differ
diff --git a/image/card/nsf_xuwang.webp b/image/card/nsf_xuwang.webp
new file mode 100644
index 0000000..37602c6
Binary files /dev/null and b/image/card/nsf_xuwang.webp differ
diff --git a/image/card/nsf_yuanjiao.webp b/image/card/nsf_yuanjiao.webp
new file mode 100644
index 0000000..b6a6ea2
Binary files /dev/null and b/image/card/nsf_yuanjiao.webp differ
diff --git a/image/card/nsf_zhangba.webp b/image/card/nsf_zhangba.webp
new file mode 100644
index 0000000..2ea1526
Binary files /dev/null and b/image/card/nsf_zhangba.webp differ
diff --git a/image/card/nsf_zhungang.webp b/image/card/nsf_zhungang.webp
new file mode 100644
index 0000000..76c62d1
Binary files /dev/null and b/image/card/nsf_zhungang.webp differ
diff --git a/image/card/nsf_zou.webp b/image/card/nsf_zou.webp
new file mode 100644
index 0000000..fc77b4c
Binary files /dev/null and b/image/card/nsf_zou.webp differ
diff --git a/image/card/numa.webp b/image/card/numa.webp
new file mode 100644
index 0000000..97a76ed
Binary files /dev/null and b/image/card/numa.webp differ
diff --git a/image/card/nvzhuang.webp b/image/card/nvzhuang.webp
new file mode 100644
index 0000000..c0a7751
Binary files /dev/null and b/image/card/nvzhuang.webp differ
diff --git a/image/card/pilitoushiche.webp b/image/card/pilitoushiche.webp
new file mode 100644
index 0000000..a0c5d81
Binary files /dev/null and b/image/card/pilitoushiche.webp differ
diff --git a/image/card/pyzhuren_club.webp b/image/card/pyzhuren_club.webp
new file mode 100644
index 0000000..7e0e3d4
Binary files /dev/null and b/image/card/pyzhuren_club.webp differ
diff --git a/image/card/pyzhuren_diamond.webp b/image/card/pyzhuren_diamond.webp
new file mode 100644
index 0000000..8076f6a
Binary files /dev/null and b/image/card/pyzhuren_diamond.webp differ
diff --git a/image/card/pyzhuren_heart.webp b/image/card/pyzhuren_heart.webp
new file mode 100644
index 0000000..e1c982e
Binary files /dev/null and b/image/card/pyzhuren_heart.webp differ
diff --git a/image/card/pyzhuren_shandian.webp b/image/card/pyzhuren_shandian.webp
new file mode 100644
index 0000000..e8f27ac
Binary files /dev/null and b/image/card/pyzhuren_shandian.webp differ
diff --git a/image/card/pyzhuren_spade.webp b/image/card/pyzhuren_spade.webp
new file mode 100644
index 0000000..e684ea8
Binary files /dev/null and b/image/card/pyzhuren_spade.webp differ
diff --git a/image/card/qibaodao.webp b/image/card/qibaodao.webp
new file mode 100644
index 0000000..b349836
Binary files /dev/null and b/image/card/qibaodao.webp differ
diff --git a/image/card/qicaishenlu.webp b/image/card/qicaishenlu.webp
new file mode 100644
index 0000000..eff7b46
Binary files /dev/null and b/image/card/qicaishenlu.webp differ
diff --git a/image/card/qijia.webp b/image/card/qijia.webp
new file mode 100644
index 0000000..5ad58fb
Binary files /dev/null and b/image/card/qijia.webp differ
diff --git a/image/card/qilin.webp b/image/card/qilin.webp
new file mode 100644
index 0000000..b227553
Binary files /dev/null and b/image/card/qilin.webp differ
diff --git a/image/card/qimenbagua.webp b/image/card/qimenbagua.webp
new file mode 100644
index 0000000..de89118
Binary files /dev/null and b/image/card/qimenbagua.webp differ
diff --git a/image/card/qinggang.webp b/image/card/qinggang.webp
new file mode 100644
index 0000000..461a4fb
Binary files /dev/null and b/image/card/qinggang.webp differ
diff --git a/image/card/qinglong.webp b/image/card/qinglong.webp
new file mode 100644
index 0000000..ea4bcf3
Binary files /dev/null and b/image/card/qinglong.webp differ
diff --git a/image/card/qinnu.webp b/image/card/qinnu.webp
new file mode 100644
index 0000000..811fc8b
Binary files /dev/null and b/image/card/qinnu.webp differ
diff --git a/image/card/qixingbaodao.webp b/image/card/qixingbaodao.webp
new file mode 100644
index 0000000..c807de2
Binary files /dev/null and b/image/card/qixingbaodao.webp differ
diff --git a/image/card/qizhengxiangsheng.webp b/image/card/qizhengxiangsheng.webp
new file mode 100644
index 0000000..0afa435
Binary files /dev/null and b/image/card/qizhengxiangsheng.webp differ
diff --git a/image/card/renwang.webp b/image/card/renwang.webp
new file mode 100644
index 0000000..7c939dc
Binary files /dev/null and b/image/card/renwang.webp differ
diff --git a/image/card/rewrite_bagua.webp b/image/card/rewrite_bagua.webp
new file mode 100644
index 0000000..4b6e413
Binary files /dev/null and b/image/card/rewrite_bagua.webp differ
diff --git a/image/card/rewrite_baiyin.webp b/image/card/rewrite_baiyin.webp
new file mode 100644
index 0000000..6ce9101
Binary files /dev/null and b/image/card/rewrite_baiyin.webp differ
diff --git a/image/card/rewrite_lanyinjia.webp b/image/card/rewrite_lanyinjia.webp
new file mode 100644
index 0000000..1df621e
Binary files /dev/null and b/image/card/rewrite_lanyinjia.webp differ
diff --git a/image/card/rewrite_renwang.webp b/image/card/rewrite_renwang.webp
new file mode 100644
index 0000000..2e4c698
Binary files /dev/null and b/image/card/rewrite_renwang.webp differ
diff --git a/image/card/rewrite_tengjia.webp b/image/card/rewrite_tengjia.webp
new file mode 100644
index 0000000..0c53cc6
Binary files /dev/null and b/image/card/rewrite_tengjia.webp differ
diff --git a/image/card/rewrite_zhuge.webp b/image/card/rewrite_zhuge.webp
new file mode 100644
index 0000000..e66a92c
Binary files /dev/null and b/image/card/rewrite_zhuge.webp differ
diff --git a/image/card/ruyijingubang.webp b/image/card/ruyijingubang.webp
new file mode 100644
index 0000000..c538134
Binary files /dev/null and b/image/card/ruyijingubang.webp differ
diff --git a/image/card/sadouchengbing.webp b/image/card/sadouchengbing.webp
new file mode 100644
index 0000000..cf971ea
Binary files /dev/null and b/image/card/sadouchengbing.webp differ
diff --git a/image/card/sanjian.webp b/image/card/sanjian.webp
new file mode 100644
index 0000000..b3c3a9c
Binary files /dev/null and b/image/card/sanjian.webp differ
diff --git a/image/card/sanlve.webp b/image/card/sanlve.webp
new file mode 100644
index 0000000..8e5c741
Binary files /dev/null and b/image/card/sanlve.webp differ
diff --git a/image/card/serafuku.webp b/image/card/serafuku.webp
new file mode 100644
index 0000000..f6f703d
Binary files /dev/null and b/image/card/serafuku.webp differ
diff --git a/image/card/sha.webp b/image/card/sha.webp
new file mode 100644
index 0000000..20a0740
Binary files /dev/null and b/image/card/sha.webp differ
diff --git a/image/card/sha_fire.webp b/image/card/sha_fire.webp
new file mode 100644
index 0000000..ab0f1e7
Binary files /dev/null and b/image/card/sha_fire.webp differ
diff --git a/image/card/sha_ice.webp b/image/card/sha_ice.webp
new file mode 100644
index 0000000..026c063
Binary files /dev/null and b/image/card/sha_ice.webp differ
diff --git a/image/card/sha_stab.webp b/image/card/sha_stab.webp
new file mode 100644
index 0000000..8cb3515
Binary files /dev/null and b/image/card/sha_stab.webp differ
diff --git a/image/card/sha_thunder.webp b/image/card/sha_thunder.webp
new file mode 100644
index 0000000..a68bcd3
Binary files /dev/null and b/image/card/sha_thunder.webp differ
diff --git a/image/card/shan.webp b/image/card/shan.webp
new file mode 100644
index 0000000..0365fe2
Binary files /dev/null and b/image/card/shan.webp differ
diff --git a/image/card/shandian.webp b/image/card/shandian.webp
new file mode 100644
index 0000000..79b6478
Binary files /dev/null and b/image/card/shandian.webp differ
diff --git a/image/card/shangyangbianfa.webp b/image/card/shangyangbianfa.webp
new file mode 100644
index 0000000..4c84752
Binary files /dev/null and b/image/card/shangyangbianfa.webp differ
diff --git a/image/card/shanrangzhaoshu.webp b/image/card/shanrangzhaoshu.webp
new file mode 100644
index 0000000..59a6c0b
Binary files /dev/null and b/image/card/shanrangzhaoshu.webp differ
diff --git a/image/card/shengdong.webp b/image/card/shengdong.webp
new file mode 100644
index 0000000..152d8d1
Binary files /dev/null and b/image/card/shengdong.webp differ
diff --git a/image/card/shezhanqunru.webp b/image/card/shezhanqunru.webp
new file mode 100644
index 0000000..c901876
Binary files /dev/null and b/image/card/shezhanqunru.webp differ
diff --git a/image/card/shoulijian.webp b/image/card/shoulijian.webp
new file mode 100644
index 0000000..a9ae75f
Binary files /dev/null and b/image/card/shoulijian.webp differ
diff --git a/image/card/shufazijinguan.webp b/image/card/shufazijinguan.webp
new file mode 100644
index 0000000..212702d
Binary files /dev/null and b/image/card/shufazijinguan.webp differ
diff --git a/image/card/shuijing_card.webp b/image/card/shuijing_card.webp
new file mode 100644
index 0000000..99529d6
Binary files /dev/null and b/image/card/shuijing_card.webp differ
diff --git a/image/card/shuiyanqijun.webp b/image/card/shuiyanqijun.webp
new file mode 100644
index 0000000..1e7df72
Binary files /dev/null and b/image/card/shuiyanqijun.webp differ
diff --git a/image/card/shuiyanqijunx.webp b/image/card/shuiyanqijunx.webp
new file mode 100644
index 0000000..25a9efb
Binary files /dev/null and b/image/card/shuiyanqijunx.webp differ
diff --git a/image/card/shuiyanqijuny.webp b/image/card/shuiyanqijuny.webp
new file mode 100644
index 0000000..f7269f0
Binary files /dev/null and b/image/card/shuiyanqijuny.webp differ
diff --git a/image/card/shunshou.webp b/image/card/shunshou.webp
new file mode 100644
index 0000000..802b60a
Binary files /dev/null and b/image/card/shunshou.webp differ
diff --git a/image/card/suijiyingbian.webp b/image/card/suijiyingbian.webp
new file mode 100644
index 0000000..9a900a4
Binary files /dev/null and b/image/card/suijiyingbian.webp differ
diff --git a/image/card/suolianjia.webp b/image/card/suolianjia.webp
new file mode 100644
index 0000000..dbf8100
Binary files /dev/null and b/image/card/suolianjia.webp differ
diff --git a/image/card/taigongyinfu.webp b/image/card/taigongyinfu.webp
new file mode 100644
index 0000000..b7f3a70
Binary files /dev/null and b/image/card/taigongyinfu.webp differ
diff --git a/image/card/taipingyaoshu.webp b/image/card/taipingyaoshu.webp
new file mode 100644
index 0000000..a89bd75
Binary files /dev/null and b/image/card/taipingyaoshu.webp differ
diff --git a/image/card/tao.webp b/image/card/tao.webp
new file mode 100644
index 0000000..5628a27
Binary files /dev/null and b/image/card/tao.webp differ
diff --git a/image/card/taoyuan.webp b/image/card/taoyuan.webp
new file mode 100644
index 0000000..726b740
Binary files /dev/null and b/image/card/taoyuan.webp differ
diff --git a/image/card/tengjia.webp b/image/card/tengjia.webp
new file mode 100644
index 0000000..bce95c5
Binary files /dev/null and b/image/card/tengjia.webp differ
diff --git a/image/card/tianjitu.webp b/image/card/tianjitu.webp
new file mode 100644
index 0000000..7f2e302
Binary files /dev/null and b/image/card/tianjitu.webp differ
diff --git a/image/card/tiaojiyanmei.webp b/image/card/tiaojiyanmei.webp
new file mode 100644
index 0000000..d4a97ba
Binary files /dev/null and b/image/card/tiaojiyanmei.webp differ
diff --git a/image/card/tiesuo.webp b/image/card/tiesuo.webp
new file mode 100644
index 0000000..18f3cc9
Binary files /dev/null and b/image/card/tiesuo.webp differ
diff --git a/image/card/tiesuosss.webp b/image/card/tiesuosss.webp
new file mode 100644
index 0000000..18f3cc9
Binary files /dev/null and b/image/card/tiesuosss.webp differ
diff --git a/image/card/tongpao_bagua.webp b/image/card/tongpao_bagua.webp
new file mode 100644
index 0000000..0c04bcc
Binary files /dev/null and b/image/card/tongpao_bagua.webp differ
diff --git a/image/card/tongpao_baiyin.webp b/image/card/tongpao_baiyin.webp
new file mode 100644
index 0000000..86f3f01
Binary files /dev/null and b/image/card/tongpao_baiyin.webp differ
diff --git a/image/card/tongpao_renwang.webp b/image/card/tongpao_renwang.webp
new file mode 100644
index 0000000..7c939dc
Binary files /dev/null and b/image/card/tongpao_renwang.webp differ
diff --git a/image/card/tongpao_tengjia.webp b/image/card/tongpao_tengjia.webp
new file mode 100644
index 0000000..bce95c5
Binary files /dev/null and b/image/card/tongpao_tengjia.webp differ
diff --git a/image/card/tongque.webp b/image/card/tongque.webp
new file mode 100644
index 0000000..421a382
Binary files /dev/null and b/image/card/tongque.webp differ
diff --git a/image/card/tongzhougongji.webp b/image/card/tongzhougongji.webp
new file mode 100644
index 0000000..c8716d0
Binary files /dev/null and b/image/card/tongzhougongji.webp differ
diff --git a/image/card/toulianghuanzhu.webp b/image/card/toulianghuanzhu.webp
new file mode 100644
index 0000000..1d91183
Binary files /dev/null and b/image/card/toulianghuanzhu.webp differ
diff --git a/image/card/toushiche.webp b/image/card/toushiche.webp
new file mode 100644
index 0000000..e993d13
Binary files /dev/null and b/image/card/toushiche.webp differ
diff --git a/image/card/tuixinzhifu.webp b/image/card/tuixinzhifu.webp
new file mode 100644
index 0000000..b2b06f2
Binary files /dev/null and b/image/card/tuixinzhifu.webp differ
diff --git a/image/card/tunliang.webp b/image/card/tunliang.webp
new file mode 100644
index 0000000..c4cced8
Binary files /dev/null and b/image/card/tunliang.webp differ
diff --git a/image/card/wangmeizhike.webp b/image/card/wangmeizhike.webp
new file mode 100644
index 0000000..00cc02c
Binary files /dev/null and b/image/card/wangmeizhike.webp differ
diff --git a/image/card/wanjian.webp b/image/card/wanjian.webp
new file mode 100644
index 0000000..cce33ad
Binary files /dev/null and b/image/card/wanjian.webp differ
diff --git a/image/card/wenheluanwu_card.webp b/image/card/wenheluanwu_card.webp
new file mode 100644
index 0000000..8c32365
Binary files /dev/null and b/image/card/wenheluanwu_card.webp differ
diff --git a/image/card/whlw_lidaitaojiang.webp b/image/card/whlw_lidaitaojiang.webp
new file mode 100644
index 0000000..95bac9c
Binary files /dev/null and b/image/card/whlw_lidaitaojiang.webp differ
diff --git a/image/card/whlw_toulianghuanzhu.webp b/image/card/whlw_toulianghuanzhu.webp
new file mode 100644
index 0000000..5dd4243
Binary files /dev/null and b/image/card/whlw_toulianghuanzhu.webp differ
diff --git a/image/card/wolong_card.webp b/image/card/wolong_card.webp
new file mode 100644
index 0000000..3ab0894
Binary files /dev/null and b/image/card/wolong_card.webp differ
diff --git a/image/card/wufengjian.webp b/image/card/wufengjian.webp
new file mode 100644
index 0000000..377ce93
Binary files /dev/null and b/image/card/wufengjian.webp differ
diff --git a/image/card/wugu.webp b/image/card/wugu.webp
new file mode 100644
index 0000000..4f2fa5c
Binary files /dev/null and b/image/card/wugu.webp differ
diff --git a/image/card/wuliu.webp b/image/card/wuliu.webp
new file mode 100644
index 0000000..73c0aac
Binary files /dev/null and b/image/card/wuliu.webp differ
diff --git a/image/card/wushuangfangtianji.webp b/image/card/wushuangfangtianji.webp
new file mode 100644
index 0000000..5efaabf
Binary files /dev/null and b/image/card/wushuangfangtianji.webp differ
diff --git a/image/card/wutiesuolian.webp b/image/card/wutiesuolian.webp
new file mode 100644
index 0000000..92ea76a
Binary files /dev/null and b/image/card/wutiesuolian.webp differ
diff --git a/image/card/wuxie.webp b/image/card/wuxie.webp
new file mode 100644
index 0000000..2ad0c0b
Binary files /dev/null and b/image/card/wuxie.webp differ
diff --git a/image/card/wuxinghelingshan.webp b/image/card/wuxinghelingshan.webp
new file mode 100644
index 0000000..c58f578
Binary files /dev/null and b/image/card/wuxinghelingshan.webp differ
diff --git a/image/card/wuzhong.webp b/image/card/wuzhong.webp
new file mode 100644
index 0000000..186511e
Binary files /dev/null and b/image/card/wuzhong.webp differ
diff --git a/image/card/wy_meirenji.webp b/image/card/wy_meirenji.webp
new file mode 100644
index 0000000..0e9c628
Binary files /dev/null and b/image/card/wy_meirenji.webp differ
diff --git a/image/card/wy_xiaolicangdao.webp b/image/card/wy_xiaolicangdao.webp
new file mode 100644
index 0000000..bfcc6df
Binary files /dev/null and b/image/card/wy_xiaolicangdao.webp differ
diff --git a/image/card/xietianzi.webp b/image/card/xietianzi.webp
new file mode 100644
index 0000000..c3dab05
Binary files /dev/null and b/image/card/xietianzi.webp differ
diff --git a/image/card/xinge.webp b/image/card/xinge.webp
new file mode 100644
index 0000000..8ec6eb0
Binary files /dev/null and b/image/card/xinge.webp differ
diff --git a/image/card/xingtianpojunfu.webp b/image/card/xingtianpojunfu.webp
new file mode 100644
index 0000000..82a64a5
Binary files /dev/null and b/image/card/xingtianpojunfu.webp differ
diff --git a/image/card/xionghuangjiu.webp b/image/card/xionghuangjiu.webp
new file mode 100644
index 0000000..892cca9
Binary files /dev/null and b/image/card/xionghuangjiu.webp differ
diff --git a/image/card/xiuluolianyuji.webp b/image/card/xiuluolianyuji.webp
new file mode 100644
index 0000000..cf3ec2c
Binary files /dev/null and b/image/card/xiuluolianyuji.webp differ
diff --git a/image/card/xuanjian_card.webp b/image/card/xuanjian_card.webp
new file mode 100644
index 0000000..823a50a
Binary files /dev/null and b/image/card/xuanjian_card.webp differ
diff --git a/image/card/xuelunyang.webp b/image/card/xuelunyang.webp
new file mode 100644
index 0000000..8c1ae4c
Binary files /dev/null and b/image/card/xuelunyang.webp differ
diff --git a/image/card/xuwangzhimian.webp b/image/card/xuwangzhimian.webp
new file mode 100644
index 0000000..8540be2
Binary files /dev/null and b/image/card/xuwangzhimian.webp differ
diff --git a/image/card/yajiaoqiang.webp b/image/card/yajiaoqiang.webp
new file mode 100644
index 0000000..c6579bf
Binary files /dev/null and b/image/card/yajiaoqiang.webp differ
diff --git a/image/card/yexingyi.webp b/image/card/yexingyi.webp
new file mode 100644
index 0000000..2cdbaf1
Binary files /dev/null and b/image/card/yexingyi.webp differ
diff --git a/image/card/yihuajiemu.webp b/image/card/yihuajiemu.webp
new file mode 100644
index 0000000..0469fdc
Binary files /dev/null and b/image/card/yihuajiemu.webp differ
diff --git a/image/card/yinfengjia.webp b/image/card/yinfengjia.webp
new file mode 100644
index 0000000..f94ac22
Binary files /dev/null and b/image/card/yinfengjia.webp differ
diff --git a/image/card/yinfengyi.webp b/image/card/yinfengyi.webp
new file mode 100644
index 0000000..55c1b3b
Binary files /dev/null and b/image/card/yinfengyi.webp differ
diff --git a/image/card/yinyueqiang.webp b/image/card/yinyueqiang.webp
new file mode 100644
index 0000000..7315698
Binary files /dev/null and b/image/card/yinyueqiang.webp differ
diff --git a/image/card/yitianjian.webp b/image/card/yitianjian.webp
new file mode 100644
index 0000000..07ea140
Binary files /dev/null and b/image/card/yitianjian.webp differ
diff --git a/image/card/yiyi.webp b/image/card/yiyi.webp
new file mode 100644
index 0000000..329a029
Binary files /dev/null and b/image/card/yiyi.webp differ
diff --git a/image/card/yonglv.webp b/image/card/yonglv.webp
new file mode 100644
index 0000000..b80717a
Binary files /dev/null and b/image/card/yonglv.webp differ
diff --git a/image/card/youdishenru.webp b/image/card/youdishenru.webp
new file mode 100644
index 0000000..7fa04d2
Binary files /dev/null and b/image/card/youdishenru.webp differ
diff --git a/image/card/yuanjiao.webp b/image/card/yuanjiao.webp
new file mode 100644
index 0000000..b6a6ea2
Binary files /dev/null and b/image/card/yuanjiao.webp differ
diff --git a/image/card/yuanjun.webp b/image/card/yuanjun.webp
new file mode 100644
index 0000000..1c6206d
Binary files /dev/null and b/image/card/yuanjun.webp differ
diff --git a/image/card/yuxi.webp b/image/card/yuxi.webp
new file mode 100644
index 0000000..45364d7
Binary files /dev/null and b/image/card/yuxi.webp differ
diff --git a/image/card/zengbin.webp b/image/card/zengbin.webp
new file mode 100644
index 0000000..221e17f
Binary files /dev/null and b/image/card/zengbin.webp differ
diff --git a/image/card/zhangba.webp b/image/card/zhangba.webp
new file mode 100644
index 0000000..98aaa07
Binary files /dev/null and b/image/card/zhangba.webp differ
diff --git a/image/card/zhanxiang.webp b/image/card/zhanxiang.webp
new file mode 100644
index 0000000..0b79f32
Binary files /dev/null and b/image/card/zhanxiang.webp differ
diff --git a/image/card/zhaogujing.webp b/image/card/zhaogujing.webp
new file mode 100644
index 0000000..1e89aa5
Binary files /dev/null and b/image/card/zhaogujing.webp differ
diff --git a/image/card/zhaoshu.webp b/image/card/zhaoshu.webp
new file mode 100644
index 0000000..9e3e956
Binary files /dev/null and b/image/card/zhaoshu.webp differ
diff --git a/image/card/zheji.webp b/image/card/zheji.webp
new file mode 100644
index 0000000..b91a77e
Binary files /dev/null and b/image/card/zheji.webp differ
diff --git a/image/card/zhenlongchangjian.webp b/image/card/zhenlongchangjian.webp
new file mode 100644
index 0000000..7ba2b71
Binary files /dev/null and b/image/card/zhenlongchangjian.webp differ
diff --git a/image/card/zhibi.webp b/image/card/zhibi.webp
new file mode 100644
index 0000000..e4e14bc
Binary files /dev/null and b/image/card/zhibi.webp differ
diff --git a/image/card/zhuahuang.webp b/image/card/zhuahuang.webp
new file mode 100644
index 0000000..f1f16d8
Binary files /dev/null and b/image/card/zhuahuang.webp differ
diff --git a/image/card/zhuangshu_basic.webp b/image/card/zhuangshu_basic.webp
new file mode 100644
index 0000000..78b377d
Binary files /dev/null and b/image/card/zhuangshu_basic.webp differ
diff --git a/image/card/zhuangshu_equip.webp b/image/card/zhuangshu_equip.webp
new file mode 100644
index 0000000..9396ce2
Binary files /dev/null and b/image/card/zhuangshu_equip.webp differ
diff --git a/image/card/zhuangshu_trick.webp b/image/card/zhuangshu_trick.webp
new file mode 100644
index 0000000..037df91
Binary files /dev/null and b/image/card/zhuangshu_trick.webp differ
diff --git a/image/card/zhuge.webp b/image/card/zhuge.webp
new file mode 100644
index 0000000..fb47c17
Binary files /dev/null and b/image/card/zhuge.webp differ
diff --git a/image/card/zhujinqiyuan.webp b/image/card/zhujinqiyuan.webp
new file mode 100644
index 0000000..286272c
Binary files /dev/null and b/image/card/zhujinqiyuan.webp differ
diff --git a/image/card/zhulu_card.webp b/image/card/zhulu_card.webp
new file mode 100644
index 0000000..2bcb281
Binary files /dev/null and b/image/card/zhulu_card.webp differ
diff --git a/image/card/zhungangshuo.webp b/image/card/zhungangshuo.webp
new file mode 100644
index 0000000..9f93a10
Binary files /dev/null and b/image/card/zhungangshuo.webp differ
diff --git a/image/card/zhuque.webp b/image/card/zhuque.webp
new file mode 100644
index 0000000..d7e4301
Binary files /dev/null and b/image/card/zhuque.webp differ
diff --git a/image/card/zixin.webp b/image/card/zixin.webp
new file mode 100644
index 0000000..a0dc68b
Binary files /dev/null and b/image/card/zixin.webp differ
diff --git a/image/card/zong.webp b/image/card/zong.webp
new file mode 100644
index 0000000..2ffdd64
Binary files /dev/null and b/image/card/zong.webp differ
diff --git a/image/decoration/border_camp.png b/image/decoration/border_camp.png
new file mode 100644
index 0000000..7a4f02b
Binary files /dev/null and b/image/decoration/border_camp.png differ
diff --git a/image/decoration/border_camp1.png b/image/decoration/border_camp1.png
new file mode 100644
index 0000000..4b896e2
Binary files /dev/null and b/image/decoration/border_camp1.png differ
diff --git a/image/decoration/border_camp2.png b/image/decoration/border_camp2.png
new file mode 100644
index 0000000..7f3bd80
Binary files /dev/null and b/image/decoration/border_camp2.png differ
diff --git a/image/decoration/border_camp3.png b/image/decoration/border_camp3.png
new file mode 100644
index 0000000..41a21e3
Binary files /dev/null and b/image/decoration/border_camp3.png differ
diff --git a/image/decoration/border_camp4.png b/image/decoration/border_camp4.png
new file mode 100644
index 0000000..285b896
Binary files /dev/null and b/image/decoration/border_camp4.png differ
diff --git a/image/decoration/border_camp5.png b/image/decoration/border_camp5.png
new file mode 100644
index 0000000..7a4f02b
Binary files /dev/null and b/image/decoration/border_camp5.png differ
diff --git a/image/decoration/border_hp.png b/image/decoration/border_hp.png
new file mode 100644
index 0000000..90e15bc
Binary files /dev/null and b/image/decoration/border_hp.png differ
diff --git a/image/decoration/border_hp1.png b/image/decoration/border_hp1.png
new file mode 100644
index 0000000..3bcf66a
Binary files /dev/null and b/image/decoration/border_hp1.png differ
diff --git a/image/decoration/border_hp2.png b/image/decoration/border_hp2.png
new file mode 100644
index 0000000..877ff27
Binary files /dev/null and b/image/decoration/border_hp2.png differ
diff --git a/image/decoration/border_hp3.png b/image/decoration/border_hp3.png
new file mode 100644
index 0000000..6d26d55
Binary files /dev/null and b/image/decoration/border_hp3.png differ
diff --git a/image/decoration/border_hp4.png b/image/decoration/border_hp4.png
new file mode 100644
index 0000000..32db715
Binary files /dev/null and b/image/decoration/border_hp4.png differ
diff --git a/image/decoration/button.png b/image/decoration/button.png
new file mode 100644
index 0000000..cec90c1
Binary files /dev/null and b/image/decoration/button.png differ
diff --git a/image/decoration/button_disable.png b/image/decoration/button_disable.png
new file mode 100644
index 0000000..e8af4a4
Binary files /dev/null and b/image/decoration/button_disable.png differ
diff --git a/image/decoration/card_count.png b/image/decoration/card_count.png
new file mode 100644
index 0000000..2524768
Binary files /dev/null and b/image/decoration/card_count.png differ
diff --git a/image/decoration/dead_bNei.png b/image/decoration/dead_bNei.png
new file mode 100644
index 0000000..ae45891
Binary files /dev/null and b/image/decoration/dead_bNei.png differ
diff --git a/image/decoration/dead_bYe.png b/image/decoration/dead_bYe.png
new file mode 100644
index 0000000..24911ad
Binary files /dev/null and b/image/decoration/dead_bYe.png differ
diff --git a/image/decoration/dead_bZhong.png b/image/decoration/dead_bZhong.png
new file mode 100644
index 0000000..2fe1e29
Binary files /dev/null and b/image/decoration/dead_bZhong.png differ
diff --git a/image/decoration/dead_bZhu.png b/image/decoration/dead_bZhu.png
new file mode 100644
index 0000000..9046389
Binary files /dev/null and b/image/decoration/dead_bZhu.png differ
diff --git a/image/decoration/dead_boss.png b/image/decoration/dead_boss.png
new file mode 100644
index 0000000..113d071
Binary files /dev/null and b/image/decoration/dead_boss.png differ
diff --git a/image/decoration/dead_cong.png b/image/decoration/dead_cong.png
new file mode 100644
index 0000000..3d5fd40
Binary files /dev/null and b/image/decoration/dead_cong.png differ
diff --git a/image/decoration/dead_dajiang.png b/image/decoration/dead_dajiang.png
new file mode 100644
index 0000000..972bbbb
Binary files /dev/null and b/image/decoration/dead_dajiang.png differ
diff --git a/image/decoration/dead_dizhu.png b/image/decoration/dead_dizhu.png
new file mode 100644
index 0000000..165c56c
Binary files /dev/null and b/image/decoration/dead_dizhu.png differ
diff --git a/image/decoration/dead_enemy.png b/image/decoration/dead_enemy.png
new file mode 100644
index 0000000..3a40879
Binary files /dev/null and b/image/decoration/dead_enemy.png differ
diff --git a/image/decoration/dead_fan.png b/image/decoration/dead_fan.png
new file mode 100644
index 0000000..d9b8dff
Binary files /dev/null and b/image/decoration/dead_fan.png differ
diff --git a/image/decoration/dead_friend.png b/image/decoration/dead_friend.png
new file mode 100644
index 0000000..aad68b8
Binary files /dev/null and b/image/decoration/dead_friend.png differ
diff --git a/image/decoration/dead_jin.png b/image/decoration/dead_jin.png
new file mode 100644
index 0000000..b62a010
Binary files /dev/null and b/image/decoration/dead_jin.png differ
diff --git a/image/decoration/dead_jinjun.png b/image/decoration/dead_jinjun.png
new file mode 100644
index 0000000..e7ddbd9
Binary files /dev/null and b/image/decoration/dead_jinjun.png differ
diff --git a/image/decoration/dead_junshi.png b/image/decoration/dead_junshi.png
new file mode 100644
index 0000000..772ed0f
Binary files /dev/null and b/image/decoration/dead_junshi.png differ
diff --git a/image/decoration/dead_key.png b/image/decoration/dead_key.png
new file mode 100644
index 0000000..f30fe83
Binary files /dev/null and b/image/decoration/dead_key.png differ
diff --git a/image/decoration/dead_keyjun.png b/image/decoration/dead_keyjun.png
new file mode 100644
index 0000000..f30fe83
Binary files /dev/null and b/image/decoration/dead_keyjun.png differ
diff --git a/image/decoration/dead_meng.png b/image/decoration/dead_meng.png
new file mode 100644
index 0000000..13e4e92
Binary files /dev/null and b/image/decoration/dead_meng.png differ
diff --git a/image/decoration/dead_mingzhong.png b/image/decoration/dead_mingzhong.png
new file mode 100644
index 0000000..581d51e
Binary files /dev/null and b/image/decoration/dead_mingzhong.png differ
diff --git a/image/decoration/dead_nei.png b/image/decoration/dead_nei.png
new file mode 100644
index 0000000..9e36862
Binary files /dev/null and b/image/decoration/dead_nei.png differ
diff --git a/image/decoration/dead_nongmin.png b/image/decoration/dead_nongmin.png
new file mode 100644
index 0000000..3ceee7c
Binary files /dev/null and b/image/decoration/dead_nongmin.png differ
diff --git a/image/decoration/dead_qun.png b/image/decoration/dead_qun.png
new file mode 100644
index 0000000..f4dba7a
Binary files /dev/null and b/image/decoration/dead_qun.png differ
diff --git a/image/decoration/dead_qunjun.png b/image/decoration/dead_qunjun.png
new file mode 100644
index 0000000..fab0818
Binary files /dev/null and b/image/decoration/dead_qunjun.png differ
diff --git a/image/decoration/dead_rNei.png b/image/decoration/dead_rNei.png
new file mode 100644
index 0000000..a7e1617
Binary files /dev/null and b/image/decoration/dead_rNei.png differ
diff --git a/image/decoration/dead_rYe.png b/image/decoration/dead_rYe.png
new file mode 100644
index 0000000..102756e
Binary files /dev/null and b/image/decoration/dead_rYe.png differ
diff --git a/image/decoration/dead_rZhong.png b/image/decoration/dead_rZhong.png
new file mode 100644
index 0000000..403c7f1
Binary files /dev/null and b/image/decoration/dead_rZhong.png differ
diff --git a/image/decoration/dead_rZhu.png b/image/decoration/dead_rZhu.png
new file mode 100644
index 0000000..0ee1492
Binary files /dev/null and b/image/decoration/dead_rZhu.png differ
diff --git a/image/decoration/dead_shu.png b/image/decoration/dead_shu.png
new file mode 100644
index 0000000..31170eb
Binary files /dev/null and b/image/decoration/dead_shu.png differ
diff --git a/image/decoration/dead_shujun.png b/image/decoration/dead_shujun.png
new file mode 100644
index 0000000..0f486a6
Binary files /dev/null and b/image/decoration/dead_shujun.png differ
diff --git a/image/decoration/dead_wei.png b/image/decoration/dead_wei.png
new file mode 100644
index 0000000..a336ad6
Binary files /dev/null and b/image/decoration/dead_wei.png differ
diff --git a/image/decoration/dead_weijun.png b/image/decoration/dead_weijun.png
new file mode 100644
index 0000000..39cac51
Binary files /dev/null and b/image/decoration/dead_weijun.png differ
diff --git a/image/decoration/dead_wu.png b/image/decoration/dead_wu.png
new file mode 100644
index 0000000..13980ac
Binary files /dev/null and b/image/decoration/dead_wu.png differ
diff --git a/image/decoration/dead_wujun.png b/image/decoration/dead_wujun.png
new file mode 100644
index 0000000..cdb521c
Binary files /dev/null and b/image/decoration/dead_wujun.png differ
diff --git a/image/decoration/dead_xwxhcike.png b/image/decoration/dead_xwxhcike.png
new file mode 100644
index 0000000..f844fcf
Binary files /dev/null and b/image/decoration/dead_xwxhcike.png differ
diff --git a/image/decoration/dead_xwxhhuwei.png b/image/decoration/dead_xwxhhuwei.png
new file mode 100644
index 0000000..0ed4fe3
Binary files /dev/null and b/image/decoration/dead_xwxhhuwei.png differ
diff --git a/image/decoration/dead_xwxhjianzhu.png b/image/decoration/dead_xwxhjianzhu.png
new file mode 100644
index 0000000..5bcde0b
Binary files /dev/null and b/image/decoration/dead_xwxhjianzhu.png differ
diff --git a/image/decoration/dead_xwxhluankou.png b/image/decoration/dead_xwxhluankou.png
new file mode 100644
index 0000000..68d2d90
Binary files /dev/null and b/image/decoration/dead_xwxhluankou.png differ
diff --git a/image/decoration/dead_xwxhxizuo.png b/image/decoration/dead_xwxhxizuo.png
new file mode 100644
index 0000000..0ed4fe3
Binary files /dev/null and b/image/decoration/dead_xwxhxizuo.png differ
diff --git a/image/decoration/dead_xwxhzhu.png b/image/decoration/dead_xwxhzhu.png
new file mode 100644
index 0000000..0ed4fe3
Binary files /dev/null and b/image/decoration/dead_xwxhzhu.png differ
diff --git a/image/decoration/dead_ye.png b/image/decoration/dead_ye.png
new file mode 100644
index 0000000..102756e
Binary files /dev/null and b/image/decoration/dead_ye.png differ
diff --git a/image/decoration/dead_zeishou.png b/image/decoration/dead_zeishou.png
new file mode 100644
index 0000000..bb5aaf8
Binary files /dev/null and b/image/decoration/dead_zeishou.png differ
diff --git a/image/decoration/dead_zhong.png b/image/decoration/dead_zhong.png
new file mode 100644
index 0000000..bbe276d
Binary files /dev/null and b/image/decoration/dead_zhong.png differ
diff --git a/image/decoration/dead_zhu.png b/image/decoration/dead_zhu.png
new file mode 100644
index 0000000..e41f7a8
Binary files /dev/null and b/image/decoration/dead_zhu.png differ
diff --git a/image/decoration/dialog.png b/image/decoration/dialog.png
new file mode 100644
index 0000000..3b53268
Binary files /dev/null and b/image/decoration/dialog.png differ
diff --git a/image/decoration/identity_boss.png b/image/decoration/identity_boss.png
new file mode 100644
index 0000000..87212aa
Binary files /dev/null and b/image/decoration/identity_boss.png differ
diff --git a/image/decoration/identity_cai.png b/image/decoration/identity_cai.png
new file mode 100644
index 0000000..df8f502
Binary files /dev/null and b/image/decoration/identity_cai.png differ
diff --git a/image/decoration/identity_cai_blue.png b/image/decoration/identity_cai_blue.png
new file mode 100644
index 0000000..47873b6
Binary files /dev/null and b/image/decoration/identity_cai_blue.png differ
diff --git a/image/decoration/identity_dajiang.png b/image/decoration/identity_dajiang.png
new file mode 100644
index 0000000..d223907
Binary files /dev/null and b/image/decoration/identity_dajiang.png differ
diff --git a/image/decoration/identity_dizhu.png b/image/decoration/identity_dizhu.png
new file mode 100644
index 0000000..7d33ca7
Binary files /dev/null and b/image/decoration/identity_dizhu.png differ
diff --git a/image/decoration/identity_enemy.png b/image/decoration/identity_enemy.png
new file mode 100644
index 0000000..b69202e
Binary files /dev/null and b/image/decoration/identity_enemy.png differ
diff --git a/image/decoration/identity_fan.png b/image/decoration/identity_fan.png
new file mode 100644
index 0000000..6b681c6
Binary files /dev/null and b/image/decoration/identity_fan.png differ
diff --git a/image/decoration/identity_friend.png b/image/decoration/identity_friend.png
new file mode 100644
index 0000000..3d59781
Binary files /dev/null and b/image/decoration/identity_friend.png differ
diff --git a/image/decoration/identity_guessing.png b/image/decoration/identity_guessing.png
new file mode 100644
index 0000000..85e0250
Binary files /dev/null and b/image/decoration/identity_guessing.png differ
diff --git a/image/decoration/identity_houshou.png b/image/decoration/identity_houshou.png
new file mode 100644
index 0000000..984b2a8
Binary files /dev/null and b/image/decoration/identity_houshou.png differ
diff --git a/image/decoration/identity_junshi.png b/image/decoration/identity_junshi.png
new file mode 100644
index 0000000..63806da
Binary files /dev/null and b/image/decoration/identity_junshi.png differ
diff --git a/image/decoration/identity_mengjun.png b/image/decoration/identity_mengjun.png
new file mode 100644
index 0000000..6e778fe
Binary files /dev/null and b/image/decoration/identity_mengjun.png differ
diff --git a/image/decoration/identity_mingzhong.png b/image/decoration/identity_mingzhong.png
new file mode 100644
index 0000000..a32c75e
Binary files /dev/null and b/image/decoration/identity_mingzhong.png differ
diff --git a/image/decoration/identity_nei.png b/image/decoration/identity_nei.png
new file mode 100644
index 0000000..2b5e6cc
Binary files /dev/null and b/image/decoration/identity_nei.png differ
diff --git a/image/decoration/identity_nongmin.png b/image/decoration/identity_nongmin.png
new file mode 100644
index 0000000..43f89ec
Binary files /dev/null and b/image/decoration/identity_nongmin.png differ
diff --git a/image/decoration/identity_qianfeng.png b/image/decoration/identity_qianfeng.png
new file mode 100644
index 0000000..2158f29
Binary files /dev/null and b/image/decoration/identity_qianfeng.png differ
diff --git a/image/decoration/identity_qianfeng_blue.png b/image/decoration/identity_qianfeng_blue.png
new file mode 100644
index 0000000..cb5506a
Binary files /dev/null and b/image/decoration/identity_qianfeng_blue.png differ
diff --git a/image/decoration/identity_suicong.png b/image/decoration/identity_suicong.png
new file mode 100644
index 0000000..89d224e
Binary files /dev/null and b/image/decoration/identity_suicong.png differ
diff --git a/image/decoration/identity_xianshou.png b/image/decoration/identity_xianshou.png
new file mode 100644
index 0000000..c105d82
Binary files /dev/null and b/image/decoration/identity_xianshou.png differ
diff --git a/image/decoration/identity_xizuo.png b/image/decoration/identity_xizuo.png
new file mode 100644
index 0000000..499384e
Binary files /dev/null and b/image/decoration/identity_xizuo.png differ
diff --git a/image/decoration/identity_xizuo_blue.png b/image/decoration/identity_xizuo_blue.png
new file mode 100644
index 0000000..847329c
Binary files /dev/null and b/image/decoration/identity_xizuo_blue.png differ
diff --git a/image/decoration/identity_ye.png b/image/decoration/identity_ye.png
new file mode 100644
index 0000000..f5731ab
Binary files /dev/null and b/image/decoration/identity_ye.png differ
diff --git a/image/decoration/identity_ye_blue.png b/image/decoration/identity_ye_blue.png
new file mode 100644
index 0000000..848fa61
Binary files /dev/null and b/image/decoration/identity_ye_blue.png differ
diff --git a/image/decoration/identity_zeishou.png b/image/decoration/identity_zeishou.png
new file mode 100644
index 0000000..7e5b096
Binary files /dev/null and b/image/decoration/identity_zeishou.png differ
diff --git a/image/decoration/identity_zhong.png b/image/decoration/identity_zhong.png
new file mode 100644
index 0000000..584615b
Binary files /dev/null and b/image/decoration/identity_zhong.png differ
diff --git a/image/decoration/identity_zhong_blue.png b/image/decoration/identity_zhong_blue.png
new file mode 100644
index 0000000..838c670
Binary files /dev/null and b/image/decoration/identity_zhong_blue.png differ
diff --git a/image/decoration/identity_zhu.png b/image/decoration/identity_zhu.png
new file mode 100644
index 0000000..e3d1aaa
Binary files /dev/null and b/image/decoration/identity_zhu.png differ
diff --git a/image/decoration/identity_zhu_blue.png b/image/decoration/identity_zhu_blue.png
new file mode 100644
index 0000000..3260f76
Binary files /dev/null and b/image/decoration/identity_zhu_blue.png differ
diff --git a/image/decoration/identity_zhushuai.png b/image/decoration/identity_zhushuai.png
new file mode 100644
index 0000000..edce588
Binary files /dev/null and b/image/decoration/identity_zhushuai.png differ
diff --git a/image/decoration/identity_zhushuai_blue.png b/image/decoration/identity_zhushuai_blue.png
new file mode 100644
index 0000000..cf6f82e
Binary files /dev/null and b/image/decoration/identity_zhushuai_blue.png differ
diff --git a/image/decoration/name_SK_demon.png b/image/decoration/name_SK_demon.png
new file mode 100644
index 0000000..b80a151
Binary files /dev/null and b/image/decoration/name_SK_demon.png differ
diff --git a/image/decoration/name_SK_demon.webp b/image/decoration/name_SK_demon.webp
new file mode 100644
index 0000000..361515b
Binary files /dev/null and b/image/decoration/name_SK_demon.webp differ
diff --git a/image/decoration/name_SK_east.png b/image/decoration/name_SK_east.png
new file mode 100644
index 0000000..6a6fb0d
Binary files /dev/null and b/image/decoration/name_SK_east.png differ
diff --git a/image/decoration/name_SK_east.webp b/image/decoration/name_SK_east.webp
new file mode 100644
index 0000000..bea3e59
Binary files /dev/null and b/image/decoration/name_SK_east.webp differ
diff --git a/image/decoration/name_SK_king.png b/image/decoration/name_SK_king.png
new file mode 100644
index 0000000..84c8b99
Binary files /dev/null and b/image/decoration/name_SK_king.png differ
diff --git a/image/decoration/name_SK_king.webp b/image/decoration/name_SK_king.webp
new file mode 100644
index 0000000..895be33
Binary files /dev/null and b/image/decoration/name_SK_king.webp differ
diff --git a/image/decoration/name_SK_qun.png b/image/decoration/name_SK_qun.png
new file mode 100644
index 0000000..cc4cbc9
Binary files /dev/null and b/image/decoration/name_SK_qun.png differ
diff --git a/image/decoration/name_SK_qun.webp b/image/decoration/name_SK_qun.webp
new file mode 100644
index 0000000..7232fef
Binary files /dev/null and b/image/decoration/name_SK_qun.webp differ
diff --git a/image/decoration/name_SK_sea.png b/image/decoration/name_SK_sea.png
new file mode 100644
index 0000000..c2f9b63
Binary files /dev/null and b/image/decoration/name_SK_sea.png differ
diff --git a/image/decoration/name_SK_sea.webp b/image/decoration/name_SK_sea.webp
new file mode 100644
index 0000000..c5376fc
Binary files /dev/null and b/image/decoration/name_SK_sea.webp differ
diff --git a/image/decoration/name_SK_shen.png b/image/decoration/name_SK_shen.png
new file mode 100644
index 0000000..88cf3c3
Binary files /dev/null and b/image/decoration/name_SK_shen.png differ
diff --git a/image/decoration/name_SK_shen.webp b/image/decoration/name_SK_shen.webp
new file mode 100644
index 0000000..cf7c60b
Binary files /dev/null and b/image/decoration/name_SK_shen.webp differ
diff --git a/image/decoration/name_daqin.png b/image/decoration/name_daqin.png
new file mode 100644
index 0000000..d722ecd
Binary files /dev/null and b/image/decoration/name_daqin.png differ
diff --git a/image/decoration/name_han.png b/image/decoration/name_han.png
new file mode 100644
index 0000000..54f4f25
Binary files /dev/null and b/image/decoration/name_han.png differ
diff --git a/image/decoration/name_jin.png b/image/decoration/name_jin.png
new file mode 100644
index 0000000..dcb0958
Binary files /dev/null and b/image/decoration/name_jin.png differ
diff --git a/image/decoration/name_key.png b/image/decoration/name_key.png
new file mode 100644
index 0000000..de02dbe
Binary files /dev/null and b/image/decoration/name_key.png differ
diff --git a/image/decoration/name_qun.png b/image/decoration/name_qun.png
new file mode 100644
index 0000000..15c1375
Binary files /dev/null and b/image/decoration/name_qun.png differ
diff --git a/image/decoration/name_shen.png b/image/decoration/name_shen.png
new file mode 100644
index 0000000..88cf3c3
Binary files /dev/null and b/image/decoration/name_shen.png differ
diff --git a/image/decoration/name_shen2.png b/image/decoration/name_shen2.png
new file mode 100644
index 0000000..f58d0c0
Binary files /dev/null and b/image/decoration/name_shen2.png differ
diff --git a/image/decoration/name_shu.png b/image/decoration/name_shu.png
new file mode 100644
index 0000000..d52a622
Binary files /dev/null and b/image/decoration/name_shu.png differ
diff --git a/image/decoration/name_unknown.png b/image/decoration/name_unknown.png
new file mode 100644
index 0000000..6fb4baf
Binary files /dev/null and b/image/decoration/name_unknown.png differ
diff --git a/image/decoration/name_wei.png b/image/decoration/name_wei.png
new file mode 100644
index 0000000..eaa8ad0
Binary files /dev/null and b/image/decoration/name_wei.png differ
diff --git a/image/decoration/name_western.png b/image/decoration/name_western.png
new file mode 100644
index 0000000..7d64e98
Binary files /dev/null and b/image/decoration/name_western.png differ
diff --git a/image/decoration/name_wu.png b/image/decoration/name_wu.png
new file mode 100644
index 0000000..9ae6341
Binary files /dev/null and b/image/decoration/name_wu.png differ
diff --git a/image/decoration/name_xwjh_chao.png b/image/decoration/name_xwjh_chao.png
new file mode 100644
index 0000000..9ac459a
Binary files /dev/null and b/image/decoration/name_xwjh_chao.png differ
diff --git a/image/decoration/name_xwjh_chao.webp b/image/decoration/name_xwjh_chao.webp
new file mode 100644
index 0000000..5590f68
Binary files /dev/null and b/image/decoration/name_xwjh_chao.webp differ
diff --git a/image/decoration/name_xwjh_qiu.png b/image/decoration/name_xwjh_qiu.png
new file mode 100644
index 0000000..12d914d
Binary files /dev/null and b/image/decoration/name_xwjh_qiu.png differ
diff --git a/image/decoration/name_xwjh_xian.png b/image/decoration/name_xwjh_xian.png
new file mode 100644
index 0000000..a0468d3
Binary files /dev/null and b/image/decoration/name_xwjh_xian.png differ
diff --git a/image/decoration/name_xwjh_xian.webp b/image/decoration/name_xwjh_xian.webp
new file mode 100644
index 0000000..1468f61
Binary files /dev/null and b/image/decoration/name_xwjh_xian.webp differ
diff --git a/image/decoration/name_xwjh_xie.png b/image/decoration/name_xwjh_xie.png
new file mode 100644
index 0000000..f82a666
Binary files /dev/null and b/image/decoration/name_xwjh_xie.png differ
diff --git a/image/decoration/name_xwjh_xie.webp b/image/decoration/name_xwjh_xie.webp
new file mode 100644
index 0000000..5bc6f0f
Binary files /dev/null and b/image/decoration/name_xwjh_xie.webp differ
diff --git a/image/decoration/name_xwjh_ye.png b/image/decoration/name_xwjh_ye.png
new file mode 100644
index 0000000..01af019
Binary files /dev/null and b/image/decoration/name_xwjh_ye.png differ
diff --git a/image/decoration/name_xwjh_ye.webp b/image/decoration/name_xwjh_ye.webp
new file mode 100644
index 0000000..ec9ed02
Binary files /dev/null and b/image/decoration/name_xwjh_ye.webp differ
diff --git a/image/decoration/name_xwjh_zheng.png b/image/decoration/name_xwjh_zheng.png
new file mode 100644
index 0000000..39d0c74
Binary files /dev/null and b/image/decoration/name_xwjh_zheng.png differ
diff --git a/image/decoration/name_xwjh_zheng.webp b/image/decoration/name_xwjh_zheng.webp
new file mode 100644
index 0000000..df6526e
Binary files /dev/null and b/image/decoration/name_xwjh_zheng.webp differ
diff --git a/image/decoration/name_xwjh_zong.png b/image/decoration/name_xwjh_zong.png
new file mode 100644
index 0000000..dfb7187
Binary files /dev/null and b/image/decoration/name_xwjh_zong.png differ
diff --git a/image/decoration/name_xwjh_zong.webp b/image/decoration/name_xwjh_zong.webp
new file mode 100644
index 0000000..3226e37
Binary files /dev/null and b/image/decoration/name_xwjh_zong.webp differ
diff --git a/image/decoration/name_yao.png b/image/decoration/name_yao.png
new file mode 100644
index 0000000..4968bcc
Binary files /dev/null and b/image/decoration/name_yao.png differ
diff --git a/image/decoration/name_ye.png b/image/decoration/name_ye.png
new file mode 100644
index 0000000..6d5a709
Binary files /dev/null and b/image/decoration/name_ye.png differ
diff --git a/image/decoration/vs.png b/image/decoration/vs.png
new file mode 100644
index 0000000..736c427
Binary files /dev/null and b/image/decoration/vs.png differ
diff --git a/info.json b/info.json
new file mode 100644
index 0000000..0cc42a0
--- /dev/null
+++ b/info.json
@@ -0,0 +1,9 @@
+{
+ "name":"十周年UI",
+ "author":"Show-K←寰宇星城←disgrace2013←短歌 QQ464598631",
+ "version":"1.10.7.1",
+ "intro":"有bug先检查其他扩展,不行再关闭UI重试,最后再联系作者。",
+ "diskURL":"https://github.com/Tipx-L/decade-ui/releases/latest/download/decade-ui.zip",
+ "forumURL":"https://github.com/Tipx-L/decade-ui/issues",
+ "updateDate":"2024-02-09"
+}
\ No newline at end of file
diff --git a/layout.css b/layout.css
new file mode 100644
index 0000000..503fe0d
--- /dev/null
+++ b/layout.css
@@ -0,0 +1,633 @@
+@import 'dialog.css';
+@import 'component.css';
+@import 'card.css';
+@import 'icon.css';
+@import 'animation.css';
+@import 'effect.css';
+@import 'equip.css';
+
+html {
+ background: rgb(60, 60, 60);
+}
+
+/* #arena>.dialog { */
+/* display: none; */
+/* } */
+
+body>.background {
+ animation: anime-opacity 1s ease-in-out;
+}
+
+@keyframes anime-opacity {
+ 0% {
+ opacity: 0;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+}
+
+#decadeUI-canvas,
+#decadeUI-canvas-background {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 8;
+ pointer-events: none;
+}
+
+#decadeUI-canvas-background {
+ z-index: -1;
+}
+
+#decadeUI-canvas-arena {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ z-index: 4;
+ pointer-events: none;
+}
+
+#decadeUI-body-sensor {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ visibility: hidden;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+}
+
+#arena {
+ left: 22px;
+ right: 25px;
+ top: 10%;
+ bottom: 1%;
+ width: auto;
+ height: auto;
+ /* pointer-events: none; */
+ transition-property: opacity;
+}
+
+#arena.phone {
+ top: 2%;
+}
+
+/* #arena.dragging { */
+/* cursor: default; */
+/* } */
+
+#window.leftbar #arena:not(.chess) {
+ width: auto;
+ left: calc(2% + 50px);
+}
+
+#window.rightbar #arena:not(.chess) {
+ width: auto;
+ right: calc(2% + 50px);
+}
+
+#arena:not(.chess).decadeUI>#mebg {
+ display: none;
+}
+
+#arena.decadeUI:not(.single-handcard):not(.chess)>#autonode {
+ display: flex !important;
+ align-items: center;
+ justify-content: center;
+ left: -2% !important;
+ right: -2% !important;
+ bottom: -2% !important;
+ width: auto !important;
+ height: calc(2% + 180px);
+ background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
+}
+
+#autonode>div {
+ position: static;
+ text-shadow: 0 0 20px red;
+}
+
+#shortcut.hidden {
+ z-index: -1;
+}
+
+#window>#time {
+ left: 50px;
+ right: 50px;
+ color: rgb(250, 250, 200);
+ font-family: xinwei;
+ text-shadow: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black;
+}
+
+#arena>.hand-wrap,
+#arena>.hand-back {
+ left: 143px;
+ right: 170px;
+ width: auto;
+ height: 170px;
+ bottom: 1%;
+ transition: none;
+ z-index: 6;
+}
+
+#arena[data-right-layout='on']>.hand-wrap,
+#arena[data-right-layout='on']>.hand-back {
+ left: 160px;
+ right: 140px;
+}
+
+.discard-zone {
+ width: 100%;
+ height: 10%;
+}
+
+.hand-wrap>.fakeme.avatar {
+ left: -128px;
+ top: auto;
+ right: auto;
+ bottom: 0;
+ width: 120px;
+ height: 120px;
+ border-radius: 0;
+ background-size: cover;
+}
+
+#arena[data-right-layout='on']>.hand-wrap>.fakeme.avatar {
+ left: auto;
+ right: -128px;
+}
+
+.hand-cards {
+ display: inline-block;
+ width: 100%;
+ height: 100%;
+ transition: none;
+ z-index: 3;
+}
+
+.hand-cards>.handcards {
+ display: inline-block;
+ padding: 0;
+ margin: 0;
+ bottom: 0px;
+ width: 100%;
+ height: calc(100% - 30px);
+ min-width: 100%;
+ transition: none;
+}
+
+.hand-cards>.handcards>.card {
+ margin: 0px;
+ width: 108px;
+ height: 150px;
+ position: absolute;
+ transition-property: transform, opacity, left, top;
+ z-index: 1;
+}
+
+.hand-cards>.handcards>.card.display-none {
+ display: none;
+ transition: none;
+}
+
+.hand-cards>.handcards>.card.selected {
+ border-radius: 2px;
+}
+
+.hand-cards>.handcards>.card.selectable {
+ border-radius: 2px;
+ cursor: pointer;
+}
+
+.hand-special {
+ left: auto;
+ right: calc(-1% + 3px);
+ bottom: calc(1% + 150px);
+ width: auto;
+ height: 75px;
+ min-width: 150px;
+ box-shadow: 0 0 6px rgb(200, 150, 80) inset;
+ background: rgba(0, 0, 0, 0.4);
+}
+
+.hand-special>.cards {
+ display: flex;
+ flex-direction: row-reverse;
+ position: relative;
+ left: 0;
+ top: 0;
+ width: auto;
+ height: auto;
+ zoom: 0.5;
+}
+
+.hand-special>.cards>.card {
+ margin-top: 0;
+ margin-left: 0;
+ margin-right: 0;
+ transform: none !important;
+}
+
+.hand-special>.cards>.card::after {
+ border-radius: inherit !important;
+ box-shadow: 0px -1px 2px yellow, 0px -1px 5px yellow, 0px 0px 15px yellow;
+ transition: opacity 0.5s;
+}
+
+#arena>.card,
+#arena.oblongcard:not(.chess)>.card,
+#arena.oblongcard:not(.chess) .handcards>.card {
+ width: 108px;
+ height: 150px;
+}
+
+.button.card {
+ width: 108px;
+ height: 150px;
+ background-size: 100% 100%;
+}
+
+.card,
+#window:not(*[data-radius_size='']) .card {
+ border-radius: 2px;
+}
+
+.card {
+ width: 108px;
+ height: 150px;
+ box-shadow: 0 1px 4px black;
+ border-radius: 2px;
+ background-repeat: no-repeat !important;
+ background-size: 100% 100% !important;
+ -moz-background-size: 100% 100% !important;
+ transition: all 0.46s;
+}
+
+.dui-mobile .card {
+ box-shadow: 0 1px 2px black;
+}
+
+#arena.decadeUI.selecting:not(.video)>.dialog:not(.noselect) .buttons>.card.button:not(.selectable):not(.noclick):not(.replaceButton) {
+ opacity: 1;
+}
+
+#arena.decadeUI.selecting:not(.video)>.dialog:not(.noselect) .buttons>.card.button:not(.selected):not(.selectable)>.card-mask {
+ opacity: 1;
+}
+
+.card>.background,
+.card.button>.background {
+ top: auto;
+ bottom: 8%;
+ font-size: 80px;
+ line-height: 80px;
+ padding-top: 0;
+}
+
+.card.mark>.background {
+ line-height: 100%;
+}
+
+.card>.top-name {
+ left: 14px;
+ top: 10px;
+ width: calc(100% - 15px);
+ color: black;
+ font-size: 20px;
+ font-family: shousha;
+ text-align: center;
+ z-index: 1;
+}
+
+.card.decade-card>.top-name {
+ display: none;
+}
+
+.card.decade-card>.image {
+ display: none;
+ visibility: hidden !important;
+}
+
+.card>.image,
+#arena:not(.chess)>.card>.image,
+#arena:not(.chess) .handcards>.card>.image,
+#arena.oblongcard:not(.chess)>.card>.image,
+#arena.oblongcard:not(.chess) .handcards>.card>.image {
+ position: absolute;
+ width: 108px;
+ height: 108px;
+ left: 0;
+ top: auto;
+ right: 0;
+ bottom: 8%;
+ background-position-x: 0;
+}
+
+.card>.suit-num {
+ color: black;
+ display: flex;
+ flex-direction: column;
+ font-size: 25px;
+ height: auto;
+ left: 5px;
+ letter-spacing: -1px;
+ line-height: 20px;
+ text-align: center;
+ text-shadow: 0 0 3px #ffffff, 0 0 8px #ffffff;
+ -webkit-text-size-adjust: none;
+ top: 10px;
+ transform-origin: 0 0;
+ width: 25px;
+ z-index: 1;
+}
+
+.dui-mobile .card>.suit-num>.suit {
+ font-size: 16px;
+}
+
+.card[data-suit='heart']>.suit-num,
+.card[data-suit='diamond']>.suit-num {
+ color: red;
+}
+
+.card>.range {
+ right: 5px;
+ bottom: 5px;
+ line-height: 14px;
+ color: black;
+ font-size: 14px;
+ font-weight: bold;
+ font-family: shousha;
+ text-shadow: 0 0 1px white, 0 0 3px white;
+ border: 1px solid black;
+ border-radius: 2px;
+}
+
+.card>.range:empty {
+ display: none;
+}
+
+.card>.range.card-tag {
+ left: 4px;
+ top: calc(50% + 13px);
+ bottom: auto;
+ right: 4px;
+ width: auto;
+ color: #181818;
+ font-size: 16px;
+ line-height: 24px;
+ text-align: center;
+ text-shadow: none;
+ white-space: normal;
+ background: rgba(230, 210, 166, 0.8);
+}
+
+.card.fullborder>.range.card-tag,
+.card.fullimage>.range.card-tag {
+ background-color: rgba(0, 0, 0, 0.8);
+ border-color: white;
+}
+
+.card>.card-mask {
+ opacity: 0;
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.4);
+ border-radius: inherit;
+ transition: opacity 0.1s linear;
+ pointer-events: none;
+ z-index: 8;
+}
+
+.card.invalided>.card-mask,
+#arena.selecting:not(.video) .handcards>.card:not(.selectable)>.card-mask,
+#arena.thrownhighlight>.card.thrown:not(.thrownhighlight):not(.drawingcard),
+#arena.thrownhighlight>.card.thrown:not(.thrownhighlight):not(.drawingcard)>.card-mask {
+ opacity: 1;
+}
+
+.transition-none {
+ transition: none !important;
+}
+
+/*牌堆牌数 游戏时间*/
+.touchinfo {
+ top: 1%;
+ color: rgb(250, 250, 200);
+ font-family: xinwei;
+ text-shadow: rgb(51, 51, 51) 1px 0 0, rgb(51, 51, 51) 0 1px 0, rgb(51, 51, 51) -1px 0 0, rgb(51, 51, 51) 0 -1px 0;
+ /* background: 0 0 1px black, 0 0 1px black, 0 0 1px black, 0 0 1px black; */
+ z-index: 4;
+}
+
+.touchinfo.left {
+ left: 2%;
+}
+
+.touchinfo.right {
+ right: 2%;
+}
+
+#window.leftbar>.touchinfo.left {
+ left: calc(2% + 50px);
+}
+
+#window.rightbar>.touchinfo.right {
+ right: calc(2% + 50px);
+}
+
+#arena>.dialog {
+ z-index: 7;
+}
+
+/*界面操作按钮*/
+#arena>#dui-controls {
+ position: absolute;
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ top: auto;
+ left: 143px;
+ right: 150px;
+ bottom: calc(20% + 40px);
+ width: auto;
+ height: 42px;
+ font-size: 23px;
+ font-family: xinwei;
+ transition: opacity 0.3s;
+ pointer-events: none;
+ z-index: 8;
+}
+
+#arena>#dui-controls>* {
+ height: 44px;
+ font-size: 24px;
+ overflow: inherit;
+ pointer-events: auto;
+}
+
+#arena>#dui-controls.bosslist,
+#arena.choose-character>#dui-controls {
+ bottom: 20px;
+}
+
+#arena.dui-mobile:not(.choose-character)>#dui-controls {
+ bottom: calc(23% + 40px);
+}
+
+#arena>#dui-controls>.control {
+ flex: 0 0 auto;
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ position: static;
+ height: calc(100% - 4px);
+ line-height: normal;
+ margin-left: 5px;
+ margin-right: 5px;
+ text-shadow: none;
+ font-size: inherit;
+ cursor: pointer;
+}
+
+#arena>#dui-controls>.control.stayleft {
+ position: absolute;
+ left: 0;
+ order: 0;
+}
+
+#arena>#dui-controls>.control>div {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: static;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ height: 100%;
+ margin-left: 5px;
+ margin-right: 5px;
+ opacity: 1;
+}
+
+#arena>#dui-controls>.control>div:only-child {
+ position: static;
+ padding-left: 3px;
+ padding-right: 3px;
+ padding-top: 0;
+ padding-bottom: 0;
+}
+
+#arena>#dui-controls>.control.combo-control {
+ flex-direction: row;
+ padding-left: 0;
+ padding-right: 0;
+ box-shadow: none;
+ background: none;
+}
+
+#arena>#dui-controls>.control:not(.disabled)>div:active,
+#arena>#dui-controls>.control:not(.disabled):not(.combo-control):active {
+ transform: scale(0.96);
+}
+
+
+#arena>#dui-controls>.control.combo-control>div {
+ font-size: inherit;
+}
+
+#arena.choose-to-move>#dui-controls {
+ top: calc(80%) !important;
+}
+
+/*暂停记录栏*/
+.pausedbg>#sidebar {
+ width: auto;
+}
+
+.dialog .buttons>.button.character.decadeUI,
+.button.character.longcharacter.decadeUI {
+ width: 90px;
+ height: 120px;
+ background-position: 666px 666px;
+ background-size: 0 0 !important;
+}
+
+.button.character {
+ position: relative;
+ width: 90px;
+ height: 120px;
+ margin: 6px;
+}
+
+.button.character::before {
+ left: -15px;
+ top: -15px;
+ width: calc(100% + 30px);
+ height: calc(100% + 30px);
+ box-shadow: none;
+ box-sizing: border-box;
+ border-width: 15px;
+ border-style: solid;
+ border-color: transparent;
+ border-image-source: url('assets/image/glow_orange.png');
+ border-image-slice: 42 46 32 46 fill;
+}
+
+.button.character.selected::before {
+ opacity: 1;
+}
+
+.button.character::after {
+ display: none;
+}
+
+.button.character>.showintro.rarity {
+ font-family: yuanli;
+ font-size: 16px;
+ bottom: -25px;
+ left: calc(50% - 25px);
+ top: auto;
+ width: 50px;
+ height: 50px;
+ background-repeat: no-repeat;
+ background-size: contain;
+}
+
+.button.character>.character {
+ display: block;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ left: 0;
+ bottom: 0;
+ border-radius: inherit;
+ background-position: top;
+ background-image: inherit;
+ background-size: cover;
+ pointer-events: none;
+ transition: none;
+}
+
+#arena[data-outcrop-skin='on'] .button.character>.character {
+ height: 128px;
+ clip-path: url(#solo-clip);
+ -webkit-clip-path: url(#solo-clip);
+}
+
+#arena>.card>.judge-mark {
+ visibility: hidden;
+}
\ No newline at end of file
diff --git a/menu.js b/menu.js
new file mode 100644
index 0000000..92e118c
--- /dev/null
+++ b/menu.js
@@ -0,0 +1,4 @@
+'use strict';
+decadeModule.import((lib, game, ui, get, ai, _status) => {
+ game.menuZoom = 1;
+});
diff --git a/player.css b/player.css
new file mode 100644
index 0000000..38e97ab
--- /dev/null
+++ b/player.css
@@ -0,0 +1,1388 @@
+/*角色基本外观*/
+.player {
+ height: 180px;
+ width: 120px;
+ border-radius: 8px;
+ box-shadow: 0px -1px 3px black, 0px 3px 8px black;
+ background-image: linear-gradient(rgb(53, 38, 32), rgb(53, 38, 32));
+ transition-property: transform, opacity, left, top, right, bottom;
+}
+
+.dui-mobile .player {
+ box-shadow: 0px -1px 2px black, 0px 1px 5px black;
+}
+
+.player.dead {
+ animation: player-died 0.5s linear;
+ -webkit-animation: player-died 0.5s linear;
+ animation-iteration-count: 1;
+}
+
+.player::before {
+ /* left: -15px; */
+ /* top: -15px; */
+ /* width: calc(100% + 30px); */
+ /* height: calc(100% + 30px); */
+ /* border-width: 15px; */
+ /* border-style: solid; */
+ /* border-color: transparent; */
+ /* border-image-source: url('assets/image/glow_blue.png'); */
+ /* border-image-slice: 42 46 32 46 fill; */
+ /* box-sizing: border-box; */
+ left: -55px;
+ top: -42px;
+ width: 230px;
+ height: 262px;
+ opacity: 0;
+ background-image: url('assets/image/sprites_glow_blue.png');
+ background-repeat: no-repeat;
+ animation-name: kf-sprites-glow;
+ animation-duration: 0s;
+ animation-delay: 0s;
+ animation-iteration-count: infinite;
+ animation-fill-mode: forwards;
+ animation-timing-function: steps(1);
+ pointer-events: none;
+ box-shadow: none;
+ transition: opacity 0.1s linear;
+}
+
+.player.selected:not(.target):before,
+.player.glow_phase:not(.selectable):not(*[data-position='0'])::before {
+ /* border-image-source: url('assets/image/glow_orange.png'); */
+ animation-duration: 0.9s;
+ background-image: url('assets/image/sprites_glow_orange.png');
+ opacity: 1;
+}
+
+.player.selectable:not(.selected):not(.target)::before {
+ animation-duration: 0.9s;
+ opacity: 1;
+}
+
+.player::after,
+.player.selected::after,
+.player.selectable::after {
+ /* left: -15px; */
+ /* top: -15px; */
+ /* width: calc(100% + 30px); */
+ /* height: calc(100% + 30px); */
+ /* border-width: 15px; */
+ /* border-style: solid; */
+ /* border-color: transparent; */
+ /* border-image-source: url('assets/image/glow_red.png'); */
+ /* border-image-slice: 42 46 32 46 fill; */
+ /* box-sizing: border-box; */
+ left: -55px;
+ top: -42px;
+ width: 230px;
+ height: 262px;
+ opacity: 0;
+ background-image: url('assets/image/sprites_glow_red.png');
+ background-repeat: no-repeat;
+ animation-name: kf-sprites-glow;
+ animation-duration: 0s;
+ animation-delay: 0s;
+ animation-iteration-count: infinite;
+ animation-fill-mode: forwards;
+ animation-timing-function: steps(1);
+ pointer-events: none;
+ box-shadow: none;
+ transition: opacity 0.1s linear;
+}
+
+.player.target:not(.glow_phase):not(.selectable):not(.selected)::after {
+ animation-duration: 0.9s;
+ opacity: 1;
+}
+
+
+#arena>.player {
+ z-index: 4;
+}
+
+.player>.mask {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ border-radius: inherit;
+ background: rgba(0, 0, 0, 0.65);
+ opacity: 0;
+ transition: opacity 0.3s ease-in-out;
+ pointer-events: none;
+ z-index: 66;
+}
+
+.player.un-selectable:not(.selectable)>.mask {
+ opacity: 1;
+ transition: opacity 0.3s linear;
+}
+
+#arena:not(.fewplayer)>.player:not(.minskin),
+#arena:not(.fewplayer):not(*[data-player_height=''])>.player:not(.minskin) {
+ height: 180px !important;
+}
+
+/*玩家锁链*/
+.player>.chain {
+ top: 40%;
+ height: 24px;
+ visibility: hidden;
+ background-size: cover;
+ background-position-x: -120px;
+ background-repeat: no-repeat;
+ background-image: url('assets/image/tie_suo.png');
+ transition-duration: 0.4s;
+ z-index: 86;
+}
+
+.player.linked2>.chain {
+ visibility: visible;
+ background-position-x: center;
+}
+
+/*主玩家位置*/
+.player[data-position='0'],
+#arena>.player[data-position='0'],
+#arena>.player[data-position='0']:not(.minskin),
+#arena:not(*[data-player_height=''])>.player[data-position='0'],
+#arena:not(*[data-player_height=''])>.player[data-position='0']:not(.miniskin) {
+ left: -2px;
+ top: auto;
+ right: auto;
+ bottom: 1%;
+}
+
+#arena[data-right-layout='on']>.player[data-position='0'],
+#arena[data-right-layout='on']>.player[data-position='0']:not(.miniskin) {
+ left: auto;
+ right: 0;
+}
+
+/*玩家姓名阵营*/
+.player>.camp-wrap {
+ display: block;
+ left: -19px;
+ top: -9px;
+ width: 37px;
+ height: 128px;
+ transition: none;
+ z-index: 88;
+}
+
+.player.connect>div:not(.avatar):not(.name):not(.nameol):not(.hp):not(.room):not(.gaming):not(.identity).camp-wrap {
+ display: block !important;
+}
+
+.player>.camp-wrap div {
+ transition: none;
+}
+
+.player>.camp-wrap>.camp-back {
+ background: linear-gradient(to bottom, rgb(155, 129, 108), rgb(73, 71, 58));
+ clip-path: polygon(0 0, 100% 0, 100% 90%, 50% 100%, 0% 90%);
+ -webkit-clip-path: polygon(0 0, 100% 0, 100% 90%, 50% 100%, 0% 90%);
+}
+
+.player.unseen>.camp-wrap>.camp-back {
+ background: linear-gradient(to bottom, rgb(92, 35, 22), rgb(50, 27, 26));
+}
+
+.player>.camp-wrap[data-camp='wei']>.camp-back {
+ background: linear-gradient(to bottom, rgb(45, 103, 153), rgb(19, 45, 78));
+}
+
+.player>.camp-wrap[data-camp='shu']>.camp-back {
+ background: linear-gradient(to bottom, rgb(153, 28, 34), rgb(57, 12, 17));
+}
+
+.player>.camp-wrap[data-camp='wu']>.camp-back {
+ background: linear-gradient(to bottom, rgb(29, 114, 29), rgb(34, 42, 27));
+}
+
+.player>.camp-wrap[data-camp='qun']>.camp-back {
+ background: linear-gradient(to bottom, rgb(154, 148, 122), rgb(74, 72, 57));
+}
+
+.player>.camp-wrap[data-camp='shen']>.camp-back {
+ background: linear-gradient(to bottom, rgb(97, 87, 15), rgb(65, 50, 9), rgb(67, 52, 9));
+}
+
+.player>.camp-wrap[data-camp='shen2']>.camp-back {
+ background: linear-gradient(to bottom, rgb(112, 52, 126), rgb(52, 18, 55));
+}
+
+.player>.camp-wrap[data-camp='ye']>.camp-back {
+ background: linear-gradient(to bottom, rgb(112, 52, 126), rgb(52, 18, 55));
+}
+
+.player>.camp-wrap[data-camp='key']>.camp-back {
+ background: linear-gradient(to bottom, rgb(147, 132, 183), rgb(130, 120, 160), rgb(120, 115, 154));
+}
+
+.player>.camp-wrap[data-camp='western']>.camp-back {
+ background: linear-gradient(to bottom, rgb(93, 44, 105), rgb(54, 18, 58));
+}
+
+.player>.camp-wrap[data-camp='jin']>.camp-back {
+ background: linear-gradient(to bottom, rgb(112, 52, 126), rgb(52, 18, 55));
+}
+
+.player>.camp-wrap[data-camp='han']>.camp-back {
+ background: linear-gradient(to bottom, rgb(112, 52, 126), rgb(52, 18, 55));
+}
+
+.player>.camp-wrap[data-camp='daqin']>.camp-back {
+ background: linear-gradient(to bottom, rgb(100, 100, 100), rgb(0, 0, 0));
+}
+
+.player>.camp-wrap[data-camp='ming']>.camp-back {
+ background: linear-gradient(to bottom, rgb(153, 28, 34), rgb(57, 12, 17));
+}
+
+.player>.camp-wrap[data-camp='yao']>.camp-back {
+ background: linear-gradient(to bottom, rgb(144, 0, 0), rgb(17, 73, 132));
+}
+
+.player>.camp-wrap[data-camp='xin']>.camp-back {
+ background: linear-gradient(to bottom, rgb(112, 52, 126), rgb(52, 18, 55));
+}
+
+.player>.camp-wrap>.camp-border {
+ display: block;
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ background-image: url('image/decoration/border_camp.png');
+ background-size: 100% 100%;
+ background-repeat: no-repeat;
+}
+
+#arena.decadeUI[data-border-level='one'] .player>.camp-wrap>.camp-border {
+ background-image: url('image/decoration/border_camp1.png');
+}
+
+#arena.decadeUI[data-border-level='two'] .player>.camp-wrap>.camp-border {
+ background-image: url('image/decoration/border_camp2.png');
+}
+
+#arena.decadeUI[data-border-level='three'] .player>.camp-wrap>.camp-border {
+ background-image: url('image/decoration/border_camp3.png');
+}
+
+#arena.decadeUI[data-border-level='four'] .player>.camp-wrap>.camp-border {
+ background-image: url('image/decoration/border_camp4.png');
+}
+
+.player>.camp-wrap>.avatar-name,
+.player>.camp-wrap>.avatar-name-default,
+.player>.camp-wrap>.camp-back {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ font-size: 16px;
+ text-align: center;
+ text-shadow: none;
+ /*#000 1px 0 0, #000 0 1px 0, #000 -1px 0 0, #000 0 -1px 0;*/
+ left: 26%;
+ top: 24%;
+ right: 26%;
+ bottom: 1%;
+ position: absolute;
+ white-space: nowrap;
+ writing-mode: vertical-rl;
+ -webkit-writing-mode: vertical-rl;
+}
+
+.player.unseen>.camp-wrap>.avatar-name,
+.player:not(.unseen)>.camp-wrap>.avatar-name-default,
+.player:not(.unseen2)>.camp-wrap>.avatar2-name-default {
+ visibility: hidden;
+}
+
+.player>.camp-wrap>.camp-name {
+ font-family: xinwei, xingkai;
+ font-display: swap;
+ font-size: 26px;
+ width: 100%;
+ height: 33.5%;
+ display: flex;
+ text-align: center;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ background-size: contain;
+ background-repeat: no-repeat;
+ background-position: center;
+ transition: none;
+}
+
+.player>.camp-wrap[data-camp='wei']>.camp-name {
+ text-shadow: 0 0 5px rgb(50, 50, 255), 0 0 10px rgb(120, 120, 255), 0 0 15px rgb(100, 100, 255);
+}
+
+.player>.camp-wrap[data-camp='shu']>.camp-name {
+ text-shadow: 0 0 5px rgb(255, 100, 100), 0 0 10px rgb(255, 50, 50), 0 0 15px rgb(255, 50, 50);
+}
+
+.player>.camp-wrap[data-camp='wu']>.camp-name {
+ text-shadow: 0 0 5px rgb(100, 233, 100), 0 0 10px rgb(50, 255, 50), 0 0 15px rgb(50, 255, 50);
+}
+
+.player>.camp-wrap[data-camp='qun']>.camp-name {
+ text-shadow: 0 0 5px rgb(170, 170, 170), 0 0 10px rgb(118, 118, 118), 0 0 15px rgb(118, 118, 118);
+}
+
+.player>.camp-wrap[data-camp='shen']>.camp-name {
+ text-shadow: 0 0 5px rgb(255, 200, 0), 0 0 10px rgb(255, 200, 0), 0 0 15px rgb(255, 200, 0);
+}
+
+.player>.camp-wrap>.camp-name {
+ text-shadow: 0 0 5px #e0ea33, 0 0 15px #e0ea33, 0 0 25px #e0ea33;
+}
+
+.player>.name.name2,
+#arena>.player:not(.minskin)>.name.name2 {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ left: 50% !important;
+ right: auto;
+ top: 22px;
+ width: 18px;
+ height: 96px;
+ font-size: 16px;
+ text-shadow: none;
+ /*#000 1px 0 0, #000 0 1px 0, #000 -1px 0 0, #000 0 -1px 0;*/
+ background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.4) 20%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0.4) 80%, transparent 100%);
+ z-index: 89;
+}
+
+.player>.name.name2:empty,
+#arena>.player:not(.minskin)>.name.name2:empty {
+ display: none;
+}
+
+.player.fullskin.fullskin2>.name.name2:empty::before {
+ content: '副将';
+}
+
+/*联机名称显示*/
+.player>.nameol {
+ top: 5px;
+ font-size: 16px;
+ font-family: 'shousha';
+ text-shadow: 0 0 2px black;
+ background: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
+ z-index: 89;
+ pointer-events: none;
+}
+
+/*玩家血量显示*/
+.player>.hp-wrap {
+ display: block;
+ right: -2px;
+ bottom: -5px;
+ width: 12px;
+ height: 50px;
+ border-width: 24px 5px 21px 82px;
+ border-style: solid;
+ border-color: transparent;
+ border-image-source: url('image/decoration/border_hp.png');
+ border-image-slice: 32 6 25 113 fill;
+ pointer-events: none;
+ transition-property: transform, opacity, height;
+ transition-duration: 0.1s;
+ transition-timing-function: linear;
+ z-index: 88;
+}
+
+.player[data-max-hp='1']>.hp-wrap {
+ height: 5px;
+}
+
+.player[data-max-hp='2']>.hp-wrap {
+ height: 20px;
+}
+
+.player[data-max-hp='3']>.hp-wrap {
+ height: 35px;
+}
+
+.player[data-max-hp='5']>.hp-wrap {
+ height: 65px;
+}
+
+.player.connect>div:not(.avatar):not(.name):not(.nameol):not(.hp):not(.room):not(.gaming):not(.identity).hp-wrap {
+ display: block !important;
+}
+
+#arena.decadeUI[data-border-level='one'] .player>.hp-wrap {
+ border-image-source: url('image/decoration/border_hp1.png');
+}
+
+#arena.decadeUI[data-border-level='two'] .player>.hp-wrap {
+ border-image-source: url('image/decoration/border_hp2.png');
+}
+
+#arena.decadeUI[data-border-level='three'] .player>.hp-wrap {
+ border-image-source: url('image/decoration/border_hp3.png');
+}
+
+#arena.decadeUI[data-border-level='four'] .player>.hp-wrap {
+ border-image-source: url('image/decoration/border_hp4.png');
+}
+
+.player>.hp-wrap>.hp,
+#arena.slim_player .player .hp,
+#window>.player:not(.minskin) .hp {
+ display: flex;
+ left: 0;
+ right: 0;
+ width: 12px;
+ bottom: -8px;
+ font-size: 13px;
+ line-height: 14px;
+ flex-direction: column-reverse;
+}
+
+.player>.hp-wrap>.hp.textstyle {
+ flex-direction: column;
+}
+
+.player>.hp-wrap>.hp.hidden {
+ opacity: 1 !important;
+}
+
+.player>.hp-wrap>.hp>div:not(.shield) {
+ position: static;
+ margin-top: 3px;
+ width: 12px;
+ height: 12px;
+ line-height: 100%;
+ border: none;
+}
+
+.hp:not(.text):not(.actcount):not(.treasure)>.lost,
+.hp:not(.text):not(.actcount):not(.treasure)[data-condition="mid"]>div:not(.lost),
+.hp:not(.text):not(.actcount):not(.treasure)[data-condition="high"]>div:not(.lost),
+.hp:not(.text):not(.actcount):not(.treasure)[data-condition="low"]>div:not(.lost) {
+ transform: none !important;
+}
+
+/*武将牌显示*/
+.player>.primary-avatar {
+ left: 0;
+ top: auto;
+ bottom: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 1;
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: top;
+ border-radius: 8px;
+ transition-property: opacity, transform;
+ z-index: 61;
+}
+
+.player.connect>div:not(.avatar):not(.name):not(.nameol):not(.hp):not(.room):not(.gaming):not(.identity).primary-avatar {
+ display: block !important;
+}
+
+.player.fullskin2>.primary-avatar {
+ width: 50%;
+ border-radius: 8px 0 0 8px;
+}
+
+.player.bossplayer>.primary-avatar:not(.hp):not(.identity):not(.avatar):not(.framebg) {
+ display: block !important;
+}
+
+.player>.deputy-avatar {
+ left: 50%;
+ top: auto;
+ bottom: 0;
+ width: 50%;
+ height: 100%;
+ opacity: 1;
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: top;
+ border-radius: 0 8px 8px 0;
+ transition-property: opacity, transform;
+ z-index: 61;
+}
+
+.player.unseen>.primary-avatar,
+.player.unseen2>.deputy-avatar,
+.player.d-skin>.primary-avatar,
+.player.d-skin2>.deputy-avatar,
+.player.unseen>.dynamic-wrap,
+.player.unseen2>.dynamic-wrap {
+ opacity: 0;
+}
+
+#arena:not(.observe)>.player[data-position='0'].unseen>.primary-avatar,
+#arena:not(.observe)>.player[data-position='0'].unseen2>.deputy-avatar {
+ opacity: 0.3;
+}
+
+#arena[data-outcrop-skin='on']>.player>.primary-avatar {
+ height: 192px;
+ clip-path: url(#solo-clip);
+ -webkit-clip-path: url(#solo-clip);
+}
+
+#arena[data-outcrop-skin='on']>.player>.deputy-avatar {
+ height: 192px;
+ clip-path: url(#duor-clip);
+ -webkit-clip-path: url(#duor-clip);
+}
+
+#arena[data-outcrop-skin='on']>.player.fullskin2>.primary-avatar {
+ clip-path: url(#duol-clip);
+ -webkit-clip-path: url(#duol-clip);
+}
+
+/*武将牌动皮显示*/
+.player>.dynamic-wrap {
+ display: block;
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ height: 100%;
+ border-radius: 8px;
+ background-size: cover;
+ background-repeat: no-repeat;
+ pointer-events: none;
+ z-index: 60;
+}
+
+.player>.dynamic-wrap>.animation-player {
+ display: block;
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ height: 100%;
+ border-radius: inherit;
+ pointer-events: none;
+ clip-path: inset(0 0 0 0 round 8px);
+ -webkit-clip-path: inset(0 0 0 0 round 8px);
+}
+
+#arena[data-dynamic-skin-outcrop='on']>.player>.dynamic-wrap>.animation-player {
+ clip-path: url(#dskin-clip);
+ -webkit-clip-path: url(#dskin-clip);
+ height: 200px;
+}
+
+.player>.dynamic-wrap>.primary-bg,
+.player>.dynamic-wrap>.deputy-bg {
+ left: 0;
+ top: auto;
+ bottom: 0;
+ width: 50%;
+ height: 100%;
+ opacity: 0;
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: top;
+ border-radius: 8px 0 0 8px;
+ transition-property: opacity, transform;
+}
+
+.player>.dynamic-wrap>.deputy-bg {
+ left: 50%;
+}
+
+.player.d-skin>.dynamic-wrap>.primary-bg,
+.player.d-skin2>.dynamic-wrap>.deputy-bg {
+ opacity: 1;
+}
+
+#arena:not(.observe)>.player[data-position='0'].unseen.d-skin>.dynamic-wrap>.primary-bg,
+#arena:not(.observe)>.player[data-position='0'].unseen2.d-skin2>.dynamic-wrap>.deputy-bg {
+ opacity: 0.3;
+}
+
+#window:not(*[data-radius_size='']) .player {
+ border-radius: 8px;
+}
+
+/*行动*/
+.player>.primary-avatar>.action {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: auto;
+ right: 0;
+ bottom: 0;
+ width: 100%;
+ margin: 0;
+ text-align: center;
+}
+
+/*玩家标记显示-灯笼*/
+.player>.dui-marks {
+ display: flex;
+ flex-direction: column;
+ left: auto;
+ top: 1px;
+ right: -20px;
+ width: 18px;
+ height: auto;
+ padding-bottom: 0;
+ z-index: 88;
+ transition-property: opacity, transform, background;
+}
+
+.player>.dui-marks>.mark {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ position: relative;
+ margin-top: 0;
+ margin-left: 0;
+ margin-right: 0;
+ margin-bottom: 5px;
+ width: 18px;
+ height: auto;
+ border-radius: 0;
+ font-family: xinwei, xingkai;
+ box-shadow: none;
+ background: none;
+ overflow: visible;
+ animation: open 0.5s;
+}
+
+.player>.dui-marks>.mark:before,
+.player>.dui-marks>.mark:after {
+ display: none;
+}
+
+.player>.dui-marks>.mark>.mark-text {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ position: relative;
+ width: 17px;
+ height: auto;
+ min-height: 16px;
+ line-height: 16px;
+ text-align: center;
+ font-size: 20px;
+ font-family: xinwei, xingkai;
+ color: rgb(77, 60, 51);
+ border-radius: 5px;
+ background-image: radial-gradient(rgb(255, 255, 200) 0, rgb(255, 255, 120) 50%, rgb(255, 255, 10) 80%, yellow 100%);
+ box-shadow: 0 0 1px yellow;
+ text-shadow: none;
+ animation: swing 1.5s alternate infinite ease-in-out;
+}
+
+.player>.dui-marks>.mark>.mark-text.small-text {
+ font-size: 14px;
+ line-height: 11px;
+}
+
+.player>.dui-marks>.mark>.mark-text::before {
+ content: '';
+ display: block;
+ position: absolute;
+ left: 30%;
+ top: -1px;
+ width: 40%;
+ height: calc(100% + 3px);
+ border-top: 1px solid black;
+ border-bottom: 2px solid #FF9900;
+ box-sizing: border-box;
+}
+
+.player>.dui-marks>.mark>.mark-text.before-hidden::before {
+ display: none;
+}
+
+.player>.dui-marks>.mark>.mark-count {
+ position: absolute;
+ left: auto;
+ top: -2px;
+ right: -5px;
+ bottom: auto;
+ height: 10px;
+ width: 10px;
+ line-height: 11px;
+ font-size: 11px;
+ font-weight: bold;
+ text-shadow: none;
+ text-align: center;
+ border-radius: 100%;
+ background: yellow;
+ box-shadow: 0 0 1px black inset;
+}
+
+.player>.dui-marks>.mark>.image {
+ display: none;
+}
+
+#arena[data-player-mark-style='red']>.player>.dui-marks>.mark>.mark-text {
+ color: yellow;
+ text-shadow: 0 0 1px black, 0 0 1px black;
+ box-shadow: 0 0 1px yellow;
+ background-image: radial-gradient(rgb(100, 255, 100), rgb(255, 120, 0), rgb(255, 0, 0));
+}
+
+#arena[data-player-mark-style='red']>.player>.dui-marks>.mark>.mark-count {
+ color: #c86400;
+ background: #ffdc00;
+}
+
+/*玩家标记显示-新样式*/
+#arena[data-player-mark-style="decade"]>.player>.dui-marks {
+ left: auto;
+ top: 34px;
+ right: -3px;
+ width: auto;
+ max-width: 80px;
+}
+
+#arena[data-player-mark-style="decade"]>.player>.dui-marks>.mark {
+ display: flex;
+ width: 40px;
+ height: 18px;
+ white-space: nowrap;
+ background-image: url('assets/image/player_mark.png');
+ animation: fade-in 0.5s;
+ margin-bottom: 1px;
+}
+
+#arena[data-player-mark-style="decade"]>.player>.dui-marks>.mark>.mark-text {
+ animation: none;
+ background-image: none;
+ border-radius: 9px;
+ box-shadow: none;
+ color: white;
+ display: inline;
+ font-size: 11px;
+ height: auto;
+ line-height: 17px;
+ position: static;
+ width: auto;
+}
+
+#arena[data-player-mark-style="decade"]>.player>.dui-marks>.mark>.mark-text::before {
+ display: none;
+}
+
+#arena[data-player-mark-style="decade"]>.player>.dui-marks>.mark>.mark-count {
+ display: inline;
+ position: static;
+ padding-top: 3px;
+ padding-bottom: 3px;
+ width: auto;
+ height: auto;
+ line-height: 17px;
+ border-radius: 0;
+ font-size: 11px;
+ font-weight: inherit;
+ color: white;
+ text-shadow: none;
+ background: none;
+ box-shadow: none;
+}
+
+
+#arena[data-player-mark-style="normal"]>.player>.dui-marks {
+ display: flex;
+ flex-direction: column;
+ left: auto;
+ top: 1px;
+ right: -20px;
+ width: 18px;
+ height: auto;
+ padding-bottom: 0;
+ z-index: 88;
+}
+
+#arena[data-player-mark-style="normal"]>.player>.dui-marks>.mark {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ position: relative;
+ margin-top: 5px;
+ margin-left: 0;
+ margin-right: 0;
+ margin-bottom: 5px;
+ width: 18px;
+ height: auto;
+ border-radius: 0;
+ font-family: xinwei, xingkai;
+ box-shadow: none;
+ background: none;
+ overflow: visible;
+ animation: open 0.5s;
+}
+
+#arena[data-player-mark-style="normal"]>.player>.dui-marks>.mark>.mark-text {
+ display: flex !important;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ position: static;
+ left: auto;
+ top: auto;
+ right: auto;
+ bottom: auto;
+ line-height: 20px;
+ width: 100%;
+ height: 15px;
+ padding-top: 0;
+ color: rgb(77, 60, 51);
+ font-size: 18px;
+ font-family: xinwei, xinkai;
+ border-radius: 6px !important;
+ background: rgb(240, 240, 200);
+ text-shadow: none;
+ box-shadow: 0px 0px 3px rgb(240, 240, 50) inset, 0px 0px 7px rgb(220, 220, 50) inset !important;
+ animation: none;
+}
+
+#arena[data-player-mark-style="normal"]>.player>.dui-marks>.mark>.mark-text::before {
+ display: none;
+}
+
+#arena[data-player-mark-style="normal"]>.player>.dui-marks>.mark>.mark-count {
+ position: absolute;
+ bottom: -1px;
+ left: -5px;
+ top: auto;
+ right: auto;
+ height: 10px;
+ width: 10px;
+ line-height: 11px;
+ font-size: 11px;
+ font-weight: bold;
+ text-shadow: none;
+ text-align: center;
+ border-radius: 100%;
+ background: yellow;
+ box-shadow: 0 0 1px black inset;
+}
+
+.mark-container.marks>.mark {
+ overflow: visible;
+}
+
+.mark-container.marks>.mark>.mark-text {
+ display: flex;
+ position: absolute;
+ justify-content: center;
+ align-items: center;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ color: black;
+ font-size: 20px;
+}
+
+.mark-container.marks>.mark>.mark-count {
+ display: block;
+ position: absolute;
+ right: -5px;
+ width: 15px;
+ background: white;
+ border-radius: 4px;
+}
+
+/*玩家判断标记显示*/
+.player>.judges,
+#arena>.player:not(.minskin)>.judges {
+ display: flex;
+ justify-content: flex-end;
+ left: auto;
+ right: -1%;
+ top: auto;
+ bottom: -1%;
+ width: auto;
+ height: 0;
+ padding-bottom: 0;
+ z-index: 88;
+}
+
+.player[data-position='0']>.judges,
+#arena>.player[data-position='0']:not(.minskin)>.judges {
+ top: -24px;
+ bottom: auto;
+}
+
+.player>.judges>.card,
+#window:not(.nopointer) .player .judges>.card {
+ position: static;
+ left: auto;
+ top: auto;
+ right: auto;
+ bottom: auto;
+ margin: 4px;
+ width: 16px;
+ height: 16px;
+ opacity: 1;
+ box-shadow: none;
+ background: none !important;
+ transform: none;
+ overflow: visible;
+}
+
+.player>.judges>.card>.image {
+ display: none;
+}
+
+.player>.judges>.card>.judge-mark {
+ display: block;
+ position: relative;
+ width: 100%;
+ height: 100%;
+}
+
+.player>.judges>.card>.judge-mark>.back {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background: rgb(240, 220, 160);
+ transition: none;
+ transform: rotate(45deg);
+ border-radius: 4px;
+ box-shadow: 0 0 1px rgba(0, 0, 0, 0.4), 0 0 8px rgba(0, 0, 0, 0.8);
+ z-index: -1;
+}
+
+.player>.judges>.card>.judge-mark>.back::before {
+ display: block;
+ position: absolute;
+ content: '';
+ background: rgb(240, 220, 160);
+ left: 12%;
+ top: 12%;
+ right: 12%;
+ bottom: 12%;
+ border-radius: 2px;
+ box-shadow: 0 0 1px black;
+ z-index: -1;
+}
+
+.player>.judges>.card>.judge-mark>div:not(.back) .player>.judges>.card>.judge-mark>div:not(.judge) {
+ display: none;
+}
+
+.player>.judges>.card>.judge-mark>.judge {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ text-align: center;
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ font-family: xinwei, xingkai;
+ font-size: 16px;
+ color: white;
+ text-shadow: #000 1px 0 0, #000 0 1px 0, #000 -1px 0 0, #000 0 -1px 0, 0 0 8px #000;
+}
+
+.player>.judges>.card.feichu>.judge-mark>.judge::before {
+ content: '废';
+}
+
+.player>.judges>.card>.background,
+.judges>.card.fakejudge.fullskin>.background,
+.judges>.card.fakejudge.fullborder>.background {
+ display: none !important;
+}
+
+/*玩家号位显示*/
+.player>.seat {
+ display: block;
+ position: absolute;
+ bottom: -16px;
+ width: 100%;
+ line-height: 16px;
+ color: rgb(255, 245, 223);
+ font-family: 'shousha';
+ font-size: 16px;
+ text-align: center;
+ text-shadow: 0 0 2px black, 0 0 1px black;
+ white-space: nowrap;
+ z-index: 89;
+ pointer-events: none;
+}
+
+.player[data-position='0']>.seat {
+ bottom: -10px;
+}
+
+.player>.name_seat {
+ display: none !important;
+}
+
+/*玩家手牌数显示*/
+.player>.card-count {
+ position: absolute;
+ top: auto;
+ right: auto;
+ left: -12px;
+ bottom: -6px;
+ line-height: 28px;
+ height: 28px;
+ width: 28px;
+ background: url("image/decoration/card_count.png");
+ background-repeat: no-repeat;
+ background-size: 100% 100%;
+ background-position: 0 -1px;
+ border: none;
+ box-shadow: none;
+ font-size: 19px;
+ font-family: xinwei, xingkai;
+ color: white;
+ text-align: center;
+ text-shadow: none;
+ border-radius: 0px;
+ z-index: 88;
+ transition: transform, opacity;
+}
+
+.player>.card-count::before {
+ color: transparent;
+ content: attr(data-text);
+ height: 100%;
+ left: 0;
+ line-height: 28px;
+ position: absolute;
+ -webkit-text-stroke: 2px black;
+ top: 0;
+ white-space: pre;
+ width: 100%;
+ z-index: -1;
+}
+
+/*玩家身份标记*/
+#bosslist>.player>.identity {
+ height: 100%;
+}
+
+#bosslist>.player>.identity>div {
+ text-align: left;
+}
+
+.player>.identity,
+#arena>.player:not(.minskin)>.identity {
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: 100% 100%;
+ border-radius: initial;
+ font-size: 31px;
+ height: 31px;
+ left: auto;
+ line-height: 31px;
+ right: 1px;
+ top: 1px;
+ transform: none;
+ transition: none;
+ width: 29px;
+ z-index: 89;
+}
+
+.player>.identity[data-color='rYe'] {
+ text-shadow: rgba(255, 120, 0, 1) 0 0 2px, rgba(255, 120, 0, 1) 0 0 5px, rgba(255, 120, 0, 1) 0 0 10px,
+ rgba(255, 120, 0, 1) 0 0 10px, rgba(255, 120, 0, 1) 0 0 20px, rgba(255, 120, 0, 1) 0 0 20px, black 0 0 1px;
+}
+
+.player>.identity[data-color='bYe'],
+.player.opposite-camp>.identity {
+ text-shadow: 0 0 1px black, 0 0 5px blue, 0 0 10px rgb(100, 100, 250), 0 0 20px rgb(100, 100, 250), 0 0 20px white;
+}
+
+.player>.identity>div:first-child {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ font-size: 31px;
+ line-height: 31px;
+ background-size: 100% 100%;
+ background-repeat: no-repeat;
+ background-position: center;
+}
+
+.player>.identity.guozhan-mode,
+#arena>.player:not(.minskin)>.identity.guozhan-mode {
+ left: -20px;
+ top: -9px;
+ width: 37px;
+ height: 42px;
+}
+
+
+/*人物弹出文字*/
+.player>.damage {
+ width: 100%;
+ text-shadow: none;
+ transition: none;
+ z-index: 89;
+}
+
+.player>.damage::before {
+ color: transparent;
+ content: attr(data-text);
+ left: 0;
+ position: absolute;
+ -webkit-text-stroke: 4px #803B02;
+ top: 0;
+ white-space: pre;
+ width: 100%;
+ z-index: -1;
+}
+
+/* .player>.damage[data-nature='metal']::before { */
+/* -webkit-text-stroke: 4px #FFCB00; */
+/* } */
+/* .player>.damage[data-nature='wood']::before { */
+/* -webkit-text-stroke: 4px #5D832C; */
+/* } */
+/* .player>.damage[data-nature='water']::before { */
+/* -webkit-text-stroke: 4px #355CA1; */
+/* } */
+/* .player>.damage[data-nature='fire']::before { */
+/* -webkit-text-stroke: 4px #EE7F01; */
+/* } */
+/* .player>.damage[data-nature='soil']::before { */
+/* -webkit-text-stroke: 4px #803B02; */
+/* } */
+/* .player>.damage[data-nature='thunder']::before { */
+/* -webkit-text-stroke: 4px #644A8B; */
+/* } */
+
+/*联机用牌时限*/
+.player>.timerbar {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: auto;
+ bottom: -10px;
+ width: 100%;
+ z-index: 88;
+}
+
+.player[data-position='0']>.timerbar {
+ top: -15px;
+ bottom: auto;
+}
+
+.player>.timerbar>div,
+#arena .timerbar>div {
+ position: absolute;
+ left: calc(50% - 50px);
+ top: auto !important;
+ right: auto;
+ width: 100px;
+ height: 5px;
+}
+
+.player>.timerbar>div:first-child {
+ box-shadow: 0 0 4px yellow;
+ background: rgb(100, 0, 0);
+}
+
+/*联机游戏等待中*/
+.player.connect>.gaming {
+ display: block;
+ position: absolute;
+ left: 0;
+ top: calc(50% - 16px);
+ width: 100%;
+ height: 32px;
+ font-size: 32px;
+ font-family: 'xinwei';
+ text-align: center;
+ z-index: 89;
+}
+
+/*玩家死亡变灰*/
+.player.dead {
+ opacity: 1;
+ filter: none;
+ -webkit-filter: none;
+}
+
+.player.dead>div {
+ filter: grayscale(1);
+ -webkit-filter: grayscale(1);
+}
+
+/*玩家死亡文字*/
+.player>.died-identity {
+ display: flex;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ left: calc(50% - 47px);
+ top: auto;
+ bottom: 15px;
+ width: 88px;
+ height: 88px;
+ line-height: 38px;
+ color: rgb(210, 50, 50);
+ font-size: 38px;
+ font-family: xingkai, huangcao, xinwei;
+ font-display: swap;
+ text-shadow: 0 0 5px black, 0 0 10px black, 0 0 15px black;
+ background-size: contain;
+ background-repeat: no-repeat;
+ background-position: center;
+ transform: none;
+ opacity: 0;
+ z-index: 61;
+}
+
+.player.opposite-camp>.died-identity {
+ color: rgb(50, 50, 210);
+}
+
+.player.dead>.died-identity {
+ filter: none;
+ -webkit-filter: none;
+ animation: fade-in 0.5s forwards;
+ animation-delay: 0.5s;
+ -webkit-animation: fade-in 0.5s forwards;
+ -webkit-animation-delay: 0.5s;
+}
+
+/*玩家获得的技能显示*/
+.player>.gain-skill {
+ position: absolute;
+ left: 15px;
+ right: 15px;
+ max-height: calc(97% - 81px);
+ bottom: calc(3% + 81px);
+ color: rgb(255, 255, 200);
+ font-size: 13px;
+ text-align: center;
+ background: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
+ z-index: 87;
+}
+
+#arena.decadeUI[data-gain-skills-visible='off']>.player>.gain-skill,
+#arena.decadeUI[data-gain-skills-visible='othersOn']>.player[data-position='0']>.gain-skill {
+ display: none;
+}
+
+/*角色翻面背景*/
+.player>.turned-over {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0;
+ background-image: url('assets/image/turn_over_mask.png');
+ background-size: cover;
+ pointer-events: none;
+ z-index: 62;
+}
+
+.player.turnedover>.turned-over {
+ opacity: 0.8;
+}
+
+.turnedover>div {
+ opacity: initial;
+}
+
+/*角色边框*/
+.player>.framebg {
+ z-index: 63;
+}
+
+/*身份标记框*/
+.player>.identity-mark-box {
+ display: flex;
+ position: absolute;
+ justify-content: center;
+ flex-wrap: wrap;
+ top: 20%;
+ left: 16%;
+ width: 68%;
+ height: auto;
+ z-index: 99;
+}
+
+.player>.identity-mark-box>.identity-mark-item {
+ position: static;
+ width: auto;
+ height: auto;
+ min-width: 20px;
+ line-height: 20px;
+ border-style: solid;
+ border-width: 10px;
+ border-image-width: 18px;
+ border-image-slice: 31 31 fill;
+ border-image-source: url('assets/image/item_bg.png');
+ cursor: pointer;
+ color: rgb(77, 60, 51);
+ font-family: shousha;
+ font-weight: bold;
+ font-size: 20px;
+ text-shadow: none;
+ transition: opacity, background, transform 0.3s;
+}
+
+.player>.identity-mark-box>.identity-mark-item:active {
+ transform: scale(0.9);
+}
+
+/*说话泡泡框*/
+.player>.chat-bubble {
+ left: 0;
+ top: 20px;
+ width: 100%;
+ height: auto;
+ border-style: solid;
+ border-width: 6px 6px 14px 6px;
+ border-image-slice: 6 6 14 6 fill;
+ border-image-source: url('assets/image/chat_bubble.png');
+ box-sizing: border-box;
+ word-break: break-all;
+ z-index: 99;
+}
+
+.player.connect>div:not(.avatar):not(.name):not(.nameol):not(.hp):not(.room):not(.gaming):not(.identity).chat-bubble {
+ display: block !important;
+}
+
+.player>.jie-mark {
+ position: absolute;
+ top: 108px;
+ left: -11px;
+ width: 22px;
+ height: 34px;
+ background-image: url('assets/image/mark_jie.png');
+ background-size: 100% 100%;
+ pointer-events: none;
+ z-index: 87;
+}
\ No newline at end of file
diff --git a/skill.js b/skill.js
new file mode 100644
index 0000000..f996f4c
--- /dev/null
+++ b/skill.js
@@ -0,0 +1,1840 @@
+'use strict';
+decadeModule.import((lib, game, ui, get, ai, _status) => {
+ const skillMap = {
+ guanxing: {
+ content: function () {
+ 'step 0'
+ if (player.isUnderControl()) {
+ game.modeSwapPlayer(player);
+ }
+
+ var num = Math.min(5, game.countPlayer());
+ if (player.hasSkill('yizhi') && player.hasSkill('guanxing')) {
+ num = 5;
+ }
+ var player = event.player;
+ if (player.isUnderControl()) game.modeSwapPlayer(player);
+
+ var cards = get.cards(num);
+ var guanXing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ game.broadcast(function (player, cards) {
+ if (!window.decadeUI) return;
+ decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ }, player, cards);
+
+ event.switchToAuto = function () {
+ var cards = guanXing.cards[0].concat();
+ var cheats = [];
+ var judges = player.node.judges.childNodes;
+
+ if (judges.length) {
+ cheats = decadeUI.get.cheatJudgeCards(cards, judges, true);
+ }
+
+ if (cards.length && cheats.length == judges.length) {
+ for (var i = 0; i >= 0 && i < cards.length; i++) {
+ if (get.value(cards[i], player) >= 5) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ }
+ }
+
+ var time = 500;
+ for (var i = 0; i < cheats.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanXing.move(card, index, 0);
+ if (finished) guanXing.finishTime(1000);
+ }, time, cheats[i], i, (i >= cheats.length - 1) && cards.length == 0);
+ time += 500;
+ }
+
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanXing.move(card, index, 1);
+ if (finished) guanXing.finishTime(1000);
+ }, time, cards[i], i, (i >= cards.length - 1));
+ time += 500;
+ }
+ };
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ 'step 1'
+ player.popup(get.cnNumber(event.num1) + '上' + get.cnNumber(event.num2) + '下');
+ game.log(player, '将' + get.cnNumber(event.num1) + '张牌置于牌堆顶,' + get.cnNumber(event.num2) + '张牌置于牌堆底');
+ game.updateRoundNumber()
+ }
+ },
+ reguanxing: {
+ content: function () {
+ 'step 0'
+ var player = event.player;
+ if (player.isUnderControl()) game.modeSwapPlayer(player);
+
+ var cards = get.cards(game.countPlayer() < 4 ? 3 : 5);
+ var guanXing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ game.broadcast(function (player, cards) {
+ if (!window.decadeUI) return;
+ decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ }, player, cards);
+
+ event.switchToAuto = function () {
+ var cheats = [];
+ var cards = guanXing.cards[0].concat();
+ var judges;
+
+ var next = player.getNext();
+ var friend = player;
+ if (event.triggername == 'phaseJieshuBegin') {
+ friend = next;
+ judges = friend.node.judges.childNodes;
+ if (get.attitude(player, friend) < 0) friend = null;
+ } else {
+ judges = player.node.judges.childNodes;
+ }
+
+ if (judges.length) {
+ cheats = decadeUI.get.cheatJudgeCards(cards, judges, friend != null);
+ }
+
+ if (cards.length && cheats.length == judges.length) {
+ for (var i = 0; i >= 0 && i < cards.length; i++) {
+ if (friend) {
+ if (get.value(cards[i], friend) >= 5) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ } else {
+ if (get.value(cards[i], next) < 4) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ }
+ }
+ }
+
+ var time = 500;
+ for (var i = 0; i < cheats.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanXing.move(card, index, 0);
+ if (finished) guanXing.finishTime(1000);
+ }, time, cheats[i], i, (i >= cheats.length - 1) && cards.length == 0);
+ time += 500;
+ }
+
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanXing.move(card, index, 1);
+ if (finished) guanXing.finishTime(1000);
+ }, time, cards[i], i, (i >= cards.length - 1));
+ time += 500;
+ }
+ };
+
+ if (event.isOnline()) {
+ // 判断其他玩家是否有十周年UI,否则直接给他结束,不知道有没有效果
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ // 等待其他玩家操作
+ event.player.wait();
+ // 暂停主机端游戏
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ /*
+ 注释说明
+ var guanXing = decadeUI.content.chooseGuanXing(
+ 控制观星的玩家, // 必选
+ [顶部初始化的牌], // 必选,可为null,但底部不能为null
+ 顶部允许控制的牌数范围, // 可选,不填根据初始化的牌数量
+ [底部初始化的牌], // 必选,可为null,但顶部不能为null
+ 底部允许控制的牌数范围, // 可选,不填根据初始化的牌数量
+ 第一个参数的玩家是否可见); // 可选,不设置则根据控制观星的玩家来显示
+
+ // undefined 均为可设置,其他为只读或调用
+ var properties = {
+ caption: undefined, // 设置标题
+ header1: undefined, // 牌堆顶的文字
+ header2: undefined, // 牌堆底的文字
+ cards: [[],[]], // 获取当前观星的牌,不要瞎改
+ callback: undefined, // 回调函数,返回 true 表示可以点击【确认】按钮,例:guanXing.callback = function(){ return guanXing.cards[1].length == 1; }
+ // 注意:此值一旦设置,观星finish后不会自己置顶牌堆顶和牌堆底,需要自行实现
+ infohide: undefined, // 设置上面第1个参数的玩家是否可见观星的牌
+ confirmed: undefined, // 是否按下确认按钮
+ doubleSwitch: undefined, // 双击切换牌
+ finishTime:function(time), // 指定的毫秒数后完成观星
+ finish:function(), // 观星完成,在下一个step 中,可以通过 event.cards1 与 event.cards2 访问观星后的牌
+ swap:function(s, t), // 交换观星中的两个牌
+ switch:function(card), // 将观星中的牌切换到另一方
+ move:function(card, index, moveDown) // 移动观星的牌到指定的一方位置
+ }
+ */
+ }
+ 'step 1'
+ if (event.triggername == 'phaseZhunbeiBegin' && event.num1 == 0) player.addTempSkill('reguanxing_on');
+ player.popup(get.cnNumber(event.num1) + '上' + get.cnNumber(event.num2) + '下');
+ game.log(player, '将' + get.cnNumber(event.num1) + '张牌置于牌堆顶,' + get.cnNumber(event.num2) + '张牌置于牌堆底');
+ game.updateRoundNumber();
+ }
+ },
+ chengxiang: {
+ content: function () {
+ 'step 0'
+ var cards = get.cards(4);
+ var guanXing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, 4, false);
+ guanXing.doubleSwitch = true;
+ guanXing.caption = '【称象】';
+ guanXing.header2 = '获得的牌';
+ guanXing.callback = function () {
+ var num = 0;
+ for (var i = 0; i < this.cards[1].length; i++) {
+ num += get.number(this.cards[1][i]);
+ }
+
+ return num > 0 && num <= 13;
+ };
+
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var guanXing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, 4, false);
+ guanXing.caption = '【称象】';
+ guanXing.header2 = '获得的牌';
+ guanXing.callback = callback;
+ }, player, cards, guanXing.callback);
+
+ var player = event.player;
+ event.switchToAuto = function () {
+ var cards = guanXing.cards[0];
+ var num, sum, next;
+ var index = 0;
+ var results = [];
+
+ for (var i = 0; i < cards.length; i++) {
+ num = 0;
+ sum = 0;
+ next = i + 1;
+ for (var j = i; j < cards.length; j++) {
+ if (j != i && j < next)
+ continue;
+
+ num = sum + get.number(cards[j]);
+ if (num <= 13) {
+ sum = num;
+ if (!results[index]) results[index] = [];
+ results[index].push(cards[j]);
+ }
+
+ if (j >= cards.length - 1) index++;
+ }
+
+ if (results[index] && results[index].length == cards.length) break;
+ }
+
+ var costs = [];
+ for (var i = 0; i < results.length; i++) {
+ costs[i] = {
+ value: 0,
+ index: i,
+ };
+ for (var j = 0; j < results[i].length; j++) {
+ costs[i].value += get.value(results[i][j], player);
+ // 如果有队友且有【仁心】且血量不低,优先选择装备牌
+ if (player.hasFriend() && player.hasSkill('renxin') && get.type(results[i][j]) == 'equip' && player.hp > 1) {
+ costs[i].value += 5;
+ }
+
+ // 如果自己有延时牌且没有无懈可击,优先选择无懈可击
+ if (player.node.judges.childNodes.length > 0 && !player.hasWuxie() && results[i][j] == 'wuxie') {
+ costs[i].value += 5;
+ }
+ }
+ }
+
+ costs.sort(function (a, b) {
+ return b.value - a.value;
+ });
+
+ var time = 500;
+ var result = results[costs[0].index];
+
+ for (var i = 0; i < result.length; i++) {
+ setTimeout(function (move, finished) {
+ guanXing.move(move, guanXing.cards[1].length, 1);
+ if (finished) guanXing.finishTime(1000);
+ }, time, result[i], (i >= result.length - 1));
+ time += 500;
+ }
+ };
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ 'step 1'
+ if (event.result && event.result.bool) {
+ game.cardsDiscard(event.cards1);
+ player.gain(event.cards2, 'log', 'gain2');
+ }
+ }
+ },
+ xinfu_zuilun: {
+ content: function () {
+ 'step 0'
+ event.num = 0;
+ event.cards = get.cards(3);
+ if (player.getHistory('lose', function (evt) {
+ return evt.type == 'discard';
+ }).length) event.num++;
+ if (!player.isMinHandcard()) event.num++;
+ if (!player.getStat('damage')) event.num++;
+ 'step 1'
+ if (event.num == 0) {
+ player.gain(event.cards, 'draw');
+ event.finish();
+ return;
+ }
+
+ var cards = event.cards;
+ var gains = cards.length - event.num;
+
+ var zuiLun = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, gains);
+ zuiLun.caption = '【罪论】';
+ zuiLun.header2 = '获得的牌';
+ zuiLun.tip = '可获得' + gains + '张牌
' + zuiLun.tip;
+ zuiLun.callback = function () {
+ return this.cards[1].length == gains;
+ };
+
+ game.broadcast(function (player, cards, gains, callback) {
+ if (!window.decadeUI) return;
+ var zuiLun = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, gains);
+ zuiLun.caption = '【罪论】';
+ zuiLun.header2 = '获得的牌';
+ zuiLun.tip = '可获得' + gains + '张牌
' + zuiLun.tip;
+ zuiLun.callback = callback;
+ }, player, cards, gains, zuiLun.callback);
+
+ var player = event.player;
+ event.switchToAuto = function () {
+ var cheats = [];
+ var cards = zuiLun.cards[0].concat();
+ var stopped = false;
+
+ var next = player.getNext();
+ var hasFriend = get.attitude(player, next) > 0;
+
+ // 判断下家是不是队友,令其生效或者失效
+ var judges = next.node.judges.childNodes;
+ if (judges.length > 0) cheats = decadeUI.get.cheatJudgeCards(cards, judges, hasFriend);
+
+ // 如果有【父荫】优先把好牌给队友
+ if (hasFriend && player.hasSkill('xinfu_fuyin')) {
+ cards = decadeUI.get.bestValueCards(cards, next);
+ } else {
+ cards.sort(function (a, b) {
+ return get.value(a, player) - get.value(b, player);
+ });
+ }
+
+ cards = cheats.concat(cards);
+ var time = 500;
+ var gainNum = gains;
+ for (var i = cards.length - 1; i >= 0; i--) {
+ setTimeout(function (card, index, finished, moveDown) {
+ zuiLun.move(card, index, moveDown ? 1 : 0);
+ if (finished) zuiLun.finishTime(1000);
+ }, time, cards[i], i, i == 0, gainNum > 0);
+ time += 500;
+ gainNum--;
+ }
+ };
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ 'step 2'
+ event.cards = event.cards2
+ if (event.result && event.result.bool) {
+ var cards = event.cards1;
+ var first = ui.cardPile.firstChild;
+ for (var i = 0; i < cards.length; i++) {
+ ui.cardPile.insertBefore(cards[i], first);
+ }
+ }
+ 'step 3'
+ game.updateRoundNumber();
+ if (event.cards.length) {
+ player.gain(event.cards, 'draw');
+ event.finish();
+ } else {
+ player.chooseTarget('请选择一名角色,与其一同失去1点体力', true, function (card, player, target) {
+ return target != player;
+ }).ai = function (target) {
+ return - get.attitude(_status.event.player, target);
+ };
+ }
+ 'step 4'
+ player.line(result.targets[0], 'fire');
+ player.loseHp();
+ result.targets[0].loseHp();
+ }
+ },
+ xunxun: {
+ content: function () {
+ 'step 0'
+ var cards = get.cards(4);
+ var player = event.player;
+ var xunxun = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, 2);
+ xunxun.caption = '【恂恂】';
+ xunxun.header1 = '牌堆底';
+ xunxun.header2 = '牌堆顶';
+ xunxun.callback = function () {
+ return this.cards[0].length == 2 && this.cards[1].length == 2;
+ };
+
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var xunxun = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, 2);
+ xunxun.caption = '【恂恂】';
+ xunxun.header1 = '牌堆底';
+ xunxun.header2 = '牌堆顶';
+ xunxun.callback = callback;
+ }, player, cards, xunxun.callback);
+
+ event.switchToAuto = function () {
+ var cards = decadeUI.get.bestValueCards(xunxun.cards[0].concat(), player);
+ var time = 500;
+ for (var i = 0; i < 2; i++) {
+ setTimeout(function (card, index, finished) {
+ xunxun.move(card, index, 1);
+ if (finished) xunxun.finishTime(1000);
+ }, time, cards[i], i, i >= 1);
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+
+ 'step 1'
+ var first = ui.cardPile.firstChild;
+ var cards = event.cards2;
+ for (var i = 0; i < cards.length; i++) {
+ ui.cardPile.insertBefore(cards[i], first);
+ }
+
+ cards = event.cards1;
+ for (var i = 0; i < cards.length; i++) {
+ ui.cardPile.appendChild(cards[i]);
+ }
+ }
+ },
+ xinfu_dianhua: {
+ content: function () {
+ 'step 0'
+ var num = 0;
+ var player = event.player;
+ for (var i = 0; i < lib.suit.length; i++) {
+ if (player.hasMark('xinfu_falu_' + lib.suit[i])) num++;
+ }
+
+ var cards = get.cards(num);
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ dialog.caption = '【点化】';
+ game.broadcast(function (player, cards) {
+ if (!window.decadeUI) return;
+ decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length).caption = '【点化】';
+ }, player, cards);
+
+ event.switchToAuto = function () {
+ var cheats = [];
+ var cards = dialog.cards[0].concat();
+ var judges;
+
+ var next = player.getNext();
+ var friend = player;
+ if (event.triggername == 'phaseJieshuBegin') {
+ friend = next;
+ judges = friend.node.judges.childNodes;
+ if (get.attitude(player, friend) < 0) friend = null;
+ } else {
+ judges = player.node.judges.childNodes;
+ }
+
+ if (judges.length) {
+ cheats = decadeUI.get.cheatJudgeCards(cards, judges, friend != null);
+ }
+
+ if (cards.length && cheats.length == judges.length) {
+ for (var i = 0; i >= 0 && i < cards.length; i++) {
+ if (friend) {
+ if (get.value(cards[i], friend) >= 5) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ } else {
+ if (get.value(cards[i], next) < 4) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ }
+ }
+ }
+
+ var time = 500;
+ for (var i = 0; i < cheats.length; i++) {
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 0);
+ if (finished) dialog.finishTime(1000);
+ }, time, cheats[i], i, (i >= cheats.length - 1) && cards.length == 0);
+ time += 500;
+ }
+
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 1);
+ if (finished) dialog.finishTime(1000);
+ }, time, cards[i], i, (i >= cards.length - 1));
+ time += 500;
+ }
+ };
+ // var dianhua = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ // dianhua.caption = '【点化】';
+ // game.broadcast(function(player, cards, callback){
+ // if (!window.decadeUI) return;
+ // var dianhua = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ // dianhua.caption = '【点化】';
+ // dianhua.callback = callback;
+ // }, player, cards, dianhua.callback);
+
+ // event.switchToAuto = function(){
+ // var cards = dianhua.cards[0].concat();
+ // var cheats = [];
+ // var judges;
+
+ // var next = player.getNext();
+ // var friend = player;
+ // if (event.triggername == 'phaseJieshuBegin') {
+ // friend = next;
+ // judges = friend.node.judges.childNodes;
+ // if (get.attitude(player, friend) < 0) friend = null;
+ // } else {
+ // judges = player.node.judges.childNodes;
+ // }
+
+ // if (judges.length > 0) cheats = decadeUI.get.cheatJudgeCards(cards, judges, friend != null);
+
+ // if (friend) {
+ // cards = decadeUI.get.bestValueCards(cards, friend);
+ // } else {
+ // cards.sort(function(a, b){
+ // return get.value(a, next) - get.value(b, next);
+ // });
+ // }
+
+ // cards = cheats.concat(cards);
+ // var time = 500;
+ // for (var i = 0; i < cards.length; i++) {
+ // setTimeout(function(card, index, finished){
+ // dianhua.move(card, index, 0);
+ // if (finished) dianhua.finishTime(1000);
+ // }, time, cards[i], i, i >= cards.length - 1);
+ // time += 500;
+ // }
+ // }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+
+ 'step 1'
+ player.popup(get.cnNumber(event.num1) + '上' + get.cnNumber(event.num2) + '下');
+ game.log(player, '将' + get.cnNumber(event.num1) + '张牌置于牌堆顶,' + get.cnNumber(event.num2) + '张牌置于牌堆底');
+ game.updateRoundNumber();
+ }
+ },
+ zongxuan: {
+ content: function () {
+ 'step 0'
+ var cards = [];
+ for (var i = 0; i < trigger.cards2.length; i++) {
+ var card = trigger.cards2[i];
+ if (get.position(card, true) == 'd') {
+ cards.push(card);
+ clearTimeout(card.timeout);
+ card.classList.remove('removing');
+ // 防止因为限制结算速度,而导致牌提前进入弃牌堆
+ }
+ }
+
+ if (!cards.length) return;
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ dialog.caption = '【纵玄】';
+ dialog.header1 = '弃牌堆';
+ dialog.header2 = '牌堆顶';
+ dialog.lockCardsOrder(0);
+ dialog.callback = function () { return this.cards[1].length > 0; };
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var zongxuan = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ dialog.caption = '【纵玄】';
+ dialog.header1 = '弃牌堆';
+ dialog.header2 = '牌堆顶';
+ dialog.lockCardsOrder(0);
+ dialog.callback = callback;
+ }, player, cards, dialog.callback);
+
+ event.switchToAuto = function () {
+ var parent = event.parent;
+ while (parent != null && parent.name != 'phaseDiscard') parent = parent.parent;
+
+ var cards = dialog.cards[0].concat();
+ var cheats = [];
+ var next = player.getNext();
+ var hasFriend = get.attitude(player, next) > 0;
+
+ if (parent) {
+ var hasZhiYan = player.hasSkill('zhiyan'); //如果有【直言】,AI 1000%肯定会用这个技能
+ var judges = next.node.judges.childNodes;
+ if (judges > 0 && hasZhiYan && cards.length > 1) {
+ cheats = decadeUI.get.cheatJudgeCards(cards, judges, hasFriend);
+ }
+ }
+
+ if (cards.length > 0) {
+ cards.sort(function (a, b) {
+ return get.value(b, player) - get.value(a, player);
+ });
+ cheats.splice(0, 0, cards.shift());
+
+ var cost;
+ for (var i = 0; i < cards.length; i++) {
+ if (hasFriend) {
+ if (get.value(cards[i], next) >= 5) cheats.push(cards[i]);
+ } else {
+ if (get.value(cards[i], next) < 5) cheats.push(cards[i]);
+ }
+ }
+ }
+
+ var time = 500;
+ for (var i = 0; i < cheats.length; i++) {
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 1);
+ if (finished) dialog.finishTime(cards.length <= 1 ? 250 : 1000);;
+ }, time, cheats[i], i, (i >= cheats.length - 1));
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+
+ 'step 1'
+ var first = ui.cardPile.firstChild;
+ var cards = event.cards2;
+ for (var i = 0; i < cards.length; i++) {
+ ui.cardPile.insertBefore(cards[i], first);
+ }
+
+ cards = event.cards1;
+ for (var i = 0; i < cards.length; i++) {
+ ui.discardPile.appendChild(cards[i]);
+ }
+
+ game.log(player, '将' + get.cnNumber(event.num2) + '张牌置于牌堆顶');
+ }
+ },
+ identity_junshi: {
+ content: function () {
+ "step 0"
+ if (player.isUnderControl()) {
+ game.modeSwapPlayer(player);
+ }
+ var num = 3;
+ var cards = get.cards(num);
+ var guanxing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ guanxing.caption = '【军师】';
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var guanxing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ guanxing.caption = '【军师】';
+ guanxing.callback = callback;
+ }, player, cards, guanxing.callback);
+
+ event.switchToAuto = function () {
+ var cards = guanxing.cards[0].concat();
+ var cheats = [];
+ var judges = player.node.judges.childNodes;
+
+ if (judges.length) cheats = decadeUI.get.cheatJudgeCards(cards, judges, true);
+ if (cards.length) {
+ for (var i = 0; i >= 0 && i < cards.length; i++) {
+ if (get.value(cards[i], player) >= 5) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ }
+ }
+
+ var time = 500;
+ for (var i = 0; i < cheats.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanxing.move(card, index, 0);
+ if (finished) guanxing.finishTime(1000);
+ }, time, cheats[i], i, (i >= cheats.length - 1) && cards.length == 0);
+ time += 500;
+ }
+
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanxing.move(card, index, 1);
+ if (finished) guanxing.finishTime(1000);
+ }, time, cards[i], i, (i >= cards.length - 1));
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ "step 1"
+ player.popup(get.cnNumber(event.num1) + '上' + get.cnNumber(event.num2) + '下');
+ game.log(player, '将' + get.cnNumber(event.num1) + '张牌置于牌堆顶,' + get.cnNumber(event.num2) + '张牌置于牌堆底');
+ game.updateRoundNumber();
+ }
+ },
+ wuxin: {
+ content: function () {
+ var num = get.population('qun');
+ if (player.hasSkill('huangjintianbingfu')) {
+ num += player.getExpansions('huangjintianbingfu').length;
+ }
+
+ var cards = get.cards(num);
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ dialog.caption = '【悟心】';
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ dialog.caption = '【悟心】';
+ dialog.callback = callback;
+ }, player, cards, dialog.callback);
+
+ event.switchToAuto = function () {
+ var cards = dialog.cards[0].concat();
+ var cheats = [];
+
+ var next = player.getNext();
+ var friend = player;
+ var judges = friend.node.judges.childNodes;
+ if (judges.length > 0) cheats = decadeUI.get.cheatJudgeCards(cards, judges, friend != null);
+
+ if (friend) {
+ cards = decadeUI.get.bestValueCards(cards, friend);
+ } else {
+ cards.sort(function (a, b) {
+ return get.value(a, next) - get.value(b, next);
+ });
+ }
+
+ cards = cheats.concat(cards);
+ var time = 500;
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 0);
+ if (finished) dialog.finishTime(cards.length <= 1 ? 250 : 1000);;
+ }, time, cards[i], i, i >= cards.length - 1);
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ }
+ },
+ luoying_discard: {
+ content: function () {
+ "step 0"
+ if (trigger.delay == false) game.delay();
+ "step 1"
+ var cards = [];
+ for (var i = 0; i < trigger.cards2.length; i++) {
+ var card = trigger.cards2[i];
+ if (get.suit(card, trigger.player) == 'club' && get.position(card, true) == 'd') {
+ cards.push(card);
+ clearTimeout(card.timeout);
+ card.classList.remove('removing');
+ // 防止因为限制结算速度,而导致牌提前进入弃牌堆
+ }
+ }
+
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length, false);
+ dialog.caption = '【落英】';
+ dialog.header1 = '弃牌堆';
+ dialog.header2 = '获得牌';
+ dialog.tip = '请选择要获得的牌';
+ dialog.lockCardsOrder(0);
+ dialog.cards[1] = dialog.cards[0];
+ dialog.cards[0] = [];
+ dialog.update();
+ dialog.onMoved();
+ dialog.callback = function () { return true; };
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length, false);
+ dialog.caption = '【落英】';
+ dialog.header1 = '弃牌堆';
+ dialog.header2 = '获得牌';
+ dialog.tip = '请选择要获得的牌';
+ dialog.lockCardsOrder(0);
+ dialog.cards[1] = dialog.cards[0];
+ dialog.cards[0] = [];
+ dialog.update();
+ dialog.onMoved();
+ dialog.callback = callback;
+ }, player, cards, dialog.callback);
+
+ event.switchToAuto = function () {
+ var cards = dialog.cards[1].concat();
+ var time = 500;
+
+ if (cards.length) {
+ var discards = [];
+ for (var i = 0; i < cards.length; i++) {
+ if (get.value(cards[i]) < 0) {
+ discards.push(cards[i]);
+ }
+ }
+
+ if (discards.length) {
+ for (var i = 0; i < discards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 0);
+ if (finished) dialog.finishTime(1000);
+ }, time, discards[i], i, i >= discards.length - 1);
+ time += 500;
+ }
+ } else {
+ dialog.finishTime(1000);
+ }
+
+ } else {
+ dialog.finishTime(1000);
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ "step 2"
+ game.cardsDiscard(event.cards1);
+ if (event.cards2) {
+ // player.logSkill(event.name);
+ player.gain(event.cards2, 'gain2', 'log');
+ }
+ }
+ },
+ luoying_judge: {
+ content: function () {
+ "step 0"
+ var cards = trigger.cards;
+
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length, false);
+ dialog.caption = '【落英】';
+ dialog.header1 = '弃牌堆';
+ dialog.header2 = '获得牌';
+ dialog.tip = '请选择要获得的牌';
+ dialog.lockCardsOrder(0);
+ dialog.callback = function () { return true; };
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length, false);
+ dialog.caption = '【落英】';
+ dialog.header1 = '弃牌堆';
+ dialog.header2 = '获得牌';
+ dialog.tip = '请选择要获得的牌';
+ dialog.lockCardsOrder(0);
+ dialog.callback = callback;
+ }, player, cards, dialog.callback);
+
+ event.switchToAuto = function () {
+ var cards = dialog.cards[0].concat();
+ var time = 500;
+ for (var i = 0; i < cards.length; i++) {
+ if (get.value(cards[i], player) < 0) continue;
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 1);
+ if (finished) dialog.finishTime(cards.length <= 1 ? 250 : 1000);;
+ }, time, cards[i], i, i >= cards.length - 1);
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ "step 1"
+ game.cardsDiscard(event.cards1);
+ if (event.cards2) {
+ // player.logSkill(event.name);
+ player.gain(event.cards2, 'gain2', 'log');
+ }
+ }
+ },
+ // huashen: {
+ // audio: 'huashen2',
+ // unique: true,
+ // forbid: ['guozhan'],
+ // init: function (player) {
+ // player.storage.huashen = {
+ // list: [],
+ // shown: [],
+ // owned: {},
+ // player: player,
+ // }
+ // },
+ // get: function (player, num) {
+ // if (typeof num != 'number') num = 1;
+ // var list = [];
+ // while (num--) {
+ // var name = player.storage.huashen.list.randomRemove();
+ // var skills = lib.character[name][3].slice(0);
+ // for (var i = 0; i < skills.length; i++) {
+ // var info = lib.skill[skills[i]];
+ // if (info.limited || info.juexingji || info.charlotte || info.zhuSkill || info.hiddenSkill || info.dutySkill) {
+ // skills.splice(i--, 1);
+ // }
+ // }
+ // player.storage.huashen.owned[name] = skills;
+ // // player.popup(name);
+ // game.log(player, '获得了一个化身');
+ // list.push(name);
+ // }
+ // if (player.isUnderControl(true)) {
+ // var cards = [];
+ // for (var i = 0; i < list.length; i++) {
+ // var cardname = 'huashen_card_' + list[i];
+ // lib.card[cardname] = {
+ // fullimage: true,
+ // image: 'character:' + list[i]
+ // }
+ // lib.translate[cardname] = lib.translate[list[i]];
+ // cards.push(game.createCard(cardname, '', ''));
+ // }
+ // player.$draw(cards);
+ // }
+ // },
+ // group: ['huashen1', 'huashen2'],
+ // intro: {
+ // content: function (storage, player) {
+ // var str = '';
+ // var slist = storage.owned;
+ // var list = [];
+ // for (var i in slist) {
+ // list.push(i);
+ // }
+ // if (list.length) {
+ // str += get.translation(list[0]);
+ // for (var i = 1; i < list.length; i++) {
+ // str += '、' + get.translation(list[i]);
+ // }
+ // }
+ // var skill = player.additionalSkills.huashen[0];
+ // if (skill) {
+ // str += '当前技能:' + get.translation(skill);
+ // }
+ // return str;
+ // },
+ // mark: function (dialog, content, player) {
+ // var slist = content.owned;
+ // var list = [];
+ // for (var i in slist) {
+ // list.push(i);
+ // }
+ // if (list.length) {
+ // dialog.addSmall([list, 'character']);
+ // }
+ // if (!player.isUnderControl(true)) {
+ // for (var i = 0; i < dialog.buttons.length; i++) {
+ // if (!content.shown.includes(dialog.buttons[i].link)) {
+ // dialog.buttons[i].node.group.remove();
+ // dialog.buttons[i].node.hp.remove();
+ // dialog.buttons[i].node.intro.remove();
+ // dialog.buttons[i].node.name.innerHTML = '未
知';
+ // dialog.buttons[i].node.name.dataset.nature = '';
+ // dialog.buttons[i].style.background = '';
+ // dialog.buttons[i]._nointro = true;
+ // dialog.buttons[i].classList.add('menubg');
+ // }
+ // }
+ // }
+ // if (player.additionalSkills.huashen) {
+ // var skill = player.additionalSkills.huashen[0];
+ // if (skill) {
+ // dialog.add('
【' + get.translation(skill) +
+ // '】
' + lib.translate[skill + '_info'] + '
');
+ // }
+ // }
+ // }
+ // },
+ // setup: function (player, gain) {
+ // for (var i in lib.character) {
+ // if (lib.filter.characterDisabled2(i) || lib.filter.characterDisabled(i)) continue;
+ // var add = false;
+ // for (var j = 0; j < lib.character[i][3].length; j++) {
+ // var info = lib.skill[lib.character[i][3][j]];
+ // if (!info) {
+ // continue;
+ // }
+ // if (!info.limited && !info.juexingji && !info.charlotte && !info.zhuSkill && !info.hiddenSkill && !info.dutySkill) {
+ // add = true; break;
+ // }
+ // }
+ // if (add) {
+ // player.storage.huashen.list.push(i);
+ // }
+ // }
+ // for (var i = 0; i < game.players.length; i++) {
+ // player.storage.huashen.list.remove([game.players[i].name]);
+ // player.storage.huashen.list.remove([game.players[i].name1]);
+ // player.storage.huashen.list.remove([game.players[i].name2]);
+ // }
+ // player.storage.huasheninited = true;
+ // if (gain) {
+ // player.markSkill('huashen');
+ // lib.skill.huashen.get(player, 2);
+ // _status.event.trigger('huashenStart');
+ // }
+ // }
+ // },
+ // huashen1: {
+ // trigger: { global: 'gameStart', player: ['enterGame', 'damageBefore'] },
+ // forced: true,
+ // popup: false,
+ // //priority:10,
+ // filter: function (event, player) {
+ // return !player.storage.huasheninited;
+ // },
+ // content: function () {
+ // lib.skill.huashen.setup(player, trigger.name != 'damage');
+ // }
+ // },
+ // huashen2: {
+ // audio: 2,
+ // trigger: { player: ['phaseBegin', 'phaseEnd', 'huashenStart'] },
+ // filter: function (event, player, name) {
+ // //if(name=='phaseBegin'&&game.phaseNumber==1) return false;
+ // return true;
+ // },
+ // //priority:50,
+ // forced: true,
+ // //popup:false,
+ // content: function () {
+ // 'step 0'
+ // if (get.is.empty(player.storage.huashen.owned)) {
+ // if (!player.storage.huasheninited) {
+ // lib.skill.huashen.setup(player, false);
+ // }
+ // event.finish();
+ // return;
+ // }
+ // event.trigger('playercontrol');
+ // 'step 1'
+ // var slist = player.storage.huashen.owned;
+ // var list = [];
+ // for (var i in slist) {
+ // list.push(i);
+ // }
+ // event.switchToAuto = function () {
+ // var currentbutton = event.dialog.querySelector('.selected.button');
+ // if (!currentbutton) {
+ // currentbutton = event.dialog.buttons[0];
+ // currentbutton.classList.add('selected');
+ // }
+ // event.clickControl(player.storage.huashen.owned[currentbutton.link].randomGet());
+ // }
+
+ // event.clickControl = function (link, type) {
+ // if (link != 'cancel2') {
+ // var currentname;
+ // if (type == 'ai') {
+ // currentname = event.currentname;
+ // }
+ // else {
+ // currentname = event.dialog.querySelector('.selected.button').link;
+ // }
+ // player.storage.huashen.shown.add(currentname);
+ // if (!player.additionalSkills.huashen || !player.additionalSkills.huashen.includes(link)) {
+ // player.addAdditionalSkill('huashen', link);
+ // //player.logSkill('huashen2');
+ // player.flashAvatar('huashen', currentname);
+ // game.log(player, '获得技能', '【' + get.translation(link) + '】');
+ // player.popup(link);
+
+ // if (event.dialog && event.dialog.buttons) {
+ // for (var i = 0; i < event.dialog.buttons.length; i++) {
+ // if (event.dialog.buttons[i].classList.contains('selected')) {
+ // var name = event.dialog.buttons[i].link;
+ // player.sex = lib.character[name][0];
+ // player.group = lib.character[name][1];
+ // // player.node.identity.style.backgroundColor=get.translation(player.group+'Color');
+ // break;
+ // }
+ // }
+ // }
+
+ // // if(event.triggername=='phaseZhunbeiBegin'){
+ // // (function(){
+ // // var skills=[link];
+ // // var list=[];
+ // // game.expandSkills(skills);
+ // // var triggerevent=event._trigger;
+ // // var name='phaseZhunbeiBegin';
+ // // for(i=0;i 1) prompt += (';或弃置一张牌,然后' + trans + '摸' + num + '张牌');
+ var next = target.chooseToDiscard(prompt, 'he', true);
+ next.numx = cards.length;
+ next.selectCard = function () {
+ if (ui.selected.cards.length > 1) return _status.event.numx;
+ return [1, _status.event.numx];
+ };
+ next.complexCard = true;
+ next.ai = function (card) {
+ if (ui.selected.cards.length == 0 || (_status.event.player.countCards('he',
+ function (cardxq) {
+ return get.value(cardxq) < 7;
+ }) >= _status.event.numx)) return 7 - get.value(card);
+ return - 1;
+ };
+ 'step 1'
+ if (result.bool) {
+ if (result.cards.length == cards.length) player.draw();
+ else player.draw(cards.length);
+ event.cardsx.addArray(result.cards);
+ for (var i = 0; i < event.cardsx.length; i++) {
+ if (get.position(event.cardsx[i]) != 'd') event.cardsx.splice(i--, 1);
+ }
+ } else event.finish();
+ 'step 2'
+ if (event.cardsx.length) {
+ var cards = event.cardsx;
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ dialog.caption = '【设控】';
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var dialog = decadeUI.content.chooseGuanXing(player, cards, cards.length);
+ dialog.caption = '【设控】';
+ dialog.callback = callback;
+ }, player, cards, dialog.callback);
+
+ event.switchToAuto = function () {
+ var cards = dialog.cards[0].concat();
+ var cheats = [];
+ var judges;
+
+ var next = player.getNext();
+ var friend = (get.attitude(player, next) < 0) ? null : next;
+ judges = next.node.judges.childNodes;
+
+ if (judges.length > 0) cheats = decadeUI.get.cheatJudgeCards(cards, judges, friend != null);
+
+ if (friend) {
+ cards = decadeUI.get.bestValueCards(cards, friend);
+ } else {
+ cards.sort(function (a, b) {
+ return get.value(a, next) - get.value(b, next);
+ });
+ }
+
+ cards = cheats.concat(cards);
+ var time = 500;
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ dialog.move(card, index, 0);
+ if (finished) dialog.finishTime(cards.length <= 1 ? 250 : 1000);;
+ }, time, cards[i], i, i >= cards.length - 1);
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ } else event.finish();
+ }
+ },
+ kamome_huanmeng: {
+ content: function () {
+ "step 0"
+ if (player.isUnderControl()) {
+ game.modeSwapPlayer(player);
+ }
+ var num = 1 + player.countCards('e');;
+ var cards = get.cards(num);
+ var guanxing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ guanxing.caption = '【幻梦】';
+ game.broadcast(function (player, cards, callback) {
+ if (!window.decadeUI) return;
+ var guanxing = decadeUI.content.chooseGuanXing(player, cards, cards.length, null, cards.length);
+ guanxing.caption = '【幻梦】';
+ guanxing.callback = callback;
+ }, player, cards, guanxing.callback);
+
+ event.switchToAuto = function () {
+ var cards = guanxing.cards[0].concat();
+ var cheats = [];
+ var judges = player.node.judges.childNodes;
+
+ if (judges.length) cheats = decadeUI.get.cheatJudgeCards(cards, judges, true);
+ if (cards.length) {
+ for (var i = 0; i >= 0 && i < cards.length; i++) {
+ if (get.value(cards[i], player) >= 5) {
+ cheats.push(cards[i]);
+ cards.splice(i, 1)
+ }
+ }
+ }
+
+ var time = 500;
+ for (var i = 0; i < cheats.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanxing.move(card, index, 0);
+ if (finished) guanxing.finishTime(1000);
+ }, time, cheats[i], i, (i >= cheats.length - 1) && cards.length == 0);
+ time += 500;
+ }
+
+ for (var i = 0; i < cards.length; i++) {
+ setTimeout(function (card, index, finished) {
+ guanxing.move(card, index, 1);
+ if (finished) guanxing.finishTime(1000);
+ }, time, cards[i], i, (i >= cards.length - 1));
+ time += 500;
+ }
+ }
+
+ if (event.isOnline()) {
+ event.player.send(function () {
+ if (!window.decadeUI && decadeUI.eventDialog) _status.event.finish();
+ }, event.player);
+
+ event.player.wait();
+ decadeUI.game.wait();
+ } else if (!event.isMine()) {
+ event.switchToAuto();
+ }
+ "step 1"
+ player.popup(get.cnNumber(event.num1) + '上' + get.cnNumber(event.num2) + '下');
+ game.log(player, '将' + get.cnNumber(event.num1) + '张牌置于牌堆顶,' + get.cnNumber(event.num2) + '张牌置于牌堆底');
+ game.updateRoundNumber()
+ }
+ },
+ // xinbenxi: {
+ // content: function () {
+ // "step 0"
+ // event.videoId = lib.status.videoId++;
+ // var func = function (card, id, bool) {
+ // var list = ['为XXX多指定一个目标', '令XXX无视防具', '令XXX不可被抵消', '当XXX造成伤害时摸一张牌',];
+ // var choiceList = ui.create.dialog('【奔袭】:请选择一至两项', 'forcebutton');
+ // choiceList.videoId = id;
+ // for (var i = 0; i < list.length; i++) {
+ // list[i] = list[i].replace(/XXX/g, card);
+ // var str = '';
+ // var next = choiceList.add(str);
+ // next.firstChild.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.button);
+ // next.firstChild.link = i;
+ // for (var j in lib.element.button) {
+ // next[j] = lib.element.button[j];
+ // }
+ // choiceList.buttons.add(next.firstChild);
+ // }
+ // return choiceList;
+ // };
+ // if (player.isOnline2()) {
+ // player.send(func, get.translation(trigger.card), event.videoId, lib.skill.xinbenxi.filterx(trigger, player));
+ // }
+ // event.dialog = func(get.translation(trigger.card), event.videoId, lib.skill.xinbenxi.filterx(trigger, player));
+ // if (player != game.me || _status.auto) {
+ // event.dialog.style.display = 'none';
+ // }
+ // var next = player.chooseButton();
+ // next.set('dialog', event.videoId);
+ // next.set('forced', true);
+ // next.set('selectButton', [1, 2]);
+ // next.set('filterButton',
+ // function (button) {
+ // if (button.link == 0) {
+ // return _status.event.bool1;
+ // };
+ // return true;
+ // });
+ // next.set('bool1', lib.skill.xinbenxi.filterx(trigger, player));
+ // next.set('ai',
+ // function (button) {
+ // var player = _status.event.player;
+ // var event = _status.event.getTrigger();
+ // switch (button.link) {
+ // case 0:
+ // {
+ // if (game.hasPlayer(function (current) {
+ // return lib.filter.targetEnabled2(event.card, player, current) && !event.targets.includes(current) && get.effect(current, event.card, player, player) > 0;
+ // })) return 1.6 + Math.random();
+ // return 0;
+ // }
+ // case 1:
+ // {
+ // if (event.targets.filter(function (current) {
+ // var eff1 = get.effect(current, event.card, player, player);
+ // player._xinbenxi_ai = true;
+ // var eff2 = get.effect(current, event.card, player, player);
+ // delete player._xinbenxi_ai;
+ // return eff1 > eff2;
+ // }).length) return 1.9 + Math.random();
+ // return Math.random();
+ // }
+ // case 2:
+ // {
+ // var num = 1.3;
+ // if (event.card.name == 'sha' && event.targets.filter(function (current) {
+ // if (current.mayHaveShan() && get.attitude(player, current) <= 0) {
+ // if (current.hasSkillTag('useShan')) num = 1.9;
+ // return true;
+ // }
+ // return false;
+ // }).length) return num + Math.random();
+ // return 0.5 + Math.random();
+ // }
+ // case 3:
+ // {
+ // return (get.tag(event.card, 'damage') || 0) + Math.random();
+ // }
+ // }
+ // });
+ // "step 1"
+ // if (player.isOnline2()) {
+ // player.send('closeDialog', event.videoId);
+ // }
+ // event.dialog.close();
+ // var map = [function (trigger, player, event) {
+ // player.chooseTarget('请选择' + get.translation(trigger.card) + '的额外目标', true,
+ // function (card, player, target) {
+ // var player = _status.event.player;
+ // if (_status.event.targets.includes(target)) return false;
+ // return lib.filter.targetEnabled2(_status.event.card, player, target);
+ // }).set('targets', trigger.targets).set('card', trigger.card).set('ai',
+ // function (target) {
+ // var trigger = _status.event.getTrigger();
+ // var player = _status.event.player;
+ // return get.effect(target, trigger.card, player, player);
+ // });
+ // },
+ // function (trigger, player, event) {
+ // player.storage.xinbenxi_unequip.add(trigger.card);
+ // },
+ // function (trigger, player, event) {
+ // player.storage.xinbenxi_directHit.add(trigger.card);
+ // trigger.nowuxie = true;
+ // trigger.customArgs.
+ // default.directHit2 = true;
+ // },
+ // function (trigger, player, event) {
+ // player.storage.xinbenxi_damage.add(trigger.card);
+ // }];
+ // for (var i = 0; i < result.links.length; i++) {
+ // game.log(player, '选择了', '#g【奔袭】', '的', '#y选项' + get.cnNumber(result.links[i] + 1, true));
+ // map[result.links[i]](trigger, player, event);
+ // }
+ // if (!result.links.includes(0)) event.finish();
+ // "step 2"
+ // if (result.targets) {
+ // player.line(result.targets);
+ // trigger.targets.addArray(result.targets);
+ // }
+ // }
+ // }
+ };
+ if (!_status.connectMode) {
+ Object.keys(skillMap).forEach(key => {
+ const skill = lib.skill[key];
+ if (!skill) return;
+ const decadeUISkill = skillMap[key];
+ Object.keys(decadeUISkill).forEach(subKey => skill[subKey] = decadeUISkill[subKey]);
+ });
+ Object.keys(inheritSkillMap).forEach(key => {
+ const skill = lib.skill[key];
+ if (!skill) return;
+ const decadeUIInheritSkill = inheritSkillMap[key];
+ Object.keys(decadeUIInheritSkill).forEach(subKey => skill[subKey] = decadeUIInheritSkill[subKey]);
+ });
+ }
+ const onlineSkillMap = {
+ xinfu_pingcai: {
+ contentx: function () {
+ "step 0"
+ event.pingcai_delayed = true;
+ var name = lib.skill.xinfu_pingcai_backup.takara;
+ event.cardname = name;
+ event.videoId = lib.status.videoId++;
+ if (player.isUnderControl()) {
+ game.swapPlayerAuto(player);
+ }
+ var switchToAuto = function () {
+ game.pause();
+ game.countChoose();
+ setTimeout(function () {
+ _status.imchoosing = false;
+ event._result = {
+ bool: true,
+ };
+ game.resume();
+ }, 9000);
+ };
+ var createDialog = function (player, id, name) {
+ if (player == game.me) return;
+ var dialog = ui.create.dialog('forcebutton', 'hidden');
+ var str = get.translation(player) + '正在擦拭宝物上的灰尘…';
+ var canSkip = (!_status.connectMode);
+ if (canSkip) str += '
(点击宝物可以跳过等待AI操作)';
+ dialog.textPrompt = dialog.add('' + str + '
');
+ dialog.classList.add('fixed');
+ dialog.classList.add('scroll1');
+ dialog.classList.add('scroll2');
+ dialog.classList.add('fullwidth');
+ dialog.classList.add('fullheight');
+ dialog.classList.add('noupdate');
+ dialog.videoId = id;
+
+ var canvas2 = document.createElement('canvas');
+ dialog.canvas_viewer = canvas2;
+ dialog.appendChild(canvas2);
+ canvas2.classList.add('grayscale');
+ canvas2.style.position = "absolute";
+ canvas2.style.width = '249px';
+ canvas2.style.height = '249px';
+ canvas2.style['border-radius'] = '6px';
+ canvas2.style.left = "calc(50% - 125px)";
+ canvas2.style.top = "calc(50% - 125px)";
+ canvas2.width = 249;
+ canvas2.height = 249;
+ canvas2.style.border = '3px solid';
+
+ var ctx2 = canvas2.getContext('2d');
+ var img = new Image();
+ img.src = lib.assetURL + 'image/card/' + name + '.png';
+ img.onload = function () {
+ ctx2.drawImage(this, 0, 0, this.width, this.height, 0, 0, canvas2.width, canvas2.height);
+ }
+ if (canSkip) {
+ var skip = function () {
+ if (event.pingcai_delayed) {
+ delete event.pingcai_delayed;
+ event._result = {
+ bool: true,
+ };
+ game.resume();
+ canvas2.removeEventListener(lib.config.touchscreen ? 'touchend' : 'click', skip);
+ }
+ };
+ canvas2.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', skip);
+ }
+ dialog.open();
+ };
+ var chooseButton = function (id, name) {
+ var event = _status.event;
+ _status.xinfu_pingcai_finished = false;
+
+ var dialog = ui.create.dialog('forcebutton', 'hidden');
+ dialog.textPrompt = dialog.add('擦拭掉宝物上的灰尘吧!
');
+ event.switchToAuto = function () {
+ event._result = {
+ bool: _status.xinfu_pingcai_finished,
+ };
+ game.resume();
+ _status.imchoosing = false;
+ _status.xinfu_pingcai_finished = true;
+ };
+ dialog.classList.add('fixed');
+ dialog.classList.add('scroll1');
+ dialog.classList.add('scroll2');
+ dialog.classList.add('fullwidth');
+ dialog.classList.add('fullheight');
+ dialog.classList.add('noupdate');
+ dialog.videoId = id;
+
+ var canvas = document.createElement('canvas');
+ var canvas2 = document.createElement('canvas');
+
+ dialog.appendChild(canvas2);
+ dialog.appendChild(canvas);
+
+ canvas.style.position = "absolute";
+ canvas.style.width = '249px';
+ canvas.style.height = '249px';
+ canvas.style['border-radius'] = '6px';
+ canvas.style.left = "calc(50% - 125px)";
+ canvas.style.top = "calc(50% - 125px)";
+ canvas.width = 249;
+ canvas.height = 249;
+ canvas.style.border = '3px solid';
+
+ canvas2.style.position = "absolute";
+ canvas2.style.width = '249px';
+ canvas2.style.height = '249px';
+ canvas2.style['border-radius'] = '6px';
+ canvas2.style.left = "calc(50% - 125px)";
+ canvas2.style.top = "calc(50% - 125px)";
+ canvas2.width = 249;
+ canvas2.height = 249;
+ canvas2.style.border = '3px solid';
+
+ var ctx = canvas.getContext('2d');
+ var ctx2 = canvas2.getContext('2d');
+
+ var img = new Image();
+ img.src = lib.assetURL + 'image/card/' + name + '.png';
+ img.onload = function () {
+ ctx2.drawImage(this, 0, 0, this.width, this.height, 0, 0, canvas2.width, canvas2.height);
+ }
+
+ ctx.fillStyle = 'lightgray';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ canvas.onmousedown = function (ev) {
+ //if(_status.xinfu_pingcai_finished) return;
+ canvas.onmousemove = function (e) {
+ if (_status.xinfu_pingcai_finished) return;
+ ctx.beginPath();
+ ctx.clearRect(e.offsetX / game.documentZoom - 16, e.offsetY / game.documentZoom - 16, 32, 32);
+ var data = ctx.getImageData(canvas.width * 0.1, canvas.height * 0.1, canvas.width * 0.8, canvas.height * 0.8).data;
+ var sum = 0;
+ for (var i = 3; i < data.length; i += 4) {
+ if (data[i] == 0) {
+ sum++;
+ }
+ }
+ if (sum >= (canvas.width * canvas.height) * 0.6) {
+ //ctx.clearRect(0,0,canvas.width,canvas.height);
+ if (!_status.xinfu_pingcai_finished) {
+ _status.xinfu_pingcai_finished = true;
+ event.switchToAuto();
+ }
+ }
+ }
+ }
+ canvas.ontouchstart = function (ev) {
+ //if(_status.xinfu_pingcai_finished) return;
+ canvas.ontouchmove = function (e) {
+ if (_status.xinfu_pingcai_finished) return;
+ ctx.beginPath();
+ var rect = canvas.getBoundingClientRect();
+ var X = ((e.touches[0].clientX / game.documentZoom - rect.left) / rect.width * canvas.width);
+ var Y = ((e.touches[0].clientY / game.documentZoom - rect.top) / rect.height * canvas.height);
+ ctx.clearRect(X - 16, Y - 16, 32, 32);
+ var data = ctx.getImageData(canvas.width * 0.1, canvas.height * 0.1, canvas.width * 0.8, canvas.height * 0.8).data;
+ var sum = 0;
+ for (var i = 3; i < data.length; i += 4) {
+ if (data[i] == 0) {
+ sum++;
+ }
+ }
+ if (sum >= (canvas.width * canvas.height) * 0.6) {
+ if (!_status.xinfu_pingcai_finished) {
+ _status.xinfu_pingcai_finished = true;
+ event.switchToAuto();
+ }
+ }
+ }
+ }
+ canvas.onmouseup = function (ev) {
+ canvas.onmousemove = null;
+ }
+ canvas.ontouchend = function (ev) {
+ canvas.ontouchmove = null;
+ }
+
+ dialog.open();
+
+ game.pause();
+ game.countChoose();
+ };
+ //event.switchToAuto=switchToAuto;
+ game.broadcastAll(createDialog, player, event.videoId, name);
+ if (event.isMine()) {
+ chooseButton(event.videoId, name);
+ }
+ else if (event.isOnline()) {
+ event.player.send(chooseButton, event.videoId, name);
+ event.player.wait();
+ game.pause();
+ }
+ else {
+ switchToAuto();
+ }
+ "step 1"
+ var result = event.result || result;
+ if (!result) result = { bool: false };
+ event._result = result;
+ game.broadcastAll(function (id, result, player) {
+ _status.xinfu_pingcai_finished = true;
+ var dialog = get.idDialog(id);
+ if (dialog) {
+ dialog.textPrompt.innerHTML = '' + (get.translation(player) + '擦拭宝物' + (result.bool ? '成功!' : '失败…')) + '
';
+ if (result.bool && dialog.canvas_viewer) dialog.canvas_viewer.classList.remove('grayscale');
+ }
+ if (!_status.connectMode) delete event.pingcai_delayed;
+ }, event.videoId, result, player);
+ game.delay(2.5);
+ "step 2"
+ game.broadcastAll('closeDialog', event.videoId);
+ if (result.bool) {
+ player.logSkill('pcaudio_' + event.cardname);
+ event.insert(lib.skill.xinfu_pingcai[event.cardname], {
+ player: player,
+ });
+ }
+ }
+ }
+ };
+ Object.keys(onlineSkillMap).forEach(key => {
+ const skill = lib.skill[key];
+ if (!skill) return;
+ const decadeUIOnlineSkill = onlineSkillMap[key];
+ Object.keys(decadeUIOnlineSkill).forEach(subKey => skill[subKey] = decadeUIOnlineSkill[subKey]);
+ });
+});
diff --git a/spine.js b/spine.js
new file mode 100644
index 0000000..8aca3f3
--- /dev/null
+++ b/spine.js
@@ -0,0 +1,10389 @@
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+var spine;
+(function (spine) {
+ var Animation = (function () {
+ function Animation(name, timelines, duration) {
+ if (name == null)
+ throw new Error("name cannot be null.");
+ if (timelines == null)
+ throw new Error("timelines cannot be null.");
+ this.name = name;
+ this.timelines = timelines;
+ this.duration = duration;
+ }
+ Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, pose, direction) {
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ if (loop && this.duration != 0) {
+ time %= this.duration;
+ if (lastTime > 0)
+ lastTime %= this.duration;
+ }
+ var timelines = this.timelines;
+ for (var i = 0, n = timelines.length; i < n; i++)
+ timelines[i].apply(skeleton, lastTime, time, events, alpha, pose, direction);
+ };
+ Animation.binarySearch = function (values, target, step) {
+ if (step === void 0) { step = 1; }
+ var low = 0;
+ var high = values.length / step - 2;
+ if (high == 0)
+ return step;
+ var current = high >>> 1;
+ while (true) {
+ if (values[(current + 1) * step] <= target)
+ low = current + 1;
+ else
+ high = current;
+ if (low == high)
+ return (low + 1) * step;
+ current = (low + high) >>> 1;
+ }
+ };
+ Animation.linearSearch = function (values, target, step) {
+ for (var i = 0, last = values.length - step; i <= last; i += step)
+ if (values[i] > target)
+ return i;
+ return -1;
+ };
+ return Animation;
+ }());
+ spine.Animation = Animation;
+ var MixPose;
+ (function (MixPose) {
+ MixPose[MixPose["setup"] = 0] = "setup";
+ MixPose[MixPose["current"] = 1] = "current";
+ MixPose[MixPose["currentLayered"] = 2] = "currentLayered";
+ })(MixPose = spine.MixPose || (spine.MixPose = {}));
+ var MixDirection;
+ (function (MixDirection) {
+ MixDirection[MixDirection["in"] = 0] = "in";
+ MixDirection[MixDirection["out"] = 1] = "out";
+ })(MixDirection = spine.MixDirection || (spine.MixDirection = {}));
+ var TimelineType;
+ (function (TimelineType) {
+ TimelineType[TimelineType["rotate"] = 0] = "rotate";
+ TimelineType[TimelineType["translate"] = 1] = "translate";
+ TimelineType[TimelineType["scale"] = 2] = "scale";
+ TimelineType[TimelineType["shear"] = 3] = "shear";
+ TimelineType[TimelineType["attachment"] = 4] = "attachment";
+ TimelineType[TimelineType["color"] = 5] = "color";
+ TimelineType[TimelineType["deform"] = 6] = "deform";
+ TimelineType[TimelineType["event"] = 7] = "event";
+ TimelineType[TimelineType["drawOrder"] = 8] = "drawOrder";
+ TimelineType[TimelineType["ikConstraint"] = 9] = "ikConstraint";
+ TimelineType[TimelineType["transformConstraint"] = 10] = "transformConstraint";
+ TimelineType[TimelineType["pathConstraintPosition"] = 11] = "pathConstraintPosition";
+ TimelineType[TimelineType["pathConstraintSpacing"] = 12] = "pathConstraintSpacing";
+ TimelineType[TimelineType["pathConstraintMix"] = 13] = "pathConstraintMix";
+ TimelineType[TimelineType["twoColor"] = 14] = "twoColor";
+ })(TimelineType = spine.TimelineType || (spine.TimelineType = {}));
+ var CurveTimeline = (function () {
+ function CurveTimeline(frameCount) {
+ if (frameCount <= 0)
+ throw new Error("frameCount must be > 0: " + frameCount);
+ this.curves = spine.Utils.newFloatArray((frameCount - 1) * CurveTimeline.BEZIER_SIZE);
+ }
+ CurveTimeline.prototype.getFrameCount = function () {
+ return this.curves.length / CurveTimeline.BEZIER_SIZE + 1;
+ };
+ CurveTimeline.prototype.setLinear = function (frameIndex) {
+ this.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.LINEAR;
+ };
+ CurveTimeline.prototype.setStepped = function (frameIndex) {
+ this.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.STEPPED;
+ };
+ CurveTimeline.prototype.getCurveType = function (frameIndex) {
+ var index = frameIndex * CurveTimeline.BEZIER_SIZE;
+ if (index == this.curves.length)
+ return CurveTimeline.LINEAR;
+ var type = this.curves[index];
+ if (type == CurveTimeline.LINEAR)
+ return CurveTimeline.LINEAR;
+ if (type == CurveTimeline.STEPPED)
+ return CurveTimeline.STEPPED;
+ return CurveTimeline.BEZIER;
+ };
+ CurveTimeline.prototype.setCurve = function (frameIndex, cx1, cy1, cx2, cy2) {
+ var tmpx = (-cx1 * 2 + cx2) * 0.03, tmpy = (-cy1 * 2 + cy2) * 0.03;
+ var dddfx = ((cx1 - cx2) * 3 + 1) * 0.006, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006;
+ var ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy;
+ var dfx = cx1 * 0.3 + tmpx + dddfx * 0.16666667, dfy = cy1 * 0.3 + tmpy + dddfy * 0.16666667;
+ var i = frameIndex * CurveTimeline.BEZIER_SIZE;
+ var curves = this.curves;
+ curves[i++] = CurveTimeline.BEZIER;
+ var x = dfx, y = dfy;
+ for (var n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) {
+ curves[i] = x;
+ curves[i + 1] = y;
+ dfx += ddfx;
+ dfy += ddfy;
+ ddfx += dddfx;
+ ddfy += dddfy;
+ x += dfx;
+ y += dfy;
+ }
+ };
+ CurveTimeline.prototype.getCurvePercent = function (frameIndex, percent) {
+ percent = spine.MathUtils.clamp(percent, 0, 1);
+ var curves = this.curves;
+ var i = frameIndex * CurveTimeline.BEZIER_SIZE;
+ var type = curves[i];
+ if (type == CurveTimeline.LINEAR)
+ return percent;
+ if (type == CurveTimeline.STEPPED)
+ return 0;
+ i++;
+ var x = 0;
+ for (var start = i, n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) {
+ x = curves[i];
+ if (x >= percent) {
+ var prevX = void 0, prevY = void 0;
+ if (i == start) {
+ prevX = 0;
+ prevY = 0;
+ }
+ else {
+ prevX = curves[i - 2];
+ prevY = curves[i - 1];
+ }
+ return prevY + (curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);
+ }
+ }
+ var y = curves[i - 1];
+ return y + (1 - y) * (percent - x) / (1 - x);
+ };
+ CurveTimeline.LINEAR = 0;
+ CurveTimeline.STEPPED = 1;
+ CurveTimeline.BEZIER = 2;
+ CurveTimeline.BEZIER_SIZE = 10 * 2 - 1;
+ return CurveTimeline;
+ }());
+ spine.CurveTimeline = CurveTimeline;
+ var RotateTimeline = (function (_super) {
+ __extends(RotateTimeline, _super);
+ function RotateTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount << 1);
+ return _this;
+ }
+ RotateTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.rotate << 24) + this.boneIndex;
+ };
+ RotateTimeline.prototype.setFrame = function (frameIndex, time, degrees) {
+ frameIndex <<= 1;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + RotateTimeline.ROTATION] = degrees;
+ };
+ RotateTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var frames = this.frames;
+ var bone = skeleton.bones[this.boneIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ bone.rotation = bone.data.rotation;
+ return;
+ case MixPose.current:
+ var r_1 = bone.data.rotation - bone.rotation;
+ r_1 -= (16384 - ((16384.499999999996 - r_1 / 360) | 0)) * 360;
+ bone.rotation += r_1 * alpha;
+ }
+ return;
+ }
+ if (time >= frames[frames.length - RotateTimeline.ENTRIES]) {
+ if (pose == MixPose.setup)
+ bone.rotation = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION] * alpha;
+ else {
+ var r_2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION] - bone.rotation;
+ r_2 -= (16384 - ((16384.499999999996 - r_2 / 360) | 0)) * 360;
+ bone.rotation += r_2 * alpha;
+ }
+ return;
+ }
+ var frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);
+ var prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));
+ var r = frames[frame + RotateTimeline.ROTATION] - prevRotation;
+ r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
+ r = prevRotation + r * percent;
+ if (pose == MixPose.setup) {
+ r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
+ bone.rotation = bone.data.rotation + r * alpha;
+ }
+ else {
+ r = bone.data.rotation + r - bone.rotation;
+ r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
+ bone.rotation += r * alpha;
+ }
+ };
+ RotateTimeline.ENTRIES = 2;
+ RotateTimeline.PREV_TIME = -2;
+ RotateTimeline.PREV_ROTATION = -1;
+ RotateTimeline.ROTATION = 1;
+ return RotateTimeline;
+ }(CurveTimeline));
+ spine.RotateTimeline = RotateTimeline;
+ var TranslateTimeline = (function (_super) {
+ __extends(TranslateTimeline, _super);
+ function TranslateTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * TranslateTimeline.ENTRIES);
+ return _this;
+ }
+ TranslateTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.translate << 24) + this.boneIndex;
+ };
+ TranslateTimeline.prototype.setFrame = function (frameIndex, time, x, y) {
+ frameIndex *= TranslateTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + TranslateTimeline.X] = x;
+ this.frames[frameIndex + TranslateTimeline.Y] = y;
+ };
+ TranslateTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var frames = this.frames;
+ var bone = skeleton.bones[this.boneIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ bone.x = bone.data.x;
+ bone.y = bone.data.y;
+ return;
+ case MixPose.current:
+ bone.x += (bone.data.x - bone.x) * alpha;
+ bone.y += (bone.data.y - bone.y) * alpha;
+ }
+ return;
+ }
+ var x = 0, y = 0;
+ if (time >= frames[frames.length - TranslateTimeline.ENTRIES]) {
+ x = frames[frames.length + TranslateTimeline.PREV_X];
+ y = frames[frames.length + TranslateTimeline.PREV_Y];
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, TranslateTimeline.ENTRIES);
+ x = frames[frame + TranslateTimeline.PREV_X];
+ y = frames[frame + TranslateTimeline.PREV_Y];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / TranslateTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + TranslateTimeline.PREV_TIME] - frameTime));
+ x += (frames[frame + TranslateTimeline.X] - x) * percent;
+ y += (frames[frame + TranslateTimeline.Y] - y) * percent;
+ }
+ if (pose == MixPose.setup) {
+ bone.x = bone.data.x + x * alpha;
+ bone.y = bone.data.y + y * alpha;
+ }
+ else {
+ bone.x += (bone.data.x + x - bone.x) * alpha;
+ bone.y += (bone.data.y + y - bone.y) * alpha;
+ }
+ };
+ TranslateTimeline.ENTRIES = 3;
+ TranslateTimeline.PREV_TIME = -3;
+ TranslateTimeline.PREV_X = -2;
+ TranslateTimeline.PREV_Y = -1;
+ TranslateTimeline.X = 1;
+ TranslateTimeline.Y = 2;
+ return TranslateTimeline;
+ }(CurveTimeline));
+ spine.TranslateTimeline = TranslateTimeline;
+ var ScaleTimeline = (function (_super) {
+ __extends(ScaleTimeline, _super);
+ function ScaleTimeline(frameCount) {
+ return _super.call(this, frameCount) || this;
+ }
+ ScaleTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.scale << 24) + this.boneIndex;
+ };
+ ScaleTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var frames = this.frames;
+ var bone = skeleton.bones[this.boneIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ bone.scaleX = bone.data.scaleX;
+ bone.scaleY = bone.data.scaleY;
+ return;
+ case MixPose.current:
+ bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
+ bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
+ }
+ return;
+ }
+ var x = 0, y = 0;
+ if (time >= frames[frames.length - ScaleTimeline.ENTRIES]) {
+ x = frames[frames.length + ScaleTimeline.PREV_X] * bone.data.scaleX;
+ y = frames[frames.length + ScaleTimeline.PREV_Y] * bone.data.scaleY;
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, ScaleTimeline.ENTRIES);
+ x = frames[frame + ScaleTimeline.PREV_X];
+ y = frames[frame + ScaleTimeline.PREV_Y];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / ScaleTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + ScaleTimeline.PREV_TIME] - frameTime));
+ x = (x + (frames[frame + ScaleTimeline.X] - x) * percent) * bone.data.scaleX;
+ y = (y + (frames[frame + ScaleTimeline.Y] - y) * percent) * bone.data.scaleY;
+ }
+ if (alpha == 1) {
+ bone.scaleX = x;
+ bone.scaleY = y;
+ }
+ else {
+ var bx = 0, by = 0;
+ if (pose == MixPose.setup) {
+ bx = bone.data.scaleX;
+ by = bone.data.scaleY;
+ }
+ else {
+ bx = bone.scaleX;
+ by = bone.scaleY;
+ }
+ if (direction == MixDirection.out) {
+ x = Math.abs(x) * spine.MathUtils.signum(bx);
+ y = Math.abs(y) * spine.MathUtils.signum(by);
+ }
+ else {
+ bx = Math.abs(bx) * spine.MathUtils.signum(x);
+ by = Math.abs(by) * spine.MathUtils.signum(y);
+ }
+ bone.scaleX = bx + (x - bx) * alpha;
+ bone.scaleY = by + (y - by) * alpha;
+ }
+ };
+ return ScaleTimeline;
+ }(TranslateTimeline));
+ spine.ScaleTimeline = ScaleTimeline;
+ var ShearTimeline = (function (_super) {
+ __extends(ShearTimeline, _super);
+ function ShearTimeline(frameCount) {
+ return _super.call(this, frameCount) || this;
+ }
+ ShearTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.shear << 24) + this.boneIndex;
+ };
+ ShearTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var frames = this.frames;
+ var bone = skeleton.bones[this.boneIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ bone.shearX = bone.data.shearX;
+ bone.shearY = bone.data.shearY;
+ return;
+ case MixPose.current:
+ bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
+ bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
+ }
+ return;
+ }
+ var x = 0, y = 0;
+ if (time >= frames[frames.length - ShearTimeline.ENTRIES]) {
+ x = frames[frames.length + ShearTimeline.PREV_X];
+ y = frames[frames.length + ShearTimeline.PREV_Y];
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, ShearTimeline.ENTRIES);
+ x = frames[frame + ShearTimeline.PREV_X];
+ y = frames[frame + ShearTimeline.PREV_Y];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / ShearTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + ShearTimeline.PREV_TIME] - frameTime));
+ x = x + (frames[frame + ShearTimeline.X] - x) * percent;
+ y = y + (frames[frame + ShearTimeline.Y] - y) * percent;
+ }
+ if (pose == MixPose.setup) {
+ bone.shearX = bone.data.shearX + x * alpha;
+ bone.shearY = bone.data.shearY + y * alpha;
+ }
+ else {
+ bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
+ bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
+ }
+ };
+ return ShearTimeline;
+ }(TranslateTimeline));
+ spine.ShearTimeline = ShearTimeline;
+ var ColorTimeline = (function (_super) {
+ __extends(ColorTimeline, _super);
+ function ColorTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * ColorTimeline.ENTRIES);
+ return _this;
+ }
+ ColorTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.color << 24) + this.slotIndex;
+ };
+ ColorTimeline.prototype.setFrame = function (frameIndex, time, r, g, b, a) {
+ frameIndex *= ColorTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + ColorTimeline.R] = r;
+ this.frames[frameIndex + ColorTimeline.G] = g;
+ this.frames[frameIndex + ColorTimeline.B] = b;
+ this.frames[frameIndex + ColorTimeline.A] = a;
+ };
+ ColorTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var slot = skeleton.slots[this.slotIndex];
+ var frames = this.frames;
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ slot.color.setFromColor(slot.data.color);
+ return;
+ case MixPose.current:
+ var color = slot.color, setup = slot.data.color;
+ color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha, (setup.a - color.a) * alpha);
+ }
+ return;
+ }
+ var r = 0, g = 0, b = 0, a = 0;
+ if (time >= frames[frames.length - ColorTimeline.ENTRIES]) {
+ var i = frames.length;
+ r = frames[i + ColorTimeline.PREV_R];
+ g = frames[i + ColorTimeline.PREV_G];
+ b = frames[i + ColorTimeline.PREV_B];
+ a = frames[i + ColorTimeline.PREV_A];
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, ColorTimeline.ENTRIES);
+ r = frames[frame + ColorTimeline.PREV_R];
+ g = frames[frame + ColorTimeline.PREV_G];
+ b = frames[frame + ColorTimeline.PREV_B];
+ a = frames[frame + ColorTimeline.PREV_A];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / ColorTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + ColorTimeline.PREV_TIME] - frameTime));
+ r += (frames[frame + ColorTimeline.R] - r) * percent;
+ g += (frames[frame + ColorTimeline.G] - g) * percent;
+ b += (frames[frame + ColorTimeline.B] - b) * percent;
+ a += (frames[frame + ColorTimeline.A] - a) * percent;
+ }
+ if (alpha == 1)
+ slot.color.set(r, g, b, a);
+ else {
+ var color = slot.color;
+ if (pose == MixPose.setup)
+ color.setFromColor(slot.data.color);
+ color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
+ }
+ };
+ ColorTimeline.ENTRIES = 5;
+ ColorTimeline.PREV_TIME = -5;
+ ColorTimeline.PREV_R = -4;
+ ColorTimeline.PREV_G = -3;
+ ColorTimeline.PREV_B = -2;
+ ColorTimeline.PREV_A = -1;
+ ColorTimeline.R = 1;
+ ColorTimeline.G = 2;
+ ColorTimeline.B = 3;
+ ColorTimeline.A = 4;
+ return ColorTimeline;
+ }(CurveTimeline));
+ spine.ColorTimeline = ColorTimeline;
+ var TwoColorTimeline = (function (_super) {
+ __extends(TwoColorTimeline, _super);
+ function TwoColorTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * TwoColorTimeline.ENTRIES);
+ return _this;
+ }
+ TwoColorTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.twoColor << 24) + this.slotIndex;
+ };
+ TwoColorTimeline.prototype.setFrame = function (frameIndex, time, r, g, b, a, r2, g2, b2) {
+ frameIndex *= TwoColorTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + TwoColorTimeline.R] = r;
+ this.frames[frameIndex + TwoColorTimeline.G] = g;
+ this.frames[frameIndex + TwoColorTimeline.B] = b;
+ this.frames[frameIndex + TwoColorTimeline.A] = a;
+ this.frames[frameIndex + TwoColorTimeline.R2] = r2;
+ this.frames[frameIndex + TwoColorTimeline.G2] = g2;
+ this.frames[frameIndex + TwoColorTimeline.B2] = b2;
+ };
+ TwoColorTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var slot = skeleton.slots[this.slotIndex];
+ var frames = this.frames;
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ slot.color.setFromColor(slot.data.color);
+ slot.darkColor.setFromColor(slot.data.darkColor);
+ return;
+ case MixPose.current:
+ var light = slot.color, dark = slot.darkColor, setupLight = slot.data.color, setupDark = slot.data.darkColor;
+ light.add((setupLight.r - light.r) * alpha, (setupLight.g - light.g) * alpha, (setupLight.b - light.b) * alpha, (setupLight.a - light.a) * alpha);
+ dark.add((setupDark.r - dark.r) * alpha, (setupDark.g - dark.g) * alpha, (setupDark.b - dark.b) * alpha, 0);
+ }
+ return;
+ }
+ var r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
+ if (time >= frames[frames.length - TwoColorTimeline.ENTRIES]) {
+ var i = frames.length;
+ r = frames[i + TwoColorTimeline.PREV_R];
+ g = frames[i + TwoColorTimeline.PREV_G];
+ b = frames[i + TwoColorTimeline.PREV_B];
+ a = frames[i + TwoColorTimeline.PREV_A];
+ r2 = frames[i + TwoColorTimeline.PREV_R2];
+ g2 = frames[i + TwoColorTimeline.PREV_G2];
+ b2 = frames[i + TwoColorTimeline.PREV_B2];
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, TwoColorTimeline.ENTRIES);
+ r = frames[frame + TwoColorTimeline.PREV_R];
+ g = frames[frame + TwoColorTimeline.PREV_G];
+ b = frames[frame + TwoColorTimeline.PREV_B];
+ a = frames[frame + TwoColorTimeline.PREV_A];
+ r2 = frames[frame + TwoColorTimeline.PREV_R2];
+ g2 = frames[frame + TwoColorTimeline.PREV_G2];
+ b2 = frames[frame + TwoColorTimeline.PREV_B2];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / TwoColorTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + TwoColorTimeline.PREV_TIME] - frameTime));
+ r += (frames[frame + TwoColorTimeline.R] - r) * percent;
+ g += (frames[frame + TwoColorTimeline.G] - g) * percent;
+ b += (frames[frame + TwoColorTimeline.B] - b) * percent;
+ a += (frames[frame + TwoColorTimeline.A] - a) * percent;
+ r2 += (frames[frame + TwoColorTimeline.R2] - r2) * percent;
+ g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;
+ b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;
+ }
+ if (alpha == 1) {
+ slot.color.set(r, g, b, a);
+ slot.darkColor.set(r2, g2, b2, 1);
+ }
+ else {
+ var light = slot.color, dark = slot.darkColor;
+ if (pose == MixPose.setup) {
+ light.setFromColor(slot.data.color);
+ dark.setFromColor(slot.data.darkColor);
+ }
+ light.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha);
+ dark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0);
+ }
+ };
+ TwoColorTimeline.ENTRIES = 8;
+ TwoColorTimeline.PREV_TIME = -8;
+ TwoColorTimeline.PREV_R = -7;
+ TwoColorTimeline.PREV_G = -6;
+ TwoColorTimeline.PREV_B = -5;
+ TwoColorTimeline.PREV_A = -4;
+ TwoColorTimeline.PREV_R2 = -3;
+ TwoColorTimeline.PREV_G2 = -2;
+ TwoColorTimeline.PREV_B2 = -1;
+ TwoColorTimeline.R = 1;
+ TwoColorTimeline.G = 2;
+ TwoColorTimeline.B = 3;
+ TwoColorTimeline.A = 4;
+ TwoColorTimeline.R2 = 5;
+ TwoColorTimeline.G2 = 6;
+ TwoColorTimeline.B2 = 7;
+ return TwoColorTimeline;
+ }(CurveTimeline));
+ spine.TwoColorTimeline = TwoColorTimeline;
+ var AttachmentTimeline = (function () {
+ function AttachmentTimeline(frameCount) {
+ this.frames = spine.Utils.newFloatArray(frameCount);
+ this.attachmentNames = new Array(frameCount);
+ }
+ AttachmentTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.attachment << 24) + this.slotIndex;
+ };
+ AttachmentTimeline.prototype.getFrameCount = function () {
+ return this.frames.length;
+ };
+ AttachmentTimeline.prototype.setFrame = function (frameIndex, time, attachmentName) {
+ this.frames[frameIndex] = time;
+ this.attachmentNames[frameIndex] = attachmentName;
+ };
+ AttachmentTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, pose, direction) {
+ var slot = skeleton.slots[this.slotIndex];
+ if (direction == MixDirection.out && pose == MixPose.setup) {
+ var attachmentName_1 = slot.data.attachmentName;
+ slot.setAttachment(attachmentName_1 == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName_1));
+ return;
+ }
+ var frames = this.frames;
+ if (time < frames[0]) {
+ if (pose == MixPose.setup) {
+ var attachmentName_2 = slot.data.attachmentName;
+ slot.setAttachment(attachmentName_2 == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName_2));
+ }
+ return;
+ }
+ var frameIndex = 0;
+ if (time >= frames[frames.length - 1])
+ frameIndex = frames.length - 1;
+ else
+ frameIndex = Animation.binarySearch(frames, time, 1) - 1;
+ var attachmentName = this.attachmentNames[frameIndex];
+ skeleton.slots[this.slotIndex]
+ .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName));
+ };
+ return AttachmentTimeline;
+ }());
+ spine.AttachmentTimeline = AttachmentTimeline;
+ var zeros = null;
+ var DeformTimeline = (function (_super) {
+ __extends(DeformTimeline, _super);
+ function DeformTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount);
+ _this.frameVertices = new Array(frameCount);
+ if (zeros == null)
+ zeros = spine.Utils.newFloatArray(64);
+ return _this;
+ }
+ DeformTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.deform << 27) + +this.attachment.id + this.slotIndex;
+ };
+ DeformTimeline.prototype.setFrame = function (frameIndex, time, vertices) {
+ this.frames[frameIndex] = time;
+ this.frameVertices[frameIndex] = vertices;
+ };
+ DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var slot = skeleton.slots[this.slotIndex];
+ var slotAttachment = slot.getAttachment();
+ if (!(slotAttachment instanceof spine.VertexAttachment) || !slotAttachment.applyDeform(this.attachment))
+ return;
+ var verticesArray = slot.attachmentVertices;
+ if (verticesArray.length == 0)
+ alpha = 1;
+ var frameVertices = this.frameVertices;
+ var vertexCount = frameVertices[0].length;
+ var frames = this.frames;
+ if (time < frames[0]) {
+ var vertexAttachment = slotAttachment;
+ switch (pose) {
+ case MixPose.setup:
+ verticesArray.length = 0;
+ return;
+ case MixPose.current:
+ if (alpha == 1) {
+ verticesArray.length = 0;
+ break;
+ }
+ var vertices_1 = spine.Utils.setArraySize(verticesArray, vertexCount);
+ if (vertexAttachment.bones == null) {
+ var setupVertices = vertexAttachment.vertices;
+ for (var i = 0; i < vertexCount; i++)
+ vertices_1[i] += (setupVertices[i] - vertices_1[i]) * alpha;
+ }
+ else {
+ alpha = 1 - alpha;
+ for (var i = 0; i < vertexCount; i++)
+ vertices_1[i] *= alpha;
+ }
+ }
+ return;
+ }
+ var vertices = spine.Utils.setArraySize(verticesArray, vertexCount);
+ if (time >= frames[frames.length - 1]) {
+ var lastVertices = frameVertices[frames.length - 1];
+ if (alpha == 1) {
+ spine.Utils.arrayCopy(lastVertices, 0, vertices, 0, vertexCount);
+ }
+ else if (pose == MixPose.setup) {
+ var vertexAttachment = slotAttachment;
+ if (vertexAttachment.bones == null) {
+ var setupVertices_1 = vertexAttachment.vertices;
+ for (var i_1 = 0; i_1 < vertexCount; i_1++) {
+ var setup = setupVertices_1[i_1];
+ vertices[i_1] = setup + (lastVertices[i_1] - setup) * alpha;
+ }
+ }
+ else {
+ for (var i_2 = 0; i_2 < vertexCount; i_2++)
+ vertices[i_2] = lastVertices[i_2] * alpha;
+ }
+ }
+ else {
+ for (var i_3 = 0; i_3 < vertexCount; i_3++)
+ vertices[i_3] += (lastVertices[i_3] - vertices[i_3]) * alpha;
+ }
+ return;
+ }
+ var frame = Animation.binarySearch(frames, time);
+ var prevVertices = frameVertices[frame - 1];
+ var nextVertices = frameVertices[frame];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime));
+ if (alpha == 1) {
+ for (var i_4 = 0; i_4 < vertexCount; i_4++) {
+ var prev = prevVertices[i_4];
+ vertices[i_4] = prev + (nextVertices[i_4] - prev) * percent;
+ }
+ }
+ else if (pose == MixPose.setup) {
+ var vertexAttachment = slotAttachment;
+ if (vertexAttachment.bones == null) {
+ var setupVertices_2 = vertexAttachment.vertices;
+ for (var i_5 = 0; i_5 < vertexCount; i_5++) {
+ var prev = prevVertices[i_5], setup = setupVertices_2[i_5];
+ vertices[i_5] = setup + (prev + (nextVertices[i_5] - prev) * percent - setup) * alpha;
+ }
+ }
+ else {
+ for (var i_6 = 0; i_6 < vertexCount; i_6++) {
+ var prev = prevVertices[i_6];
+ vertices[i_6] = (prev + (nextVertices[i_6] - prev) * percent) * alpha;
+ }
+ }
+ }
+ else {
+ for (var i_7 = 0; i_7 < vertexCount; i_7++) {
+ var prev = prevVertices[i_7];
+ vertices[i_7] += (prev + (nextVertices[i_7] - prev) * percent - vertices[i_7]) * alpha;
+ }
+ }
+ };
+ return DeformTimeline;
+ }(CurveTimeline));
+ spine.DeformTimeline = DeformTimeline;
+ var EventTimeline = (function () {
+ function EventTimeline(frameCount) {
+ this.frames = spine.Utils.newFloatArray(frameCount);
+ this.events = new Array(frameCount);
+ }
+ EventTimeline.prototype.getPropertyId = function () {
+ return TimelineType.event << 24;
+ };
+ EventTimeline.prototype.getFrameCount = function () {
+ return this.frames.length;
+ };
+ EventTimeline.prototype.setFrame = function (frameIndex, event) {
+ this.frames[frameIndex] = event.time;
+ this.events[frameIndex] = event;
+ };
+ EventTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ if (firedEvents == null)
+ return;
+ var frames = this.frames;
+ var frameCount = this.frames.length;
+ if (lastTime > time) {
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha, pose, direction);
+ lastTime = -1;
+ }
+ else if (lastTime >= frames[frameCount - 1])
+ return;
+ if (time < frames[0])
+ return;
+ var frame = 0;
+ if (lastTime < frames[0])
+ frame = 0;
+ else {
+ frame = Animation.binarySearch(frames, lastTime);
+ var frameTime = frames[frame];
+ while (frame > 0) {
+ if (frames[frame - 1] != frameTime)
+ break;
+ frame--;
+ }
+ }
+ for (; frame < frameCount && time >= frames[frame]; frame++)
+ firedEvents.push(this.events[frame]);
+ };
+ return EventTimeline;
+ }());
+ spine.EventTimeline = EventTimeline;
+ var DrawOrderTimeline = (function () {
+ function DrawOrderTimeline(frameCount) {
+ this.frames = spine.Utils.newFloatArray(frameCount);
+ this.drawOrders = new Array(frameCount);
+ }
+ DrawOrderTimeline.prototype.getPropertyId = function () {
+ return TimelineType.drawOrder << 24;
+ };
+ DrawOrderTimeline.prototype.getFrameCount = function () {
+ return this.frames.length;
+ };
+ DrawOrderTimeline.prototype.setFrame = function (frameIndex, time, drawOrder) {
+ this.frames[frameIndex] = time;
+ this.drawOrders[frameIndex] = drawOrder;
+ };
+ DrawOrderTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var drawOrder = skeleton.drawOrder;
+ var slots = skeleton.slots;
+ if (direction == MixDirection.out && pose == MixPose.setup) {
+ spine.Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
+ return;
+ }
+ var frames = this.frames;
+ if (time < frames[0]) {
+ if (pose == MixPose.setup)
+ spine.Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
+ return;
+ }
+ var frame = 0;
+ if (time >= frames[frames.length - 1])
+ frame = frames.length - 1;
+ else
+ frame = Animation.binarySearch(frames, time) - 1;
+ var drawOrderToSetupIndex = this.drawOrders[frame];
+ if (drawOrderToSetupIndex == null)
+ spine.Utils.arrayCopy(slots, 0, drawOrder, 0, slots.length);
+ else {
+ for (var i = 0, n = drawOrderToSetupIndex.length; i < n; i++)
+ drawOrder[i] = slots[drawOrderToSetupIndex[i]];
+ }
+ };
+ return DrawOrderTimeline;
+ }());
+ spine.DrawOrderTimeline = DrawOrderTimeline;
+ var IkConstraintTimeline = (function (_super) {
+ __extends(IkConstraintTimeline, _super);
+ function IkConstraintTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * IkConstraintTimeline.ENTRIES);
+ return _this;
+ }
+ IkConstraintTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.ikConstraint << 24) + this.ikConstraintIndex;
+ };
+ IkConstraintTimeline.prototype.setFrame = function (frameIndex, time, mix, bendDirection) {
+ frameIndex *= IkConstraintTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + IkConstraintTimeline.MIX] = mix;
+ this.frames[frameIndex + IkConstraintTimeline.BEND_DIRECTION] = bendDirection;
+ };
+ IkConstraintTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var frames = this.frames;
+ var constraint = skeleton.ikConstraints[this.ikConstraintIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ constraint.mix = constraint.data.mix;
+ constraint.bendDirection = constraint.data.bendDirection;
+ return;
+ case MixPose.current:
+ constraint.mix += (constraint.data.mix - constraint.mix) * alpha;
+ constraint.bendDirection = constraint.data.bendDirection;
+ }
+ return;
+ }
+ if (time >= frames[frames.length - IkConstraintTimeline.ENTRIES]) {
+ if (pose == MixPose.setup) {
+ constraint.mix = constraint.data.mix + (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.data.mix) * alpha;
+ constraint.bendDirection = direction == MixDirection.out ? constraint.data.bendDirection
+ : frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION];
+ }
+ else {
+ constraint.mix += (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.mix) * alpha;
+ if (direction == MixDirection["in"])
+ constraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION];
+ }
+ return;
+ }
+ var frame = Animation.binarySearch(frames, time, IkConstraintTimeline.ENTRIES);
+ var mix = frames[frame + IkConstraintTimeline.PREV_MIX];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / IkConstraintTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + IkConstraintTimeline.PREV_TIME] - frameTime));
+ if (pose == MixPose.setup) {
+ constraint.mix = constraint.data.mix + (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.data.mix) * alpha;
+ constraint.bendDirection = direction == MixDirection.out ? constraint.data.bendDirection : frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION];
+ }
+ else {
+ constraint.mix += (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.mix) * alpha;
+ if (direction == MixDirection["in"])
+ constraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION];
+ }
+ };
+ IkConstraintTimeline.ENTRIES = 3;
+ IkConstraintTimeline.PREV_TIME = -3;
+ IkConstraintTimeline.PREV_MIX = -2;
+ IkConstraintTimeline.PREV_BEND_DIRECTION = -1;
+ IkConstraintTimeline.MIX = 1;
+ IkConstraintTimeline.BEND_DIRECTION = 2;
+ return IkConstraintTimeline;
+ }(CurveTimeline));
+ spine.IkConstraintTimeline = IkConstraintTimeline;
+ var TransformConstraintTimeline = (function (_super) {
+ __extends(TransformConstraintTimeline, _super);
+ function TransformConstraintTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * TransformConstraintTimeline.ENTRIES);
+ return _this;
+ }
+ TransformConstraintTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.transformConstraint << 24) + this.transformConstraintIndex;
+ };
+ TransformConstraintTimeline.prototype.setFrame = function (frameIndex, time, rotateMix, translateMix, scaleMix, shearMix) {
+ frameIndex *= TransformConstraintTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + TransformConstraintTimeline.ROTATE] = rotateMix;
+ this.frames[frameIndex + TransformConstraintTimeline.TRANSLATE] = translateMix;
+ this.frames[frameIndex + TransformConstraintTimeline.SCALE] = scaleMix;
+ this.frames[frameIndex + TransformConstraintTimeline.SHEAR] = shearMix;
+ };
+ TransformConstraintTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var frames = this.frames;
+ var constraint = skeleton.transformConstraints[this.transformConstraintIndex];
+ if (time < frames[0]) {
+ var data = constraint.data;
+ switch (pose) {
+ case MixPose.setup:
+ constraint.rotateMix = data.rotateMix;
+ constraint.translateMix = data.translateMix;
+ constraint.scaleMix = data.scaleMix;
+ constraint.shearMix = data.shearMix;
+ return;
+ case MixPose.current:
+ constraint.rotateMix += (data.rotateMix - constraint.rotateMix) * alpha;
+ constraint.translateMix += (data.translateMix - constraint.translateMix) * alpha;
+ constraint.scaleMix += (data.scaleMix - constraint.scaleMix) * alpha;
+ constraint.shearMix += (data.shearMix - constraint.shearMix) * alpha;
+ }
+ return;
+ }
+ var rotate = 0, translate = 0, scale = 0, shear = 0;
+ if (time >= frames[frames.length - TransformConstraintTimeline.ENTRIES]) {
+ var i = frames.length;
+ rotate = frames[i + TransformConstraintTimeline.PREV_ROTATE];
+ translate = frames[i + TransformConstraintTimeline.PREV_TRANSLATE];
+ scale = frames[i + TransformConstraintTimeline.PREV_SCALE];
+ shear = frames[i + TransformConstraintTimeline.PREV_SHEAR];
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, TransformConstraintTimeline.ENTRIES);
+ rotate = frames[frame + TransformConstraintTimeline.PREV_ROTATE];
+ translate = frames[frame + TransformConstraintTimeline.PREV_TRANSLATE];
+ scale = frames[frame + TransformConstraintTimeline.PREV_SCALE];
+ shear = frames[frame + TransformConstraintTimeline.PREV_SHEAR];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / TransformConstraintTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + TransformConstraintTimeline.PREV_TIME] - frameTime));
+ rotate += (frames[frame + TransformConstraintTimeline.ROTATE] - rotate) * percent;
+ translate += (frames[frame + TransformConstraintTimeline.TRANSLATE] - translate) * percent;
+ scale += (frames[frame + TransformConstraintTimeline.SCALE] - scale) * percent;
+ shear += (frames[frame + TransformConstraintTimeline.SHEAR] - shear) * percent;
+ }
+ if (pose == MixPose.setup) {
+ var data = constraint.data;
+ constraint.rotateMix = data.rotateMix + (rotate - data.rotateMix) * alpha;
+ constraint.translateMix = data.translateMix + (translate - data.translateMix) * alpha;
+ constraint.scaleMix = data.scaleMix + (scale - data.scaleMix) * alpha;
+ constraint.shearMix = data.shearMix + (shear - data.shearMix) * alpha;
+ }
+ else {
+ constraint.rotateMix += (rotate - constraint.rotateMix) * alpha;
+ constraint.translateMix += (translate - constraint.translateMix) * alpha;
+ constraint.scaleMix += (scale - constraint.scaleMix) * alpha;
+ constraint.shearMix += (shear - constraint.shearMix) * alpha;
+ }
+ };
+ TransformConstraintTimeline.ENTRIES = 5;
+ TransformConstraintTimeline.PREV_TIME = -5;
+ TransformConstraintTimeline.PREV_ROTATE = -4;
+ TransformConstraintTimeline.PREV_TRANSLATE = -3;
+ TransformConstraintTimeline.PREV_SCALE = -2;
+ TransformConstraintTimeline.PREV_SHEAR = -1;
+ TransformConstraintTimeline.ROTATE = 1;
+ TransformConstraintTimeline.TRANSLATE = 2;
+ TransformConstraintTimeline.SCALE = 3;
+ TransformConstraintTimeline.SHEAR = 4;
+ return TransformConstraintTimeline;
+ }(CurveTimeline));
+ spine.TransformConstraintTimeline = TransformConstraintTimeline;
+ var PathConstraintPositionTimeline = (function (_super) {
+ __extends(PathConstraintPositionTimeline, _super);
+ function PathConstraintPositionTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * PathConstraintPositionTimeline.ENTRIES);
+ return _this;
+ }
+ PathConstraintPositionTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.pathConstraintPosition << 24) + this.pathConstraintIndex;
+ };
+ PathConstraintPositionTimeline.prototype.setFrame = function (frameIndex, time, value) {
+ frameIndex *= PathConstraintPositionTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + PathConstraintPositionTimeline.VALUE] = value;
+ };
+ PathConstraintPositionTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var frames = this.frames;
+ var constraint = skeleton.pathConstraints[this.pathConstraintIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ constraint.position = constraint.data.position;
+ return;
+ case MixPose.current:
+ constraint.position += (constraint.data.position - constraint.position) * alpha;
+ }
+ return;
+ }
+ var position = 0;
+ if (time >= frames[frames.length - PathConstraintPositionTimeline.ENTRIES])
+ position = frames[frames.length + PathConstraintPositionTimeline.PREV_VALUE];
+ else {
+ var frame = Animation.binarySearch(frames, time, PathConstraintPositionTimeline.ENTRIES);
+ position = frames[frame + PathConstraintPositionTimeline.PREV_VALUE];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / PathConstraintPositionTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PathConstraintPositionTimeline.PREV_TIME] - frameTime));
+ position += (frames[frame + PathConstraintPositionTimeline.VALUE] - position) * percent;
+ }
+ if (pose == MixPose.setup)
+ constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
+ else
+ constraint.position += (position - constraint.position) * alpha;
+ };
+ PathConstraintPositionTimeline.ENTRIES = 2;
+ PathConstraintPositionTimeline.PREV_TIME = -2;
+ PathConstraintPositionTimeline.PREV_VALUE = -1;
+ PathConstraintPositionTimeline.VALUE = 1;
+ return PathConstraintPositionTimeline;
+ }(CurveTimeline));
+ spine.PathConstraintPositionTimeline = PathConstraintPositionTimeline;
+ var PathConstraintSpacingTimeline = (function (_super) {
+ __extends(PathConstraintSpacingTimeline, _super);
+ function PathConstraintSpacingTimeline(frameCount) {
+ return _super.call(this, frameCount) || this;
+ }
+ PathConstraintSpacingTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.pathConstraintSpacing << 24) + this.pathConstraintIndex;
+ };
+ PathConstraintSpacingTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var frames = this.frames;
+ var constraint = skeleton.pathConstraints[this.pathConstraintIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ constraint.spacing = constraint.data.spacing;
+ return;
+ case MixPose.current:
+ constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
+ }
+ return;
+ }
+ var spacing = 0;
+ if (time >= frames[frames.length - PathConstraintSpacingTimeline.ENTRIES])
+ spacing = frames[frames.length + PathConstraintSpacingTimeline.PREV_VALUE];
+ else {
+ var frame = Animation.binarySearch(frames, time, PathConstraintSpacingTimeline.ENTRIES);
+ spacing = frames[frame + PathConstraintSpacingTimeline.PREV_VALUE];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / PathConstraintSpacingTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PathConstraintSpacingTimeline.PREV_TIME] - frameTime));
+ spacing += (frames[frame + PathConstraintSpacingTimeline.VALUE] - spacing) * percent;
+ }
+ if (pose == MixPose.setup)
+ constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
+ else
+ constraint.spacing += (spacing - constraint.spacing) * alpha;
+ };
+ return PathConstraintSpacingTimeline;
+ }(PathConstraintPositionTimeline));
+ spine.PathConstraintSpacingTimeline = PathConstraintSpacingTimeline;
+ var PathConstraintMixTimeline = (function (_super) {
+ __extends(PathConstraintMixTimeline, _super);
+ function PathConstraintMixTimeline(frameCount) {
+ var _this = _super.call(this, frameCount) || this;
+ _this.frames = spine.Utils.newFloatArray(frameCount * PathConstraintMixTimeline.ENTRIES);
+ return _this;
+ }
+ PathConstraintMixTimeline.prototype.getPropertyId = function () {
+ return (TimelineType.pathConstraintMix << 24) + this.pathConstraintIndex;
+ };
+ PathConstraintMixTimeline.prototype.setFrame = function (frameIndex, time, rotateMix, translateMix) {
+ frameIndex *= PathConstraintMixTimeline.ENTRIES;
+ this.frames[frameIndex] = time;
+ this.frames[frameIndex + PathConstraintMixTimeline.ROTATE] = rotateMix;
+ this.frames[frameIndex + PathConstraintMixTimeline.TRANSLATE] = translateMix;
+ };
+ PathConstraintMixTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, pose, direction) {
+ var frames = this.frames;
+ var constraint = skeleton.pathConstraints[this.pathConstraintIndex];
+ if (time < frames[0]) {
+ switch (pose) {
+ case MixPose.setup:
+ constraint.rotateMix = constraint.data.rotateMix;
+ constraint.translateMix = constraint.data.translateMix;
+ return;
+ case MixPose.current:
+ constraint.rotateMix += (constraint.data.rotateMix - constraint.rotateMix) * alpha;
+ constraint.translateMix += (constraint.data.translateMix - constraint.translateMix) * alpha;
+ }
+ return;
+ }
+ var rotate = 0, translate = 0;
+ if (time >= frames[frames.length - PathConstraintMixTimeline.ENTRIES]) {
+ rotate = frames[frames.length + PathConstraintMixTimeline.PREV_ROTATE];
+ translate = frames[frames.length + PathConstraintMixTimeline.PREV_TRANSLATE];
+ }
+ else {
+ var frame = Animation.binarySearch(frames, time, PathConstraintMixTimeline.ENTRIES);
+ rotate = frames[frame + PathConstraintMixTimeline.PREV_ROTATE];
+ translate = frames[frame + PathConstraintMixTimeline.PREV_TRANSLATE];
+ var frameTime = frames[frame];
+ var percent = this.getCurvePercent(frame / PathConstraintMixTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PathConstraintMixTimeline.PREV_TIME] - frameTime));
+ rotate += (frames[frame + PathConstraintMixTimeline.ROTATE] - rotate) * percent;
+ translate += (frames[frame + PathConstraintMixTimeline.TRANSLATE] - translate) * percent;
+ }
+ if (pose == MixPose.setup) {
+ constraint.rotateMix = constraint.data.rotateMix + (rotate - constraint.data.rotateMix) * alpha;
+ constraint.translateMix = constraint.data.translateMix + (translate - constraint.data.translateMix) * alpha;
+ }
+ else {
+ constraint.rotateMix += (rotate - constraint.rotateMix) * alpha;
+ constraint.translateMix += (translate - constraint.translateMix) * alpha;
+ }
+ };
+ PathConstraintMixTimeline.ENTRIES = 3;
+ PathConstraintMixTimeline.PREV_TIME = -3;
+ PathConstraintMixTimeline.PREV_ROTATE = -2;
+ PathConstraintMixTimeline.PREV_TRANSLATE = -1;
+ PathConstraintMixTimeline.ROTATE = 1;
+ PathConstraintMixTimeline.TRANSLATE = 2;
+ return PathConstraintMixTimeline;
+ }(CurveTimeline));
+ spine.PathConstraintMixTimeline = PathConstraintMixTimeline;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var AnimationState = (function () {
+ function AnimationState(data) {
+ this.tracks = new Array();
+ this.events = new Array();
+ this.listeners = new Array();
+ this.queue = new EventQueue(this);
+ this.propertyIDs = new spine.IntSet();
+ this.mixingTo = new Array();
+ this.animationsChanged = false;
+ this.timeScale = 1;
+ this.trackEntryPool = new spine.Pool(function () { return new TrackEntry(); });
+ this.data = data;
+ }
+ AnimationState.prototype.update = function (delta) {
+ delta *= this.timeScale;
+ var tracks = this.tracks;
+ for (var i = 0, n = tracks.length; i < n; i++) {
+ var current = tracks[i];
+ if (current == null)
+ continue;
+ current.animationLast = current.nextAnimationLast;
+ current.trackLast = current.nextTrackLast;
+ var currentDelta = delta * current.timeScale;
+ if (current.delay > 0) {
+ current.delay -= currentDelta;
+ if (current.delay > 0)
+ continue;
+ currentDelta = -current.delay;
+ current.delay = 0;
+ }
+ var next = current.next;
+ if (next != null) {
+ var nextTime = current.trackLast - next.delay;
+ if (nextTime >= 0) {
+ next.delay = 0;
+ next.trackTime = nextTime + delta * next.timeScale;
+ current.trackTime += currentDelta;
+ this.setCurrent(i, next, true);
+ while (next.mixingFrom != null) {
+ next.mixTime += currentDelta;
+ next = next.mixingFrom;
+ }
+ continue;
+ }
+ }
+ else if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
+ tracks[i] = null;
+ this.queue.end(current);
+ this.disposeNext(current);
+ continue;
+ }
+ if (current.mixingFrom != null && this.updateMixingFrom(current, delta)) {
+ var from = current.mixingFrom;
+ current.mixingFrom = null;
+ while (from != null) {
+ this.queue.end(from);
+ from = from.mixingFrom;
+ }
+ }
+ current.trackTime += currentDelta;
+ }
+ this.queue.drain();
+ };
+ AnimationState.prototype.updateMixingFrom = function (to, delta) {
+ var from = to.mixingFrom;
+ if (from == null)
+ return true;
+ var finished = this.updateMixingFrom(from, delta);
+ from.animationLast = from.nextAnimationLast;
+ from.trackLast = from.nextTrackLast;
+ if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) {
+ if (from.totalAlpha == 0 || to.mixDuration == 0) {
+ to.mixingFrom = from.mixingFrom;
+ to.interruptAlpha = from.interruptAlpha;
+ this.queue.end(from);
+ }
+ return finished;
+ }
+ from.trackTime += delta * from.timeScale;
+ to.mixTime += delta * to.timeScale;
+ return false;
+ };
+ AnimationState.prototype.apply = function (skeleton) {
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ if (this.animationsChanged)
+ this._animationsChanged();
+ var events = this.events;
+ var tracks = this.tracks;
+ var applied = false;
+ for (var i = 0, n = tracks.length; i < n; i++) {
+ var current = tracks[i];
+ if (current == null || current.delay > 0)
+ continue;
+ applied = true;
+ var currentPose = i == 0 ? spine.MixPose.current : spine.MixPose.currentLayered;
+ var mix = current.alpha;
+ if (current.mixingFrom != null)
+ mix *= this.applyMixingFrom(current, skeleton, currentPose);
+ else if (current.trackTime >= current.trackEnd && current.next == null)
+ mix = 0;
+ var animationLast = current.animationLast, animationTime = current.getAnimationTime();
+ var timelineCount = current.animation.timelines.length;
+ var timelines = current.animation.timelines;
+ if (mix == 1) {
+ for (var ii = 0; ii < timelineCount; ii++) {
+ var timeline = timelines[ii];
+ timeline.apply(skeleton, animationLast, animationTime, events, 1, spine.MixPose.setup, spine.MixDirection["in"]);
+ }
+ }
+ else {
+ var timelineData = current.timelineData;
+ var firstFrame = current.timelinesRotation.length == 0;
+ if (firstFrame)
+ spine.Utils.setArraySize(current.timelinesRotation, timelineCount << 1, null);
+ var timelinesRotation = current.timelinesRotation;
+ for (var ii = 0; ii < timelineCount; ii++) {
+ var timeline = timelines[ii];
+ var pose = timelineData[ii] >= AnimationState.FIRST ? spine.MixPose.setup : currentPose;
+ if (timeline instanceof spine.RotateTimeline) {
+ this.applyRotateTimeline(timeline, skeleton, animationTime, mix, pose, timelinesRotation, ii << 1, firstFrame);
+ }
+ else {
+ spine.Utils.webkit602BugfixHelper(mix, pose);
+ timeline.apply(skeleton, animationLast, animationTime, events, mix, pose, spine.MixDirection["in"]);
+ }
+ }
+ }
+ this.queueEvents(current, animationTime);
+ events.length = 0;
+ current.nextAnimationLast = animationTime;
+ current.nextTrackLast = current.trackTime;
+ }
+ this.queue.drain();
+ return applied;
+ };
+ AnimationState.prototype.applyMixingFrom = function (to, skeleton, currentPose) {
+ var from = to.mixingFrom;
+ if (from.mixingFrom != null)
+ this.applyMixingFrom(from, skeleton, currentPose);
+ var mix = 0;
+ if (to.mixDuration == 0) {
+ mix = 1;
+ currentPose = spine.MixPose.setup;
+ }
+ else {
+ mix = to.mixTime / to.mixDuration;
+ if (mix > 1)
+ mix = 1;
+ }
+ var events = mix < from.eventThreshold ? this.events : null;
+ var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
+ var animationLast = from.animationLast, animationTime = from.getAnimationTime();
+ var timelineCount = from.animation.timelines.length;
+ var timelines = from.animation.timelines;
+ var timelineData = from.timelineData;
+ var timelineDipMix = from.timelineDipMix;
+ var firstFrame = from.timelinesRotation.length == 0;
+ if (firstFrame)
+ spine.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
+ var timelinesRotation = from.timelinesRotation;
+ var pose;
+ var alphaDip = from.alpha * to.interruptAlpha, alphaMix = alphaDip * (1 - mix), alpha = 0;
+ from.totalAlpha = 0;
+ for (var i = 0; i < timelineCount; i++) {
+ var timeline = timelines[i];
+ switch (timelineData[i]) {
+ case AnimationState.SUBSEQUENT:
+ if (!attachments && timeline instanceof spine.AttachmentTimeline)
+ continue;
+ if (!drawOrder && timeline instanceof spine.DrawOrderTimeline)
+ continue;
+ pose = currentPose;
+ alpha = alphaMix;
+ break;
+ case AnimationState.FIRST:
+ pose = spine.MixPose.setup;
+ alpha = alphaMix;
+ break;
+ case AnimationState.DIP:
+ pose = spine.MixPose.setup;
+ alpha = alphaDip;
+ break;
+ default:
+ pose = spine.MixPose.setup;
+ alpha = alphaDip;
+ var dipMix = timelineDipMix[i];
+ alpha *= Math.max(0, 1 - dipMix.mixTime / dipMix.mixDuration);
+ break;
+ }
+ from.totalAlpha += alpha;
+ if (timeline instanceof spine.RotateTimeline)
+ this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, pose, timelinesRotation, i << 1, firstFrame);
+ else {
+ spine.Utils.webkit602BugfixHelper(alpha, pose);
+ timeline.apply(skeleton, animationLast, animationTime, events, alpha, pose, spine.MixDirection.out);
+ }
+ }
+ if (to.mixDuration > 0)
+ this.queueEvents(from, animationTime);
+ this.events.length = 0;
+ from.nextAnimationLast = animationTime;
+ from.nextTrackLast = from.trackTime;
+ return mix;
+ };
+ AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, pose, timelinesRotation, i, firstFrame) {
+ if (firstFrame)
+ timelinesRotation[i] = 0;
+ if (alpha == 1) {
+ timeline.apply(skeleton, 0, time, null, 1, pose, spine.MixDirection["in"]);
+ return;
+ }
+ var rotateTimeline = timeline;
+ var frames = rotateTimeline.frames;
+ var bone = skeleton.bones[rotateTimeline.boneIndex];
+ if (time < frames[0]) {
+ if (pose == spine.MixPose.setup)
+ bone.rotation = bone.data.rotation;
+ return;
+ }
+ var r2 = 0;
+ if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
+ r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
+ else {
+ var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
+ var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
+ var frameTime = frames[frame];
+ var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
+ r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
+ r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
+ r2 = prevRotation + r2 * percent + bone.data.rotation;
+ r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
+ }
+ var r1 = pose == spine.MixPose.setup ? bone.data.rotation : bone.rotation;
+ var total = 0, diff = r2 - r1;
+ if (diff == 0) {
+ total = timelinesRotation[i];
+ }
+ else {
+ diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
+ var lastTotal = 0, lastDiff = 0;
+ if (firstFrame) {
+ lastTotal = 0;
+ lastDiff = diff;
+ }
+ else {
+ lastTotal = timelinesRotation[i];
+ lastDiff = timelinesRotation[i + 1];
+ }
+ var current = diff > 0, dir = lastTotal >= 0;
+ if (spine.MathUtils.signum(lastDiff) != spine.MathUtils.signum(diff) && Math.abs(lastDiff) <= 90) {
+ if (Math.abs(lastTotal) > 180)
+ lastTotal += 360 * spine.MathUtils.signum(lastTotal);
+ dir = current;
+ }
+ total = diff + lastTotal - lastTotal % 360;
+ if (dir != current)
+ total += 360 * spine.MathUtils.signum(lastTotal);
+ timelinesRotation[i] = total;
+ }
+ timelinesRotation[i + 1] = diff;
+ r1 += total * alpha;
+ bone.rotation = r1 - (16384 - ((16384.499999999996 - r1 / 360) | 0)) * 360;
+ };
+ AnimationState.prototype.queueEvents = function (entry, animationTime) {
+ var animationStart = entry.animationStart, animationEnd = entry.animationEnd;
+ var duration = animationEnd - animationStart;
+ var trackLastWrapped = entry.trackLast % duration;
+ var events = this.events;
+ var i = 0, n = events.length;
+ for (; i < n; i++) {
+ var event_1 = events[i];
+ if (event_1.time < trackLastWrapped)
+ break;
+ if (event_1.time > animationEnd)
+ continue;
+ this.queue.event(entry, event_1);
+ }
+ var complete = false;
+ if (entry.loop)
+ complete = duration == 0 || trackLastWrapped > entry.trackTime % duration;
+ else
+ complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
+ if (complete)
+ this.queue.complete(entry);
+ for (; i < n; i++) {
+ var event_2 = events[i];
+ if (event_2.time < animationStart)
+ continue;
+ this.queue.event(entry, events[i]);
+ }
+ };
+ AnimationState.prototype.clearTracks = function () {
+ var oldDrainDisabled = this.queue.drainDisabled;
+ this.queue.drainDisabled = true;
+ for (var i = 0, n = this.tracks.length; i < n; i++)
+ this.clearTrack(i);
+ this.tracks.length = 0;
+ this.queue.drainDisabled = oldDrainDisabled;
+ this.queue.drain();
+ };
+ AnimationState.prototype.clearTrack = function (trackIndex) {
+ if (trackIndex >= this.tracks.length)
+ return;
+ var current = this.tracks[trackIndex];
+ if (current == null)
+ return;
+ this.queue.end(current);
+ this.disposeNext(current);
+ var entry = current;
+ while (true) {
+ var from = entry.mixingFrom;
+ if (from == null)
+ break;
+ this.queue.end(from);
+ entry.mixingFrom = null;
+ entry = from;
+ }
+ this.tracks[current.trackIndex] = null;
+ this.queue.drain();
+ };
+ AnimationState.prototype.setCurrent = function (index, current, interrupt) {
+ var from = this.expandToIndex(index);
+ this.tracks[index] = current;
+ if (from != null) {
+ if (interrupt)
+ this.queue.interrupt(from);
+ current.mixingFrom = from;
+ current.mixTime = 0;
+ if (from.mixingFrom != null && from.mixDuration > 0)
+ current.interruptAlpha *= Math.min(1, from.mixTime / from.mixDuration);
+ from.timelinesRotation.length = 0;
+ }
+ this.queue.start(current);
+ };
+ AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
+ var animation = this.data.skeletonData.findAnimation(animationName);
+ if (animation == null)
+ throw new Error("Animation not found: " + animationName);
+ return this.setAnimationWith(trackIndex, animation, loop);
+ };
+ AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) {
+ if (animation == null)
+ throw new Error("animation cannot be null.");
+ var interrupt = true;
+ var current = this.expandToIndex(trackIndex);
+ if (current != null) {
+ if (current.nextTrackLast == -1) {
+ this.tracks[trackIndex] = current.mixingFrom;
+ this.queue.interrupt(current);
+ this.queue.end(current);
+ this.disposeNext(current);
+ current = current.mixingFrom;
+ interrupt = false;
+ }
+ else
+ this.disposeNext(current);
+ }
+ var entry = this.trackEntry(trackIndex, animation, loop, current);
+ this.setCurrent(trackIndex, entry, interrupt);
+ this.queue.drain();
+ return entry;
+ };
+ AnimationState.prototype.addAnimation = function (trackIndex, animationName, loop, delay) {
+ var animation = this.data.skeletonData.findAnimation(animationName);
+ if (animation == null)
+ throw new Error("Animation not found: " + animationName);
+ return this.addAnimationWith(trackIndex, animation, loop, delay);
+ };
+ AnimationState.prototype.addAnimationWith = function (trackIndex, animation, loop, delay) {
+ if (animation == null)
+ throw new Error("animation cannot be null.");
+ var last = this.expandToIndex(trackIndex);
+ if (last != null) {
+ while (last.next != null)
+ last = last.next;
+ }
+ var entry = this.trackEntry(trackIndex, animation, loop, last);
+ if (last == null) {
+ this.setCurrent(trackIndex, entry, true);
+ this.queue.drain();
+ }
+ else {
+ last.next = entry;
+ if (delay <= 0) {
+ var duration = last.animationEnd - last.animationStart;
+ if (duration != 0) {
+ if (last.loop)
+ delay += duration * (1 + ((last.trackTime / duration) | 0));
+ else
+ delay += duration;
+ delay -= this.data.getMix(last.animation, animation);
+ }
+ else
+ delay = 0;
+ }
+ }
+ entry.delay = delay;
+ return entry;
+ };
+ AnimationState.prototype.setEmptyAnimation = function (trackIndex, mixDuration) {
+ var entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation, false);
+ entry.mixDuration = mixDuration;
+ entry.trackEnd = mixDuration;
+ return entry;
+ };
+ AnimationState.prototype.addEmptyAnimation = function (trackIndex, mixDuration, delay) {
+ if (delay <= 0)
+ delay -= mixDuration;
+ var entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation, false, delay);
+ entry.mixDuration = mixDuration;
+ entry.trackEnd = mixDuration;
+ return entry;
+ };
+ AnimationState.prototype.setEmptyAnimations = function (mixDuration) {
+ var oldDrainDisabled = this.queue.drainDisabled;
+ this.queue.drainDisabled = true;
+ for (var i = 0, n = this.tracks.length; i < n; i++) {
+ var current = this.tracks[i];
+ if (current != null)
+ this.setEmptyAnimation(current.trackIndex, mixDuration);
+ }
+ this.queue.drainDisabled = oldDrainDisabled;
+ this.queue.drain();
+ };
+ AnimationState.prototype.expandToIndex = function (index) {
+ if (index < this.tracks.length)
+ return this.tracks[index];
+ spine.Utils.ensureArrayCapacity(this.tracks, index - this.tracks.length + 1, null);
+ this.tracks.length = index + 1;
+ return null;
+ };
+ AnimationState.prototype.trackEntry = function (trackIndex, animation, loop, last) {
+ var entry = this.trackEntryPool.obtain();
+ entry.trackIndex = trackIndex;
+ entry.animation = animation;
+ entry.loop = loop;
+ entry.eventThreshold = 0;
+ entry.attachmentThreshold = 0;
+ entry.drawOrderThreshold = 0;
+ entry.animationStart = 0;
+ entry.animationEnd = animation.duration;
+ entry.animationLast = -1;
+ entry.nextAnimationLast = -1;
+ entry.delay = 0;
+ entry.trackTime = 0;
+ entry.trackLast = -1;
+ entry.nextTrackLast = -1;
+ entry.trackEnd = Number.MAX_VALUE;
+ entry.timeScale = 1;
+ entry.alpha = 1;
+ entry.interruptAlpha = 1;
+ entry.mixTime = 0;
+ entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation);
+ return entry;
+ };
+ AnimationState.prototype.disposeNext = function (entry) {
+ var next = entry.next;
+ while (next != null) {
+ this.queue.dispose(next);
+ next = next.next;
+ }
+ entry.next = null;
+ };
+ AnimationState.prototype._animationsChanged = function () {
+ this.animationsChanged = false;
+ var propertyIDs = this.propertyIDs;
+ propertyIDs.clear();
+ var mixingTo = this.mixingTo;
+ for (var i = 0, n = this.tracks.length; i < n; i++) {
+ var entry = this.tracks[i];
+ if (entry != null)
+ entry.setTimelineData(null, mixingTo, propertyIDs);
+ }
+ };
+ AnimationState.prototype.getCurrent = function (trackIndex) {
+ if (trackIndex >= this.tracks.length)
+ return null;
+ return this.tracks[trackIndex];
+ };
+ AnimationState.prototype.addListener = function (listener) {
+ if (listener == null)
+ throw new Error("listener cannot be null.");
+ this.listeners.push(listener);
+ };
+ AnimationState.prototype.removeListener = function (listener) {
+ var index = this.listeners.indexOf(listener);
+ if (index >= 0)
+ this.listeners.splice(index, 1);
+ };
+ AnimationState.prototype.clearListeners = function () {
+ this.listeners.length = 0;
+ };
+ AnimationState.prototype.clearListenerNotifications = function () {
+ this.queue.clear();
+ };
+ AnimationState.emptyAnimation = new spine.Animation("", [], 0);
+ AnimationState.SUBSEQUENT = 0;
+ AnimationState.FIRST = 1;
+ AnimationState.DIP = 2;
+ AnimationState.DIP_MIX = 3;
+ return AnimationState;
+ }());
+ spine.AnimationState = AnimationState;
+ var TrackEntry = (function () {
+ function TrackEntry() {
+ this.timelineData = new Array();
+ this.timelineDipMix = new Array();
+ this.timelinesRotation = new Array();
+ }
+ TrackEntry.prototype.reset = function () {
+ this.next = null;
+ this.mixingFrom = null;
+ this.animation = null;
+ this.listener = null;
+ this.timelineData.length = 0;
+ this.timelineDipMix.length = 0;
+ this.timelinesRotation.length = 0;
+ };
+ TrackEntry.prototype.setTimelineData = function (to, mixingToArray, propertyIDs) {
+ if (to != null)
+ mixingToArray.push(to);
+ var lastEntry = this.mixingFrom != null ? this.mixingFrom.setTimelineData(this, mixingToArray, propertyIDs) : this;
+ if (to != null)
+ mixingToArray.pop();
+ var mixingTo = mixingToArray;
+ var mixingToLast = mixingToArray.length - 1;
+ var timelines = this.animation.timelines;
+ var timelinesCount = this.animation.timelines.length;
+ var timelineData = spine.Utils.setArraySize(this.timelineData, timelinesCount);
+ this.timelineDipMix.length = 0;
+ var timelineDipMix = spine.Utils.setArraySize(this.timelineDipMix, timelinesCount);
+ outer: for (var i = 0; i < timelinesCount; i++) {
+ var id = timelines[i].getPropertyId();
+ if (!propertyIDs.add(id))
+ timelineData[i] = AnimationState.SUBSEQUENT;
+ else if (to == null || !to.hasTimeline(id))
+ timelineData[i] = AnimationState.FIRST;
+ else {
+ for (var ii = mixingToLast; ii >= 0; ii--) {
+ var entry = mixingTo[ii];
+ if (!entry.hasTimeline(id)) {
+ if (entry.mixDuration > 0) {
+ timelineData[i] = AnimationState.DIP_MIX;
+ timelineDipMix[i] = entry;
+ continue outer;
+ }
+ }
+ }
+ timelineData[i] = AnimationState.DIP;
+ }
+ }
+ return lastEntry;
+ };
+ TrackEntry.prototype.hasTimeline = function (id) {
+ var timelines = this.animation.timelines;
+ for (var i = 0, n = timelines.length; i < n; i++)
+ if (timelines[i].getPropertyId() == id)
+ return true;
+ return false;
+ };
+ TrackEntry.prototype.getAnimationTime = function () {
+ if (this.loop) {
+ var duration = this.animationEnd - this.animationStart;
+ if (duration == 0)
+ return this.animationStart;
+ return (this.trackTime % duration) + this.animationStart;
+ }
+ return Math.min(this.trackTime + this.animationStart, this.animationEnd);
+ };
+ TrackEntry.prototype.setAnimationLast = function (animationLast) {
+ this.animationLast = animationLast;
+ this.nextAnimationLast = animationLast;
+ };
+ TrackEntry.prototype.isComplete = function () {
+ return this.trackTime >= this.animationEnd - this.animationStart;
+ };
+ TrackEntry.prototype.resetRotationDirections = function () {
+ this.timelinesRotation.length = 0;
+ };
+ return TrackEntry;
+ }());
+ spine.TrackEntry = TrackEntry;
+ var EventQueue = (function () {
+ function EventQueue(animState) {
+ this.objects = [];
+ this.drainDisabled = false;
+ this.animState = animState;
+ }
+ EventQueue.prototype.start = function (entry) {
+ this.objects.push(EventType.start);
+ this.objects.push(entry);
+ this.animState.animationsChanged = true;
+ };
+ EventQueue.prototype.interrupt = function (entry) {
+ this.objects.push(EventType.interrupt);
+ this.objects.push(entry);
+ };
+ EventQueue.prototype.end = function (entry) {
+ this.objects.push(EventType.end);
+ this.objects.push(entry);
+ this.animState.animationsChanged = true;
+ };
+ EventQueue.prototype.dispose = function (entry) {
+ this.objects.push(EventType.dispose);
+ this.objects.push(entry);
+ };
+ EventQueue.prototype.complete = function (entry) {
+ this.objects.push(EventType.complete);
+ this.objects.push(entry);
+ };
+ EventQueue.prototype.event = function (entry, event) {
+ this.objects.push(EventType.event);
+ this.objects.push(entry);
+ this.objects.push(event);
+ };
+ EventQueue.prototype.drain = function () {
+ if (this.drainDisabled)
+ return;
+ this.drainDisabled = true;
+ var objects = this.objects;
+ var listeners = this.animState.listeners;
+ for (var i = 0; i < objects.length; i += 2) {
+ var type = objects[i];
+ var entry = objects[i + 1];
+ switch (type) {
+ case EventType.start:
+ if (entry.listener != null && entry.listener.start)
+ entry.listener.start(entry);
+ for (var ii = 0; ii < listeners.length; ii++)
+ if (listeners[ii].start)
+ listeners[ii].start(entry);
+ break;
+ case EventType.interrupt:
+ if (entry.listener != null && entry.listener.interrupt)
+ entry.listener.interrupt(entry);
+ for (var ii = 0; ii < listeners.length; ii++)
+ if (listeners[ii].interrupt)
+ listeners[ii].interrupt(entry);
+ break;
+ case EventType.end:
+ if (entry.listener != null && entry.listener.end)
+ entry.listener.end(entry);
+ for (var ii = 0; ii < listeners.length; ii++)
+ if (listeners[ii].end)
+ listeners[ii].end(entry);
+ case EventType.dispose:
+ if (entry.listener != null && entry.listener.dispose)
+ entry.listener.dispose(entry);
+ for (var ii = 0; ii < listeners.length; ii++)
+ if (listeners[ii].dispose)
+ listeners[ii].dispose(entry);
+ this.animState.trackEntryPool.free(entry);
+ break;
+ case EventType.complete:
+ if (entry.listener != null && entry.listener.complete)
+ entry.listener.complete(entry);
+ for (var ii = 0; ii < listeners.length; ii++)
+ if (listeners[ii].complete)
+ listeners[ii].complete(entry);
+ break;
+ case EventType.event:
+ var event_3 = objects[i++ + 2];
+ if (entry.listener != null && entry.listener.event)
+ entry.listener.event(entry, event_3);
+ for (var ii = 0; ii < listeners.length; ii++)
+ if (listeners[ii].event)
+ listeners[ii].event(entry, event_3);
+ break;
+ }
+ }
+ this.clear();
+ this.drainDisabled = false;
+ };
+ EventQueue.prototype.clear = function () {
+ this.objects.length = 0;
+ };
+ return EventQueue;
+ }());
+ spine.EventQueue = EventQueue;
+ var EventType;
+ (function (EventType) {
+ EventType[EventType["start"] = 0] = "start";
+ EventType[EventType["interrupt"] = 1] = "interrupt";
+ EventType[EventType["end"] = 2] = "end";
+ EventType[EventType["dispose"] = 3] = "dispose";
+ EventType[EventType["complete"] = 4] = "complete";
+ EventType[EventType["event"] = 5] = "event";
+ })(EventType = spine.EventType || (spine.EventType = {}));
+ var AnimationStateAdapter2 = (function () {
+ function AnimationStateAdapter2() {
+ }
+ AnimationStateAdapter2.prototype.start = function (entry) {
+ };
+ AnimationStateAdapter2.prototype.interrupt = function (entry) {
+ };
+ AnimationStateAdapter2.prototype.end = function (entry) {
+ };
+ AnimationStateAdapter2.prototype.dispose = function (entry) {
+ };
+ AnimationStateAdapter2.prototype.complete = function (entry) {
+ };
+ AnimationStateAdapter2.prototype.event = function (entry, event) {
+ };
+ return AnimationStateAdapter2;
+ }());
+ spine.AnimationStateAdapter2 = AnimationStateAdapter2;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var AnimationStateData = (function () {
+ function AnimationStateData(skeletonData) {
+ this.animationToMixTime = {};
+ this.defaultMix = 0;
+ if (skeletonData == null)
+ throw new Error("skeletonData cannot be null.");
+ this.skeletonData = skeletonData;
+ }
+ AnimationStateData.prototype.setMix = function (fromName, toName, duration) {
+ var from = this.skeletonData.findAnimation(fromName);
+ if (from == null)
+ throw new Error("Animation not found: " + fromName);
+ var to = this.skeletonData.findAnimation(toName);
+ if (to == null)
+ throw new Error("Animation not found: " + toName);
+ this.setMixWith(from, to, duration);
+ };
+ AnimationStateData.prototype.setMixWith = function (from, to, duration) {
+ if (from == null)
+ throw new Error("from cannot be null.");
+ if (to == null)
+ throw new Error("to cannot be null.");
+ var key = from.name + "." + to.name;
+ this.animationToMixTime[key] = duration;
+ };
+ AnimationStateData.prototype.getMix = function (from, to) {
+ var key = from.name + "." + to.name;
+ var value = this.animationToMixTime[key];
+ return value === undefined ? this.defaultMix : value;
+ };
+ return AnimationStateData;
+ }());
+ spine.AnimationStateData = AnimationStateData;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var AssetManager = (function () {
+ function AssetManager(textureLoader, pathPrefix, worker) {
+ if (pathPrefix === void 0) { pathPrefix = ""; }
+ this.assets = {};
+ this.errors = {};
+ this.toLoad = 0;
+ this.loaded = 0;
+ this.textureLoader = textureLoader;
+ this.pathPrefix = pathPrefix;
+ }
+ AssetManager.prototype.downloadText = function (url, success, error) {
+ var request = new XMLHttpRequest();
+ request.open("GET", url, true);
+ request.onload = function () {
+ if (request.status == 200 || (request.status == 0 && request.readyState == 4)) {
+ success(request.responseText);
+ }
+ else {
+ error(request.status, request.responseText);
+ }
+ };
+ request.onerror = function () {
+ error(request.status, request.responseText);
+ };
+ request.send();
+ };
+ AssetManager.prototype.downloadBinary = function (url, success, error) {
+ var request = new XMLHttpRequest();
+ request.open("GET", url, true);
+ request.responseType = "arraybuffer";
+ request.onload = function () {
+ if (request.status == 200 || (request.status == 0 && request.readyState == 4)) {
+ success(new Uint8Array(request.response));
+ }
+ else {
+ error(request.status, request.response);
+ }
+ };
+ request.onerror = function () {
+ error(request.status, request.response);
+ };
+ request.send();
+ };
+ AssetManager.prototype.downloadImageBitmap = function (url, success, error) {
+ var request = new XMLHttpRequest();
+ request.open("GET", url, true);
+ request.responseType = "blob";
+ request.onload = function () {
+ if (request.status == 200 || (request.status == 0 && request.readyState == 4)) {
+ createImageBitmap(request.response, {
+ premultiplyAlpha: 'none',
+ colorSpaceConversion: 'none'
+ }).then((imageBitmap) => {
+ success(imageBitmap);
+ });
+ }
+ else {
+ error(request.status, request.response);
+ }
+ };
+ request.onerror = function () {
+ error(request.status, request.response);
+ };
+ request.send();
+ };
+ AssetManager.prototype.loadBinary = function (path, success, error) {
+ var _this = this;
+ if (success === void 0) { success = null; }
+ if (error === void 0) { error = null; }
+ path = this.pathPrefix + path;
+ if (spine.lodedAssets[path]) {
+ _this.assets[path] = spine.lodedAssets[path];
+ if (success)
+ setTimeout(success, 0, path, _this.assets[path]);
+ return;
+ }
+
+ this.toLoad++;
+ this.downloadBinary(path, function (data) {
+ _this.assets[path] = data;
+ spine.lodedAssets[path] = data;
+ if (success)
+ success(path, data);
+ _this.toLoad--;
+ _this.loaded++;
+ }, function (status, response) {
+ _this.errors[path] = "Couldn't load binary " + path + ": status " + status + ", " + response;
+ if (error)
+ error(path, "Couldn't load binary " + path + ": status " + status + ", " + response);
+ _this.toLoad--;
+ _this.loaded++;
+ });
+ };
+ AssetManager.prototype.loadText = function (path, success, error) {
+ var _this = this;
+ if (success === void 0) { success = null; }
+ if (error === void 0) { error = null; }
+ path = this.pathPrefix + path;
+ if (spine.lodedAssets[path]) {
+ _this.assets[path] = spine.lodedAssets[path];
+ setTimeout(success, 0, path, _this.assets[path]);
+ return;
+ }
+
+ this.toLoad++;
+ this.downloadText(path, function (data) {
+ _this.assets[path] = data;
+ spine.lodedAssets[path] = data;
+ if (success)
+ success(path, data);
+ _this.toLoad--;
+ _this.loaded++;
+ }, function (status, responseText) {
+ _this.errors[path] = "Couldn't load text " + path + ": status " + status + ", " + responseText;
+ if (error)
+ error(path, "Couldn't load text " + path + ": status " + status + ", " + responseText);
+ _this.toLoad--;
+ _this.loaded++;
+ });
+ };
+ AssetManager.prototype.loadTexture = function (path, success, error) {
+ var _this = this;
+ if (success === void 0)
+ success = null;
+ if (error === void 0)
+ error = null;
+ path = this.pathPrefix + path;
+ if (spine.lodedAssets[path]) {
+ var texture = _this.textureLoader(spine.lodedAssets[path]);
+ _this.assets[path] = texture;
+ if (success) setTimeout(success, 0, path, _this.assets[path]);
+ return;
+ }
+
+ this.toLoad++;
+ if (self.Image == undefined || _this.useImageBitmap) {
+ this.downloadImageBitmap(path, function (imageBitmap) {
+ spine.lodedAssets[path] = imageBitmap;
+
+ var texture = _this.textureLoader(imageBitmap);
+ _this.assets[path] = texture;
+ _this.toLoad--;
+ _this.loaded++;
+ if (success)
+ success(path, imageBitmap);
+
+ }, function (status, response) {
+ _this.errors[path] = "Couldn't load texture " + path + ": status " + status + ".";
+ if (error)
+ error(path, "Couldn't load texture " + path + ": status " + status + ".");
+ _this.toLoad--;
+ _this.loaded++;
+ });
+ return;
+ }
+
+ var img = new Image();
+ img.onload = function (ev) {
+ spine.lodedAssets[path] = img;
+
+ var texture = _this.textureLoader(img);
+ _this.assets[path] = texture;
+ _this.toLoad--;
+ _this.loaded++;
+ if (success)
+ success(path, img);
+ };
+ img.onerror = function (ev) {
+ _this.errors[path] = "Couldn't load image " + path;
+ _this.toLoad--;
+ _this.loaded++;
+ if (error)
+ error(path, "Couldn't load image " + path);
+ };
+ img.src = path;
+ };
+ AssetManager.prototype.loadTextureData = function (path, data, success, error) {
+ var _this = this;
+ if (success === void 0) { success = null; }
+ if (error === void 0) { error = null; }
+ path = this.pathPrefix + path;
+ this.toLoad++;
+ var img = new Image();
+ img.onload = function (ev) {
+ var texture = _this.textureLoader(img);
+ _this.assets[path] = texture;
+ _this.toLoad--;
+ _this.loaded++;
+ if (success)
+ success(path, img);
+ };
+ img.onerror = function (ev) {
+ _this.errors[path] = "Couldn't load image " + path;
+ _this.toLoad--;
+ _this.loaded++;
+ if (error)
+ error(path, "Couldn't load image " + path);
+ };
+ img.src = data;
+ };
+ AssetManager.prototype.loadTextureAtlas = function (path, success, error) {
+ var _this = this;
+ if (success === void 0) { success = null; }
+ if (error === void 0) { error = null; }
+ var parent = path.lastIndexOf("/") >= 0 ? path.substring(0, path.lastIndexOf("/")) : "";
+ path = this.pathPrefix + path;
+ this.toLoad++;
+ this.downloadText(path, function (atlasData) {
+ var pagesLoaded = { count: 0 };
+ var atlasPages = new Array();
+ try {
+ var atlas = new spine.TextureAtlas(atlasData, function (path) {
+ atlasPages.push(parent == "" ? path : parent + "/" + path);
+ var image = document.createElement("img");
+ image.width = 16;
+ image.height = 16;
+ return new spine.FakeTexture(image);
+ });
+ }
+ catch (e) {
+ var ex = e;
+ _this.errors[path] = "Couldn't load texture atlas " + path + ": " + ex.message;
+ if (error)
+ error(path, "Couldn't load texture atlas " + path + ": " + ex.message);
+ _this.toLoad--;
+ _this.loaded++;
+ return;
+ }
+ var _loop_1 = function (atlasPage) {
+ var pageLoadError = false;
+ _this.loadTexture(atlasPage, function (imagePath, image) {
+ pagesLoaded.count++;
+ if (pagesLoaded.count == atlasPages.length) {
+ if (!pageLoadError) {
+ try {
+ var atlas = new spine.TextureAtlas(atlasData, function (path) {
+ return _this.get(parent == "" ? path : parent + "/" + path);
+ });
+ _this.assets[path] = atlas;
+ if (success)
+ success(path, atlas);
+ _this.toLoad--;
+ _this.loaded++;
+ }
+ catch (e) {
+ var ex = e;
+ _this.errors[path] = "Couldn't load texture atlas " + path + ": " + ex.message;
+ if (error)
+ error(path, "Couldn't load texture atlas " + path + ": " + ex.message);
+ _this.toLoad--;
+ _this.loaded++;
+ }
+ }
+ else {
+ _this.errors[path] = "Couldn't load texture atlas page " + imagePath + "} of atlas " + path;
+ if (error)
+ error(path, "Couldn't load texture atlas page " + imagePath + " of atlas " + path);
+ _this.toLoad--;
+ _this.loaded++;
+ }
+ }
+ }, function (imagePath, errorMessage) {
+ pageLoadError = true;
+ pagesLoaded.count++;
+ if (pagesLoaded.count == atlasPages.length) {
+ _this.errors[path] = "Couldn't load texture atlas page " + imagePath + "} of atlas " + path;
+ if (error)
+ error(path, "Couldn't load texture atlas page " + imagePath + " of atlas " + path);
+ _this.toLoad--;
+ _this.loaded++;
+ }
+ });
+ };
+ for (var _i = 0, atlasPages_1 = atlasPages; _i < atlasPages_1.length; _i++) {
+ var atlasPage = atlasPages_1[_i];
+ _loop_1(atlasPage);
+ }
+ }, function (status, responseText) {
+ _this.errors[path] = "Couldn't load texture atlas " + path + ": status " + status + ", " + responseText;
+ if (error)
+ error(path, "Couldn't load texture atlas " + path + ": status " + status + ", " + responseText);
+ _this.toLoad--;
+ _this.loaded++;
+ });
+ };
+ AssetManager.prototype.get = function (path) {
+ path = this.pathPrefix + path;
+ return this.assets[path];
+ };
+ AssetManager.prototype.remove = function (path) {
+ path = this.pathPrefix + path;
+ var asset = this.assets[path];
+ if (asset.dispose)
+ asset.dispose();
+ this.assets[path] = null;
+ };
+ AssetManager.prototype.removeAll = function () {
+ for (var key in this.assets) {
+ var asset = this.assets[key];
+ if (asset.dispose)
+ asset.dispose();
+ }
+ this.assets = {};
+ };
+ AssetManager.prototype.isLoadingComplete = function () {
+ return this.toLoad == 0;
+ };
+ AssetManager.prototype.getToLoad = function () {
+ return this.toLoad;
+ };
+ AssetManager.prototype.getLoaded = function () {
+ return this.loaded;
+ };
+ AssetManager.prototype.dispose = function () {
+ this.removeAll();
+ };
+ AssetManager.prototype.hasErrors = function () {
+ return Object.keys(this.errors).length > 0;
+ };
+ AssetManager.prototype.getErrors = function () {
+ return this.errors;
+ };
+ return AssetManager;
+ }());
+ spine.AssetManager = AssetManager;
+ spine.lodedAssets = {};
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var AtlasAttachmentLoader = (function () {
+ function AtlasAttachmentLoader(atlas) {
+ this.atlas = atlas;
+ }
+ AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) {
+ var region = this.atlas.findRegion(path);
+ if (region == null)
+ throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
+ region.renderObject = region;
+ var attachment = new spine.RegionAttachment(name);
+ attachment.setRegion(region);
+ return attachment;
+ };
+ AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
+ var region = this.atlas.findRegion(path);
+ if (region == null)
+ throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
+ region.renderObject = region;
+ var attachment = new spine.MeshAttachment(name);
+ attachment.region = region;
+ return attachment;
+ };
+ AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) {
+ return new spine.BoundingBoxAttachment(name);
+ };
+ AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) {
+ return new spine.PathAttachment(name);
+ };
+ AtlasAttachmentLoader.prototype.newPointAttachment = function (skin, name) {
+ return new spine.PointAttachment(name);
+ };
+ AtlasAttachmentLoader.prototype.newClippingAttachment = function (skin, name) {
+ return new spine.ClippingAttachment(name);
+ };
+ return AtlasAttachmentLoader;
+ }());
+ spine.AtlasAttachmentLoader = AtlasAttachmentLoader;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var BlendMode;
+ (function (BlendMode) {
+ BlendMode[BlendMode["Normal"] = 0] = "Normal";
+ BlendMode[BlendMode["Additive"] = 1] = "Additive";
+ BlendMode[BlendMode["Multiply"] = 2] = "Multiply";
+ BlendMode[BlendMode["Screen"] = 3] = "Screen";
+ })(BlendMode = spine.BlendMode || (spine.BlendMode = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Bone = (function () {
+ function Bone(data, skeleton, parent) {
+ this.children = new Array();
+ this.x = 0;
+ this.y = 0;
+ this.rotation = 0;
+ this.scaleX = 0;
+ this.scaleY = 0;
+ this.shearX = 0;
+ this.shearY = 0;
+ this.ax = 0;
+ this.ay = 0;
+ this.arotation = 0;
+ this.ascaleX = 0;
+ this.ascaleY = 0;
+ this.ashearX = 0;
+ this.ashearY = 0;
+ this.appliedValid = false;
+ this.a = 0;
+ this.b = 0;
+ this.worldX = 0;
+ this.c = 0;
+ this.d = 0;
+ this.worldY = 0;
+ this.sorted = false;
+ if (data == null)
+ throw new Error("data cannot be null.");
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ this.data = data;
+ this.name = data.name;
+ this.skeleton = skeleton;
+ this.parent = parent;
+ this.setToSetupPose();
+ }
+ Bone.prototype.update = function () {
+ this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
+ };
+ Bone.prototype.updateWorldTransform = function () {
+ this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
+ };
+ Bone.prototype.updateWorldTransformWith = function (x, y, rotation, scaleX, scaleY, shearX, shearY) {
+ this.ax = x;
+ this.ay = y;
+ this.arotation = rotation;
+ this.ascaleX = scaleX;
+ this.ascaleY = scaleY;
+ this.ashearX = shearX;
+ this.ashearY = shearY;
+ this.appliedValid = true;
+ var parent = this.parent;
+ if (parent == null) {
+ var rotationY = rotation + 90 + shearY;
+ var la = spine.MathUtils.cosDeg(rotation + shearX) * scaleX;
+ var lb = spine.MathUtils.cosDeg(rotationY) * scaleY;
+ var lc = spine.MathUtils.sinDeg(rotation + shearX) * scaleX;
+ var ld = spine.MathUtils.sinDeg(rotationY) * scaleY;
+ var skeleton = this.skeleton;
+ if (skeleton.flipX) {
+ x = -x;
+ la = -la;
+ lb = -lb;
+ }
+ if (skeleton.flipY) {
+ y = -y;
+ lc = -lc;
+ ld = -ld;
+ }
+ this.a = la;
+ this.b = lb;
+ this.c = lc;
+ this.d = ld;
+ this.worldX = x + skeleton.x;
+ this.worldY = y + skeleton.y;
+ return;
+ }
+ var pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
+ this.worldX = pa * x + pb * y + parent.worldX;
+ this.worldY = pc * x + pd * y + parent.worldY;
+ switch (this.data.transformMode) {
+ case spine.TransformMode.Normal: {
+ var rotationY = rotation + 90 + shearY;
+ var la = spine.MathUtils.cosDeg(rotation + shearX) * scaleX;
+ var lb = spine.MathUtils.cosDeg(rotationY) * scaleY;
+ var lc = spine.MathUtils.sinDeg(rotation + shearX) * scaleX;
+ var ld = spine.MathUtils.sinDeg(rotationY) * scaleY;
+ this.a = pa * la + pb * lc;
+ this.b = pa * lb + pb * ld;
+ this.c = pc * la + pd * lc;
+ this.d = pc * lb + pd * ld;
+ return;
+ }
+ case spine.TransformMode.OnlyTranslation: {
+ var rotationY = rotation + 90 + shearY;
+ this.a = spine.MathUtils.cosDeg(rotation + shearX) * scaleX;
+ this.b = spine.MathUtils.cosDeg(rotationY) * scaleY;
+ this.c = spine.MathUtils.sinDeg(rotation + shearX) * scaleX;
+ this.d = spine.MathUtils.sinDeg(rotationY) * scaleY;
+ break;
+ }
+ case spine.TransformMode.NoRotationOrReflection: {
+ var s = pa * pa + pc * pc;
+ var prx = 0;
+ if (s > 0.0001) {
+ s = Math.abs(pa * pd - pb * pc) / s;
+ pb = pc * s;
+ pd = pa * s;
+ prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
+ }
+ else {
+ pa = 0;
+ pc = 0;
+ prx = 90 - Math.atan2(pd, pb) * spine.MathUtils.radDeg;
+ }
+ var rx = rotation + shearX - prx;
+ var ry = rotation + shearY - prx + 90;
+ var la = spine.MathUtils.cosDeg(rx) * scaleX;
+ var lb = spine.MathUtils.cosDeg(ry) * scaleY;
+ var lc = spine.MathUtils.sinDeg(rx) * scaleX;
+ var ld = spine.MathUtils.sinDeg(ry) * scaleY;
+ this.a = pa * la - pb * lc;
+ this.b = pa * lb - pb * ld;
+ this.c = pc * la + pd * lc;
+ this.d = pc * lb + pd * ld;
+ break;
+ }
+ case spine.TransformMode.NoScale:
+ case spine.TransformMode.NoScaleOrReflection: {
+ var cos = spine.MathUtils.cosDeg(rotation);
+ var sin = spine.MathUtils.sinDeg(rotation);
+ var za = pa * cos + pb * sin;
+ var zc = pc * cos + pd * sin;
+ var s = Math.sqrt(za * za + zc * zc);
+ if (s > 0.00001)
+ s = 1 / s;
+ za *= s;
+ zc *= s;
+ s = Math.sqrt(za * za + zc * zc);
+ var r = Math.PI / 2 + Math.atan2(zc, za);
+ var zb = Math.cos(r) * s;
+ var zd = Math.sin(r) * s;
+ var la = spine.MathUtils.cosDeg(shearX) * scaleX;
+ var lb = spine.MathUtils.cosDeg(90 + shearY) * scaleY;
+ var lc = spine.MathUtils.sinDeg(shearX) * scaleX;
+ var ld = spine.MathUtils.sinDeg(90 + shearY) * scaleY;
+ if (this.data.transformMode != spine.TransformMode.NoScaleOrReflection ? pa * pd - pb * pc < 0 : this.skeleton.flipX != this.skeleton.flipY) {
+ zb = -zb;
+ zd = -zd;
+ }
+ this.a = za * la + zb * lc;
+ this.b = za * lb + zb * ld;
+ this.c = zc * la + zd * lc;
+ this.d = zc * lb + zd * ld;
+ return;
+ }
+ }
+ if (this.skeleton.flipX) {
+ this.a = -this.a;
+ this.b = -this.b;
+ }
+ if (this.skeleton.flipY) {
+ this.c = -this.c;
+ this.d = -this.d;
+ }
+ };
+ Bone.prototype.setToSetupPose = function () {
+ var data = this.data;
+ this.x = data.x;
+ this.y = data.y;
+ this.rotation = data.rotation;
+ this.scaleX = data.scaleX;
+ this.scaleY = data.scaleY;
+ this.shearX = data.shearX;
+ this.shearY = data.shearY;
+ };
+ Bone.prototype.getWorldRotationX = function () {
+ return Math.atan2(this.c, this.a) * spine.MathUtils.radDeg;
+ };
+ Bone.prototype.getWorldRotationY = function () {
+ return Math.atan2(this.d, this.b) * spine.MathUtils.radDeg;
+ };
+ Bone.prototype.getWorldScaleX = function () {
+ return Math.sqrt(this.a * this.a + this.c * this.c);
+ };
+ Bone.prototype.getWorldScaleY = function () {
+ return Math.sqrt(this.b * this.b + this.d * this.d);
+ };
+ Bone.prototype.updateAppliedTransform = function () {
+ this.appliedValid = true;
+ var parent = this.parent;
+ if (parent == null) {
+ this.ax = this.worldX;
+ this.ay = this.worldY;
+ this.arotation = Math.atan2(this.c, this.a) * spine.MathUtils.radDeg;
+ this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c);
+ this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d);
+ this.ashearX = 0;
+ this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * spine.MathUtils.radDeg;
+ return;
+ }
+ var pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
+ var pid = 1 / (pa * pd - pb * pc);
+ var dx = this.worldX - parent.worldX, dy = this.worldY - parent.worldY;
+ this.ax = (dx * pd * pid - dy * pb * pid);
+ this.ay = (dy * pa * pid - dx * pc * pid);
+ var ia = pid * pd;
+ var id = pid * pa;
+ var ib = pid * pb;
+ var ic = pid * pc;
+ var ra = ia * this.a - ib * this.c;
+ var rb = ia * this.b - ib * this.d;
+ var rc = id * this.c - ic * this.a;
+ var rd = id * this.d - ic * this.b;
+ this.ashearX = 0;
+ this.ascaleX = Math.sqrt(ra * ra + rc * rc);
+ if (this.ascaleX > 0.0001) {
+ var det = ra * rd - rb * rc;
+ this.ascaleY = det / this.ascaleX;
+ this.ashearY = Math.atan2(ra * rb + rc * rd, det) * spine.MathUtils.radDeg;
+ this.arotation = Math.atan2(rc, ra) * spine.MathUtils.radDeg;
+ }
+ else {
+ this.ascaleX = 0;
+ this.ascaleY = Math.sqrt(rb * rb + rd * rd);
+ this.ashearY = 0;
+ this.arotation = 90 - Math.atan2(rd, rb) * spine.MathUtils.radDeg;
+ }
+ };
+ Bone.prototype.worldToLocal = function (world) {
+ var a = this.a, b = this.b, c = this.c, d = this.d;
+ var invDet = 1 / (a * d - b * c);
+ var x = world.x - this.worldX, y = world.y - this.worldY;
+ world.x = (x * d * invDet - y * b * invDet);
+ world.y = (y * a * invDet - x * c * invDet);
+ return world;
+ };
+ Bone.prototype.localToWorld = function (local) {
+ var x = local.x, y = local.y;
+ local.x = x * this.a + y * this.b + this.worldX;
+ local.y = x * this.c + y * this.d + this.worldY;
+ return local;
+ };
+ Bone.prototype.worldToLocalRotation = function (worldRotation) {
+ var sin = spine.MathUtils.sinDeg(worldRotation), cos = spine.MathUtils.cosDeg(worldRotation);
+ return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * spine.MathUtils.radDeg;
+ };
+ Bone.prototype.localToWorldRotation = function (localRotation) {
+ var sin = spine.MathUtils.sinDeg(localRotation), cos = spine.MathUtils.cosDeg(localRotation);
+ return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * spine.MathUtils.radDeg;
+ };
+ Bone.prototype.rotateWorld = function (degrees) {
+ var a = this.a, b = this.b, c = this.c, d = this.d;
+ var cos = spine.MathUtils.cosDeg(degrees), sin = spine.MathUtils.sinDeg(degrees);
+ this.a = cos * a - sin * c;
+ this.b = cos * b - sin * d;
+ this.c = sin * a + cos * c;
+ this.d = sin * b + cos * d;
+ this.appliedValid = false;
+ };
+ return Bone;
+ }());
+ spine.Bone = Bone;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var BoneData = (function () {
+ function BoneData(index, name, parent) {
+ this.x = 0;
+ this.y = 0;
+ this.rotation = 0;
+ this.scaleX = 1;
+ this.scaleY = 1;
+ this.shearX = 0;
+ this.shearY = 0;
+ this.transformMode = TransformMode.Normal;
+ this.skinRequired = false;
+ this.color = new spine.Color();
+ if (index < 0)
+ throw new Error("index must be >= 0.");
+ if (name == null)
+ throw new Error("name cannot be null.");
+ this.index = index;
+ this.name = name;
+ this.parent = parent;
+ }
+ BoneData.prototype.copy = function () {
+ var copy = new BoneData(this.index, this.name, this.parent);
+ copy.x = this.x;
+ copy.y = this.y;
+ copy.rotation = this.rotation;
+ copy.scaleX = this.scaleX;
+ copy.scaleY = this.scaleY;
+ copy.shearX = this.shearX;
+ copy.shearY = this.shearY;
+ copy.transformMode = this.shearY;
+ this.skinRequired = this.skinRequired;
+ this.color = this.color.copy();
+ return copy;
+ };
+ return BoneData;
+ }());
+ spine.BoneData = BoneData;
+ var TransformMode;
+ (function (TransformMode) {
+ TransformMode[TransformMode["Normal"] = 0] = "Normal";
+ TransformMode[TransformMode["OnlyTranslation"] = 1] = "OnlyTranslation";
+ TransformMode[TransformMode["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
+ TransformMode[TransformMode["NoScale"] = 3] = "NoScale";
+ TransformMode[TransformMode["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
+ })(TransformMode = spine.TransformMode || (spine.TransformMode = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Event = (function () {
+ function Event(time, data) {
+ if (data == null)
+ throw new Error("data cannot be null.");
+ this.time = time;
+ this.data = data;
+ }
+ return Event;
+ }());
+ spine.Event = Event;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var EventData = (function () {
+ function EventData(name) {
+ this.name = name;
+ }
+ return EventData;
+ }());
+ spine.EventData = EventData;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var IkConstraint = (function () {
+ function IkConstraint(data, skeleton) {
+ if (data == null)
+ throw new Error("data cannot be null.");
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ this.data = data;
+ this.mix = data.mix;
+ this.bendDirection = data.bendDirection;
+ this.bones = new Array();
+ for (var i = 0; i < data.bones.length; i++)
+ this.bones.push(skeleton.findBone(data.bones[i].name));
+ this.target = skeleton.findBone(data.target.name);
+ }
+ IkConstraint.prototype.getOrder = function () {
+ return this.data.order;
+ };
+ IkConstraint.prototype.apply = function () {
+ this.update();
+ };
+ IkConstraint.prototype.update = function () {
+ var target = this.target;
+ var bones = this.bones;
+ switch (bones.length) {
+ case 1:
+ this.apply1(bones[0], target.worldX, target.worldY, this.mix);
+ break;
+ case 2:
+ this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.mix);
+ break;
+ }
+ };
+ IkConstraint.prototype.apply1 = function (bone, targetX, targetY, alpha) {
+ if (!bone.appliedValid)
+ bone.updateAppliedTransform();
+ var p = bone.parent;
+ var id = 1 / (p.a * p.d - p.b * p.c);
+ var x = targetX - p.worldX, y = targetY - p.worldY;
+ var tx = (x * p.d - y * p.b) * id - bone.ax, ty = (y * p.a - x * p.c) * id - bone.ay;
+ var rotationIK = Math.atan2(ty, tx) * spine.MathUtils.radDeg - bone.ashearX - bone.arotation;
+ if (bone.ascaleX < 0)
+ rotationIK += 180;
+ if (rotationIK > 180)
+ rotationIK -= 360;
+ else if (rotationIK < -180)
+ rotationIK += 360;
+ bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, bone.ascaleX, bone.ascaleY, bone.ashearX, bone.ashearY);
+ };
+ IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, alpha) {
+ if (alpha == 0) {
+ child.updateWorldTransform();
+ return;
+ }
+ if (!parent.appliedValid)
+ parent.updateAppliedTransform();
+ if (!child.appliedValid)
+ child.updateAppliedTransform();
+ var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, csx = child.ascaleX;
+ var os1 = 0, os2 = 0, s2 = 0;
+ if (psx < 0) {
+ psx = -psx;
+ os1 = 180;
+ s2 = -1;
+ }
+ else {
+ os1 = 0;
+ s2 = 1;
+ }
+ if (psy < 0) {
+ psy = -psy;
+ s2 = -s2;
+ }
+ if (csx < 0) {
+ csx = -csx;
+ os2 = 180;
+ }
+ else
+ os2 = 0;
+ var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
+ var u = Math.abs(psx - psy) <= 0.0001;
+ if (!u) {
+ cy = 0;
+ cwx = a * cx + parent.worldX;
+ cwy = c * cx + parent.worldY;
+ }
+ else {
+ cy = child.ay;
+ cwx = a * cx + b * cy + parent.worldX;
+ cwy = c * cx + d * cy + parent.worldY;
+ }
+ var pp = parent.parent;
+ a = pp.a;
+ b = pp.b;
+ c = pp.c;
+ d = pp.d;
+ var id = 1 / (a * d - b * c), x = targetX - pp.worldX, y = targetY - pp.worldY;
+ var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
+ x = cwx - pp.worldX;
+ y = cwy - pp.worldY;
+ var dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
+ var l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1 = 0, a2 = 0;
+ outer: if (u) {
+ l2 *= psx;
+ var cos = (tx * tx + ty * ty - l1 * l1 - l2 * l2) / (2 * l1 * l2);
+ if (cos < -1)
+ cos = -1;
+ else if (cos > 1)
+ cos = 1;
+ a2 = Math.acos(cos) * bendDir;
+ a = l1 + l2 * cos;
+ b = l2 * Math.sin(a2);
+ a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b);
+ }
+ else {
+ a = psx * l2;
+ b = psy * l2;
+ var aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = Math.atan2(ty, tx);
+ c = bb * l1 * l1 + aa * dd - aa * bb;
+ var c1 = -2 * bb * l1, c2 = bb - aa;
+ d = c1 * c1 - 4 * c2 * c;
+ if (d >= 0) {
+ var q = Math.sqrt(d);
+ if (c1 < 0)
+ q = -q;
+ q = -(c1 + q) / 2;
+ var r0 = q / c2, r1 = c / q;
+ var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
+ if (r * r <= dd) {
+ y = Math.sqrt(dd - r * r) * bendDir;
+ a1 = ta - Math.atan2(y, r);
+ a2 = Math.atan2(y / psy, (r - l1) / psx);
+ break outer;
+ }
+ }
+ var minAngle = spine.MathUtils.PI, minX = l1 - a, minDist = minX * minX, minY = 0;
+ var maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;
+ c = -a * l1 / (aa - bb);
+ if (c >= -1 && c <= 1) {
+ c = Math.acos(c);
+ x = a * Math.cos(c) + l1;
+ y = b * Math.sin(c);
+ d = x * x + y * y;
+ if (d < minDist) {
+ minAngle = c;
+ minDist = d;
+ minX = x;
+ minY = y;
+ }
+ if (d > maxDist) {
+ maxAngle = c;
+ maxDist = d;
+ maxX = x;
+ maxY = y;
+ }
+ }
+ if (dd <= (minDist + maxDist) / 2) {
+ a1 = ta - Math.atan2(minY * bendDir, minX);
+ a2 = minAngle * bendDir;
+ }
+ else {
+ a1 = ta - Math.atan2(maxY * bendDir, maxX);
+ a2 = maxAngle * bendDir;
+ }
+ }
+ var os = Math.atan2(cy, cx) * s2;
+ var rotation = parent.arotation;
+ a1 = (a1 - os) * spine.MathUtils.radDeg + os1 - rotation;
+ if (a1 > 180)
+ a1 -= 360;
+ else if (a1 < -180)
+ a1 += 360;
+ parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, parent.ascaleX, parent.ascaleY, 0, 0);
+ rotation = child.arotation;
+ a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
+ if (a2 > 180)
+ a2 -= 360;
+ else if (a2 < -180)
+ a2 += 360;
+ child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);
+ };
+ return IkConstraint;
+ }());
+ spine.IkConstraint = IkConstraint;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var IkConstraintData = (function () {
+ function IkConstraintData(name) {
+ this.order = 0;
+ this.bones = new Array();
+ this.bendDirection = 1;
+ this.mix = 1;
+ this.name = name;
+ }
+ return IkConstraintData;
+ }());
+ spine.IkConstraintData = IkConstraintData;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var PathConstraint = (function () {
+ function PathConstraint(data, skeleton) {
+ this.position = 0;
+ this.spacing = 0;
+ this.rotateMix = 0;
+ this.translateMix = 0;
+ this.spaces = new Array();
+ this.positions = new Array();
+ this.world = new Array();
+ this.curves = new Array();
+ this.lengths = new Array();
+ this.segments = new Array();
+ if (data == null)
+ throw new Error("data cannot be null.");
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ this.data = data;
+ this.bones = new Array();
+ for (var i = 0, n = data.bones.length; i < n; i++)
+ this.bones.push(skeleton.findBone(data.bones[i].name));
+ this.target = skeleton.findSlot(data.target.name);
+ this.position = data.position;
+ this.spacing = data.spacing;
+ this.rotateMix = data.rotateMix;
+ this.translateMix = data.translateMix;
+ }
+ PathConstraint.prototype.apply = function () {
+ this.update();
+ };
+ PathConstraint.prototype.update = function () {
+ var attachment = this.target.getAttachment();
+ if (!(attachment instanceof spine.PathAttachment))
+ return;
+ var rotateMix = this.rotateMix, translateMix = this.translateMix;
+ var translate = translateMix > 0, rotate = rotateMix > 0;
+ if (!translate && !rotate)
+ return;
+ var data = this.data;
+ var spacingMode = data.spacingMode;
+ var lengthSpacing = spacingMode == spine.SpacingMode.Length;
+ var rotateMode = data.rotateMode;
+ var tangents = rotateMode == spine.RotateMode.Tangent, scale = rotateMode == spine.RotateMode.ChainScale;
+ var boneCount = this.bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
+ var bones = this.bones;
+ var spaces = spine.Utils.setArraySize(this.spaces, spacesCount), lengths = null;
+ var spacing = this.spacing;
+ if (scale || lengthSpacing) {
+ if (scale)
+ lengths = spine.Utils.setArraySize(this.lengths, boneCount);
+ for (var i = 0, n = spacesCount - 1; i < n;) {
+ var bone = bones[i];
+ var setupLength = bone.data.length;
+ if (setupLength < PathConstraint.epsilon) {
+ if (scale)
+ lengths[i] = 0;
+ spaces[++i] = 0;
+ }
+ else {
+ var x = setupLength * bone.a, y = setupLength * bone.c;
+ var length_1 = Math.sqrt(x * x + y * y);
+ if (scale)
+ lengths[i] = length_1;
+ spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length_1 / setupLength;
+ }
+ }
+ }
+ else {
+ for (var i = 1; i < spacesCount; i++)
+ spaces[i] = spacing;
+ }
+ var positions = this.computeWorldPositions(attachment, spacesCount, tangents, data.positionMode == spine.PositionMode.Percent, spacingMode == spine.SpacingMode.Percent);
+ var boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
+ var tip = false;
+ if (offsetRotation == 0)
+ tip = rotateMode == spine.RotateMode.Chain;
+ else {
+ tip = false;
+ var p = this.target.bone;
+ offsetRotation *= p.a * p.d - p.b * p.c > 0 ? spine.MathUtils.degRad : -spine.MathUtils.degRad;
+ }
+ for (var i = 0, p = 3; i < boneCount; i++, p += 3) {
+ var bone = bones[i];
+ bone.worldX += (boneX - bone.worldX) * translateMix;
+ bone.worldY += (boneY - bone.worldY) * translateMix;
+ var x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY;
+ if (scale) {
+ var length_2 = lengths[i];
+ if (length_2 != 0) {
+ var s = (Math.sqrt(dx * dx + dy * dy) / length_2 - 1) * rotateMix + 1;
+ bone.a *= s;
+ bone.c *= s;
+ }
+ }
+ boneX = x;
+ boneY = y;
+ if (rotate) {
+ var a = bone.a, b = bone.b, c = bone.c, d = bone.d, r = 0, cos = 0, sin = 0;
+ if (tangents)
+ r = positions[p - 1];
+ else if (spaces[i + 1] == 0)
+ r = positions[p + 2];
+ else
+ r = Math.atan2(dy, dx);
+ r -= Math.atan2(c, a);
+ if (tip) {
+ cos = Math.cos(r);
+ sin = Math.sin(r);
+ var length_3 = bone.data.length;
+ boneX += (length_3 * (cos * a - sin * c) - dx) * rotateMix;
+ boneY += (length_3 * (sin * a + cos * c) - dy) * rotateMix;
+ }
+ else {
+ r += offsetRotation;
+ }
+ if (r > spine.MathUtils.PI)
+ r -= spine.MathUtils.PI2;
+ else if (r < -spine.MathUtils.PI)
+ r += spine.MathUtils.PI2;
+ r *= rotateMix;
+ cos = Math.cos(r);
+ sin = Math.sin(r);
+ bone.a = cos * a - sin * c;
+ bone.b = cos * b - sin * d;
+ bone.c = sin * a + cos * c;
+ bone.d = sin * b + cos * d;
+ }
+ bone.appliedValid = false;
+ }
+ };
+ PathConstraint.prototype.computeWorldPositions = function (path, spacesCount, tangents, percentPosition, percentSpacing) {
+ var target = this.target;
+ var position = this.position;
+ var spaces = this.spaces, out = spine.Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = null;
+ var closed = path.closed;
+ var verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PathConstraint.NONE;
+ if (!path.constantSpeed) {
+ var lengths = path.lengths;
+ curveCount -= closed ? 1 : 2;
+ var pathLength_1 = lengths[curveCount];
+ if (percentPosition)
+ position *= pathLength_1;
+ if (percentSpacing) {
+ for (var i = 0; i < spacesCount; i++)
+ spaces[i] *= pathLength_1;
+ }
+ world = spine.Utils.setArraySize(this.world, 8);
+ for (var i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) {
+ var space = spaces[i];
+ position += space;
+ var p = position;
+ if (closed) {
+ p %= pathLength_1;
+ if (p < 0)
+ p += pathLength_1;
+ curve = 0;
+ }
+ else if (p < 0) {
+ if (prevCurve != PathConstraint.BEFORE) {
+ prevCurve = PathConstraint.BEFORE;
+ path.computeWorldVertices(target, 2, 4, world, 0, 2);
+ }
+ this.addBeforePosition(p, world, 0, out, o);
+ continue;
+ }
+ else if (p > pathLength_1) {
+ if (prevCurve != PathConstraint.AFTER) {
+ prevCurve = PathConstraint.AFTER;
+ path.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2);
+ }
+ this.addAfterPosition(p - pathLength_1, world, 0, out, o);
+ continue;
+ }
+ for (; ; curve++) {
+ var length_4 = lengths[curve];
+ if (p > length_4)
+ continue;
+ if (curve == 0)
+ p /= length_4;
+ else {
+ var prev = lengths[curve - 1];
+ p = (p - prev) / (length_4 - prev);
+ }
+ break;
+ }
+ if (curve != prevCurve) {
+ prevCurve = curve;
+ if (closed && curve == curveCount) {
+ path.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2);
+ path.computeWorldVertices(target, 0, 4, world, 4, 2);
+ }
+ else
+ path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
+ }
+ this.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || (i > 0 && space == 0));
+ }
+ return out;
+ }
+ if (closed) {
+ verticesLength += 2;
+ world = spine.Utils.setArraySize(this.world, verticesLength);
+ path.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2);
+ path.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2);
+ world[verticesLength - 2] = world[0];
+ world[verticesLength - 1] = world[1];
+ }
+ else {
+ curveCount--;
+ verticesLength -= 4;
+ world = spine.Utils.setArraySize(this.world, verticesLength);
+ path.computeWorldVertices(target, 2, verticesLength, world, 0, 2);
+ }
+ var curves = spine.Utils.setArraySize(this.curves, curveCount);
+ var pathLength = 0;
+ var x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0;
+ var tmpx = 0, tmpy = 0, dddfx = 0, dddfy = 0, ddfx = 0, ddfy = 0, dfx = 0, dfy = 0;
+ for (var i = 0, w = 2; i < curveCount; i++, w += 6) {
+ cx1 = world[w];
+ cy1 = world[w + 1];
+ cx2 = world[w + 2];
+ cy2 = world[w + 3];
+ x2 = world[w + 4];
+ y2 = world[w + 5];
+ tmpx = (x1 - cx1 * 2 + cx2) * 0.1875;
+ tmpy = (y1 - cy1 * 2 + cy2) * 0.1875;
+ dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375;
+ dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375;
+ ddfx = tmpx * 2 + dddfx;
+ ddfy = tmpy * 2 + dddfy;
+ dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667;
+ dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667;
+ pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ dfx += ddfx;
+ dfy += ddfy;
+ ddfx += dddfx;
+ ddfy += dddfy;
+ pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ dfx += ddfx;
+ dfy += ddfy;
+ pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ dfx += ddfx + dddfx;
+ dfy += ddfy + dddfy;
+ pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ curves[i] = pathLength;
+ x1 = x2;
+ y1 = y2;
+ }
+ if (percentPosition)
+ position *= pathLength;
+ if (percentSpacing) {
+ for (var i = 0; i < spacesCount; i++)
+ spaces[i] *= pathLength;
+ }
+ var segments = this.segments;
+ var curveLength = 0;
+ for (var i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) {
+ var space = spaces[i];
+ position += space;
+ var p = position;
+ if (closed) {
+ p %= pathLength;
+ if (p < 0)
+ p += pathLength;
+ curve = 0;
+ }
+ else if (p < 0) {
+ this.addBeforePosition(p, world, 0, out, o);
+ continue;
+ }
+ else if (p > pathLength) {
+ this.addAfterPosition(p - pathLength, world, verticesLength - 4, out, o);
+ continue;
+ }
+ for (; ; curve++) {
+ var length_5 = curves[curve];
+ if (p > length_5)
+ continue;
+ if (curve == 0)
+ p /= length_5;
+ else {
+ var prev = curves[curve - 1];
+ p = (p - prev) / (length_5 - prev);
+ }
+ break;
+ }
+ if (curve != prevCurve) {
+ prevCurve = curve;
+ var ii = curve * 6;
+ x1 = world[ii];
+ y1 = world[ii + 1];
+ cx1 = world[ii + 2];
+ cy1 = world[ii + 3];
+ cx2 = world[ii + 4];
+ cy2 = world[ii + 5];
+ x2 = world[ii + 6];
+ y2 = world[ii + 7];
+ tmpx = (x1 - cx1 * 2 + cx2) * 0.03;
+ tmpy = (y1 - cy1 * 2 + cy2) * 0.03;
+ dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006;
+ dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006;
+ ddfx = tmpx * 2 + dddfx;
+ ddfy = tmpy * 2 + dddfy;
+ dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667;
+ dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667;
+ curveLength = Math.sqrt(dfx * dfx + dfy * dfy);
+ segments[0] = curveLength;
+ for (ii = 1; ii < 8; ii++) {
+ dfx += ddfx;
+ dfy += ddfy;
+ ddfx += dddfx;
+ ddfy += dddfy;
+ curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ segments[ii] = curveLength;
+ }
+ dfx += ddfx;
+ dfy += ddfy;
+ curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ segments[8] = curveLength;
+ dfx += ddfx + dddfx;
+ dfy += ddfy + dddfy;
+ curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
+ segments[9] = curveLength;
+ segment = 0;
+ }
+ p *= curveLength;
+ for (; ; segment++) {
+ var length_6 = segments[segment];
+ if (p > length_6)
+ continue;
+ if (segment == 0)
+ p /= length_6;
+ else {
+ var prev = segments[segment - 1];
+ p = segment + (p - prev) / (length_6 - prev);
+ }
+ break;
+ }
+ this.addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0));
+ }
+ return out;
+ };
+ PathConstraint.prototype.addBeforePosition = function (p, temp, i, out, o) {
+ var x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = Math.atan2(dy, dx);
+ out[o] = x1 + p * Math.cos(r);
+ out[o + 1] = y1 + p * Math.sin(r);
+ out[o + 2] = r;
+ };
+ PathConstraint.prototype.addAfterPosition = function (p, temp, i, out, o) {
+ var x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = Math.atan2(dy, dx);
+ out[o] = x1 + p * Math.cos(r);
+ out[o + 1] = y1 + p * Math.sin(r);
+ out[o + 2] = r;
+ };
+ PathConstraint.prototype.addCurvePosition = function (p, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents) {
+ if (p == 0 || isNaN(p))
+ p = 0.0001;
+ var tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u;
+ var ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p;
+ var x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;
+ out[o] = x;
+ out[o + 1] = y;
+ if (tangents)
+ out[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
+ };
+ PathConstraint.prototype.getOrder = function () {
+ return this.data.order;
+ };
+ PathConstraint.NONE = -1;
+ PathConstraint.BEFORE = -2;
+ PathConstraint.AFTER = -3;
+ PathConstraint.epsilon = 0.00001;
+ return PathConstraint;
+ }());
+ spine.PathConstraint = PathConstraint;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var PathConstraintData = (function () {
+ function PathConstraintData(name) {
+ this.order = 0;
+ this.bones = new Array();
+ this.name = name;
+ }
+ return PathConstraintData;
+ }());
+ spine.PathConstraintData = PathConstraintData;
+ var PositionMode;
+ (function (PositionMode) {
+ PositionMode[PositionMode["Fixed"] = 0] = "Fixed";
+ PositionMode[PositionMode["Percent"] = 1] = "Percent";
+ })(PositionMode = spine.PositionMode || (spine.PositionMode = {}));
+ var SpacingMode;
+ (function (SpacingMode) {
+ SpacingMode[SpacingMode["Length"] = 0] = "Length";
+ SpacingMode[SpacingMode["Fixed"] = 1] = "Fixed";
+ SpacingMode[SpacingMode["Percent"] = 2] = "Percent";
+ })(SpacingMode = spine.SpacingMode || (spine.SpacingMode = {}));
+ var RotateMode;
+ (function (RotateMode) {
+ RotateMode[RotateMode["Tangent"] = 0] = "Tangent";
+ RotateMode[RotateMode["Chain"] = 1] = "Chain";
+ RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
+ })(RotateMode = spine.RotateMode || (spine.RotateMode = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Assets = (function () {
+ function Assets(clientId) {
+ this.toLoad = new Array();
+ this.assets = {};
+ this.clientId = clientId;
+ }
+ Assets.prototype.loaded = function () {
+ var i = 0;
+ for (var v in this.assets)
+ i++;
+ return i;
+ };
+ return Assets;
+ }());
+ var SharedAssetManager = (function () {
+ function SharedAssetManager(pathPrefix) {
+ if (pathPrefix === void 0) { pathPrefix = ""; }
+ this.clientAssets = {};
+ this.queuedAssets = {};
+ this.rawAssets = {};
+ this.errors = {};
+ this.pathPrefix = pathPrefix;
+ }
+ SharedAssetManager.prototype.queueAsset = function (clientId, textureLoader, path) {
+ var clientAssets = this.clientAssets[clientId];
+ if (clientAssets === null || clientAssets === undefined) {
+ clientAssets = new Assets(clientId);
+ this.clientAssets[clientId] = clientAssets;
+ }
+ if (textureLoader !== null)
+ clientAssets.textureLoader = textureLoader;
+ clientAssets.toLoad.push(path);
+ if (this.queuedAssets[path] === path) {
+ return false;
+ }
+ else {
+ this.queuedAssets[path] = path;
+ return true;
+ }
+ };
+ SharedAssetManager.prototype.loadText = function (clientId, path) {
+ var _this = this;
+ path = this.pathPrefix + path;
+ if (!this.queueAsset(clientId, null, path))
+ return;
+ var request = new XMLHttpRequest();
+ request.onreadystatechange = function () {
+ if (request.readyState == XMLHttpRequest.DONE) {
+ if (request.status >= 200 && request.status < 300) {
+ _this.rawAssets[path] = request.responseText;
+ }
+ else {
+ _this.errors[path] = "Couldn't load text " + path + ": status " + request.status + ", " + request.responseText;
+ }
+ }
+ };
+ request.open("GET", path, true);
+ request.send();
+ };
+ SharedAssetManager.prototype.loadJson = function (clientId, path) {
+ var _this = this;
+ path = this.pathPrefix + path;
+ if (!this.queueAsset(clientId, null, path))
+ return;
+ var request = new XMLHttpRequest();
+ request.onreadystatechange = function () {
+ if (request.readyState == XMLHttpRequest.DONE) {
+ if (request.status >= 200 && request.status < 300) {
+ _this.rawAssets[path] = JSON.parse(request.responseText);
+ }
+ else {
+ _this.errors[path] = "Couldn't load text " + path + ": status " + request.status + ", " + request.responseText;
+ }
+ }
+ };
+ request.open("GET", path, true);
+ request.send();
+ };
+ SharedAssetManager.prototype.loadTexture = function (clientId, textureLoader, path) {
+ var _this = this;
+ path = this.pathPrefix + path;
+ if (!this.queueAsset(clientId, textureLoader, path))
+ return;
+ var img = new Image();
+ img.src = path;
+ // img.crossOrigin = "anonymous";
+ img.onload = function (ev) {
+ _this.rawAssets[path] = img;
+ };
+ img.onerror = function (ev) {
+ _this.errors[path] = "Couldn't load image " + path;
+ };
+ };
+ SharedAssetManager.prototype.get = function (clientId, path) {
+ path = this.pathPrefix + path;
+ var clientAssets = this.clientAssets[clientId];
+ if (clientAssets === null || clientAssets === undefined)
+ return true;
+ return clientAssets.assets[path];
+ };
+ SharedAssetManager.prototype.updateClientAssets = function (clientAssets) {
+ for (var i = 0; i < clientAssets.toLoad.length; i++) {
+ var path = clientAssets.toLoad[i];
+ var asset = clientAssets.assets[path];
+ if (asset === null || asset === undefined) {
+ var rawAsset = this.rawAssets[path];
+ if (rawAsset === null || rawAsset === undefined)
+ continue;
+ if (rawAsset instanceof HTMLImageElement) {
+ clientAssets.assets[path] = clientAssets.textureLoader(rawAsset);
+ }
+ else {
+ clientAssets.assets[path] = rawAsset;
+ }
+ }
+ }
+ };
+ SharedAssetManager.prototype.isLoadingComplete = function (clientId) {
+ var clientAssets = this.clientAssets[clientId];
+ if (clientAssets === null || clientAssets === undefined)
+ return true;
+ this.updateClientAssets(clientAssets);
+ return clientAssets.toLoad.length == clientAssets.loaded();
+ };
+ SharedAssetManager.prototype.dispose = function () {
+ };
+ SharedAssetManager.prototype.hasErrors = function () {
+ return Object.keys(this.errors).length > 0;
+ };
+ SharedAssetManager.prototype.getErrors = function () {
+ return this.errors;
+ };
+ return SharedAssetManager;
+ }());
+ spine.SharedAssetManager = SharedAssetManager;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Skeleton = (function () {
+ function Skeleton(data) {
+ this._updateCache = new Array();
+ this.updateCacheReset = new Array();
+ this.time = 0;
+ this.flipX = false;
+ this.flipY = false;
+ this.x = 0;
+ this.y = 0;
+ if (data == null)
+ throw new Error("data cannot be null.");
+ this.data = data;
+ this.bones = new Array();
+ for (var i = 0; i < data.bones.length; i++) {
+ var boneData = data.bones[i];
+ var bone = void 0;
+ if (boneData.parent == null)
+ bone = new spine.Bone(boneData, this, null);
+ else {
+ var parent_1 = this.bones[boneData.parent.index];
+ bone = new spine.Bone(boneData, this, parent_1);
+ parent_1.children.push(bone);
+ }
+ this.bones.push(bone);
+ }
+ this.slots = new Array();
+ this.drawOrder = new Array();
+ for (var i = 0; i < data.slots.length; i++) {
+ var slotData = data.slots[i];
+ var bone = this.bones[slotData.boneData.index];
+ var slot = new spine.Slot(slotData, bone);
+ this.slots.push(slot);
+ this.drawOrder.push(slot);
+ }
+ this.ikConstraints = new Array();
+ for (var i = 0; i < data.ikConstraints.length; i++) {
+ var ikConstraintData = data.ikConstraints[i];
+ this.ikConstraints.push(new spine.IkConstraint(ikConstraintData, this));
+ }
+ this.transformConstraints = new Array();
+ for (var i = 0; i < data.transformConstraints.length; i++) {
+ var transformConstraintData = data.transformConstraints[i];
+ this.transformConstraints.push(new spine.TransformConstraint(transformConstraintData, this));
+ }
+ this.pathConstraints = new Array();
+ for (var i = 0; i < data.pathConstraints.length; i++) {
+ var pathConstraintData = data.pathConstraints[i];
+ this.pathConstraints.push(new spine.PathConstraint(pathConstraintData, this));
+ }
+ this.color = new spine.Color(1, 1, 1, 1);
+ this.updateCache();
+ }
+ Skeleton.prototype.updateCache = function () {
+ var updateCache = this._updateCache;
+ updateCache.length = 0;
+ this.updateCacheReset.length = 0;
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++)
+ bones[i].sorted = false;
+ var ikConstraints = this.ikConstraints;
+ var transformConstraints = this.transformConstraints;
+ var pathConstraints = this.pathConstraints;
+ var ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length;
+ var constraintCount = ikCount + transformCount + pathCount;
+ outer: for (var i = 0; i < constraintCount; i++) {
+ for (var ii = 0; ii < ikCount; ii++) {
+ var constraint = ikConstraints[ii];
+ if (constraint.data.order == i) {
+ this.sortIkConstraint(constraint);
+ continue outer;
+ }
+ }
+ for (var ii = 0; ii < transformCount; ii++) {
+ var constraint = transformConstraints[ii];
+ if (constraint.data.order == i) {
+ this.sortTransformConstraint(constraint);
+ continue outer;
+ }
+ }
+ for (var ii = 0; ii < pathCount; ii++) {
+ var constraint = pathConstraints[ii];
+ if (constraint.data.order == i) {
+ this.sortPathConstraint(constraint);
+ continue outer;
+ }
+ }
+ }
+ for (var i = 0, n = bones.length; i < n; i++)
+ this.sortBone(bones[i]);
+ };
+ Skeleton.prototype.sortIkConstraint = function (constraint) {
+ var target = constraint.target;
+ this.sortBone(target);
+ var constrained = constraint.bones;
+ var parent = constrained[0];
+ this.sortBone(parent);
+ if (constrained.length > 1) {
+ var child = constrained[constrained.length - 1];
+ if (!(this._updateCache.indexOf(child) > -1))
+ this.updateCacheReset.push(child);
+ }
+ this._updateCache.push(constraint);
+ this.sortReset(parent.children);
+ constrained[constrained.length - 1].sorted = true;
+ };
+ Skeleton.prototype.sortPathConstraint = function (constraint) {
+ var slot = constraint.target;
+ var slotIndex = slot.data.index;
+ var slotBone = slot.bone;
+ if (this.skin != null)
+ this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
+ if (this.data.defaultSkin != null && this.data.defaultSkin != this.skin)
+ this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
+ for (var i = 0, n = this.data.skins.length; i < n; i++)
+ this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
+ var attachment = slot.getAttachment();
+ if (attachment instanceof spine.PathAttachment)
+ this.sortPathConstraintAttachmentWith(attachment, slotBone);
+ var constrained = constraint.bones;
+ var boneCount = constrained.length;
+ for (var i = 0; i < boneCount; i++)
+ this.sortBone(constrained[i]);
+ this._updateCache.push(constraint);
+ for (var i = 0; i < boneCount; i++)
+ this.sortReset(constrained[i].children);
+ for (var i = 0; i < boneCount; i++)
+ constrained[i].sorted = true;
+ };
+ Skeleton.prototype.sortTransformConstraint = function (constraint) {
+ this.sortBone(constraint.target);
+ var constrained = constraint.bones;
+ var boneCount = constrained.length;
+ if (constraint.data.local) {
+ for (var i = 0; i < boneCount; i++) {
+ var child = constrained[i];
+ this.sortBone(child.parent);
+ if (!(this._updateCache.indexOf(child) > -1))
+ this.updateCacheReset.push(child);
+ }
+ }
+ else {
+ for (var i = 0; i < boneCount; i++) {
+ this.sortBone(constrained[i]);
+ }
+ }
+ this._updateCache.push(constraint);
+ for (var ii = 0; ii < boneCount; ii++)
+ this.sortReset(constrained[ii].children);
+ for (var ii = 0; ii < boneCount; ii++)
+ constrained[ii].sorted = true;
+ };
+ Skeleton.prototype.sortPathConstraintAttachment = function (skin, slotIndex, slotBone) {
+ var attachments = skin.attachments[slotIndex];
+ if (!attachments)
+ return;
+ for (var key in attachments) {
+ this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
+ }
+ };
+ Skeleton.prototype.sortPathConstraintAttachmentWith = function (attachment, slotBone) {
+ if (!(attachment instanceof spine.PathAttachment))
+ return;
+ var pathBones = attachment.bones;
+ if (pathBones == null)
+ this.sortBone(slotBone);
+ else {
+ var bones = this.bones;
+ var i = 0;
+ while (i < pathBones.length) {
+ var boneCount = pathBones[i++];
+ for (var n = i + boneCount; i < n; i++) {
+ var boneIndex = pathBones[i];
+ this.sortBone(bones[boneIndex]);
+ }
+ }
+ }
+ };
+ Skeleton.prototype.sortBone = function (bone) {
+ if (bone.sorted)
+ return;
+ var parent = bone.parent;
+ if (parent != null)
+ this.sortBone(parent);
+ bone.sorted = true;
+ this._updateCache.push(bone);
+ };
+ Skeleton.prototype.sortReset = function (bones) {
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (bone.sorted)
+ this.sortReset(bone.children);
+ bone.sorted = false;
+ }
+ };
+ Skeleton.prototype.updateWorldTransform = function () {
+ var updateCacheReset = this.updateCacheReset;
+ for (var i = 0, n = updateCacheReset.length; i < n; i++) {
+ var bone = updateCacheReset[i];
+ bone.ax = bone.x;
+ bone.ay = bone.y;
+ bone.arotation = bone.rotation;
+ bone.ascaleX = bone.scaleX;
+ bone.ascaleY = bone.scaleY;
+ bone.ashearX = bone.shearX;
+ bone.ashearY = bone.shearY;
+ bone.appliedValid = true;
+ }
+ var updateCache = this._updateCache;
+ for (var i = 0, n = updateCache.length; i < n; i++)
+ updateCache[i].update();
+ };
+ Skeleton.prototype.setToSetupPose = function () {
+ this.setBonesToSetupPose();
+ this.setSlotsToSetupPose();
+ };
+ Skeleton.prototype.setBonesToSetupPose = function () {
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++)
+ bones[i].setToSetupPose();
+ var ikConstraints = this.ikConstraints;
+ for (var i = 0, n = ikConstraints.length; i < n; i++) {
+ var constraint = ikConstraints[i];
+ constraint.bendDirection = constraint.data.bendDirection;
+ constraint.mix = constraint.data.mix;
+ }
+ var transformConstraints = this.transformConstraints;
+ for (var i = 0, n = transformConstraints.length; i < n; i++) {
+ var constraint = transformConstraints[i];
+ var data = constraint.data;
+ constraint.rotateMix = data.rotateMix;
+ constraint.translateMix = data.translateMix;
+ constraint.scaleMix = data.scaleMix;
+ constraint.shearMix = data.shearMix;
+ }
+ var pathConstraints = this.pathConstraints;
+ for (var i = 0, n = pathConstraints.length; i < n; i++) {
+ var constraint = pathConstraints[i];
+ var data = constraint.data;
+ constraint.position = data.position;
+ constraint.spacing = data.spacing;
+ constraint.rotateMix = data.rotateMix;
+ constraint.translateMix = data.translateMix;
+ }
+ };
+ Skeleton.prototype.setSlotsToSetupPose = function () {
+ var slots = this.slots;
+ spine.Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
+ for (var i = 0, n = slots.length; i < n; i++)
+ slots[i].setToSetupPose();
+ };
+ Skeleton.prototype.getRootBone = function () {
+ if (this.bones.length == 0)
+ return null;
+ return this.bones[0];
+ };
+ Skeleton.prototype.findBone = function (boneName) {
+ if (boneName == null)
+ throw new Error("boneName cannot be null.");
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (bone.data.name == boneName)
+ return bone;
+ }
+ return null;
+ };
+ Skeleton.prototype.findBoneIndex = function (boneName) {
+ if (boneName == null)
+ throw new Error("boneName cannot be null.");
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++)
+ if (bones[i].data.name == boneName)
+ return i;
+ return -1;
+ };
+ Skeleton.prototype.findSlot = function (slotName) {
+ if (slotName == null)
+ throw new Error("slotName cannot be null.");
+ var slots = this.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ if (slot.data.name == slotName)
+ return slot;
+ }
+ return null;
+ };
+ Skeleton.prototype.findSlotIndex = function (slotName) {
+ if (slotName == null)
+ throw new Error("slotName cannot be null.");
+ var slots = this.slots;
+ for (var i = 0, n = slots.length; i < n; i++)
+ if (slots[i].data.name == slotName)
+ return i;
+ return -1;
+ };
+ Skeleton.prototype.setSkinByName = function (skinName) {
+ var skin = this.data.findSkin(skinName);
+ if (skin == null)
+ throw new Error("Skin not found: " + skinName);
+ this.setSkin(skin);
+ };
+ Skeleton.prototype.setSkin = function (newSkin) {
+ if (newSkin != null) {
+ if (this.skin != null)
+ newSkin.attachAll(this, this.skin);
+ else {
+ var slots = this.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ var name_1 = slot.data.attachmentName;
+ if (name_1 != null) {
+ var attachment = newSkin.getAttachment(i, name_1);
+ if (attachment != null)
+ slot.setAttachment(attachment);
+ }
+ }
+ }
+ }
+ this.skin = newSkin;
+ };
+ Skeleton.prototype.getAttachmentByName = function (slotName, attachmentName) {
+ return this.getAttachment(this.data.findSlotIndex(slotName), attachmentName);
+ };
+ Skeleton.prototype.getAttachment = function (slotIndex, attachmentName) {
+ if (attachmentName == null)
+ throw new Error("attachmentName cannot be null.");
+ if (this.skin != null) {
+ var attachment = this.skin.getAttachment(slotIndex, attachmentName);
+ if (attachment != null)
+ return attachment;
+ }
+ if (this.data.defaultSkin != null)
+ return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
+ return null;
+ };
+ Skeleton.prototype.setAttachment = function (slotName, attachmentName) {
+ if (slotName == null)
+ throw new Error("slotName cannot be null.");
+ var slots = this.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ if (slot.data.name == slotName) {
+ var attachment = null;
+ if (attachmentName != null) {
+ attachment = this.getAttachment(i, attachmentName);
+ if (attachment == null)
+ throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
+ }
+ slot.setAttachment(attachment);
+ return;
+ }
+ }
+ throw new Error("Slot not found: " + slotName);
+ };
+ Skeleton.prototype.findIkConstraint = function (constraintName) {
+ if (constraintName == null)
+ throw new Error("constraintName cannot be null.");
+ var ikConstraints = this.ikConstraints;
+ for (var i = 0, n = ikConstraints.length; i < n; i++) {
+ var ikConstraint = ikConstraints[i];
+ if (ikConstraint.data.name == constraintName)
+ return ikConstraint;
+ }
+ return null;
+ };
+ Skeleton.prototype.findTransformConstraint = function (constraintName) {
+ if (constraintName == null)
+ throw new Error("constraintName cannot be null.");
+ var transformConstraints = this.transformConstraints;
+ for (var i = 0, n = transformConstraints.length; i < n; i++) {
+ var constraint = transformConstraints[i];
+ if (constraint.data.name == constraintName)
+ return constraint;
+ }
+ return null;
+ };
+ Skeleton.prototype.findPathConstraint = function (constraintName) {
+ if (constraintName == null)
+ throw new Error("constraintName cannot be null.");
+ var pathConstraints = this.pathConstraints;
+ for (var i = 0, n = pathConstraints.length; i < n; i++) {
+ var constraint = pathConstraints[i];
+ if (constraint.data.name == constraintName)
+ return constraint;
+ }
+ return null;
+ };
+ Skeleton.prototype.getBounds = function (offset, size, temp) {
+ if (offset == null)
+ throw new Error("offset cannot be null.");
+ if (size == null)
+ throw new Error("size cannot be null.");
+ var drawOrder = this.drawOrder;
+ var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
+ for (var i = 0, n = drawOrder.length; i < n; i++) {
+ var slot = drawOrder[i];
+ var verticesLength = 0;
+ var vertices = null;
+ var attachment = slot.getAttachment();
+ if (attachment instanceof spine.RegionAttachment) {
+ verticesLength = 8;
+ vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
+ attachment.computeWorldVertices(slot.bone, vertices, 0, 2);
+ }
+ else if (attachment instanceof spine.MeshAttachment) {
+ var mesh = attachment;
+ verticesLength = mesh.worldVerticesLength;
+ vertices = spine.Utils.setArraySize(temp, verticesLength, 0);
+ mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
+ }
+ if (vertices != null) {
+ for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
+ var x = vertices[ii], y = vertices[ii + 1];
+ minX = Math.min(minX, x);
+ minY = Math.min(minY, y);
+ maxX = Math.max(maxX, x);
+ maxY = Math.max(maxY, y);
+ }
+ }
+ }
+ offset.set(minX, minY);
+ size.set(maxX - minX, maxY - minY);
+ };
+ Skeleton.prototype.update = function (delta) {
+ this.time += delta;
+ };
+ return Skeleton;
+ }());
+ spine.Skeleton = Skeleton;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var SkeletonBounds = (function () {
+ function SkeletonBounds() {
+ this.minX = 0;
+ this.minY = 0;
+ this.maxX = 0;
+ this.maxY = 0;
+ this.boundingBoxes = new Array();
+ this.polygons = new Array();
+ this.polygonPool = new spine.Pool(function () {
+ return spine.Utils.newFloatArray(16);
+ });
+ }
+ SkeletonBounds.prototype.update = function (skeleton, updateAabb) {
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ var boundingBoxes = this.boundingBoxes;
+ var polygons = this.polygons;
+ var polygonPool = this.polygonPool;
+ var slots = skeleton.slots;
+ var slotCount = slots.length;
+ boundingBoxes.length = 0;
+ polygonPool.freeAll(polygons);
+ polygons.length = 0;
+ for (var i = 0; i < slotCount; i++) {
+ var slot = slots[i];
+ var attachment = slot.getAttachment();
+ if (attachment instanceof spine.BoundingBoxAttachment) {
+ var boundingBox = attachment;
+ boundingBoxes.push(boundingBox);
+ var polygon = polygonPool.obtain();
+ if (polygon.length != boundingBox.worldVerticesLength) {
+ polygon = spine.Utils.newFloatArray(boundingBox.worldVerticesLength);
+ }
+ polygons.push(polygon);
+ boundingBox.computeWorldVertices(slot, 0, boundingBox.worldVerticesLength, polygon, 0, 2);
+ }
+ }
+ if (updateAabb) {
+ this.aabbCompute();
+ }
+ else {
+ this.minX = Number.POSITIVE_INFINITY;
+ this.minY = Number.POSITIVE_INFINITY;
+ this.maxX = Number.NEGATIVE_INFINITY;
+ this.maxY = Number.NEGATIVE_INFINITY;
+ }
+ };
+ SkeletonBounds.prototype.aabbCompute = function () {
+ var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
+ var polygons = this.polygons;
+ for (var i = 0, n = polygons.length; i < n; i++) {
+ var polygon = polygons[i];
+ var vertices = polygon;
+ for (var ii = 0, nn = polygon.length; ii < nn; ii += 2) {
+ var x = vertices[ii];
+ var y = vertices[ii + 1];
+ minX = Math.min(minX, x);
+ minY = Math.min(minY, y);
+ maxX = Math.max(maxX, x);
+ maxY = Math.max(maxY, y);
+ }
+ }
+ this.minX = minX;
+ this.minY = minY;
+ this.maxX = maxX;
+ this.maxY = maxY;
+ };
+ SkeletonBounds.prototype.aabbContainsPoint = function (x, y) {
+ return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
+ };
+ SkeletonBounds.prototype.aabbIntersectsSegment = function (x1, y1, x2, y2) {
+ var minX = this.minX;
+ var minY = this.minY;
+ var maxX = this.maxX;
+ var maxY = this.maxY;
+ if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY))
+ return false;
+ var m = (y2 - y1) / (x2 - x1);
+ var y = m * (minX - x1) + y1;
+ if (y > minY && y < maxY)
+ return true;
+ y = m * (maxX - x1) + y1;
+ if (y > minY && y < maxY)
+ return true;
+ var x = (minY - y1) / m + x1;
+ if (x > minX && x < maxX)
+ return true;
+ x = (maxY - y1) / m + x1;
+ if (x > minX && x < maxX)
+ return true;
+ return false;
+ };
+ SkeletonBounds.prototype.aabbIntersectsSkeleton = function (bounds) {
+ return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
+ };
+ SkeletonBounds.prototype.containsPoint = function (x, y) {
+ var polygons = this.polygons;
+ for (var i = 0, n = polygons.length; i < n; i++)
+ if (this.containsPointPolygon(polygons[i], x, y))
+ return this.boundingBoxes[i];
+ return null;
+ };
+ SkeletonBounds.prototype.containsPointPolygon = function (polygon, x, y) {
+ var vertices = polygon;
+ var nn = polygon.length;
+ var prevIndex = nn - 2;
+ var inside = false;
+ for (var ii = 0; ii < nn; ii += 2) {
+ var vertexY = vertices[ii + 1];
+ var prevY = vertices[prevIndex + 1];
+ if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) {
+ var vertexX = vertices[ii];
+ if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
+ inside = !inside;
+ }
+ prevIndex = ii;
+ }
+ return inside;
+ };
+ SkeletonBounds.prototype.intersectsSegment = function (x1, y1, x2, y2) {
+ var polygons = this.polygons;
+ for (var i = 0, n = polygons.length; i < n; i++)
+ if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
+ return this.boundingBoxes[i];
+ return null;
+ };
+ SkeletonBounds.prototype.intersectsSegmentPolygon = function (polygon, x1, y1, x2, y2) {
+ var vertices = polygon;
+ var nn = polygon.length;
+ var width12 = x1 - x2, height12 = y1 - y2;
+ var det1 = x1 * y2 - y1 * x2;
+ var x3 = vertices[nn - 2], y3 = vertices[nn - 1];
+ for (var ii = 0; ii < nn; ii += 2) {
+ var x4 = vertices[ii], y4 = vertices[ii + 1];
+ var det2 = x3 * y4 - y3 * x4;
+ var width34 = x3 - x4, height34 = y3 - y4;
+ var det3 = width12 * height34 - height12 * width34;
+ var x = (det1 * width34 - width12 * det2) / det3;
+ if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {
+ var y = (det1 * height34 - height12 * det2) / det3;
+ if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1)))
+ return true;
+ }
+ x3 = x4;
+ y3 = y4;
+ }
+ return false;
+ };
+ SkeletonBounds.prototype.getPolygon = function (boundingBox) {
+ if (boundingBox == null)
+ throw new Error("boundingBox cannot be null.");
+ var index = this.boundingBoxes.indexOf(boundingBox);
+ return index == -1 ? null : this.polygons[index];
+ };
+ SkeletonBounds.prototype.getWidth = function () {
+ return this.maxX - this.minX;
+ };
+ SkeletonBounds.prototype.getHeight = function () {
+ return this.maxY - this.minY;
+ };
+ return SkeletonBounds;
+ }());
+ spine.SkeletonBounds = SkeletonBounds;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var SkeletonClipping = (function () {
+ function SkeletonClipping() {
+ this.triangulator = new spine.Triangulator();
+ this.clippingPolygon = new Array();
+ this.clipOutput = new Array();
+ this.clippedVertices = new Array();
+ this.clippedTriangles = new Array();
+ this.scratch = new Array();
+ }
+ SkeletonClipping.prototype.clipStart = function (slot, clip) {
+ if (this.clipAttachment != null)
+ return 0;
+
+ this.clipSlot = slot;
+ this.clipAttachment = clip;
+ if (slot) {
+ var n = clip.worldVerticesLength;
+ var vertices = spine.Utils.setArraySize(this.clippingPolygon, n);
+ clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
+ } else {
+ this.clippingPolygon = clip.vertices.concat();
+ }
+
+ var clippingPolygon = this.clippingPolygon;
+ SkeletonClipping.makeClockwise(clippingPolygon);
+ var clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
+ for (var i = 0, n_1 = clippingPolygons.length; i < n_1; i++) {
+ var polygon = clippingPolygons[i];
+ SkeletonClipping.makeClockwise(polygon);
+ polygon.push(polygon[0]);
+ polygon.push(polygon[1]);
+ }
+ return clippingPolygons.length;
+ };
+ SkeletonClipping.prototype.clipEndWithSlot = function (slot) {
+ if (this.clipAttachment != null && this.clipAttachment.endSlot == slot.data)
+ this.clipEnd();
+ };
+ SkeletonClipping.prototype.clipEnd = function () {
+ if (this.clipAttachment == null)
+ return;
+
+ this.clipSlot = null;
+ this.clipAttachment = null;
+ this.clippingPolygons = null;
+ this.clippedVertices.length = 0;
+ this.clippedTriangles.length = 0;
+ this.clippingPolygon.length = 0;
+ };
+ SkeletonClipping.prototype.isClipping = function () {
+ return this.clipAttachment != null;
+ };
+ SkeletonClipping.prototype.clipTriangles = function (vertices, verticesLength, triangles, trianglesLength, uvs, light, dark, twoColor) {
+ var clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
+ var clippedTriangles = this.clippedTriangles;
+ var polygons = this.clippingPolygons;
+ var polygonsCount = this.clippingPolygons.length;
+ var vertexSize = twoColor ? 12 : 8;
+ var index = 0;
+ clippedVertices.length = 0;
+ clippedTriangles.length = 0;
+ outer: for (var i = 0; i < trianglesLength; i += 3) {
+ var vertexOffset = triangles[i] << 1;
+ var x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
+ var u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
+ vertexOffset = triangles[i + 1] << 1;
+ var x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
+ var u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
+ vertexOffset = triangles[i + 2] << 1;
+ var x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
+ var u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
+ for (var p = 0; p < polygonsCount; p++) {
+ var s = clippedVertices.length;
+ if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
+ var clipOutputLength = clipOutput.length;
+ if (clipOutputLength == 0)
+ continue;
+ var d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
+ var d = 1 / (d0 * d2 + d1 * (y1 - y3));
+ var clipOutputCount = clipOutputLength >> 1;
+ var clipOutputItems = this.clipOutput;
+ var clippedVerticesItems = spine.Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize);
+ for (var ii = 0; ii < clipOutputLength; ii += 2) {
+ var x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
+ clippedVerticesItems[s] = x;
+ clippedVerticesItems[s + 1] = y;
+ clippedVerticesItems[s + 2] = light.r;
+ clippedVerticesItems[s + 3] = light.g;
+ clippedVerticesItems[s + 4] = light.b;
+ clippedVerticesItems[s + 5] = light.a;
+ var c0 = x - x3, c1 = y - y3;
+ var a = (d0 * c0 + d1 * c1) * d;
+ var b = (d4 * c0 + d2 * c1) * d;
+ var c = 1 - a - b;
+ clippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c;
+ clippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c;
+ if (twoColor) {
+ clippedVerticesItems[s + 8] = dark.r;
+ clippedVerticesItems[s + 9] = dark.g;
+ clippedVerticesItems[s + 10] = dark.b;
+ clippedVerticesItems[s + 11] = dark.a;
+ }
+ s += vertexSize;
+ }
+ s = clippedTriangles.length;
+ var clippedTrianglesItems = spine.Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));
+ clipOutputCount--;
+ for (var ii = 1; ii < clipOutputCount; ii++) {
+ clippedTrianglesItems[s] = index;
+ clippedTrianglesItems[s + 1] = (index + ii);
+ clippedTrianglesItems[s + 2] = (index + ii + 1);
+ s += 3;
+ }
+ index += clipOutputCount + 1;
+ }
+ else {
+ var clippedVerticesItems = spine.Utils.setArraySize(clippedVertices, s + 3 * vertexSize);
+ clippedVerticesItems[s] = x1;
+ clippedVerticesItems[s + 1] = y1;
+ clippedVerticesItems[s + 2] = light.r;
+ clippedVerticesItems[s + 3] = light.g;
+ clippedVerticesItems[s + 4] = light.b;
+ clippedVerticesItems[s + 5] = light.a;
+ if (!twoColor) {
+ clippedVerticesItems[s + 6] = u1;
+ clippedVerticesItems[s + 7] = v1;
+ clippedVerticesItems[s + 8] = x2;
+ clippedVerticesItems[s + 9] = y2;
+ clippedVerticesItems[s + 10] = light.r;
+ clippedVerticesItems[s + 11] = light.g;
+ clippedVerticesItems[s + 12] = light.b;
+ clippedVerticesItems[s + 13] = light.a;
+ clippedVerticesItems[s + 14] = u2;
+ clippedVerticesItems[s + 15] = v2;
+ clippedVerticesItems[s + 16] = x3;
+ clippedVerticesItems[s + 17] = y3;
+ clippedVerticesItems[s + 18] = light.r;
+ clippedVerticesItems[s + 19] = light.g;
+ clippedVerticesItems[s + 20] = light.b;
+ clippedVerticesItems[s + 21] = light.a;
+ clippedVerticesItems[s + 22] = u3;
+ clippedVerticesItems[s + 23] = v3;
+ }
+ else {
+ clippedVerticesItems[s + 6] = u1;
+ clippedVerticesItems[s + 7] = v1;
+ clippedVerticesItems[s + 8] = dark.r;
+ clippedVerticesItems[s + 9] = dark.g;
+ clippedVerticesItems[s + 10] = dark.b;
+ clippedVerticesItems[s + 11] = dark.a;
+ clippedVerticesItems[s + 12] = x2;
+ clippedVerticesItems[s + 13] = y2;
+ clippedVerticesItems[s + 14] = light.r;
+ clippedVerticesItems[s + 15] = light.g;
+ clippedVerticesItems[s + 16] = light.b;
+ clippedVerticesItems[s + 17] = light.a;
+ clippedVerticesItems[s + 18] = u2;
+ clippedVerticesItems[s + 19] = v2;
+ clippedVerticesItems[s + 20] = dark.r;
+ clippedVerticesItems[s + 21] = dark.g;
+ clippedVerticesItems[s + 22] = dark.b;
+ clippedVerticesItems[s + 23] = dark.a;
+ clippedVerticesItems[s + 24] = x3;
+ clippedVerticesItems[s + 25] = y3;
+ clippedVerticesItems[s + 26] = light.r;
+ clippedVerticesItems[s + 27] = light.g;
+ clippedVerticesItems[s + 28] = light.b;
+ clippedVerticesItems[s + 29] = light.a;
+ clippedVerticesItems[s + 30] = u3;
+ clippedVerticesItems[s + 31] = v3;
+ clippedVerticesItems[s + 32] = dark.r;
+ clippedVerticesItems[s + 33] = dark.g;
+ clippedVerticesItems[s + 34] = dark.b;
+ clippedVerticesItems[s + 35] = dark.a;
+ }
+ s = clippedTriangles.length;
+ var clippedTrianglesItems = spine.Utils.setArraySize(clippedTriangles, s + 3);
+ clippedTrianglesItems[s] = index;
+ clippedTrianglesItems[s + 1] = (index + 1);
+ clippedTrianglesItems[s + 2] = (index + 2);
+ index += 3;
+ continue outer;
+ }
+ }
+ }
+ };
+ SkeletonClipping.prototype.clip = function (x1, y1, x2, y2, x3, y3, clippingArea, output) {
+ var originalOutput = output;
+ var clipped = false;
+ var input = null;
+ if (clippingArea.length % 4 >= 2) {
+ input = output;
+ output = this.scratch;
+ }
+ else
+ input = this.scratch;
+ input.length = 0;
+ input.push(x1);
+ input.push(y1);
+ input.push(x2);
+ input.push(y2);
+ input.push(x3);
+ input.push(y3);
+ input.push(x1);
+ input.push(y1);
+ output.length = 0;
+ var clippingVertices = clippingArea;
+ var clippingVerticesLast = clippingArea.length - 4;
+ for (var i = 0; ; i += 2) {
+ var edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
+ var edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];
+ var deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;
+ var inputVertices = input;
+ var inputVerticesLength = input.length - 2, outputStart = output.length;
+ for (var ii = 0; ii < inputVerticesLength; ii += 2) {
+ var inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
+ var inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3];
+ var side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0;
+ if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) {
+ if (side2) {
+ output.push(inputX2);
+ output.push(inputY2);
+ continue;
+ }
+ var c0 = inputY2 - inputY, c2 = inputX2 - inputX;
+ var ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY));
+ output.push(edgeX + (edgeX2 - edgeX) * ua);
+ output.push(edgeY + (edgeY2 - edgeY) * ua);
+ }
+ else if (side2) {
+ var c0 = inputY2 - inputY, c2 = inputX2 - inputX;
+ var ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY));
+ output.push(edgeX + (edgeX2 - edgeX) * ua);
+ output.push(edgeY + (edgeY2 - edgeY) * ua);
+ output.push(inputX2);
+ output.push(inputY2);
+ }
+ clipped = true;
+ }
+ if (outputStart == output.length) {
+ originalOutput.length = 0;
+ return true;
+ }
+ output.push(output[0]);
+ output.push(output[1]);
+ if (i == clippingVerticesLast)
+ break;
+ var temp = output;
+ output = input;
+ output.length = 0;
+ input = temp;
+ }
+ if (originalOutput != output) {
+ originalOutput.length = 0;
+ for (var i = 0, n = output.length - 2; i < n; i++)
+ originalOutput[i] = output[i];
+ }
+ else
+ originalOutput.length = originalOutput.length - 2;
+ return clipped;
+ };
+ SkeletonClipping.makeClockwise = function (polygon) {
+ var vertices = polygon;
+ var verticeslength = polygon.length;
+ var area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x = 0, p1y = 0, p2x = 0, p2y = 0;
+ for (var i = 0, n = verticeslength - 3; i < n; i += 2) {
+ p1x = vertices[i];
+ p1y = vertices[i + 1];
+ p2x = vertices[i + 2];
+ p2y = vertices[i + 3];
+ area += p1x * p2y - p2x * p1y;
+ }
+ if (area < 0)
+ return;
+ for (var i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
+ var x = vertices[i], y = vertices[i + 1];
+ var other = lastX - i;
+ vertices[i] = vertices[other];
+ vertices[i + 1] = vertices[other + 1];
+ vertices[other] = x;
+ vertices[other + 1] = y;
+ }
+ };
+ return SkeletonClipping;
+ }());
+ spine.SkeletonClipping = SkeletonClipping;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var SkeletonData = (function () {
+ function SkeletonData() {
+ this.bones = new Array();
+ this.slots = new Array();
+ this.skins = new Array();
+ this.events = new Array();
+ this.animations = new Array();
+ this.ikConstraints = new Array();
+ this.transformConstraints = new Array();
+ this.pathConstraints = new Array();
+ this.fps = 0;
+ }
+ SkeletonData.prototype.findBone = function (boneName) {
+ if (boneName == null)
+ throw new Error("boneName cannot be null.");
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (bone.name == boneName)
+ return bone;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findBoneIndex = function (boneName) {
+ if (boneName == null)
+ throw new Error("boneName cannot be null.");
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++)
+ if (bones[i].name == boneName)
+ return i;
+ return -1;
+ };
+ SkeletonData.prototype.findSlot = function (slotName) {
+ if (slotName == null)
+ throw new Error("slotName cannot be null.");
+ var slots = this.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ if (slot.name == slotName)
+ return slot;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findSlotIndex = function (slotName) {
+ if (slotName == null)
+ throw new Error("slotName cannot be null.");
+ var slots = this.slots;
+ for (var i = 0, n = slots.length; i < n; i++)
+ if (slots[i].name == slotName)
+ return i;
+ return -1;
+ };
+ SkeletonData.prototype.findSkin = function (skinName) {
+ if (skinName == null)
+ throw new Error("skinName cannot be null.");
+ var skins = this.skins;
+ for (var i = 0, n = skins.length; i < n; i++) {
+ var skin = skins[i];
+ if (skin.name == skinName)
+ return skin;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findEvent = function (eventDataName) {
+ if (eventDataName == null)
+ throw new Error("eventDataName cannot be null.");
+ var events = this.events;
+ for (var i = 0, n = events.length; i < n; i++) {
+ var event_4 = events[i];
+ if (event_4.name == eventDataName)
+ return event_4;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findAnimation = function (animationName) {
+ if (animationName == null)
+ throw new Error("animationName cannot be null.");
+ var animations = this.animations;
+ for (var i = 0, n = animations.length; i < n; i++) {
+ var animation = animations[i];
+ if (animation.name == animationName)
+ return animation;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findIkConstraint = function (constraintName) {
+ if (constraintName == null)
+ throw new Error("constraintName cannot be null.");
+ var ikConstraints = this.ikConstraints;
+ for (var i = 0, n = ikConstraints.length; i < n; i++) {
+ var constraint = ikConstraints[i];
+ if (constraint.name == constraintName)
+ return constraint;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findTransformConstraint = function (constraintName) {
+ if (constraintName == null)
+ throw new Error("constraintName cannot be null.");
+ var transformConstraints = this.transformConstraints;
+ for (var i = 0, n = transformConstraints.length; i < n; i++) {
+ var constraint = transformConstraints[i];
+ if (constraint.name == constraintName)
+ return constraint;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findPathConstraint = function (constraintName) {
+ if (constraintName == null)
+ throw new Error("constraintName cannot be null.");
+ var pathConstraints = this.pathConstraints;
+ for (var i = 0, n = pathConstraints.length; i < n; i++) {
+ var constraint = pathConstraints[i];
+ if (constraint.name == constraintName)
+ return constraint;
+ }
+ return null;
+ };
+ SkeletonData.prototype.findPathConstraintIndex = function (pathConstraintName) {
+ if (pathConstraintName == null)
+ throw new Error("pathConstraintName cannot be null.");
+ var pathConstraints = this.pathConstraints;
+ for (var i = 0, n = pathConstraints.length; i < n; i++)
+ if (pathConstraints[i].name == pathConstraintName)
+ return i;
+ return -1;
+ };
+ return SkeletonData;
+ }());
+ spine.SkeletonData = SkeletonData;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var SkeletonBinary = (function () {
+ function SkeletonBinary(attachmentLoader) {
+ this.scale = 1;
+ this.linkedMeshes = new Array();
+ this.attachmentLoader = attachmentLoader;
+ }
+ SkeletonBinary.prototype.readSkeletonData = function (binary) {
+ var scale = this.scale;
+ var skeletonData = new spine.SkeletonData();
+ skeletonData.name = "";
+
+ var input = new BinaryInput(binary);
+ skeletonData.hash = input.readString();
+ skeletonData.version = input.readString();
+ skeletonData.width = input.readFloat();
+ skeletonData.height = input.readFloat();
+ var nonessential = input.readBoolean();
+ if (nonessential) {
+ skeletonData.fps = input.readFloat();
+ skeletonData.imagesPath = input.readString();
+ }
+ var n = 0;
+ n = input.readInt(true);
+ for (var i = 0; i < n; i++) {
+ var name = input.readString();
+ var parent = (i == 0) ? null : skeletonData.bones[input.readInt(true)];
+ var data = new spine.BoneData(i, name, parent);
+ data.rotation = input.readFloat();
+ data.x = input.readFloat() * scale;
+ data.y = input.readFloat() * scale;
+ data.scaleX = input.readFloat();
+ data.scaleY = input.readFloat();
+ data.shearX = input.readFloat();
+ data.shearY = input.readFloat();
+ data.length = input.readFloat() * scale;
+ data.transformMode = SkeletonBinary.TransformModeValues[input.readInt(true)];
+
+ if (nonessential)
+ spine.Color.rgba8888ToColor(data.color, input.readInt32());
+ skeletonData.bones.push(data);
+ }
+
+ n = input.readInt(true);
+ for (var i = 0; i < n; i++) {
+ var slotName = input.readString();
+ var boneData = skeletonData.bones[input.readInt(true)];
+ var data = new spine.SlotData(i, slotName, boneData);
+ spine.Color.rgba8888ToColor(data.color, input.readInt32());
+
+ var darkColor = input.readInt32();
+ if (darkColor != -1)
+ spine.Color.rgb888ToColor(data.darkColor = new spine.Color(), darkColor);
+ data.attachmentName = input.readString();
+ data.blendMode = SkeletonBinary.BlendModeValues[input.readInt(true)];
+ skeletonData.slots.push(data);
+ }
+
+ n = input.readInt(true);
+ for (var i = 0, nn = void 0; i < n; i++) {
+ var data = new spine.IkConstraintData(input.readString());
+ data.order = input.readInt(true);
+ nn = input.readInt(true);
+ for (var ii = 0; ii < nn; ii++)
+ data.bones.push(skeletonData.bones[input.readInt(true)]);
+ data.target = skeletonData.bones[input.readInt(true)];
+ data.mix = input.readFloat();
+ data.bendDirection = input.readByte();
+ skeletonData.ikConstraints.push(data);
+ }
+
+ n = input.readInt(true);
+ for (var i = 0, nn = void 0; i < n; i++) {
+ var data = new spine.TransformConstraintData(input.readString());
+ data.order = input.readInt(true);;
+ nn = input.readInt(true);
+ for (var ii = 0; ii < nn; ii++)
+ data.bones.push(skeletonData.bones[input.readInt(true)]);
+ data.target = skeletonData.bones[input.readInt(true)];
+ data.local = input.readBoolean();
+ data.relative = input.readBoolean();
+ data.offsetRotation = input.readFloat();
+ data.offsetX = input.readFloat() * scale;
+ data.offsetY = input.readFloat() * scale;
+ data.offsetScaleX = input.readFloat();
+ data.offsetScaleY = input.readFloat();
+ data.offsetShearY = input.readFloat();
+ data.rotateMix = input.readFloat();
+ data.translateMix = input.readFloat();
+ data.scaleMix = input.readFloat();
+ data.shearMix = input.readFloat();
+ skeletonData.transformConstraints.push(data);
+ }
+
+ n = input.readInt(true);
+ for (var i = 0, nn = void 0; i < n; i++) {
+ var data = new spine.PathConstraintData(input.readString());
+ data.order = input.readInt(true);
+ nn = input.readInt(true);
+ for (var ii = 0; ii < nn; ii++)
+ data.bones.push(skeletonData.bones[input.readInt(true)]);
+ data.target = skeletonData.slots[input.readInt(true)];
+ data.positionMode = SkeletonBinary.PositionModeValues[input.readInt(true)];
+ data.spacingMode = SkeletonBinary.SpacingModeValues[input.readInt(true)];
+ data.rotateMode = SkeletonBinary.RotateModeValues[input.readInt(true)];
+ data.offsetRotation = input.readFloat();
+ data.position = input.readFloat();
+ if (data.positionMode == spine.PositionMode.Fixed)
+ data.position *= scale;
+ data.spacing = input.readFloat();
+ if (data.spacingMode == spine.SpacingMode.Length || data.spacingMode == spine.SpacingMode.Fixed)
+ data.spacing *= scale;
+ data.rotateMix = input.readFloat();
+ data.translateMix = input.readFloat();
+ skeletonData.pathConstraints.push(data);
+ }
+ var defaultSkin = this.readSkin(input, skeletonData, true, nonessential);
+ if (defaultSkin != null) {
+ skeletonData.defaultSkin = defaultSkin;
+ skeletonData.skins.push(defaultSkin);
+ }
+
+ n = input.readInt(true);
+ for (var i = 0; i < n; i++) {
+ skeletonData.skins.push(this.readSkin(input, skeletonData, false, nonessential));
+ }
+
+ n = this.linkedMeshes.length;
+ for (var i = 0; i < n; i++) {
+ var linkedMesh = this.linkedMeshes[i];
+ var skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
+ if (skin == null)
+ throw new Error("Skin not found: " + linkedMesh.skin);
+ var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
+ if (parent_3 == null)
+ throw new Error("Parent mesh not found: " + linkedMesh.parent);
+ linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh;
+ linkedMesh.mesh.setParentMesh(parent_3);
+ linkedMesh.mesh.updateUVs();
+ }
+ this.linkedMeshes.length = 0;
+
+ n = input.readInt(true);
+ for (var i = 0; i < n; i++) {
+ var data = new spine.EventData(input.readString());
+ data.intValue = input.readInt(false);
+ data.floatValue = input.readFloat();
+ data.stringValue = input.readString();
+ skeletonData.events.push(data);
+ }
+
+ n = input.readInt(true);
+ for (var i = 0; i < n; i++) {
+ skeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData));
+ }
+
+ return skeletonData;
+ };
+ SkeletonBinary.prototype.readSkin = function (input, skeletonData, defaultSkin, nonessential) {
+ var skin = new spine.Skin(defaultSkin ? "default" : input.readString());
+ if (!defaultSkin) {
+ skin.bones.length = input.readInt(true);
+ for (var i = 0, n = skin.bones.length; i < n; i++)
+ skin.bones[i] = skeletonData.bones[input.readInt(true)];
+ for (var i = 0, n = input.readInt(true); i < n; i++)
+ skin.constraints.push(skeletonData.ikConstraints[input.readInt(true)]);
+ for (var i = 0, n = input.readInt(true); i < n; i++)
+ skin.constraints.push(skeletonData.transformConstraints[input.readInt(true)]);
+ for (var i = 0, n = input.readInt(true); i < n; i++)
+ skin.constraints.push(skeletonData.pathConstraints[input.readInt(true)]);
+ }
+
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var slotIndex = input.readInt(true);
+ for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) {
+ var name_3 = input.readString();
+ var attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name_3, nonessential);
+ if (attachment != null)
+ skin.setAttachment(slotIndex, name_3, attachment);
+ }
+ }
+ return skin;
+ };
+ SkeletonBinary.prototype.readAttachment = function (input, skeletonData, skin, slotIndex, attachmentName, nonessential) {
+ var scale = this.scale;
+ var name = input.readString();
+ if (name == null)
+ name = attachmentName;
+ var typeIndex = input.readByte();
+ var type = SkeletonBinary.AttachmentTypeValues[typeIndex];
+ switch (type) {
+ case spine.AttachmentType.Region: {
+ var path = input.readString();
+ var rotation = input.readFloat();
+ var x = input.readFloat();
+ var y = input.readFloat();
+ var scaleX = input.readFloat();
+ var scaleY = input.readFloat();
+ var width = input.readFloat();
+ var height = input.readFloat();
+ var color = input.readInt32();
+ if (path == null)
+ path = name;
+ var region = this.attachmentLoader.newRegionAttachment(skin, name, path);
+ if (region == null)
+ return null;
+ region.path = path;
+ region.x = x * scale;
+ region.y = y * scale;
+ region.scaleX = scaleX;
+ region.scaleY = scaleY;
+ region.rotation = rotation;
+ region.width = width * scale;
+ region.height = height * scale;
+ spine.Color.rgba8888ToColor(region.color, color);
+ region.updateOffset();
+ return region;
+ }
+ case spine.AttachmentType.BoundingBox: {
+ var vertexCount = input.readInt(true);
+ var vertices = this.readVertices(input, vertexCount);
+ var color = nonessential ? input.readInt32() : 0;
+ var box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
+ if (box == null)
+ return null;
+ box.worldVerticesLength = vertexCount << 1;
+ box.vertices = vertices.vertices;
+ box.bones = vertices.bones;
+ if (nonessential)
+ spine.Color.rgba8888ToColor(box.color, color);
+ return box;
+ }
+ case spine.AttachmentType.Mesh: {
+ var path = input.readString();
+ var color = input.readInt32();
+ var vertexCount = input.readInt(true);
+ var uvs = this.readFloatArray(input, vertexCount << 1, 1);
+ var triangles = this.readShortArray(input);
+ var vertices = this.readVertices(input, vertexCount);
+ var hullLength = input.readInt(true);
+ var edges = null;
+ var width = 0, height = 0;
+ if (nonessential) {
+ edges = this.readShortArray(input);
+ width = input.readFloat();
+ height = input.readFloat();
+ }
+ if (path == null)
+ path = name;
+ var mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);
+ if (mesh == null)
+ return null;
+ mesh.path = path;
+ spine.Color.rgba8888ToColor(mesh.color, color);
+ mesh.bones = vertices.bones;
+ mesh.vertices = vertices.vertices;
+ mesh.worldVerticesLength = vertexCount << 1;
+ mesh.triangles = triangles;
+ mesh.regionUVs = uvs;
+ mesh.updateUVs();
+ mesh.hullLength = hullLength << 1;
+ if (nonessential) {
+ mesh.edges = edges;
+ mesh.width = width * scale;
+ mesh.height = height * scale;
+ }
+ return mesh;
+ }
+ case spine.AttachmentType.LinkedMesh: {
+ var path = input.readString();
+ var color = input.readInt32();
+ var skinName = input.readString();
+ var parent_4 = input.readString();
+ var inheritDeform = input.readBoolean();
+ var width = 0, height = 0;
+ if (nonessential) {
+ width = input.readFloat();
+ height = input.readFloat();
+ }
+ if (path == null)
+ path = name;
+ var mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);
+ if (mesh == null)
+ return null;
+ mesh.path = path;
+ spine.Color.rgba8888ToColor(mesh.color, color);
+ if (nonessential) {
+ mesh.width = width * scale;
+ mesh.height = height * scale;
+ }
+ this.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent_4, inheritDeform));
+ return mesh;
+ }
+ case spine.AttachmentType.Path: {
+ var closed_1 = input.readBoolean();
+ var constantSpeed = input.readBoolean();
+ var vertexCount = input.readInt(true);
+ var vertices = this.readVertices(input, vertexCount);
+ var lengths = spine.Utils.newArray(vertexCount / 3, 0);
+ for (var i = 0, n = lengths.length; i < n; i++)
+ lengths[i] = input.readFloat() * scale;
+ var color = nonessential ? input.readInt32() : 0;
+ var path = this.attachmentLoader.newPathAttachment(skin, name);
+ if (path == null)
+ return null;
+ path.closed = closed_1;
+ path.constantSpeed = constantSpeed;
+ path.worldVerticesLength = vertexCount << 1;
+ path.vertices = vertices.vertices;
+ path.bones = vertices.bones;
+ path.lengths = lengths;
+ if (nonessential)
+ spine.Color.rgba8888ToColor(path.color, color);
+ return path;
+ }
+ case spine.AttachmentType.Point: {
+ var rotation = input.readFloat();
+ var x = input.readFloat();
+ var y = input.readFloat();
+ var color = nonessential ? input.readInt32() : 0;
+ var point = this.attachmentLoader.newPointAttachment(skin, name);
+ if (point == null)
+ return null;
+ point.x = x * scale;
+ point.y = y * scale;
+ point.rotation = rotation;
+ if (nonessential)
+ spine.Color.rgba8888ToColor(point.color, color);
+ return point;
+ }
+ case spine.AttachmentType.Clipping: {
+ var endSlotIndex = input.readInt(true);
+ var vertexCount = input.readInt(true);
+ var vertices = this.readVertices(input, vertexCount);
+ var color = nonessential ? input.readInt32() : 0;
+ var clip = this.attachmentLoader.newClippingAttachment(skin, name);
+ if (clip == null)
+ return null;
+ clip.endSlot = skeletonData.slots[endSlotIndex];
+ clip.worldVerticesLength = vertexCount << 1;
+ clip.vertices = vertices.vertices;
+ clip.bones = vertices.bones;
+ if (nonessential)
+ spine.Color.rgba8888ToColor(clip.color, color);
+ return clip;
+ }
+ }
+ return null;
+ };
+ SkeletonBinary.prototype.readVertices = function (input, vertexCount) {
+ var verticesLength = vertexCount << 1;
+ var vertices = new Vertices();
+ var scale = this.scale;
+ if (!input.readBoolean()) {
+ vertices.vertices = this.readFloatArray(input, verticesLength, scale);
+ return vertices;
+ }
+ var weights = new Array();
+ var bonesArray = new Array();
+ for (var i = 0; i < vertexCount; i++) {
+ var boneCount = input.readInt(true);
+ bonesArray.push(boneCount);
+ for (var ii = 0; ii < boneCount; ii++) {
+ bonesArray.push(input.readInt(true));
+ weights.push(input.readFloat() * scale);
+ weights.push(input.readFloat() * scale);
+ weights.push(input.readFloat());
+ }
+ }
+ vertices.vertices = spine.Utils.toFloatArray(weights);
+ vertices.bones = bonesArray;
+ return vertices;
+ };
+
+ SkeletonBinary.prototype.readFloatArray = function (input, n, scale) {
+ var array = new Array(n);
+ if (scale == 1) {
+ for (var i = 0; i < n; i++)
+ array[i] = input.readFloat();
+ }
+ else {
+ for (var i = 0; i < n; i++)
+ array[i] = input.readFloat() * scale;
+ }
+ return array;
+ };
+ SkeletonBinary.prototype.readShortArray = function (input) {
+ var n = input.readInt(true);
+ var array = new Array(n);
+ for (var i = 0; i < n; i++)
+ array[i] = input.readShort();
+ return array;
+ };
+ SkeletonBinary.prototype.readAnimation = function (input, name, skeletonData) {
+ var timelines = new Array();
+ var scale = this.scale;
+ var duration = 0;
+
+ var tempColor1 = new spine.Color();
+ var tempColor2 = new spine.Color();
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var slotIndex = input.readInt(true);
+ for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) {
+ var timelineType = input.readByte();
+ var frameCount = input.readInt(true);
+ switch (timelineType) {
+ case SkeletonBinary.SLOT_ATTACHMENT: {
+ var timeline = new spine.AttachmentTimeline(frameCount);
+ timeline.slotIndex = slotIndex;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++)
+ timeline.setFrame(frameIndex, input.readFloat(), input.readString());
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[frameCount - 1]);
+ break;
+ }
+ case SkeletonBinary.SLOT_COLOR: {
+ var timeline = new spine.ColorTimeline(frameCount);
+ timeline.slotIndex = slotIndex;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ var time = input.readFloat();
+ spine.Color.rgba8888ToColor(tempColor1, input.readInt32());
+ timeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a);
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.ColorTimeline.ENTRIES]);
+ break;
+ }
+ case SkeletonBinary.SLOT_TWO_COLOR: {
+ var timeline = new spine.TwoColorTimeline(frameCount);
+ timeline.slotIndex = slotIndex;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ var time = input.readFloat();
+ spine.Color.rgba8888ToColor(tempColor1, input.readInt32());
+ spine.Color.rgb888ToColor(tempColor2, input.readInt32());
+ timeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a, tempColor2.r, tempColor2.g, tempColor2.b);
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.TwoColorTimeline.ENTRIES]);
+ break;
+ }
+ }
+ }
+ }
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var boneIndex = input.readInt(true);
+ for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) {
+ var timelineType = input.readByte();
+ var frameCount = input.readInt(true);
+ switch (timelineType) {
+ case SkeletonBinary.BONE_ROTATE: {
+ var timeline = new spine.RotateTimeline(frameCount);
+ timeline.boneIndex = boneIndex;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ timeline.setFrame(frameIndex, input.readFloat(), input.readFloat());
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.RotateTimeline.ENTRIES]);
+ break;
+ }
+ case SkeletonBinary.BONE_TRANSLATE:
+ case SkeletonBinary.BONE_SCALE:
+ case SkeletonBinary.BONE_SHEAR: {
+ var timeline = void 0;
+ var timelineScale = 1;
+ if (timelineType == SkeletonBinary.BONE_SCALE)
+ timeline = new spine.ScaleTimeline(frameCount);
+ else if (timelineType == SkeletonBinary.BONE_SHEAR)
+ timeline = new spine.ShearTimeline(frameCount);
+ else {
+ timeline = new spine.TranslateTimeline(frameCount);
+ timelineScale = scale;
+ }
+ timeline.boneIndex = boneIndex;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ timeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale, input.readFloat() * timelineScale);
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.TranslateTimeline.ENTRIES]);
+ break;
+ }
+ }
+ }
+ }
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var index = input.readInt(true);
+ var frameCount = input.readInt(true);
+ var timeline = new spine.IkConstraintTimeline(frameCount);
+ timeline.ikConstraintIndex = index;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ timeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readByte());
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.IkConstraintTimeline.ENTRIES]);
+ }
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var index = input.readInt(true);
+ var frameCount = input.readInt(true);
+ var timeline = new spine.TransformConstraintTimeline(frameCount);
+ timeline.transformConstraintIndex = index;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ timeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat());
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.TransformConstraintTimeline.ENTRIES]);
+ }
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var index = input.readInt(true);
+ var data = skeletonData.pathConstraints[index];
+ for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) {
+ var timelineType = input.readByte();
+ var frameCount = input.readInt(true);
+ switch (timelineType) {
+ case SkeletonBinary.PATH_POSITION:
+ case SkeletonBinary.PATH_SPACING: {
+ var timeline = void 0;
+ var timelineScale = 1;
+ if (timelineType == SkeletonBinary.PATH_SPACING) {
+ timeline = new spine.PathConstraintSpacingTimeline(frameCount);
+ if (data.spacingMode == spine.SpacingMode.Length || data.spacingMode == spine.SpacingMode.Fixed)
+ timelineScale = scale;
+ }
+ else {
+ timeline = new spine.PathConstraintPositionTimeline(frameCount);
+ if (data.positionMode == spine.PositionMode.Fixed)
+ timelineScale = scale;
+ }
+ timeline.pathConstraintIndex = index;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ timeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale);
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.PathConstraintPositionTimeline.ENTRIES]);
+ break;
+ }
+ case SkeletonBinary.PATH_MIX: {
+ var timeline = new spine.PathConstraintMixTimeline(frameCount);
+ timeline.pathConstraintIndex = index;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ timeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat());
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(frameCount - 1) * spine.PathConstraintMixTimeline.ENTRIES]);
+ break;
+ }
+ }
+ }
+ }
+ for (var i = 0, n = input.readInt(true); i < n; i++) {
+ var skin = skeletonData.skins[input.readInt(true)];
+ for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) {
+ var slotIndex = input.readInt(true);
+ for (var iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
+ var attachment = skin.getAttachment(slotIndex, input.readString());
+ var weighted = attachment.bones != null;
+ var vertices = attachment.vertices;
+ var deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;
+ var frameCount = input.readInt(true);
+ var timeline = new spine.DeformTimeline(frameCount);
+ timeline.slotIndex = slotIndex;
+ timeline.attachment = attachment;
+ for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) {
+ var time = input.readFloat();
+ var deform = void 0;
+ var end = input.readInt(true);
+ if (end == 0)
+ deform = weighted ? spine.Utils.newFloatArray(deformLength) : vertices;
+ else {
+ deform = spine.Utils.newFloatArray(deformLength);
+ var start = input.readInt(true);
+ end += start;
+ if (scale == 1) {
+ for (var v = start; v < end; v++)
+ deform[v] = input.readFloat();
+ }
+ else {
+ for (var v = start; v < end; v++)
+ deform[v] = input.readFloat() * scale;
+ }
+ if (!weighted) {
+ for (var v = 0, vn = deform.length; v < vn; v++)
+ deform[v] += vertices[v];
+ }
+ }
+ timeline.setFrame(frameIndex, time, deform);
+ if (frameIndex < frameCount - 1)
+ this.readCurve(input, frameIndex, timeline);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[frameCount - 1]);
+ }
+ }
+ }
+ var drawOrderCount = input.readInt(true);
+ if (drawOrderCount > 0) {
+ var timeline = new spine.DrawOrderTimeline(drawOrderCount);
+ var slotCount = skeletonData.slots.length;
+ for (var i = 0; i < drawOrderCount; i++) {
+ var time = input.readFloat();
+ var offsetCount = input.readInt(true);
+ var drawOrder = spine.Utils.newArray(slotCount, 0);
+ for (var ii = slotCount - 1; ii >= 0; ii--)
+ drawOrder[ii] = -1;
+ var unchanged = spine.Utils.newArray(slotCount - offsetCount, 0);
+ var originalIndex = 0, unchangedIndex = 0;
+ for (var ii = 0; ii < offsetCount; ii++) {
+ var slotIndex = input.readInt(true);
+ while (originalIndex != slotIndex)
+ unchanged[unchangedIndex++] = originalIndex++;
+ drawOrder[originalIndex + input.readInt(true)] = originalIndex++;
+ }
+ while (originalIndex < slotCount)
+ unchanged[unchangedIndex++] = originalIndex++;
+ for (var ii = slotCount - 1; ii >= 0; ii--)
+ if (drawOrder[ii] == -1)
+ drawOrder[ii] = unchanged[--unchangedIndex];
+ timeline.setFrame(i, time, drawOrder);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[drawOrderCount - 1]);
+ }
+ var eventCount = input.readInt(true);
+ if (eventCount > 0) {
+ var timeline = new spine.EventTimeline(eventCount);
+ for (var i = 0; i < eventCount; i++) {
+ var time = input.readFloat();
+ var eventData = skeletonData.events[input.readInt(true)];
+ var event_4 = new spine.Event(time, eventData);
+ event_4.intValue = input.readInt(false);
+ event_4.floatValue = input.readFloat();
+ event_4.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue;
+ if (event_4.data.audioPath != null) {
+ event_4.volume = input.readFloat();
+ event_4.balance = input.readFloat();
+ }
+ timeline.setFrame(i, event_4);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[eventCount - 1]);
+ }
+ return new spine.Animation(name, timelines, duration);
+ };
+ SkeletonBinary.prototype.readCurve = function (input, frameIndex, timeline) {
+ switch (input.readByte()) {
+ case SkeletonBinary.CURVE_STEPPED:
+ timeline.setStepped(frameIndex);
+ break;
+ case SkeletonBinary.CURVE_BEZIER:
+ this.setCurve(timeline, frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat());
+ break;
+ }
+ };
+ SkeletonBinary.prototype.setCurve = function (timeline, frameIndex, cx1, cy1, cx2, cy2) {
+ timeline.setCurve(frameIndex, cx1, cy1, cx2, cy2);
+ };
+ SkeletonBinary.AttachmentTypeValues = [0, 1, 2, 3, 4, 5, 6];
+ SkeletonBinary.TransformModeValues = [spine.TransformMode.Normal, spine.TransformMode.OnlyTranslation, spine.TransformMode.NoRotationOrReflection, spine.TransformMode.NoScale, spine.TransformMode.NoScaleOrReflection];
+ SkeletonBinary.PositionModeValues = [spine.PositionMode.Fixed, spine.PositionMode.Percent];
+ SkeletonBinary.SpacingModeValues = [spine.SpacingMode.Length, spine.SpacingMode.Fixed, spine.SpacingMode.Percent];
+ SkeletonBinary.RotateModeValues = [spine.RotateMode.Tangent, spine.RotateMode.Chain, spine.RotateMode.ChainScale];
+ SkeletonBinary.BlendModeValues = [spine.BlendMode.Normal, spine.BlendMode.Additive, spine.BlendMode.Multiply, spine.BlendMode.Screen];
+ SkeletonBinary.BONE_ROTATE = 0;
+ SkeletonBinary.BONE_TRANSLATE = 1;
+ SkeletonBinary.BONE_SCALE = 2;
+ SkeletonBinary.BONE_SHEAR = 3;
+ SkeletonBinary.SLOT_ATTACHMENT = 0;
+ SkeletonBinary.SLOT_COLOR = 1;
+ SkeletonBinary.SLOT_TWO_COLOR = 2;
+ SkeletonBinary.PATH_POSITION = 0;
+ SkeletonBinary.PATH_SPACING = 1;
+ SkeletonBinary.PATH_MIX = 2;
+ SkeletonBinary.CURVE_LINEAR = 0;
+ SkeletonBinary.CURVE_STEPPED = 1;
+ SkeletonBinary.CURVE_BEZIER = 2;
+ return SkeletonBinary;
+ }());
+ spine.SkeletonBinary = SkeletonBinary;
+ var BinaryInput = (function () {
+ function BinaryInput(data, strings, index, buffer) {
+ if (strings === void 0) { strings = new Array(); }
+ if (index === void 0) { index = 0; }
+ if (buffer === void 0) { buffer = new DataView(data.buffer); }
+ this.strings = strings;
+ this.index = index;
+ this.buffer = buffer;
+ }
+ BinaryInput.prototype.readByte = function () {
+ return this.buffer.getInt8(this.index++);
+ };
+ BinaryInput.prototype.readShort = function () {
+ var value = this.buffer.getInt16(this.index);
+ this.index += 2;
+ return value;
+ };
+ BinaryInput.prototype.readInt32 = function () {
+ var value = this.buffer.getInt32(this.index);
+ this.index += 4;
+ return value;
+ };
+ BinaryInput.prototype.readInt = function (optimizePositive) {
+ var b = this.readByte();
+ var result = b & 0x7F;
+ if ((b & 0x80) != 0) {
+ b = this.readByte();
+ result |= (b & 0x7F) << 7;
+ if ((b & 0x80) != 0) {
+ b = this.readByte();
+ result |= (b & 0x7F) << 14;
+ if ((b & 0x80) != 0) {
+ b = this.readByte();
+ result |= (b & 0x7F) << 21;
+ if ((b & 0x80) != 0) {
+ b = this.readByte();
+ result |= (b & 0x7F) << 28;
+ }
+ }
+ }
+ }
+ return optimizePositive ? result : ((result >>> 1) ^ -(result & 1));
+ };
+ BinaryInput.prototype.readStringRef = function () {
+ var index = this.readInt(true);
+ return index == 0 ? null : this.strings[index - 1];
+ };
+ BinaryInput.prototype.readString = function () {
+ var byteCount = this.readInt(true);
+ switch (byteCount) {
+ case 0:
+ return null;
+ case 1:
+ return "";
+ }
+ byteCount--;
+ var chars = "";
+ var charCount = 0;
+ for (var i = 0; i < byteCount;) {
+ var b = this.readByte();
+ switch (b >> 4) {
+ case 12:
+ case 13:
+ chars += String.fromCharCode(((b & 0x1F) << 6 | this.readByte() & 0x3F));
+ i += 2;
+ break;
+ case 14:
+ chars += String.fromCharCode(((b & 0x0F) << 12 | (this.readByte() & 0x3F) << 6 | this.readByte() & 0x3F));
+ i += 3;
+ break;
+ default:
+ chars += String.fromCharCode(b);
+ i++;
+ }
+ }
+ return chars;
+ };
+ BinaryInput.prototype.readFloat = function () {
+ var value = this.buffer.getFloat32(this.index);
+ this.index += 4;
+ return value;
+ };
+ BinaryInput.prototype.readBoolean = function () {
+ return this.readByte() != 0;
+ };
+ return BinaryInput;
+ }());
+
+ var SkeletonJson = (function () {
+ function SkeletonJson(attachmentLoader) {
+ this.scale = 1;
+ this.linkedMeshes = new Array();
+ this.attachmentLoader = attachmentLoader;
+ }
+ SkeletonJson.prototype.readSkeletonData = function (json) {
+ var scale = this.scale;
+ var skeletonData = new spine.SkeletonData();
+ var root = typeof (json) === "string" ? JSON.parse(json) : json;
+ var skeletonMap = root.skeleton;
+ if (skeletonMap != null) {
+ skeletonData.hash = skeletonMap.hash;
+ skeletonData.version = skeletonMap.spine;
+ skeletonData.width = skeletonMap.width;
+ skeletonData.height = skeletonMap.height;
+ skeletonData.fps = skeletonMap.fps;
+ skeletonData.imagesPath = skeletonMap.images;
+ }
+ if (root.bones) {
+ for (var i = 0; i < root.bones.length; i++) {
+ var boneMap = root.bones[i];
+ var parent_2 = null;
+ var parentName = this.getValue(boneMap, "parent", null);
+ if (parentName != null) {
+ parent_2 = skeletonData.findBone(parentName);
+ if (parent_2 == null)
+ throw new Error("Parent bone not found: " + parentName);
+ }
+ var data = new spine.BoneData(skeletonData.bones.length, boneMap.name, parent_2);
+ data.length = this.getValue(boneMap, "length", 0) * scale;
+ data.x = this.getValue(boneMap, "x", 0) * scale;
+ data.y = this.getValue(boneMap, "y", 0) * scale;
+ data.rotation = this.getValue(boneMap, "rotation", 0);
+ data.scaleX = this.getValue(boneMap, "scaleX", 1);
+ data.scaleY = this.getValue(boneMap, "scaleY", 1);
+ data.shearX = this.getValue(boneMap, "shearX", 0);
+ data.shearY = this.getValue(boneMap, "shearY", 0);
+ data.transformMode = SkeletonJson.transformModeFromString(this.getValue(boneMap, "transform", "normal"));
+ skeletonData.bones.push(data);
+ }
+ }
+ if (root.slots) {
+ for (var i = 0; i < root.slots.length; i++) {
+ var slotMap = root.slots[i];
+ var slotName = slotMap.name;
+ var boneName = slotMap.bone;
+ var boneData = skeletonData.findBone(boneName);
+ if (boneData == null)
+ throw new Error("Slot bone not found: " + boneName);
+ var data = new spine.SlotData(skeletonData.slots.length, slotName, boneData);
+ var color = this.getValue(slotMap, "color", null);
+ if (color != null)
+ data.color.setFromString(color);
+ var dark = this.getValue(slotMap, "dark", null);
+ if (dark != null) {
+ data.darkColor = new spine.Color(1, 1, 1, 1);
+ data.darkColor.setFromString(dark);
+ }
+ data.attachmentName = this.getValue(slotMap, "attachment", null);
+ data.blendMode = SkeletonJson.blendModeFromString(this.getValue(slotMap, "blend", "normal"));
+ skeletonData.slots.push(data);
+ }
+ }
+ if (root.ik) {
+ for (var i = 0; i < root.ik.length; i++) {
+ var constraintMap = root.ik[i];
+ var data = new spine.IkConstraintData(constraintMap.name);
+ data.order = this.getValue(constraintMap, "order", 0);
+ for (var j = 0; j < constraintMap.bones.length; j++) {
+ var boneName = constraintMap.bones[j];
+ var bone = skeletonData.findBone(boneName);
+ if (bone == null)
+ throw new Error("IK bone not found: " + boneName);
+ data.bones.push(bone);
+ }
+ var targetName = constraintMap.target;
+ data.target = skeletonData.findBone(targetName);
+ if (data.target == null)
+ throw new Error("IK target bone not found: " + targetName);
+ data.bendDirection = this.getValue(constraintMap, "bendPositive", true) ? 1 : -1;
+ data.mix = this.getValue(constraintMap, "mix", 1);
+ skeletonData.ikConstraints.push(data);
+ }
+ }
+ if (root.transform) {
+ for (var i = 0; i < root.transform.length; i++) {
+ var constraintMap = root.transform[i];
+ var data = new spine.TransformConstraintData(constraintMap.name);
+ data.order = this.getValue(constraintMap, "order", 0);
+ for (var j = 0; j < constraintMap.bones.length; j++) {
+ var boneName = constraintMap.bones[j];
+ var bone = skeletonData.findBone(boneName);
+ if (bone == null)
+ throw new Error("Transform constraint bone not found: " + boneName);
+ data.bones.push(bone);
+ }
+ var targetName = constraintMap.target;
+ data.target = skeletonData.findBone(targetName);
+ if (data.target == null)
+ throw new Error("Transform constraint target bone not found: " + targetName);
+ data.local = this.getValue(constraintMap, "local", false);
+ data.relative = this.getValue(constraintMap, "relative", false);
+ data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
+ data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
+ data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
+ data.offsetScaleX = this.getValue(constraintMap, "scaleX", 0);
+ data.offsetScaleY = this.getValue(constraintMap, "scaleY", 0);
+ data.offsetShearY = this.getValue(constraintMap, "shearY", 0);
+ data.rotateMix = this.getValue(constraintMap, "rotateMix", 1);
+ data.translateMix = this.getValue(constraintMap, "translateMix", 1);
+ data.scaleMix = this.getValue(constraintMap, "scaleMix", 1);
+ data.shearMix = this.getValue(constraintMap, "shearMix", 1);
+ skeletonData.transformConstraints.push(data);
+ }
+ }
+ if (root.path) {
+ for (var i = 0; i < root.path.length; i++) {
+ var constraintMap = root.path[i];
+ var data = new spine.PathConstraintData(constraintMap.name);
+ data.order = this.getValue(constraintMap, "order", 0);
+ for (var j = 0; j < constraintMap.bones.length; j++) {
+ var boneName = constraintMap.bones[j];
+ var bone = skeletonData.findBone(boneName);
+ if (bone == null)
+ throw new Error("Transform constraint bone not found: " + boneName);
+ data.bones.push(bone);
+ }
+ var targetName = constraintMap.target;
+ data.target = skeletonData.findSlot(targetName);
+ if (data.target == null)
+ throw new Error("Path target slot not found: " + targetName);
+ data.positionMode = SkeletonJson.positionModeFromString(this.getValue(constraintMap, "positionMode", "percent"));
+ data.spacingMode = SkeletonJson.spacingModeFromString(this.getValue(constraintMap, "spacingMode", "length"));
+ data.rotateMode = SkeletonJson.rotateModeFromString(this.getValue(constraintMap, "rotateMode", "tangent"));
+ data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
+ data.position = this.getValue(constraintMap, "position", 0);
+ if (data.positionMode == spine.PositionMode.Fixed)
+ data.position *= scale;
+ data.spacing = this.getValue(constraintMap, "spacing", 0);
+ if (data.spacingMode == spine.SpacingMode.Length || data.spacingMode == spine.SpacingMode.Fixed)
+ data.spacing *= scale;
+ data.rotateMix = this.getValue(constraintMap, "rotateMix", 1);
+ data.translateMix = this.getValue(constraintMap, "translateMix", 1);
+ skeletonData.pathConstraints.push(data);
+ }
+ }
+ if (root.skins) {
+ for (var skinName in root.skins) {
+ var skinMap = root.skins[skinName];
+ var skin = new spine.Skin(skinName);
+ for (var slotName in skinMap) {
+ var slotIndex = skeletonData.findSlotIndex(slotName);
+ if (slotIndex == -1)
+ throw new Error("Slot not found: " + slotName);
+ var slotMap = skinMap[slotName];
+ for (var entryName in slotMap) {
+ var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
+ if (attachment != null)
+ skin.addAttachment(slotIndex, entryName, attachment);
+ }
+ }
+ skeletonData.skins.push(skin);
+ if (skin.name == "default")
+ skeletonData.defaultSkin = skin;
+ }
+ }
+ for (var i = 0, n = this.linkedMeshes.length; i < n; i++) {
+ var linkedMesh = this.linkedMeshes[i];
+ var skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
+ if (skin == null)
+ throw new Error("Skin not found: " + linkedMesh.skin);
+ var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
+ if (parent_3 == null)
+ throw new Error("Parent mesh not found: " + linkedMesh.parent);
+ linkedMesh.mesh.setParentMesh(parent_3);
+ linkedMesh.mesh.updateUVs();
+ }
+ this.linkedMeshes.length = 0;
+ if (root.events) {
+ for (var eventName in root.events) {
+ var eventMap = root.events[eventName];
+ var data = new spine.EventData(eventName);
+ data.intValue = this.getValue(eventMap, "int", 0);
+ data.floatValue = this.getValue(eventMap, "float", 0);
+ data.stringValue = this.getValue(eventMap, "string", "");
+ skeletonData.events.push(data);
+ }
+ }
+ if (root.animations) {
+ for (var animationName in root.animations) {
+ var animationMap = root.animations[animationName];
+ this.readAnimation(animationMap, animationName, skeletonData);
+ }
+ }
+ return skeletonData;
+ };
+ SkeletonJson.prototype.readAttachment = function (map, skin, slotIndex, name, skeletonData) {
+ var scale = this.scale;
+ name = this.getValue(map, "name", name);
+ var type = this.getValue(map, "type", "region");
+ switch (type) {
+ case "region": {
+ var path = this.getValue(map, "path", name);
+ var region = this.attachmentLoader.newRegionAttachment(skin, name, path);
+ if (region == null)
+ return null;
+ region.path = path;
+ region.x = this.getValue(map, "x", 0) * scale;
+ region.y = this.getValue(map, "y", 0) * scale;
+ region.scaleX = this.getValue(map, "scaleX", 1);
+ region.scaleY = this.getValue(map, "scaleY", 1);
+ region.rotation = this.getValue(map, "rotation", 0);
+ region.width = map.width * scale;
+ region.height = map.height * scale;
+ var color = this.getValue(map, "color", null);
+ if (color != null)
+ region.color.setFromString(color);
+ region.updateOffset();
+ return region;
+ }
+ case "boundingbox": {
+ var box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
+ if (box == null)
+ return null;
+ this.readVertices(map, box, map.vertexCount << 1);
+ var color = this.getValue(map, "color", null);
+ if (color != null)
+ box.color.setFromString(color);
+ return box;
+ }
+ case "mesh":
+ case "linkedmesh": {
+ var path = this.getValue(map, "path", name);
+ var mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);
+ if (mesh == null)
+ return null;
+ mesh.path = path;
+ var color = this.getValue(map, "color", null);
+ if (color != null)
+ mesh.color.setFromString(color);
+ var parent_4 = this.getValue(map, "parent", null);
+ if (parent_4 != null) {
+ mesh.inheritDeform = this.getValue(map, "deform", true);
+ this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_4));
+ return mesh;
+ }
+ var uvs = map.uvs;
+ this.readVertices(map, mesh, uvs.length);
+ mesh.triangles = map.triangles;
+ mesh.regionUVs = uvs;
+ mesh.updateUVs();
+ mesh.hullLength = this.getValue(map, "hull", 0) * 2;
+ return mesh;
+ }
+ case "path": {
+ var path = this.attachmentLoader.newPathAttachment(skin, name);
+ if (path == null)
+ return null;
+ path.closed = this.getValue(map, "closed", false);
+ path.constantSpeed = this.getValue(map, "constantSpeed", true);
+ var vertexCount = map.vertexCount;
+ this.readVertices(map, path, vertexCount << 1);
+ var lengths = spine.Utils.newArray(vertexCount / 3, 0);
+ for (var i = 0; i < map.lengths.length; i++)
+ lengths[i] = map.lengths[i] * scale;
+ path.lengths = lengths;
+ var color = this.getValue(map, "color", null);
+ if (color != null)
+ path.color.setFromString(color);
+ return path;
+ }
+ case "point": {
+ var point = this.attachmentLoader.newPointAttachment(skin, name);
+ if (point == null)
+ return null;
+ point.x = this.getValue(map, "x", 0) * scale;
+ point.y = this.getValue(map, "y", 0) * scale;
+ point.rotation = this.getValue(map, "rotation", 0);
+ var color = this.getValue(map, "color", null);
+ if (color != null)
+ point.color.setFromString(color);
+ return point;
+ }
+ case "clipping": {
+ var clip = this.attachmentLoader.newClippingAttachment(skin, name);
+ if (clip == null)
+ return null;
+ var end = this.getValue(map, "end", null);
+ if (end != null) {
+ var slot = skeletonData.findSlot(end);
+ if (slot == null)
+ throw new Error("Clipping end slot not found: " + end);
+ clip.endSlot = slot;
+ }
+ var vertexCount = map.vertexCount;
+ this.readVertices(map, clip, vertexCount << 1);
+ var color = this.getValue(map, "color", null);
+ if (color != null)
+ clip.color.setFromString(color);
+ return clip;
+ }
+ }
+ return null;
+ };
+ SkeletonJson.prototype.readVertices = function (map, attachment, verticesLength) {
+ var scale = this.scale;
+ attachment.worldVerticesLength = verticesLength;
+ var vertices = map.vertices;
+ if (verticesLength == vertices.length) {
+ var scaledVertices = spine.Utils.toFloatArray(vertices);
+ if (scale != 1) {
+ for (var i = 0, n = vertices.length; i < n; i++)
+ scaledVertices[i] *= scale;
+ }
+ attachment.vertices = scaledVertices;
+ return;
+ }
+ var weights = new Array();
+ var bones = new Array();
+ for (var i = 0, n = vertices.length; i < n;) {
+ var boneCount = vertices[i++];
+ bones.push(boneCount);
+ for (var nn = i + boneCount * 4; i < nn; i += 4) {
+ bones.push(vertices[i]);
+ weights.push(vertices[i + 1] * scale);
+ weights.push(vertices[i + 2] * scale);
+ weights.push(vertices[i + 3]);
+ }
+ }
+ attachment.bones = bones;
+ attachment.vertices = spine.Utils.toFloatArray(weights);
+ };
+ SkeletonJson.prototype.readAnimation = function (map, name, skeletonData) {
+ var scale = this.scale;
+ var timelines = new Array();
+ var duration = 0;
+ if (map.slots) {
+ for (var slotName in map.slots) {
+ var slotMap = map.slots[slotName];
+ var slotIndex = skeletonData.findSlotIndex(slotName);
+ if (slotIndex == -1)
+ throw new Error("Slot not found: " + slotName);
+ for (var timelineName in slotMap) {
+ var timelineMap = slotMap[timelineName];
+ if (timelineName == "attachment") {
+ var timeline = new spine.AttachmentTimeline(timelineMap.length);
+ timeline.slotIndex = slotIndex;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ timeline.setFrame(frameIndex++, valueMap.time, valueMap.name);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);
+ }
+ else if (timelineName == "color") {
+ var timeline = new spine.ColorTimeline(timelineMap.length);
+ timeline.slotIndex = slotIndex;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ var color = new spine.Color();
+ color.setFromString(valueMap.color);
+ timeline.setFrame(frameIndex, valueMap.time, color.r, color.g, color.b, color.a);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.ColorTimeline.ENTRIES]);
+ }
+ else if (timelineName == "twoColor") {
+ var timeline = new spine.TwoColorTimeline(timelineMap.length);
+ timeline.slotIndex = slotIndex;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ var light = new spine.Color();
+ var dark = new spine.Color();
+ light.setFromString(valueMap.light);
+ dark.setFromString(valueMap.dark);
+ timeline.setFrame(frameIndex, valueMap.time, light.r, light.g, light.b, light.a, dark.r, dark.g, dark.b);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.TwoColorTimeline.ENTRIES]);
+ }
+ else
+ throw new Error("Invalid timeline type for a slot: " + timelineName + " (" + slotName + ")");
+ }
+ }
+ }
+ if (map.bones) {
+ for (var boneName in map.bones) {
+ var boneMap = map.bones[boneName];
+ var boneIndex = skeletonData.findBoneIndex(boneName);
+ if (boneIndex == -1)
+ throw new Error("Bone not found: " + boneName);
+ for (var timelineName in boneMap) {
+ var timelineMap = boneMap[timelineName];
+ if (timelineName === "rotate") {
+ var timeline = new spine.RotateTimeline(timelineMap.length);
+ timeline.boneIndex = boneIndex;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ timeline.setFrame(frameIndex, valueMap.time, valueMap.angle);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.RotateTimeline.ENTRIES]);
+ }
+ else if (timelineName === "translate" || timelineName === "scale" || timelineName === "shear") {
+ var timeline = null;
+ var timelineScale = 1;
+ if (timelineName === "scale")
+ timeline = new spine.ScaleTimeline(timelineMap.length);
+ else if (timelineName === "shear")
+ timeline = new spine.ShearTimeline(timelineMap.length);
+ else {
+ timeline = new spine.TranslateTimeline(timelineMap.length);
+ timelineScale = scale;
+ }
+ timeline.boneIndex = boneIndex;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ var x = this.getValue(valueMap, "x", 0), y = this.getValue(valueMap, "y", 0);
+ timeline.setFrame(frameIndex, valueMap.time, x * timelineScale, y * timelineScale);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.TranslateTimeline.ENTRIES]);
+ }
+ else
+ throw new Error("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")");
+ }
+ }
+ }
+ if (map.ik) {
+ for (var constraintName in map.ik) {
+ var constraintMap = map.ik[constraintName];
+ var constraint = skeletonData.findIkConstraint(constraintName);
+ var timeline = new spine.IkConstraintTimeline(constraintMap.length);
+ timeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf(constraint);
+ var frameIndex = 0;
+ for (var i = 0; i < constraintMap.length; i++) {
+ var valueMap = constraintMap[i];
+ timeline.setFrame(frameIndex, valueMap.time, this.getValue(valueMap, "mix", 1), this.getValue(valueMap, "bendPositive", true) ? 1 : -1);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.IkConstraintTimeline.ENTRIES]);
+ }
+ }
+ if (map.transform) {
+ for (var constraintName in map.transform) {
+ var constraintMap = map.transform[constraintName];
+ var constraint = skeletonData.findTransformConstraint(constraintName);
+ var timeline = new spine.TransformConstraintTimeline(constraintMap.length);
+ timeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf(constraint);
+ var frameIndex = 0;
+ for (var i = 0; i < constraintMap.length; i++) {
+ var valueMap = constraintMap[i];
+ timeline.setFrame(frameIndex, valueMap.time, this.getValue(valueMap, "rotateMix", 1), this.getValue(valueMap, "translateMix", 1), this.getValue(valueMap, "scaleMix", 1), this.getValue(valueMap, "shearMix", 1));
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.TransformConstraintTimeline.ENTRIES]);
+ }
+ }
+ if (map.paths) {
+ for (var constraintName in map.paths) {
+ var constraintMap = map.paths[constraintName];
+ var index = skeletonData.findPathConstraintIndex(constraintName);
+ if (index == -1)
+ throw new Error("Path constraint not found: " + constraintName);
+ var data = skeletonData.pathConstraints[index];
+ for (var timelineName in constraintMap) {
+ var timelineMap = constraintMap[timelineName];
+ if (timelineName === "position" || timelineName === "spacing") {
+ var timeline = null;
+ var timelineScale = 1;
+ if (timelineName === "spacing") {
+ timeline = new spine.PathConstraintSpacingTimeline(timelineMap.length);
+ if (data.spacingMode == spine.SpacingMode.Length || data.spacingMode == spine.SpacingMode.Fixed)
+ timelineScale = scale;
+ }
+ else {
+ timeline = new spine.PathConstraintPositionTimeline(timelineMap.length);
+ if (data.positionMode == spine.PositionMode.Fixed)
+ timelineScale = scale;
+ }
+ timeline.pathConstraintIndex = index;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ timeline.setFrame(frameIndex, valueMap.time, this.getValue(valueMap, timelineName, 0) * timelineScale);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.PathConstraintPositionTimeline.ENTRIES]);
+ }
+ else if (timelineName === "mix") {
+ var timeline = new spine.PathConstraintMixTimeline(timelineMap.length);
+ timeline.pathConstraintIndex = index;
+ var frameIndex = 0;
+ for (var i = 0; i < timelineMap.length; i++) {
+ var valueMap = timelineMap[i];
+ timeline.setFrame(frameIndex, valueMap.time, this.getValue(valueMap, "rotateMix", 1), this.getValue(valueMap, "translateMix", 1));
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * spine.PathConstraintMixTimeline.ENTRIES]);
+ }
+ }
+ }
+ }
+ if (map.deform) {
+ for (var deformName in map.deform) {
+ var deformMap = map.deform[deformName];
+ var skin = skeletonData.findSkin(deformName);
+ if (skin == null)
+ throw new Error("Skin not found: " + deformName);
+ for (var slotName in deformMap) {
+ var slotMap = deformMap[slotName];
+ var slotIndex = skeletonData.findSlotIndex(slotName);
+ if (slotIndex == -1)
+ throw new Error("Slot not found: " + slotMap.name);
+ for (var timelineName in slotMap) {
+ var timelineMap = slotMap[timelineName];
+ var attachment = skin.getAttachment(slotIndex, timelineName);
+ if (attachment == null)
+ throw new Error("Deform attachment not found: " + timelineMap.name);
+ var weighted = attachment.bones != null;
+ var vertices = attachment.vertices;
+ var deformLength = weighted ? vertices.length / 3 * 2 : vertices.length;
+ var timeline = new spine.DeformTimeline(timelineMap.length);
+ timeline.slotIndex = slotIndex;
+ timeline.attachment = attachment;
+ var frameIndex = 0;
+ for (var j = 0; j < timelineMap.length; j++) {
+ var valueMap = timelineMap[j];
+ var deform = void 0;
+ var verticesValue = this.getValue(valueMap, "vertices", null);
+ if (verticesValue == null)
+ deform = weighted ? spine.Utils.newFloatArray(deformLength) : vertices;
+ else {
+ deform = spine.Utils.newFloatArray(deformLength);
+ var start = this.getValue(valueMap, "offset", 0);
+ spine.Utils.arrayCopy(verticesValue, 0, deform, start, verticesValue.length);
+ if (scale != 1) {
+ for (var i = start, n = i + verticesValue.length; i < n; i++)
+ deform[i] *= scale;
+ }
+ if (!weighted) {
+ for (var i = 0; i < deformLength; i++)
+ deform[i] += vertices[i];
+ }
+ }
+ timeline.setFrame(frameIndex, valueMap.time, deform);
+ this.readCurve(valueMap, timeline, frameIndex);
+ frameIndex++;
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);
+ }
+ }
+ }
+ }
+ var drawOrderNode = map.drawOrder;
+ if (drawOrderNode == null)
+ drawOrderNode = map.draworder;
+ if (drawOrderNode != null) {
+ var timeline = new spine.DrawOrderTimeline(drawOrderNode.length);
+ var slotCount = skeletonData.slots.length;
+ var frameIndex = 0;
+ for (var j = 0; j < drawOrderNode.length; j++) {
+ var drawOrderMap = drawOrderNode[j];
+ var drawOrder = null;
+ var offsets = this.getValue(drawOrderMap, "offsets", null);
+ if (offsets != null) {
+ drawOrder = spine.Utils.newArray(slotCount, -1);
+ var unchanged = spine.Utils.newArray(slotCount - offsets.length, 0);
+ var originalIndex = 0, unchangedIndex = 0;
+ for (var i = 0; i < offsets.length; i++) {
+ var offsetMap = offsets[i];
+ var slotIndex = skeletonData.findSlotIndex(offsetMap.slot);
+ if (slotIndex == -1)
+ throw new Error("Slot not found: " + offsetMap.slot);
+ while (originalIndex != slotIndex)
+ unchanged[unchangedIndex++] = originalIndex++;
+ drawOrder[originalIndex + offsetMap.offset] = originalIndex++;
+ }
+ while (originalIndex < slotCount)
+ unchanged[unchangedIndex++] = originalIndex++;
+ for (var i = slotCount - 1; i >= 0; i--)
+ if (drawOrder[i] == -1)
+ drawOrder[i] = unchanged[--unchangedIndex];
+ }
+ timeline.setFrame(frameIndex++, drawOrderMap.time, drawOrder);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);
+ }
+ if (map.events) {
+ var timeline = new spine.EventTimeline(map.events.length);
+ var frameIndex = 0;
+ for (var i = 0; i < map.events.length; i++) {
+ var eventMap = map.events[i];
+ var eventData = skeletonData.findEvent(eventMap.name);
+ if (eventData == null)
+ throw new Error("Event not found: " + eventMap.name);
+ var event_5 = new spine.Event(spine.Utils.toSinglePrecision(eventMap.time), eventData);
+ event_5.intValue = this.getValue(eventMap, "int", eventData.intValue);
+ event_5.floatValue = this.getValue(eventMap, "float", eventData.floatValue);
+ event_5.stringValue = this.getValue(eventMap, "string", eventData.stringValue);
+ timeline.setFrame(frameIndex++, event_5);
+ }
+ timelines.push(timeline);
+ duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);
+ }
+ if (isNaN(duration)) {
+ throw new Error("Error while parsing animation, duration is NaN");
+ }
+ skeletonData.animations.push(new spine.Animation(name, timelines, duration));
+ };
+ SkeletonJson.prototype.readCurve = function (map, timeline, frameIndex) {
+ if (!map.curve)
+ return;
+ if (map.curve === "stepped")
+ timeline.setStepped(frameIndex);
+ else if (Object.prototype.toString.call(map.curve) === '[object Array]') {
+ var curve = map.curve;
+ timeline.setCurve(frameIndex, curve[0], curve[1], curve[2], curve[3]);
+ }
+ };
+ SkeletonJson.prototype.getValue = function (map, prop, defaultValue) {
+ return map[prop] !== undefined ? map[prop] : defaultValue;
+ };
+ SkeletonJson.blendModeFromString = function (str) {
+ str = str.toLowerCase();
+ if (str == "normal")
+ return spine.BlendMode.Normal;
+ if (str == "additive")
+ return spine.BlendMode.Additive;
+ if (str == "multiply")
+ return spine.BlendMode.Multiply;
+ if (str == "screen")
+ return spine.BlendMode.Screen;
+ throw new Error("Unknown blend mode: " + str);
+ };
+ SkeletonJson.positionModeFromString = function (str) {
+ str = str.toLowerCase();
+ if (str == "fixed")
+ return spine.PositionMode.Fixed;
+ if (str == "percent")
+ return spine.PositionMode.Percent;
+ throw new Error("Unknown position mode: " + str);
+ };
+ SkeletonJson.spacingModeFromString = function (str) {
+ str = str.toLowerCase();
+ if (str == "length")
+ return spine.SpacingMode.Length;
+ if (str == "fixed")
+ return spine.SpacingMode.Fixed;
+ if (str == "percent")
+ return spine.SpacingMode.Percent;
+ throw new Error("Unknown position mode: " + str);
+ };
+ SkeletonJson.rotateModeFromString = function (str) {
+ str = str.toLowerCase();
+ if (str == "tangent")
+ return spine.RotateMode.Tangent;
+ if (str == "chain")
+ return spine.RotateMode.Chain;
+ if (str == "chainscale")
+ return spine.RotateMode.ChainScale;
+ throw new Error("Unknown rotate mode: " + str);
+ };
+ SkeletonJson.transformModeFromString = function (str) {
+ str = str.toLowerCase();
+ if (str == "normal")
+ return spine.TransformMode.Normal;
+ if (str == "onlytranslation")
+ return spine.TransformMode.OnlyTranslation;
+ if (str == "norotationorreflection")
+ return spine.TransformMode.NoRotationOrReflection;
+ if (str == "noscale")
+ return spine.TransformMode.NoScale;
+ if (str == "noscaleorreflection")
+ return spine.TransformMode.NoScaleOrReflection;
+ throw new Error("Unknown transform mode: " + str);
+ };
+ return SkeletonJson;
+ }());
+ spine.SkeletonJson = SkeletonJson;
+
+ var LinkedMesh = (function () {
+ function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) {
+ this.mesh = mesh;
+ this.skin = skin;
+ this.slotIndex = slotIndex;
+ this.parent = parent;
+ this.inheritDeform = inheritDeform;
+ }
+ return LinkedMesh;
+ }());
+
+ var Vertices = (function () {
+ function Vertices(bones, vertices) {
+ if (bones === void 0) { bones = null; }
+ if (vertices === void 0) { vertices = null; }
+ this.bones = bones;
+ this.vertices = vertices;
+ }
+ return Vertices;
+ }());
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Skin = (function () {
+ function Skin(name) {
+ this.attachments = new Array();
+ this.bones = Array();
+ this.constraints = new Array();
+ if (name == null)
+ throw new Error("name cannot be null.");
+ this.name = name;
+ }
+ Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
+ if (attachment == null)
+ throw new Error("attachment cannot be null.");
+ var attachments = this.attachments;
+ if (slotIndex >= attachments.length)
+ attachments.length = slotIndex + 1;
+ if (!attachments[slotIndex])
+ attachments[slotIndex] = {};
+ attachments[slotIndex][name] = attachment;
+ };
+ Skin.prototype.addAttachment = function (slotIndex, name, attachment) {
+ if (attachment == null)
+ throw new Error("attachment cannot be null.");
+ var attachments = this.attachments;
+ if (slotIndex >= attachments.length)
+ attachments.length = slotIndex + 1;
+ if (!attachments[slotIndex])
+ attachments[slotIndex] = {};
+ attachments[slotIndex][name] = attachment;
+ };
+ Skin.prototype.getAttachment = function (slotIndex, name) {
+ var dictionary = this.attachments[slotIndex];
+ return dictionary ? dictionary[name] : null;
+ };
+ Skin.prototype.addSkin = function (skin) {
+ for (var i = 0; i < skin.bones.length; i++) {
+ var bone = skin.bones[i];
+ var contained = false;
+ for (var j = 0; j < this.bones.length; j++) {
+ if (this.bones[j] == bone) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained)
+ this.bones.push(bone);
+ }
+ for (var i = 0; i < skin.constraints.length; i++) {
+ var constraint = skin.constraints[i];
+ var contained = false;
+ for (var j = 0; j < this.constraints.length; j++) {
+ if (this.constraints[j] == constraint) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained)
+ this.constraints.push(constraint);
+ }
+ var attachments = skin.getAttachments();
+ for (var i = 0; i < attachments.length; i++) {
+ var attachment = attachments[i];
+ this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
+ }
+ };
+ Skin.prototype.copySkin = function (skin) {
+ for (var i = 0; i < skin.bones.length; i++) {
+ var bone = skin.bones[i];
+ var contained = false;
+ for (var j = 0; j < this.bones.length; j++) {
+ if (this.bones[j] == bone) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained)
+ this.bones.push(bone);
+ }
+ for (var i = 0; i < skin.constraints.length; i++) {
+ var constraint = skin.constraints[i];
+ var contained = false;
+ for (var j = 0; j < this.constraints.length; j++) {
+ if (this.constraints[j] == constraint) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained)
+ this.constraints.push(constraint);
+ }
+ var attachments = skin.getAttachments();
+ for (var i = 0; i < attachments.length; i++) {
+ var attachment = attachments[i];
+ if (attachment.attachment == null)
+ continue;
+ if (attachment.attachment instanceof spine.MeshAttachment) {
+ attachment.attachment = attachment.attachment.newLinkedMesh();
+ this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
+ }
+ else {
+ attachment.attachment = attachment.attachment.copy();
+ this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
+ }
+ }
+ };
+ Skin.prototype.getAttachment = function (slotIndex, name) {
+ var dictionary = this.attachments[slotIndex];
+ return dictionary ? dictionary[name] : null;
+ };
+ Skin.prototype.removeAttachment = function (slotIndex, name) {
+ var dictionary = this.attachments[slotIndex];
+ if (dictionary)
+ dictionary[name] = null;
+ };
+ Skin.prototype.getAttachments = function () {
+ var entries = new Array();
+ for (var i = 0; i < this.attachments.length; i++) {
+ var slotAttachments = this.attachments[i];
+ if (slotAttachments) {
+ for (var name_4 in slotAttachments) {
+ var attachment = slotAttachments[name_4];
+ if (attachment)
+ entries.push(new SkinEntry(i, name_4, attachment));
+ }
+ }
+ }
+ return entries;
+ };
+ Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
+ var slotAttachments = this.attachments[slotIndex];
+ if (slotAttachments) {
+ for (var name_5 in slotAttachments) {
+ var attachment = slotAttachments[name_5];
+ if (attachment)
+ attachments.push(new SkinEntry(slotIndex, name_5, attachment));
+ }
+ }
+ };
+ Skin.prototype.clear = function () {
+ this.attachments.length = 0;
+ this.bones.length = 0;
+ this.constraints.length = 0;
+ };
+ Skin.prototype.attachAll = function (skeleton, oldSkin) {
+ var slotIndex = 0;
+ for (var i = 0; i < skeleton.slots.length; i++) {
+ var slot = skeleton.slots[i];
+ var slotAttachment = slot.getAttachment();
+ if (slotAttachment && slotIndex < oldSkin.attachments.length) {
+ var dictionary = oldSkin.attachments[slotIndex];
+ for (var key in dictionary) {
+ var skinAttachment = dictionary[key];
+ if (slotAttachment == skinAttachment) {
+ var attachment = this.getAttachment(slotIndex, key);
+ if (attachment != null)
+ slot.setAttachment(attachment);
+ break;
+ }
+ }
+ }
+ slotIndex++;
+ }
+ };
+ return Skin;
+ }());
+ spine.Skin = Skin;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Slot = (function () {
+ function Slot(data, bone) {
+ this.attachmentVertices = new Array();
+ if (data == null)
+ throw new Error("data cannot be null.");
+ if (bone == null)
+ throw new Error("bone cannot be null.");
+ this.data = data;
+ this.bone = bone;
+ this.color = new spine.Color();
+ this.darkColor = data.darkColor == null ? null : new spine.Color();
+ this.setToSetupPose();
+ }
+ Slot.prototype.getAttachment = function () {
+ return this.attachment;
+ };
+ Slot.prototype.setAttachment = function (attachment) {
+ if (this.attachment == attachment)
+ return;
+ this.attachment = attachment;
+ this.attachmentTime = this.bone.skeleton.time;
+ this.attachmentVertices.length = 0;
+ };
+ Slot.prototype.setAttachmentTime = function (time) {
+ this.attachmentTime = this.bone.skeleton.time - time;
+ };
+ Slot.prototype.getAttachmentTime = function () {
+ return this.bone.skeleton.time - this.attachmentTime;
+ };
+ Slot.prototype.setToSetupPose = function () {
+ this.color.setFromColor(this.data.color);
+ if (this.darkColor != null)
+ this.darkColor.setFromColor(this.data.darkColor);
+ if (this.data.attachmentName == null)
+ this.attachment = null;
+ else {
+ this.attachment = null;
+ this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName));
+ }
+ };
+ return Slot;
+ }());
+ spine.Slot = Slot;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var SlotData = (function () {
+ function SlotData(index, name, boneData) {
+ this.color = new spine.Color(1, 1, 1, 1);
+ if (index < 0)
+ throw new Error("index must be >= 0.");
+ if (name == null)
+ throw new Error("name cannot be null.");
+ if (boneData == null)
+ throw new Error("boneData cannot be null.");
+ this.index = index;
+ this.name = name;
+ this.boneData = boneData;
+ }
+ SlotData.prototype.copy = function () {
+ var copy = new SlotData(this.index, this.name, this.boneData.copy());
+ copy.color = this.color.copy();
+ for (var key in this) {
+ if (copy[key] == void 0) {
+ copy[key] = this[key];
+ }
+ }
+ return copy;
+ };
+ return SlotData;
+ }());
+ spine.SlotData = SlotData;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Texture = (function () {
+ function Texture(image) {
+ this._image = image;
+ }
+ Texture.prototype.getImage = function () {
+ return this._image;
+ };
+ Texture.filterFromString = function (text) {
+ switch (text.toLowerCase()) {
+ case "nearest": return TextureFilter.Nearest;
+ case "linear": return TextureFilter.Linear;
+ case "mipmap": return TextureFilter.MipMap;
+ case "mipmapnearestnearest": return TextureFilter.MipMapNearestNearest;
+ case "mipmaplinearnearest": return TextureFilter.MipMapLinearNearest;
+ case "mipmapnearestlinear": return TextureFilter.MipMapNearestLinear;
+ case "mipmaplinearlinear": return TextureFilter.MipMapLinearLinear;
+ default: throw new Error("Unknown texture filter " + text);
+ }
+ };
+ Texture.wrapFromString = function (text) {
+ switch (text.toLowerCase()) {
+ case "mirroredtepeat": return TextureWrap.MirroredRepeat;
+ case "clamptoedge": return TextureWrap.ClampToEdge;
+ case "repeat": return TextureWrap.Repeat;
+ default: throw new Error("Unknown texture wrap " + text);
+ }
+ };
+ return Texture;
+ }());
+ spine.Texture = Texture;
+ var TextureFilter;
+ (function (TextureFilter) {
+ TextureFilter[TextureFilter["Nearest"] = 9728] = "Nearest";
+ TextureFilter[TextureFilter["Linear"] = 9729] = "Linear";
+ TextureFilter[TextureFilter["MipMap"] = 9987] = "MipMap";
+ TextureFilter[TextureFilter["MipMapNearestNearest"] = 9984] = "MipMapNearestNearest";
+ TextureFilter[TextureFilter["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
+ TextureFilter[TextureFilter["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
+ TextureFilter[TextureFilter["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear";
+ })(TextureFilter = spine.TextureFilter || (spine.TextureFilter = {}));
+ var TextureWrap;
+ (function (TextureWrap) {
+ TextureWrap[TextureWrap["MirroredRepeat"] = 33648] = "MirroredRepeat";
+ TextureWrap[TextureWrap["ClampToEdge"] = 33071] = "ClampToEdge";
+ TextureWrap[TextureWrap["Repeat"] = 10497] = "Repeat";
+ })(TextureWrap = spine.TextureWrap || (spine.TextureWrap = {}));
+ var TextureRegion = (function () {
+ function TextureRegion() {
+ this.u = 0;
+ this.v = 0;
+ this.u2 = 0;
+ this.v2 = 0;
+ this.width = 0;
+ this.height = 0;
+ this.rotate = false;
+ this.offsetX = 0;
+ this.offsetY = 0;
+ this.originalWidth = 0;
+ this.originalHeight = 0;
+ }
+ return TextureRegion;
+ }());
+ spine.TextureRegion = TextureRegion;
+ var FakeTexture = (function (_super) {
+ __extends(FakeTexture, _super);
+ function FakeTexture() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ FakeTexture.prototype.setFilters = function (minFilter, magFilter) { };
+ FakeTexture.prototype.setWraps = function (uWrap, vWrap) { };
+ FakeTexture.prototype.dispose = function () { };
+ return FakeTexture;
+ }(spine.Texture));
+ spine.FakeTexture = FakeTexture;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var TextureAtlas = (function () {
+ function TextureAtlas(atlasText, textureLoader) {
+ this.pages = new Array();
+ this.regions = new Array();
+ this.load(atlasText, textureLoader);
+ }
+ TextureAtlas.prototype.load = function (atlasText, textureLoader) {
+ if (textureLoader == null)
+ throw new Error("textureLoader cannot be null.");
+ var reader = new TextureAtlasReader(atlasText);
+ var tuple = new Array(4);
+ var page = null;
+ while (true) {
+ var line = reader.readLine();
+ if (line == null)
+ break;
+ line = line.trim();
+ if (line.length == 0)
+ page = null;
+ else if (!page) {
+ page = new TextureAtlasPage();
+ page.name = line;
+ if (reader.readTuple(tuple) == 2) {
+ page.width = parseInt(tuple[0]);
+ page.height = parseInt(tuple[1]);
+ reader.readTuple(tuple);
+ }
+ reader.readTuple(tuple);
+ page.minFilter = spine.Texture.filterFromString(tuple[0]);
+ page.magFilter = spine.Texture.filterFromString(tuple[1]);
+ var direction = reader.readValue();
+ page.uWrap = spine.TextureWrap.ClampToEdge;
+ page.vWrap = spine.TextureWrap.ClampToEdge;
+ if (direction == "x")
+ page.uWrap = spine.TextureWrap.Repeat;
+ else if (direction == "y")
+ page.vWrap = spine.TextureWrap.Repeat;
+ else if (direction == "xy")
+ page.uWrap = page.vWrap = spine.TextureWrap.Repeat;
+ page.texture = textureLoader(line);
+ page.texture.setFilters(page.minFilter, page.magFilter);
+ page.texture.setWraps(page.uWrap, page.vWrap);
+ page.width = page.texture.getImage().width;
+ page.height = page.texture.getImage().height;
+ this.pages.push(page);
+ }
+ else {
+ var region = new TextureAtlasRegion();
+ region.name = line;
+ region.page = page;
+ region.rotate = reader.readValue() == "true";
+ reader.readTuple(tuple);
+ var x = parseInt(tuple[0]);
+ var y = parseInt(tuple[1]);
+ reader.readTuple(tuple);
+ var width = parseInt(tuple[0]);
+ var height = parseInt(tuple[1]);
+ region.u = x / page.width;
+ region.v = y / page.height;
+ if (region.rotate) {
+ region.u2 = (x + height) / page.width;
+ region.v2 = (y + width) / page.height;
+ }
+ else {
+ region.u2 = (x + width) / page.width;
+ region.v2 = (y + height) / page.height;
+ }
+ region.x = x;
+ region.y = y;
+ region.width = Math.abs(width);
+ region.height = Math.abs(height);
+ if (reader.readTuple(tuple) == 4) {
+ if (reader.readTuple(tuple) == 4) {
+ reader.readTuple(tuple);
+ }
+ }
+ region.originalWidth = parseInt(tuple[0]);
+ region.originalHeight = parseInt(tuple[1]);
+ reader.readTuple(tuple);
+ region.offsetX = parseInt(tuple[0]);
+ region.offsetY = parseInt(tuple[1]);
+ region.index = parseInt(reader.readValue());
+ region.texture = page.texture;
+ this.regions.push(region);
+ }
+ }
+ };
+ TextureAtlas.prototype.findRegion = function (name) {
+ for (var i = 0; i < this.regions.length; i++) {
+ if (this.regions[i].name == name) {
+ return this.regions[i];
+ }
+ }
+ return null;
+ };
+ TextureAtlas.prototype.dispose = function () {
+ for (var i = 0; i < this.pages.length; i++) {
+ this.pages[i].texture.dispose();
+ }
+ };
+ return TextureAtlas;
+ }());
+ spine.TextureAtlas = TextureAtlas;
+ var TextureAtlasReader = (function () {
+ function TextureAtlasReader(text) {
+ this.index = 0;
+ this.lines = text.split(/\r\n|\r|\n/);
+ }
+ TextureAtlasReader.prototype.readLine = function () {
+ if (this.index >= this.lines.length)
+ return null;
+ return this.lines[this.index++];
+ };
+ TextureAtlasReader.prototype.readValue = function () {
+ var line = this.readLine();
+ var colon = line.indexOf(":");
+ if (colon == -1)
+ throw new Error("Invalid line: " + line);
+ return line.substring(colon + 1).trim();
+ };
+ TextureAtlasReader.prototype.readTuple = function (tuple) {
+ var line = this.readLine();
+ var colon = line.indexOf(":");
+ if (colon == -1)
+ throw new Error("Invalid line: " + line);
+ var i = 0, lastMatch = colon + 1;
+ for (; i < 3; i++) {
+ var comma = line.indexOf(",", lastMatch);
+ if (comma == -1)
+ break;
+ tuple[i] = line.substr(lastMatch, comma - lastMatch).trim();
+ lastMatch = comma + 1;
+ }
+ tuple[i] = line.substring(lastMatch).trim();
+ return i + 1;
+ };
+ return TextureAtlasReader;
+ }());
+ spine.TextureAtlasReader = TextureAtlasReader;
+ var TextureAtlasPage = (function () {
+ function TextureAtlasPage() {
+ }
+ return TextureAtlasPage;
+ }());
+ spine.TextureAtlasPage = TextureAtlasPage;
+ var TextureAtlasRegion = (function (_super) {
+ __extends(TextureAtlasRegion, _super);
+ function TextureAtlasRegion() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return TextureAtlasRegion;
+ }(spine.TextureRegion));
+ spine.TextureAtlasRegion = TextureAtlasRegion;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var TransformConstraint = (function () {
+ function TransformConstraint(data, skeleton) {
+ this.rotateMix = 0;
+ this.translateMix = 0;
+ this.scaleMix = 0;
+ this.shearMix = 0;
+ this.temp = new spine.Vector2();
+ if (data == null)
+ throw new Error("data cannot be null.");
+ if (skeleton == null)
+ throw new Error("skeleton cannot be null.");
+ this.data = data;
+ this.rotateMix = data.rotateMix;
+ this.translateMix = data.translateMix;
+ this.scaleMix = data.scaleMix;
+ this.shearMix = data.shearMix;
+ this.bones = new Array();
+ for (var i = 0; i < data.bones.length; i++)
+ this.bones.push(skeleton.findBone(data.bones[i].name));
+ this.target = skeleton.findBone(data.target.name);
+ }
+ TransformConstraint.prototype.apply = function () {
+ this.update();
+ };
+ TransformConstraint.prototype.update = function () {
+ if (this.data.local) {
+ if (this.data.relative)
+ this.applyRelativeLocal();
+ else
+ this.applyAbsoluteLocal();
+ }
+ else {
+ if (this.data.relative)
+ this.applyRelativeWorld();
+ else
+ this.applyAbsoluteWorld();
+ }
+ };
+ TransformConstraint.prototype.applyAbsoluteWorld = function () {
+ var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;
+ var target = this.target;
+ var ta = target.a, tb = target.b, tc = target.c, td = target.d;
+ var degRadReflect = ta * td - tb * tc > 0 ? spine.MathUtils.degRad : -spine.MathUtils.degRad;
+ var offsetRotation = this.data.offsetRotation * degRadReflect;
+ var offsetShearY = this.data.offsetShearY * degRadReflect;
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ var modified = false;
+ if (rotateMix != 0) {
+ var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
+ var r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation;
+ if (r > spine.MathUtils.PI)
+ r -= spine.MathUtils.PI2;
+ else if (r < -spine.MathUtils.PI)
+ r += spine.MathUtils.PI2;
+ r *= rotateMix;
+ var cos = Math.cos(r), sin = Math.sin(r);
+ bone.a = cos * a - sin * c;
+ bone.b = cos * b - sin * d;
+ bone.c = sin * a + cos * c;
+ bone.d = sin * b + cos * d;
+ modified = true;
+ }
+ if (translateMix != 0) {
+ var temp = this.temp;
+ target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));
+ bone.worldX += (temp.x - bone.worldX) * translateMix;
+ bone.worldY += (temp.y - bone.worldY) * translateMix;
+ modified = true;
+ }
+ if (scaleMix > 0) {
+ var s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
+ var ts = Math.sqrt(ta * ta + tc * tc);
+ if (s > 0.00001)
+ s = (s + (ts - s + this.data.offsetScaleX) * scaleMix) / s;
+ bone.a *= s;
+ bone.c *= s;
+ s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
+ ts = Math.sqrt(tb * tb + td * td);
+ if (s > 0.00001)
+ s = (s + (ts - s + this.data.offsetScaleY) * scaleMix) / s;
+ bone.b *= s;
+ bone.d *= s;
+ modified = true;
+ }
+ if (shearMix > 0) {
+ var b = bone.b, d = bone.d;
+ var by = Math.atan2(d, b);
+ var r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a));
+ if (r > spine.MathUtils.PI)
+ r -= spine.MathUtils.PI2;
+ else if (r < -spine.MathUtils.PI)
+ r += spine.MathUtils.PI2;
+ r = by + (r + offsetShearY) * shearMix;
+ var s = Math.sqrt(b * b + d * d);
+ bone.b = Math.cos(r) * s;
+ bone.d = Math.sin(r) * s;
+ modified = true;
+ }
+ if (modified)
+ bone.appliedValid = false;
+ }
+ };
+ TransformConstraint.prototype.applyRelativeWorld = function () {
+ var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;
+ var target = this.target;
+ var ta = target.a, tb = target.b, tc = target.c, td = target.d;
+ var degRadReflect = ta * td - tb * tc > 0 ? spine.MathUtils.degRad : -spine.MathUtils.degRad;
+ var offsetRotation = this.data.offsetRotation * degRadReflect, offsetShearY = this.data.offsetShearY * degRadReflect;
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ var modified = false;
+ if (rotateMix != 0) {
+ var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
+ var r = Math.atan2(tc, ta) + offsetRotation;
+ if (r > spine.MathUtils.PI)
+ r -= spine.MathUtils.PI2;
+ else if (r < -spine.MathUtils.PI)
+ r += spine.MathUtils.PI2;
+ r *= rotateMix;
+ var cos = Math.cos(r), sin = Math.sin(r);
+ bone.a = cos * a - sin * c;
+ bone.b = cos * b - sin * d;
+ bone.c = sin * a + cos * c;
+ bone.d = sin * b + cos * d;
+ modified = true;
+ }
+ if (translateMix != 0) {
+ var temp = this.temp;
+ target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));
+ bone.worldX += temp.x * translateMix;
+ bone.worldY += temp.y * translateMix;
+ modified = true;
+ }
+ if (scaleMix > 0) {
+ var s = (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * scaleMix + 1;
+ bone.a *= s;
+ bone.c *= s;
+ s = (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * scaleMix + 1;
+ bone.b *= s;
+ bone.d *= s;
+ modified = true;
+ }
+ if (shearMix > 0) {
+ var r = Math.atan2(td, tb) - Math.atan2(tc, ta);
+ if (r > spine.MathUtils.PI)
+ r -= spine.MathUtils.PI2;
+ else if (r < -spine.MathUtils.PI)
+ r += spine.MathUtils.PI2;
+ var b = bone.b, d = bone.d;
+ r = Math.atan2(d, b) + (r - spine.MathUtils.PI / 2 + offsetShearY) * shearMix;
+ var s = Math.sqrt(b * b + d * d);
+ bone.b = Math.cos(r) * s;
+ bone.d = Math.sin(r) * s;
+ modified = true;
+ }
+ if (modified)
+ bone.appliedValid = false;
+ }
+ };
+ TransformConstraint.prototype.applyAbsoluteLocal = function () {
+ var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;
+ var target = this.target;
+ if (!target.appliedValid)
+ target.updateAppliedTransform();
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (!bone.appliedValid)
+ bone.updateAppliedTransform();
+ var rotation = bone.arotation;
+ if (rotateMix != 0) {
+ var r = target.arotation - rotation + this.data.offsetRotation;
+ r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
+ rotation += r * rotateMix;
+ }
+ var x = bone.ax, y = bone.ay;
+ if (translateMix != 0) {
+ x += (target.ax - x + this.data.offsetX) * translateMix;
+ y += (target.ay - y + this.data.offsetY) * translateMix;
+ }
+ var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
+ if (scaleMix > 0) {
+ if (scaleX > 0.00001)
+ scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX;
+ if (scaleY > 0.00001)
+ scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY;
+ }
+ var shearY = bone.ashearY;
+ if (shearMix > 0) {
+ var r = target.ashearY - shearY + this.data.offsetShearY;
+ r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360;
+ bone.shearY += r * shearMix;
+ }
+ bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
+ }
+ };
+ TransformConstraint.prototype.applyRelativeLocal = function () {
+ var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix;
+ var target = this.target;
+ if (!target.appliedValid)
+ target.updateAppliedTransform();
+ var bones = this.bones;
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (!bone.appliedValid)
+ bone.updateAppliedTransform();
+ var rotation = bone.arotation;
+ if (rotateMix != 0)
+ rotation += (target.arotation + this.data.offsetRotation) * rotateMix;
+ var x = bone.ax, y = bone.ay;
+ if (translateMix != 0) {
+ x += (target.ax + this.data.offsetX) * translateMix;
+ y += (target.ay + this.data.offsetY) * translateMix;
+ }
+ var scaleX = bone.ascaleX, scaleY = bone.ascaleY;
+ if (scaleMix > 0) {
+ if (scaleX > 0.00001)
+ scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1;
+ if (scaleY > 0.00001)
+ scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1;
+ }
+ var shearY = bone.ashearY;
+ if (shearMix > 0)
+ shearY += (target.ashearY + this.data.offsetShearY) * shearMix;
+ bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
+ }
+ };
+ TransformConstraint.prototype.getOrder = function () {
+ return this.data.order;
+ };
+ return TransformConstraint;
+ }());
+ spine.TransformConstraint = TransformConstraint;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var TransformConstraintData = (function () {
+ function TransformConstraintData(name) {
+ this.order = 0;
+ this.bones = new Array();
+ this.rotateMix = 0;
+ this.translateMix = 0;
+ this.scaleMix = 0;
+ this.shearMix = 0;
+ this.offsetRotation = 0;
+ this.offsetX = 0;
+ this.offsetY = 0;
+ this.offsetScaleX = 0;
+ this.offsetScaleY = 0;
+ this.offsetShearY = 0;
+ this.relative = false;
+ this.local = false;
+ if (name == null)
+ throw new Error("name cannot be null.");
+ this.name = name;
+ }
+ return TransformConstraintData;
+ }());
+ spine.TransformConstraintData = TransformConstraintData;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var Triangulator = (function () {
+ function Triangulator() {
+ this.convexPolygons = new Array();
+ this.convexPolygonsIndices = new Array();
+ this.indicesArray = new Array();
+ this.isConcaveArray = new Array();
+ this.triangles = new Array();
+ this.polygonPool = new spine.Pool(function () {
+ return new Array();
+ });
+ this.polygonIndicesPool = new spine.Pool(function () {
+ return new Array();
+ });
+ }
+ Triangulator.prototype.triangulate = function (verticesArray) {
+ var vertices = verticesArray;
+ var vertexCount = verticesArray.length >> 1;
+ var indices = this.indicesArray;
+ indices.length = 0;
+ for (var i = 0; i < vertexCount; i++)
+ indices[i] = i;
+ var isConcave = this.isConcaveArray;
+ isConcave.length = 0;
+ for (var i = 0, n = vertexCount; i < n; ++i)
+ isConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);
+ var triangles = this.triangles;
+ triangles.length = 0;
+ while (vertexCount > 3) {
+ var previous = vertexCount - 1, i = 0, next = 1;
+ while (true) {
+ outer: if (!isConcave[i]) {
+ var p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1;
+ var p1x = vertices[p1], p1y = vertices[p1 + 1];
+ var p2x = vertices[p2], p2y = vertices[p2 + 1];
+ var p3x = vertices[p3], p3y = vertices[p3 + 1];
+ for (var ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
+ if (!isConcave[ii])
+ continue;
+ var v = indices[ii] << 1;
+ var vx = vertices[v], vy = vertices[v + 1];
+ if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
+ if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
+ if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy))
+ break outer;
+ }
+ }
+ }
+ break;
+ }
+ if (next == 0) {
+ do {
+ if (!isConcave[i])
+ break;
+ i--;
+ } while (i > 0);
+ break;
+ }
+ previous = i;
+ i = next;
+ next = (next + 1) % vertexCount;
+ }
+ triangles.push(indices[(vertexCount + i - 1) % vertexCount]);
+ triangles.push(indices[i]);
+ triangles.push(indices[(i + 1) % vertexCount]);
+ indices.splice(i, 1);
+ isConcave.splice(i, 1);
+ vertexCount--;
+ var previousIndex = (vertexCount + i - 1) % vertexCount;
+ var nextIndex = i == vertexCount ? 0 : i;
+ isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
+ isConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
+ }
+ if (vertexCount == 3) {
+ triangles.push(indices[2]);
+ triangles.push(indices[0]);
+ triangles.push(indices[1]);
+ }
+ return triangles;
+ };
+ Triangulator.prototype.decompose = function (verticesArray, triangles) {
+ var vertices = verticesArray;
+ var convexPolygons = this.convexPolygons;
+ this.polygonPool.freeAll(convexPolygons);
+ convexPolygons.length = 0;
+ var convexPolygonsIndices = this.convexPolygonsIndices;
+ this.polygonIndicesPool.freeAll(convexPolygonsIndices);
+ convexPolygonsIndices.length = 0;
+ var polygonIndices = this.polygonIndicesPool.obtain();
+ polygonIndices.length = 0;
+ var polygon = this.polygonPool.obtain();
+ polygon.length = 0;
+ var fanBaseIndex = -1, lastWinding = 0;
+ for (var i = 0, n = triangles.length; i < n; i += 3) {
+ var t1 = triangles[i] << 1, t2 = triangles[i + 1] << 1, t3 = triangles[i + 2] << 1;
+ var x1 = vertices[t1], y1 = vertices[t1 + 1];
+ var x2 = vertices[t2], y2 = vertices[t2 + 1];
+ var x3 = vertices[t3], y3 = vertices[t3 + 1];
+ var merged = false;
+ if (fanBaseIndex == t1) {
+ var o = polygon.length - 4;
+ var winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
+ var winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
+ if (winding1 == lastWinding && winding2 == lastWinding) {
+ polygon.push(x3);
+ polygon.push(y3);
+ polygonIndices.push(t3);
+ merged = true;
+ }
+ }
+ if (!merged) {
+ if (polygon.length > 0) {
+ convexPolygons.push(polygon);
+ convexPolygonsIndices.push(polygonIndices);
+ }
+ else {
+ this.polygonPool.free(polygon);
+ this.polygonIndicesPool.free(polygonIndices);
+ }
+ polygon = this.polygonPool.obtain();
+ polygon.length = 0;
+ polygon.push(x1);
+ polygon.push(y1);
+ polygon.push(x2);
+ polygon.push(y2);
+ polygon.push(x3);
+ polygon.push(y3);
+ polygonIndices = this.polygonIndicesPool.obtain();
+ polygonIndices.length = 0;
+ polygonIndices.push(t1);
+ polygonIndices.push(t2);
+ polygonIndices.push(t3);
+ lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);
+ fanBaseIndex = t1;
+ }
+ }
+ if (polygon.length > 0) {
+ convexPolygons.push(polygon);
+ convexPolygonsIndices.push(polygonIndices);
+ }
+ for (var i = 0, n = convexPolygons.length; i < n; i++) {
+ polygonIndices = convexPolygonsIndices[i];
+ if (polygonIndices.length == 0)
+ continue;
+ var firstIndex = polygonIndices[0];
+ var lastIndex = polygonIndices[polygonIndices.length - 1];
+ polygon = convexPolygons[i];
+ var o = polygon.length - 4;
+ var prevPrevX = polygon[o], prevPrevY = polygon[o + 1];
+ var prevX = polygon[o + 2], prevY = polygon[o + 3];
+ var firstX = polygon[0], firstY = polygon[1];
+ var secondX = polygon[2], secondY = polygon[3];
+ var winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
+ for (var ii = 0; ii < n; ii++) {
+ if (ii == i)
+ continue;
+ var otherIndices = convexPolygonsIndices[ii];
+ if (otherIndices.length != 3)
+ continue;
+ var otherFirstIndex = otherIndices[0];
+ var otherSecondIndex = otherIndices[1];
+ var otherLastIndex = otherIndices[2];
+ var otherPoly = convexPolygons[ii];
+ var x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
+ if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
+ continue;
+ var winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
+ var winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
+ if (winding1 == winding && winding2 == winding) {
+ otherPoly.length = 0;
+ otherIndices.length = 0;
+ polygon.push(x3);
+ polygon.push(y3);
+ polygonIndices.push(otherLastIndex);
+ prevPrevX = prevX;
+ prevPrevY = prevY;
+ prevX = x3;
+ prevY = y3;
+ ii = 0;
+ }
+ }
+ }
+ for (var i = convexPolygons.length - 1; i >= 0; i--) {
+ polygon = convexPolygons[i];
+ if (polygon.length == 0) {
+ convexPolygons.splice(i, 1);
+ this.polygonPool.free(polygon);
+ polygonIndices = convexPolygonsIndices[i];
+ convexPolygonsIndices.splice(i, 1);
+ this.polygonIndicesPool.free(polygonIndices);
+ }
+ }
+ return convexPolygons;
+ };
+ Triangulator.isConcave = function (index, vertexCount, vertices, indices) {
+ var previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
+ var current = indices[index] << 1;
+ var next = indices[(index + 1) % vertexCount] << 1;
+ return !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next], vertices[next + 1]);
+ };
+ Triangulator.positiveArea = function (p1x, p1y, p2x, p2y, p3x, p3y) {
+ return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
+ };
+ Triangulator.winding = function (p1x, p1y, p2x, p2y, p3x, p3y) {
+ var px = p2x - p1x, py = p2y - p1y;
+ return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;
+ };
+ return Triangulator;
+ }());
+ spine.Triangulator = Triangulator;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var IntSet = (function () {
+ function IntSet() {
+ this.array = new Array();
+ }
+ IntSet.prototype.add = function (value) {
+ var contains = this.contains(value);
+ this.array[value | 0] = value | 0;
+ return !contains;
+ };
+ IntSet.prototype.contains = function (value) {
+ return this.array[value | 0] != undefined;
+ };
+ IntSet.prototype.remove = function (value) {
+ this.array[value | 0] = undefined;
+ };
+ IntSet.prototype.clear = function () {
+ this.array.length = 0;
+ };
+ return IntSet;
+ }());
+ spine.IntSet = IntSet;
+ var Color = (function () {
+ function Color(r, g, b, a) {
+ if (r === void 0) { r = 0; }
+ if (g === void 0) { g = 0; }
+ if (b === void 0) { b = 0; }
+ if (a === void 0) { a = 0; }
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ this.a = a;
+ }
+ Color.prototype.set = function (r, g, b, a) {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ this.a = a;
+ this.clamp();
+ return this;
+ };
+ Color.prototype.setFromColor = function (c) {
+ this.r = c.r;
+ this.g = c.g;
+ this.b = c.b;
+ this.a = c.a;
+ return this;
+ };
+ Color.prototype.setFromString = function (hex) {
+ hex = hex.charAt(0) == '#' ? hex.substr(1) : hex;
+ this.r = parseInt(hex.substr(0, 2), 16) / 255.0;
+ this.g = parseInt(hex.substr(2, 2), 16) / 255.0;
+ this.b = parseInt(hex.substr(4, 2), 16) / 255.0;
+ this.a = (hex.length != 8 ? 255 : parseInt(hex.substr(6, 2), 16)) / 255.0;
+ return this;
+ };
+ Color.prototype.add = function (r, g, b, a) {
+ this.r += r;
+ this.g += g;
+ this.b += b;
+ this.a += a;
+ this.clamp();
+ return this;
+ };
+ Color.prototype.clamp = function () {
+ if (this.r < 0)
+ this.r = 0;
+ else if (this.r > 1)
+ this.r = 1;
+ if (this.g < 0)
+ this.g = 0;
+ else if (this.g > 1)
+ this.g = 1;
+ if (this.b < 0)
+ this.b = 0;
+ else if (this.b > 1)
+ this.b = 1;
+ if (this.a < 0)
+ this.a = 0;
+ else if (this.a > 1)
+ this.a = 1;
+ return this;
+ };
+ Color.prototype.copy = function () {
+ return new Color(this.r, this.g, this.b, this.a);
+ };
+ Color.rgba8888ToColor = function (color, value) {
+ color.r = ((value & 0xff000000) >>> 24) / 255;
+ color.g = ((value & 0x00ff0000) >>> 16) / 255;
+ color.b = ((value & 0x0000ff00) >>> 8) / 255;
+ color.a = ((value & 0x000000ff)) / 255;
+ };
+ Color.rgb888ToColor = function (color, value) {
+ color.r = ((value & 0x00ff0000) >>> 16) / 255;
+ color.g = ((value & 0x0000ff00) >>> 8) / 255;
+ color.b = ((value & 0x000000ff)) / 255;
+ };
+ Color.WHITE = new Color(1, 1, 1, 1);
+ Color.RED = new Color(1, 0, 0, 1);
+ Color.GREEN = new Color(0, 1, 0, 1);
+ Color.BLUE = new Color(0, 0, 1, 1);
+ Color.MAGENTA = new Color(1, 0, 1, 1);
+ return Color;
+ }());
+ spine.Color = Color;
+ var MathUtils = (function () {
+ function MathUtils() {
+ }
+ MathUtils.clamp = function (value, min, max) {
+ if (value < min)
+ return min;
+ if (value > max)
+ return max;
+ return value;
+ };
+ MathUtils.cosDeg = function (degrees) {
+ return Math.cos(degrees * MathUtils.degRad);
+ };
+ MathUtils.sinDeg = function (degrees) {
+ return Math.sin(degrees * MathUtils.degRad);
+ };
+ MathUtils.signum = function (value) {
+ return value > 0 ? 1 : value < 0 ? -1 : 0;
+ };
+ MathUtils.toInt = function (x) {
+ return x > 0 ? Math.floor(x) : Math.ceil(x);
+ };
+ MathUtils.cbrt = function (x) {
+ var y = Math.pow(Math.abs(x), 1 / 3);
+ return x < 0 ? -y : y;
+ };
+ MathUtils.randomTriangular = function (min, max) {
+ return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5);
+ };
+ MathUtils.randomTriangularWith = function (min, max, mode) {
+ var u = Math.random();
+ var d = max - min;
+ if (u <= (mode - min) / d)
+ return min + Math.sqrt(u * d * (mode - min));
+ return max - Math.sqrt((1 - u) * d * (max - mode));
+ };
+ MathUtils.PI = 3.1415927;
+ MathUtils.PI2 = MathUtils.PI * 2;
+ MathUtils.radiansToDegrees = 180 / MathUtils.PI;
+ MathUtils.radDeg = MathUtils.radiansToDegrees;
+ MathUtils.degreesToRadians = MathUtils.PI / 180;
+ MathUtils.degRad = MathUtils.degreesToRadians;
+ return MathUtils;
+ }());
+ spine.MathUtils = MathUtils;
+ var Interpolation = (function () {
+ function Interpolation() {
+ }
+ Interpolation.prototype.apply = function (start, end, a) {
+ return start + (end - start) * this.applyInternal(a);
+ };
+ return Interpolation;
+ }());
+ spine.Interpolation = Interpolation;
+ var Pow = (function (_super) {
+ __extends(Pow, _super);
+ function Pow(power) {
+ var _this = _super.call(this) || this;
+ _this.power = 2;
+ _this.power = power;
+ return _this;
+ }
+ Pow.prototype.applyInternal = function (a) {
+ if (a <= 0.5)
+ return Math.pow(a * 2, this.power) / 2;
+ return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
+ };
+ return Pow;
+ }(Interpolation));
+ spine.Pow = Pow;
+ var PowOut = (function (_super) {
+ __extends(PowOut, _super);
+ function PowOut(power) {
+ return _super.call(this, power) || this;
+ }
+ PowOut.prototype.applyInternal = function (a) {
+ return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
+ };
+ return PowOut;
+ }(Pow));
+ spine.PowOut = PowOut;
+ var Utils = (function () {
+ function Utils() {
+ }
+ Utils.arrayCopy = function (source, sourceStart, dest, destStart, numElements) {
+ for (var i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
+ dest[j] = source[i];
+ }
+ };
+ Utils.setArraySize = function (array, size, value) {
+ if (value === void 0) { value = 0; }
+ var oldSize = array.length;
+ if (oldSize == size)
+ return array;
+ array.length = size;
+ if (oldSize < size) {
+ for (var i = oldSize; i < size; i++)
+ array[i] = value;
+ }
+ return array;
+ };
+ Utils.ensureArrayCapacity = function (array, size, value) {
+ if (value === void 0) { value = 0; }
+ if (array.length >= size)
+ return array;
+ return Utils.setArraySize(array, size, value);
+ };
+ Utils.newArray = function (size, defaultValue) {
+ var array = new Array(size);
+ for (var i = 0; i < size; i++)
+ array[i] = defaultValue;
+ return array;
+ };
+ Utils.newFloatArray = function (size) {
+ if (Utils.SUPPORTS_TYPED_ARRAYS) {
+ return new Float32Array(size);
+ }
+ else {
+ var array = new Array(size);
+ for (var i = 0; i < array.length; i++)
+ array[i] = 0;
+ return array;
+ }
+ };
+ Utils.newShortArray = function (size) {
+ if (Utils.SUPPORTS_TYPED_ARRAYS) {
+ return new Int16Array(size);
+ }
+ else {
+ var array = new Array(size);
+ for (var i = 0; i < array.length; i++)
+ array[i] = 0;
+ return array;
+ }
+ };
+ Utils.toFloatArray = function (array) {
+ return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
+ };
+ Utils.toSinglePrecision = function (value) {
+ return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
+ };
+ Utils.webkit602BugfixHelper = function (alpha, pose) {
+ };
+ Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
+ return Utils;
+ }());
+ spine.Utils = Utils;
+ var DebugUtils = (function () {
+ function DebugUtils() {
+ }
+ DebugUtils.logBones = function (skeleton) {
+ for (var i = 0; i < skeleton.bones.length; i++) {
+ var bone = skeleton.bones[i];
+ console.log(bone.data.name + ", " + bone.a + ", " + bone.b + ", " + bone.c + ", " + bone.d + ", " + bone.worldX + ", " + bone.worldY);
+ }
+ };
+ return DebugUtils;
+ }());
+ spine.DebugUtils = DebugUtils;
+ var Pool = (function () {
+ function Pool(instantiator) {
+ this.items = new Array();
+ this.instantiator = instantiator;
+ }
+ Pool.prototype.obtain = function () {
+ return this.items.length > 0 ? this.items.pop() : this.instantiator();
+ };
+ Pool.prototype.free = function (item) {
+ if (item.reset)
+ item.reset();
+ this.items.push(item);
+ };
+ Pool.prototype.freeAll = function (items) {
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].reset)
+ items[i].reset();
+ this.items[i] = items[i];
+ }
+ };
+ Pool.prototype.clear = function () {
+ this.items.length = 0;
+ };
+ return Pool;
+ }());
+ spine.Pool = Pool;
+ var Vector2 = (function () {
+ function Vector2(x, y) {
+ if (x === void 0) { x = 0; }
+ if (y === void 0) { y = 0; }
+ this.x = x;
+ this.y = y;
+ }
+ Vector2.prototype.set = function (x, y) {
+ this.x = x;
+ this.y = y;
+ return this;
+ };
+ Vector2.prototype.length = function () {
+ var x = this.x;
+ var y = this.y;
+ return Math.sqrt(x * x + y * y);
+ };
+ Vector2.prototype.normalize = function () {
+ var len = this.length();
+ if (len != 0) {
+ this.x /= len;
+ this.y /= len;
+ }
+ return this;
+ };
+ return Vector2;
+ }());
+ spine.Vector2 = Vector2;
+ var TimeKeeper = (function () {
+ function TimeKeeper() {
+ this.maxDelta = 0.064;
+ this.framesPerSecond = 0;
+ this.delta = 0;
+ this.totalTime = 0;
+ this.lastTime = Date.now() / 1000;
+ this.frameCount = 0;
+ this.frameTime = 0;
+ }
+ TimeKeeper.prototype.update = function () {
+ var now = Date.now() / 1000;
+ this.delta = now - this.lastTime;
+ this.frameTime += this.delta;
+ this.totalTime += this.delta;
+ if (this.delta > this.maxDelta)
+ this.delta = this.maxDelta;
+ this.lastTime = now;
+ this.frameCount++;
+ if (this.frameTime > 1) {
+ this.framesPerSecond = this.frameCount / this.frameTime;
+ this.frameTime = 0;
+ this.frameCount = 0;
+ }
+ };
+ return TimeKeeper;
+ }());
+ spine.TimeKeeper = TimeKeeper;
+ var WindowedMean = (function () {
+ function WindowedMean(windowSize) {
+ if (windowSize === void 0) { windowSize = 32; }
+ this.addedValues = 0;
+ this.lastValue = 0;
+ this.mean = 0;
+ this.dirty = true;
+ this.values = new Array(windowSize);
+ }
+ WindowedMean.prototype.hasEnoughData = function () {
+ return this.addedValues >= this.values.length;
+ };
+ WindowedMean.prototype.addValue = function (value) {
+ if (this.addedValues < this.values.length)
+ this.addedValues++;
+ this.values[this.lastValue++] = value;
+ if (this.lastValue > this.values.length - 1)
+ this.lastValue = 0;
+ this.dirty = true;
+ };
+ WindowedMean.prototype.getMean = function () {
+ if (this.hasEnoughData()) {
+ if (this.dirty) {
+ var mean = 0;
+ for (var i = 0; i < this.values.length; i++) {
+ mean += this.values[i];
+ }
+ this.mean = mean / this.values.length;
+ this.dirty = false;
+ }
+ return this.mean;
+ }
+ else {
+ return 0;
+ }
+ };
+ return WindowedMean;
+ }());
+ spine.WindowedMean = WindowedMean;
+})(spine || (spine = {}));
+(function () {
+ if (!Math.fround) {
+ Math.fround = (function (array) {
+ return function (x) {
+ return array[0] = x, array[0];
+ };
+ })(new Float32Array(1));
+ }
+})();
+var spine;
+(function (spine) {
+ var Attachment = (function () {
+ function Attachment(name) {
+ if (name == null)
+ throw new Error("name cannot be null.");
+ this.name = name;
+ }
+ return Attachment;
+ }());
+ spine.Attachment = Attachment;
+ var VertexAttachment = (function (_super) {
+ __extends(VertexAttachment, _super);
+ function VertexAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.id = (VertexAttachment.nextID++ & 65535) << 11;
+ _this.worldVerticesLength = 0;
+ return _this;
+ }
+ VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) {
+ count = offset + (count >> 1) * stride;
+ var skeleton = slot.bone.skeleton;
+ var deformArray = slot.attachmentVertices;
+ var vertices = this.vertices;
+ var bones = this.bones;
+ if (bones == null) {
+ if (deformArray.length > 0)
+ vertices = deformArray;
+ var bone = slot.bone;
+ var x = bone.worldX;
+ var y = bone.worldY;
+ var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
+ for (var v_1 = start, w = offset; w < count; v_1 += 2, w += stride) {
+ var vx = vertices[v_1], vy = vertices[v_1 + 1];
+ worldVertices[w] = vx * a + vy * b + x;
+ worldVertices[w + 1] = vx * c + vy * d + y;
+ }
+ return;
+ }
+ var v = 0, skip = 0;
+ for (var i = 0; i < start; i += 2) {
+ var n = bones[v];
+ v += n + 1;
+ skip += n;
+ }
+ var skeletonBones = skeleton.bones;
+ if (deformArray.length == 0) {
+ for (var w = offset, b = skip * 3; w < count; w += stride) {
+ var wx = 0, wy = 0;
+ var n = bones[v++];
+ n += v;
+ for (; v < n; v++, b += 3) {
+ var bone = skeletonBones[bones[v]];
+ var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
+ wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
+ wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
+ }
+ worldVertices[w] = wx;
+ worldVertices[w + 1] = wy;
+ }
+ } else {
+ var deform = deformArray;
+ for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) {
+ var wx = 0, wy = 0;
+ var n = bones[v++];
+ n += v;
+ for (; v < n; v++, b += 3, f += 2) {
+ var bone = skeletonBones[bones[v]];
+ var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
+ wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
+ wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
+ }
+ worldVertices[w] = wx;
+ worldVertices[w + 1] = wy;
+ }
+ }
+ };
+ VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
+ return this == sourceAttachment;
+ };
+ VertexAttachment.nextID = 0;
+ return VertexAttachment;
+ }(Attachment));
+ spine.VertexAttachment = VertexAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var AttachmentType;
+ (function (AttachmentType) {
+ AttachmentType[AttachmentType["Region"] = 0] = "Region";
+ AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
+ AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
+ AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
+ AttachmentType[AttachmentType["Path"] = 4] = "Path";
+ AttachmentType[AttachmentType["Point"] = 5] = "Point";
+ AttachmentType[AttachmentType["Clipping"] = 6] = "Clipping";
+ })(AttachmentType = spine.AttachmentType || (spine.AttachmentType = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var BoundingBoxAttachment = (function (_super) {
+ __extends(BoundingBoxAttachment, _super);
+ function BoundingBoxAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.color = new spine.Color(1, 1, 1, 1);
+ return _this;
+ }
+ return BoundingBoxAttachment;
+ }(spine.VertexAttachment));
+ spine.BoundingBoxAttachment = BoundingBoxAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var ClippingAttachment = (function (_super) {
+ __extends(ClippingAttachment, _super);
+ function ClippingAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
+ return _this;
+ }
+ return ClippingAttachment;
+ }(spine.VertexAttachment));
+ spine.ClippingAttachment = ClippingAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var MeshAttachment = (function (_super) {
+ __extends(MeshAttachment, _super);
+ function MeshAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.color = new spine.Color(1, 1, 1, 1);
+ _this.inheritDeform = false;
+ _this.tempColor = new spine.Color(0, 0, 0, 0);
+ return _this;
+ }
+ MeshAttachment.prototype.updateUVs = function () {
+ var u = 0, v = 0, width = 0, height = 0;
+ if (this.region == null) {
+ u = v = 0;
+ width = height = 1;
+ }
+ else {
+ u = this.region.u;
+ v = this.region.v;
+ width = this.region.u2 - u;
+ height = this.region.v2 - v;
+ }
+ var regionUVs = this.regionUVs;
+ if (this.uvs == null || this.uvs.length != regionUVs.length)
+ this.uvs = spine.Utils.newFloatArray(regionUVs.length);
+ var uvs = this.uvs;
+ if (this.region.rotate) {
+ for (var i = 0, n = uvs.length; i < n; i += 2) {
+ uvs[i] = u + regionUVs[i + 1] * width;
+ uvs[i + 1] = v + height - regionUVs[i] * height;
+ }
+ }
+ else {
+ for (var i = 0, n = uvs.length; i < n; i += 2) {
+ uvs[i] = u + regionUVs[i] * width;
+ uvs[i + 1] = v + regionUVs[i + 1] * height;
+ }
+ }
+ };
+ MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
+ return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
+ };
+ MeshAttachment.prototype.getParentMesh = function () {
+ return this.parentMesh;
+ };
+ MeshAttachment.prototype.setParentMesh = function (parentMesh) {
+ this.parentMesh = parentMesh;
+ if (parentMesh != null) {
+ this.bones = parentMesh.bones;
+ this.vertices = parentMesh.vertices;
+ this.worldVerticesLength = parentMesh.worldVerticesLength;
+ this.regionUVs = parentMesh.regionUVs;
+ this.triangles = parentMesh.triangles;
+ this.hullLength = parentMesh.hullLength;
+ this.worldVerticesLength = parentMesh.worldVerticesLength;
+ }
+ };
+ return MeshAttachment;
+ }(spine.VertexAttachment));
+ spine.MeshAttachment = MeshAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var PathAttachment = (function (_super) {
+ __extends(PathAttachment, _super);
+ function PathAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.closed = false;
+ _this.constantSpeed = false;
+ _this.color = new spine.Color(1, 1, 1, 1);
+ return _this;
+ }
+ return PathAttachment;
+ }(spine.VertexAttachment));
+ spine.PathAttachment = PathAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var PointAttachment = (function (_super) {
+ __extends(PointAttachment, _super);
+ function PointAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.color = new spine.Color(0.38, 0.94, 0, 1);
+ return _this;
+ }
+ PointAttachment.prototype.computeWorldPosition = function (bone, point) {
+ point.x = this.x * bone.a + this.y * bone.b + bone.worldX;
+ point.y = this.x * bone.c + this.y * bone.d + bone.worldY;
+ return point;
+ };
+ PointAttachment.prototype.computeWorldRotation = function (bone) {
+ var cos = spine.MathUtils.cosDeg(this.rotation), sin = spine.MathUtils.sinDeg(this.rotation);
+ var x = cos * bone.a + sin * bone.b;
+ var y = cos * bone.c + sin * bone.d;
+ return Math.atan2(y, x) * spine.MathUtils.radDeg;
+ };
+ return PointAttachment;
+ }(spine.VertexAttachment));
+ spine.PointAttachment = PointAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var RegionAttachment = (function (_super) {
+ __extends(RegionAttachment, _super);
+ function RegionAttachment(name) {
+ var _this = _super.call(this, name) || this;
+ _this.x = 0;
+ _this.y = 0;
+ _this.scaleX = 1;
+ _this.scaleY = 1;
+ _this.rotation = 0;
+ _this.width = 0;
+ _this.height = 0;
+ _this.color = new spine.Color(1, 1, 1, 1);
+ _this.offset = spine.Utils.newFloatArray(8);
+ _this.uvs = spine.Utils.newFloatArray(8);
+ _this.tempColor = new spine.Color(1, 1, 1, 1);
+ return _this;
+ }
+ RegionAttachment.prototype.updateOffset = function () {
+ var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
+ var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
+ var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
+ var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
+ var localX2 = localX + this.region.width * regionScaleX;
+ var localY2 = localY + this.region.height * regionScaleY;
+ var radians = this.rotation * Math.PI / 180;
+ var cos = Math.cos(radians);
+ var sin = Math.sin(radians);
+ var localXCos = localX * cos + this.x;
+ var localXSin = localX * sin;
+ var localYCos = localY * cos + this.y;
+ var localYSin = localY * sin;
+ var localX2Cos = localX2 * cos + this.x;
+ var localX2Sin = localX2 * sin;
+ var localY2Cos = localY2 * cos + this.y;
+ var localY2Sin = localY2 * sin;
+ var offset = this.offset;
+ offset[RegionAttachment.OX1] = localXCos - localYSin;
+ offset[RegionAttachment.OY1] = localYCos + localXSin;
+ offset[RegionAttachment.OX2] = localXCos - localY2Sin;
+ offset[RegionAttachment.OY2] = localY2Cos + localXSin;
+ offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
+ offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
+ offset[RegionAttachment.OX4] = localX2Cos - localYSin;
+ offset[RegionAttachment.OY4] = localYCos + localX2Sin;
+ };
+ RegionAttachment.prototype.setRegion = function (region) {
+ this.region = region;
+ var uvs = this.uvs;
+ if (region.rotate) {
+ uvs[2] = region.u;
+ uvs[3] = region.v2;
+ uvs[4] = region.u;
+ uvs[5] = region.v;
+ uvs[6] = region.u2;
+ uvs[7] = region.v;
+ uvs[0] = region.u2;
+ uvs[1] = region.v2;
+ }
+ else {
+ uvs[0] = region.u;
+ uvs[1] = region.v2;
+ uvs[2] = region.u;
+ uvs[3] = region.v;
+ uvs[4] = region.u2;
+ uvs[5] = region.v;
+ uvs[6] = region.u2;
+ uvs[7] = region.v2;
+ }
+ };
+ RegionAttachment.prototype.computeWorldVertices = function (bone, worldVertices, offset, stride) {
+ var vertexOffset = this.offset;
+ var x = bone.worldX, y = bone.worldY;
+ var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
+ var offsetX = 0, offsetY = 0;
+ offsetX = vertexOffset[RegionAttachment.OX1];
+ offsetY = vertexOffset[RegionAttachment.OY1];
+ worldVertices[offset] = offsetX * a + offsetY * b + x;
+ worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
+ offset += stride;
+ offsetX = vertexOffset[RegionAttachment.OX2];
+ offsetY = vertexOffset[RegionAttachment.OY2];
+ worldVertices[offset] = offsetX * a + offsetY * b + x;
+ worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
+ offset += stride;
+ offsetX = vertexOffset[RegionAttachment.OX3];
+ offsetY = vertexOffset[RegionAttachment.OY3];
+ worldVertices[offset] = offsetX * a + offsetY * b + x;
+ worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
+ offset += stride;
+ offsetX = vertexOffset[RegionAttachment.OX4];
+ offsetY = vertexOffset[RegionAttachment.OY4];
+ worldVertices[offset] = offsetX * a + offsetY * b + x;
+ worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
+ };
+ RegionAttachment.prototype.copy = function () {
+ var copy = new RegionAttachment(this.name);
+ copy.region = this.region;
+ // copy.rendererObject = this.rendererObject;
+ copy.path = this.path;
+ copy.x = this.x;
+ copy.y = this.y;
+ copy.scaleX = this.scaleX;
+ copy.scaleY = this.scaleY;
+ copy.rotation = this.rotation;
+ copy.width = this.width;
+ copy.height = this.height;
+ spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
+ spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
+ copy.color.setFromColor(this.color);
+ return copy;
+ };
+ RegionAttachment.OX1 = 0;
+ RegionAttachment.OY1 = 1;
+ RegionAttachment.OX2 = 2;
+ RegionAttachment.OY2 = 3;
+ RegionAttachment.OX3 = 4;
+ RegionAttachment.OY3 = 5;
+ RegionAttachment.OX4 = 6;
+ RegionAttachment.OY4 = 7;
+ RegionAttachment.X1 = 0;
+ RegionAttachment.Y1 = 1;
+ RegionAttachment.C1R = 2;
+ RegionAttachment.C1G = 3;
+ RegionAttachment.C1B = 4;
+ RegionAttachment.C1A = 5;
+ RegionAttachment.U1 = 6;
+ RegionAttachment.V1 = 7;
+ RegionAttachment.X2 = 8;
+ RegionAttachment.Y2 = 9;
+ RegionAttachment.C2R = 10;
+ RegionAttachment.C2G = 11;
+ RegionAttachment.C2B = 12;
+ RegionAttachment.C2A = 13;
+ RegionAttachment.U2 = 14;
+ RegionAttachment.V2 = 15;
+ RegionAttachment.X3 = 16;
+ RegionAttachment.Y3 = 17;
+ RegionAttachment.C3R = 18;
+ RegionAttachment.C3G = 19;
+ RegionAttachment.C3B = 20;
+ RegionAttachment.C3A = 21;
+ RegionAttachment.U3 = 22;
+ RegionAttachment.V3 = 23;
+ RegionAttachment.X4 = 24;
+ RegionAttachment.Y4 = 25;
+ RegionAttachment.C4R = 26;
+ RegionAttachment.C4G = 27;
+ RegionAttachment.C4B = 28;
+ RegionAttachment.C4A = 29;
+ RegionAttachment.U4 = 30;
+ RegionAttachment.V4 = 31;
+ return RegionAttachment;
+ }(spine.Attachment));
+ spine.RegionAttachment = RegionAttachment;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var JitterEffect = (function () {
+ function JitterEffect(jitterX, jitterY) {
+ this.jitterX = 0;
+ this.jitterY = 0;
+ this.jitterX = jitterX;
+ this.jitterY = jitterY;
+ }
+ JitterEffect.prototype.begin = function (skeleton) {
+ };
+ JitterEffect.prototype.transform = function (position, uv, light, dark) {
+ position.x += spine.MathUtils.randomTriangular(-this.jitterX, this.jitterY);
+ position.y += spine.MathUtils.randomTriangular(-this.jitterX, this.jitterY);
+ };
+ JitterEffect.prototype.end = function () {
+ };
+ return JitterEffect;
+ }());
+ spine.JitterEffect = JitterEffect;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var SwirlEffect = (function () {
+ function SwirlEffect(radius) {
+ this.centerX = 0;
+ this.centerY = 0;
+ this.radius = 0;
+ this.angle = 0;
+ this.worldX = 0;
+ this.worldY = 0;
+ this.radius = radius;
+ }
+ SwirlEffect.prototype.begin = function (skeleton) {
+ this.worldX = skeleton.x + this.centerX;
+ this.worldY = skeleton.y + this.centerY;
+ };
+ SwirlEffect.prototype.transform = function (position, uv, light, dark) {
+ var radAngle = this.angle * spine.MathUtils.degreesToRadians;
+ var x = position.x - this.worldX;
+ var y = position.y - this.worldY;
+ var dist = Math.sqrt(x * x + y * y);
+ if (dist < this.radius) {
+ var theta = SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius);
+ var cos = Math.cos(theta);
+ var sin = Math.sin(theta);
+ position.x = cos * x - sin * y + this.worldX;
+ position.y = sin * x + cos * y + this.worldY;
+ }
+ };
+ SwirlEffect.prototype.end = function () {
+ };
+ SwirlEffect.interpolation = new spine.PowOut(2);
+ return SwirlEffect;
+ }());
+ spine.SwirlEffect = SwirlEffect;
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var AssetManager = (function (_super) {
+ __extends(AssetManager, _super);
+ function AssetManager(context, pathPrefix) {
+ if (pathPrefix === void 0) { pathPrefix = ""; }
+ return _super.call(this, function (image) {
+ return new spine.webgl.GLTexture(context, image);
+ }, pathPrefix) || this;
+ }
+ return AssetManager;
+ }(spine.AssetManager));
+ webgl.AssetManager = AssetManager;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var OrthoCamera = (function () {
+ function OrthoCamera(viewportWidth, viewportHeight) {
+ this.position = new webgl.Vector3(0, 0, 0);
+ this.direction = new webgl.Vector3(0, 0, -1);
+ this.up = new webgl.Vector3(0, 1, 0);
+ this.near = 0;
+ this.far = 100;
+ this.zoom = 1;
+ this.viewportWidth = 0;
+ this.viewportHeight = 0;
+ this.projectionView = new webgl.Matrix4();
+ this.inverseProjectionView = new webgl.Matrix4();
+ this.projection = new webgl.Matrix4();
+ this.view = new webgl.Matrix4();
+ this.tmp = new webgl.Vector3();
+ this.viewportWidth = viewportWidth;
+ this.viewportHeight = viewportHeight;
+ this.update();
+ }
+ OrthoCamera.prototype.update = function () {
+ var projection = this.projection;
+ var view = this.view;
+ var projectionView = this.projectionView;
+ var inverseProjectionView = this.inverseProjectionView;
+ var zoom = this.zoom, viewportWidth = this.viewportWidth, viewportHeight = this.viewportHeight;
+ projection.ortho(zoom * (-viewportWidth / 2), zoom * (viewportWidth / 2), zoom * (-viewportHeight / 2), zoom * (viewportHeight / 2), this.near, this.far);
+ view.lookAt(this.position, this.direction, this.up);
+ projectionView.set(projection.values);
+ projectionView.multiply(view);
+ inverseProjectionView.set(projectionView.values).invert();
+ };
+ OrthoCamera.prototype.screenToWorld = function (screenCoords, screenWidth, screenHeight) {
+ var x = screenCoords.x, y = screenHeight - screenCoords.y - 1;
+ var tmp = this.tmp;
+ tmp.x = (2 * x) / screenWidth - 1;
+ tmp.y = (2 * y) / screenHeight - 1;
+ tmp.z = (2 * screenCoords.z) - 1;
+ tmp.project(this.inverseProjectionView);
+ screenCoords.set(tmp.x, tmp.y, tmp.z);
+ return screenCoords;
+ };
+ OrthoCamera.prototype.setViewport = function (viewportWidth, viewportHeight) {
+ this.viewportWidth = viewportWidth;
+ this.viewportHeight = viewportHeight;
+ };
+ return OrthoCamera;
+ }());
+ webgl.OrthoCamera = OrthoCamera;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var GLTexture = (function (_super) {
+ __extends(GLTexture, _super);
+ function GLTexture(context, image, useMipMaps) {
+ if (useMipMaps === void 0) { useMipMaps = false; }
+ var _this = _super.call(this, image) || this;
+ _this.texture = null;
+ _this.boundUnit = 0;
+ _this.useMipMaps = false;
+ _this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ _this.useMipMaps = useMipMaps;
+ _this.restore();
+ _this.context.addRestorable(_this);
+ return _this;
+ }
+ GLTexture.prototype.setFilters = function (minFilter, magFilter) {
+ var gl = this.context.gl;
+ this.bind();
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter);
+ };
+ GLTexture.prototype.setWraps = function (uWrap, vWrap) {
+ var gl = this.context.gl;
+ this.bind();
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, uWrap);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, vWrap);
+ };
+ GLTexture.prototype.update = function (useMipMaps) {
+ var gl = this.context.gl;
+ if (!this.texture) {
+ this.texture = this.context.gl.createTexture();
+ }
+ this.bind();
+ useMipMaps = gl.isWebgl2 && gl.useMipMaps;
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this._image);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, useMipMaps ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+ if (useMipMaps) {
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_BASE_LEVEL, 0);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAX_LEVEL, 1);
+ gl.generateMipmap(gl.TEXTURE_2D);
+ }
+ };
+ GLTexture.prototype.restore = function () {
+ this.texture = null;
+ this.update(this.useMipMaps);
+ };
+ GLTexture.prototype.bind = function (unit) {
+ if (unit === void 0) { unit = 0; }
+ var gl = this.context.gl;
+ this.boundUnit = unit;
+ gl.activeTexture(gl.TEXTURE0 + unit);
+ gl.bindTexture(gl.TEXTURE_2D, this.texture);
+ };
+ GLTexture.prototype.unbind = function () {
+ var gl = this.context.gl;
+ gl.activeTexture(gl.TEXTURE0 + this.boundUnit);
+ gl.bindTexture(gl.TEXTURE_2D, null);
+ };
+ GLTexture.prototype.dispose = function () {
+ this.context.removeRestorable(this);
+ var gl = this.context.gl;
+ gl.deleteTexture(this.texture);
+ };
+ return GLTexture;
+ }(spine.Texture));
+ webgl.GLTexture = GLTexture;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var Input = (function () {
+ function Input(element) {
+ this.lastX = 0;
+ this.lastY = 0;
+ this.buttonDown = false;
+ this.currTouch = null;
+ this.touchesPool = new spine.Pool(function () {
+ return new spine.webgl.Touch(0, 0, 0);
+ });
+ this.listeners = new Array();
+ this.element = element;
+ this.setupCallbacks(element);
+ }
+ Input.prototype.setupCallbacks = function (element) {
+ var _this = this;
+ element.addEventListener("mousedown", function (ev) {
+ if (ev instanceof MouseEvent) {
+ var rect = element.getBoundingClientRect();
+ var x = ev.clientX - rect.left;
+ var y = ev.clientY - rect.top;
+ var listeners = _this.listeners;
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i].down(x, y);
+ }
+ _this.lastX = x;
+ _this.lastY = y;
+ _this.buttonDown = true;
+ }
+ }, true);
+ element.addEventListener("mousemove", function (ev) {
+ if (ev instanceof MouseEvent) {
+ var rect = element.getBoundingClientRect();
+ var x = ev.clientX - rect.left;
+ var y = ev.clientY - rect.top;
+ var listeners = _this.listeners;
+ for (var i = 0; i < listeners.length; i++) {
+ if (_this.buttonDown) {
+ listeners[i].dragged(x, y);
+ }
+ else {
+ listeners[i].moved(x, y);
+ }
+ }
+ _this.lastX = x;
+ _this.lastY = y;
+ }
+ }, true);
+ element.addEventListener("mouseup", function (ev) {
+ if (ev instanceof MouseEvent) {
+ var rect = element.getBoundingClientRect();
+ var x = ev.clientX - rect.left;
+ var y = ev.clientY - rect.top;
+ var listeners = _this.listeners;
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i].up(x, y);
+ }
+ _this.lastX = x;
+ _this.lastY = y;
+ _this.buttonDown = false;
+ }
+ }, true);
+ element.addEventListener("touchstart", function (ev) {
+ if (_this.currTouch != null)
+ return;
+ var touches = ev.changedTouches;
+ for (var i = 0; i < touches.length; i++) {
+ var touch = touches[i];
+ var rect = element.getBoundingClientRect();
+ var x = touch.clientX - rect.left;
+ var y = touch.clientY - rect.top;
+ _this.currTouch = _this.touchesPool.obtain();
+ _this.currTouch.identifier = touch.identifier;
+ _this.currTouch.x = x;
+ _this.currTouch.y = y;
+ break;
+ }
+ var listeners = _this.listeners;
+ for (var i_8 = 0; i_8 < listeners.length; i_8++) {
+ listeners[i_8].down(_this.currTouch.x, _this.currTouch.y);
+ }
+ console.log("Start " + _this.currTouch.x + ", " + _this.currTouch.y);
+ _this.lastX = _this.currTouch.x;
+ _this.lastY = _this.currTouch.y;
+ _this.buttonDown = true;
+ ev.preventDefault();
+ }, false);
+ element.addEventListener("touchend", function (ev) {
+ var touches = ev.changedTouches;
+ for (var i = 0; i < touches.length; i++) {
+ var touch = touches[i];
+ if (_this.currTouch.identifier === touch.identifier) {
+ var rect = element.getBoundingClientRect();
+ var x = _this.currTouch.x = touch.clientX - rect.left;
+ var y = _this.currTouch.y = touch.clientY - rect.top;
+ _this.touchesPool.free(_this.currTouch);
+ var listeners = _this.listeners;
+ for (var i_9 = 0; i_9 < listeners.length; i_9++) {
+ listeners[i_9].up(x, y);
+ }
+ console.log("End " + x + ", " + y);
+ _this.lastX = x;
+ _this.lastY = y;
+ _this.buttonDown = false;
+ _this.currTouch = null;
+ break;
+ }
+ }
+ ev.preventDefault();
+ }, false);
+ element.addEventListener("touchcancel", function (ev) {
+ var touches = ev.changedTouches;
+ for (var i = 0; i < touches.length; i++) {
+ var touch = touches[i];
+ if (_this.currTouch.identifier === touch.identifier) {
+ var rect = element.getBoundingClientRect();
+ var x = _this.currTouch.x = touch.clientX - rect.left;
+ var y = _this.currTouch.y = touch.clientY - rect.top;
+ _this.touchesPool.free(_this.currTouch);
+ var listeners = _this.listeners;
+ for (var i_10 = 0; i_10 < listeners.length; i_10++) {
+ listeners[i_10].up(x, y);
+ }
+ console.log("End " + x + ", " + y);
+ _this.lastX = x;
+ _this.lastY = y;
+ _this.buttonDown = false;
+ _this.currTouch = null;
+ break;
+ }
+ }
+ ev.preventDefault();
+ }, false);
+ element.addEventListener("touchmove", function (ev) {
+ if (_this.currTouch == null)
+ return;
+ var touches = ev.changedTouches;
+ for (var i = 0; i < touches.length; i++) {
+ var touch = touches[i];
+ if (_this.currTouch.identifier === touch.identifier) {
+ var rect = element.getBoundingClientRect();
+ var x = touch.clientX - rect.left;
+ var y = touch.clientY - rect.top;
+ var listeners = _this.listeners;
+ for (var i_11 = 0; i_11 < listeners.length; i_11++) {
+ listeners[i_11].dragged(x, y);
+ }
+ console.log("Drag " + x + ", " + y);
+ _this.lastX = _this.currTouch.x = x;
+ _this.lastY = _this.currTouch.y = y;
+ break;
+ }
+ }
+ ev.preventDefault();
+ }, false);
+ };
+ Input.prototype.addListener = function (listener) {
+ this.listeners.push(listener);
+ };
+ Input.prototype.removeListener = function (listener) {
+ var idx = this.listeners.indexOf(listener);
+ if (idx > -1) {
+ this.listeners.splice(idx, 1);
+ }
+ };
+ return Input;
+ }());
+ webgl.Input = Input;
+ var Touch = (function () {
+ function Touch(identifier, x, y) {
+ this.identifier = identifier;
+ this.x = x;
+ this.y = y;
+ }
+ return Touch;
+ }());
+ webgl.Touch = Touch;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var LoadingScreen = (function () {
+ function LoadingScreen(renderer) {
+ this.logo = null;
+ this.spinner = null;
+ this.angle = 0;
+ this.fadeOut = 0;
+ this.timeKeeper = new spine.TimeKeeper();
+ this.backgroundColor = new spine.Color(0.135, 0.135, 0.135, 1);
+ this.tempColor = new spine.Color();
+ this.firstDraw = 0;
+ this.renderer = renderer;
+ this.timeKeeper.maxDelta = 9;
+ if (LoadingScreen.logoImg === null) {
+ var isSafari = navigator.userAgent.indexOf("Safari") > -1;
+ LoadingScreen.logoImg = new Image();
+ LoadingScreen.logoImg.src = LoadingScreen.SPINE_LOGO_DATA;
+ if (!isSafari)
+ LoadingScreen.logoImg.crossOrigin = "anonymous";
+ LoadingScreen.logoImg.onload = function (ev) {
+ LoadingScreen.loaded++;
+ };
+ LoadingScreen.spinnerImg = new Image();
+ LoadingScreen.spinnerImg.src = LoadingScreen.SPINNER_DATA;
+ if (!isSafari)
+ LoadingScreen.spinnerImg.crossOrigin = "anonymous";
+ LoadingScreen.spinnerImg.onload = function (ev) {
+ LoadingScreen.loaded++;
+ };
+ }
+ }
+ LoadingScreen.prototype.draw = function (complete) {
+ if (complete === void 0) { complete = false; }
+ if (complete && this.fadeOut > LoadingScreen.FADE_SECONDS)
+ return;
+ this.timeKeeper.update();
+ var a = Math.abs(Math.sin(this.timeKeeper.totalTime + 0.75));
+ this.angle -= this.timeKeeper.delta * 360 * (1 + 1.5 * Math.pow(a, 5));
+ var renderer = this.renderer;
+ var canvas = renderer.canvas;
+ var gl = renderer.context.gl;
+ var oldX = renderer.camera.position.x, oldY = renderer.camera.position.y;
+ renderer.camera.position.set(canvas.width / 2, canvas.height / 2, 0);
+ renderer.camera.viewportWidth = canvas.width;
+ renderer.camera.viewportHeight = canvas.height;
+ renderer.resize(webgl.ResizeMode.Stretch);
+ if (!complete) {
+ gl.clearColor(this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ this.tempColor.a = 1;
+ }
+ else {
+ this.fadeOut += this.timeKeeper.delta * (this.timeKeeper.totalTime < 1 ? 2 : 1);
+ if (this.fadeOut > LoadingScreen.FADE_SECONDS) {
+ renderer.camera.position.set(oldX, oldY, 0);
+ return;
+ }
+ a = 1 - this.fadeOut / LoadingScreen.FADE_SECONDS;
+ this.tempColor.setFromColor(this.backgroundColor);
+ this.tempColor.a = 1 - (a - 1) * (a - 1);
+ renderer.begin();
+ renderer.quad(true, 0, 0, canvas.width, 0, canvas.width, canvas.height, 0, canvas.height, this.tempColor, this.tempColor, this.tempColor, this.tempColor);
+ renderer.end();
+ }
+ this.tempColor.set(1, 1, 1, this.tempColor.a);
+ if (LoadingScreen.loaded != 2)
+ return;
+ if (this.logo === null) {
+ this.logo = new webgl.GLTexture(renderer.context, LoadingScreen.logoImg);
+ this.spinner = new webgl.GLTexture(renderer.context, LoadingScreen.spinnerImg);
+ }
+ this.logo.update(false);
+ this.spinner.update(false);
+ var logoWidth = this.logo.getImage().width;
+ var logoHeight = this.logo.getImage().height;
+ var spinnerWidth = this.spinner.getImage().width;
+ var spinnerHeight = this.spinner.getImage().height;
+ renderer.batcher.setBlendMode(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
+ renderer.begin();
+ renderer.drawTexture(this.logo, (canvas.width - logoWidth) / 2, (canvas.height - logoHeight) / 2, logoWidth, logoHeight, this.tempColor);
+ renderer.drawTextureRotated(this.spinner, (canvas.width - spinnerWidth) / 2, (canvas.height - spinnerHeight) / 2, spinnerWidth, spinnerHeight, spinnerWidth / 2, spinnerHeight / 2, this.angle, this.tempColor);
+ renderer.end();
+ renderer.camera.position.set(oldX, oldY, 0);
+ };
+ LoadingScreen.FADE_SECONDS = 1;
+ LoadingScreen.loaded = 0;
+ LoadingScreen.spinnerImg = null;
+ LoadingScreen.logoImg = null;
+ LoadingScreen.SPINNER_DATA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAChCAMAAAB3TUS6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAYNQTFRFAAAA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AA/0AAkTDRyAAAAIB0Uk5TAAABAgMEBQYHCAkKCwwODxAREhMUFRYXGBkaHB0eICEiIyQlJicoKSorLC0uLzAxMjM0Nzg5Ojs8PT4/QEFDRUlKS0xNTk9QUlRWWFlbXF1eYWJjZmhscHF0d3h5e3x+f4CIiYuMj5GSlJWXm56io6arr7rAxcjO0dXe6Onr8fmb5sOOAAADuElEQVQYGe3B+3vTVBwH4M/3nCRt13br2Lozhug2q25gYQubcxqVKYoMCYoKjEsUdSpeiBc0Kl7yp9t2za39pely7PF5zvuiQKc+/e2f8K+f9g2oyQ77Ag4VGX+HketQ0XYYe0JQ0CdhogwF+WFiBgr6JkxUoKCDMMGgoP0w9gdUtB3GfoCKVsPYAVQ0H8YuQUWVMHYGKuJhrAklPQkjJpT0bdj3O9S0FfZ9ADXxP8MjVSiqFfa8B2VVV8+df14QtB4iwn+BpuZEgyM38WMQHDYhnbkgukrIh5ygZ48glyn6KshlL+jbhVRcxCzk0ApiC5CI5kVsgTAy9jiI/WxBGmqIFBMjqwYphwRZaiLNwsjqQdoVSFISGRwjM4OMFUjBRcYCYWT0XZD2SwUS0LzIKCGH2SDja0LxKiJjCrm0gowVFI6aIs1CTouPg5QvUTgSKXMMuVUeBSmEopFITBPGwO8HCYbCTYtImTAWejuI3CMUjmZFT5NjbM/9GvQcMkhADdFRIxxD7aug4wGDFGSVTcLx0MzutQ2CpmmapmmapmmapmmapmmaphWBmGFV6rNNcaLC0GUuv3LROftUo8wJk0a10207sVED6IIf+9673LIwQeW2PaCEJX/A+xYmhTbtQUu46g96SJgQZg9Zwxf+EAMTwuwhm3jkD7EwIdweBn+YhQlh9pA2HvpDTEwIs4es4GN/CMekNOxBJ9D2B10nTAyfW7fT1hjYgZ/xYIUwUcycaiwuv2h3tOcZADr7ud/12c0ru2cWSwQ1UAcixIgImqZpmqZpmqZpmqZpmqZp2v8HMSIcF186t8oghbnlOJt1wnHwl7yOGxwSlHacrjWG8dVuej03OApn7jhHtiyMiZa9yD6haLYTebWOsbDXvQRHwchJWSTkV/rQS+EoWttJaTHkJe56KXcJRZt20jY48nnBy9hE4WjLSbvAkIfwMm5zFG/KyWgRRke3vYwGZDjpZHCMruJltCAFrTtpVYxu1ktzCHKwbSdlGqOreynXGGQpOylljI5uebFbBuSZc2IbhBxmvcj9GiSiZ52+HQO5nPb6TkIqajs9L5eQk7jnddxZgGT0jNOxYSI36+Kdj9oG5OPV6QpB6yJuGAYnqIrecLveYlDUKffIOtREl90+BiWV3cgMlNR0I09DSS030oaSttzILpT0phu5BBWRmyAoiLkJgoIMN8GgoJKb4FBQzU0YUFDdTRhQUNVNcCjIdBMEBdE7buQ8lFRz+97lUFN5fe+qu//aMkeB/gU2ae9y2HgbngAAAABJRU5ErkJggg==";
+ LoadingScreen.SPINE_LOGO_DATA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAAAZCAYAAACis3k0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtNJREFUaN7tmT2I1EAUxwN+oWgRT0HFKo0WCkJ6ObmAWFwZbCxsXGysLNJaiCyIoDaSwk4ETzvhmnBaCRbBWoQ01ho4PwotjP8cE337mMy8TLK757mBH3fLTWbe/PbN53neNniqZW8FvAVvQAqugwvgDDgO9niLRyTyJagM/ACPF6bsIl9ZRDac/Cc6tLn5xQdRQ496QlKPLxD5QCDxO9jtGM8QfYoIgUlgCipGCRJL5VvlyOdCU09iEXkCfLSIfCrs7Fab6nOsiafu06iDwES9w/uU1QnDC+ekkVS9vEaDsgVeB0d+z1VDtOGxRaYPboP3Gokb4GgXkZp4chZPJKgvZ3U0XkriK/TIt9YUDllFgTAjGwoaoHqfBhMI58yD4BQ4V6/aHYdfxToftvw9F2SiVroawU2/Cv5C4Thv0KB9S5nxlOd4STxjwUjzSdYlgrYijw2BsEfgsaFcM09lhiys94xXQQwugcvgJrgFLjrEE7WUiTuWCQzt/ZXN7FfqGwuGClyVy2xZAFmfDQvNtwFFSspMDGsD+UTWqu1KoVmVooFEJgKRXw0if85RpISEzwsjzeqWzkjkC4PIJ3MUmQgITAHlQwTFhnZhELkEntfZRwR+AvfAgXmJHOqU02XligWT8ppg67NXbdCXeq7afUQ6L8C2DalEZNt2YyQ94Qy8/ekjMpBMbfyl5iTjG7YAI8cNecROAb4kJmTjaXAF3AGvwQewOiuRxEtlSaT4j2h2lMsUueQEoMlIKpTvAmKhxPMtC876jEX6rE8l8TNx/KVbn6xlWU9NWcSDUsO4NGWpQOTZFpHPOooMXcswmW2XFk3ixb2v0Nq+XVKP00QNaffBLyWwBI/AkTlfMYZDXMf12kc6yjwEjoFdO/5me5oi/6tnyhlZX6OtgmX1c2Uh0k3khmbB2b9TRfpd/jfTUeRDJvHdYg5wE7kPXAN3wQ1weDvH+xufEgpi5qIl3QAAAABJRU5ErkJggg==";
+ return LoadingScreen;
+ }());
+ webgl.LoadingScreen = LoadingScreen;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ webgl.M00 = 0;
+ webgl.M01 = 4;
+ webgl.M02 = 8;
+ webgl.M03 = 12;
+ webgl.M10 = 1;
+ webgl.M11 = 5;
+ webgl.M12 = 9;
+ webgl.M13 = 13;
+ webgl.M20 = 2;
+ webgl.M21 = 6;
+ webgl.M22 = 10;
+ webgl.M23 = 14;
+ webgl.M30 = 3;
+ webgl.M31 = 7;
+ webgl.M32 = 11;
+ webgl.M33 = 15;
+ var Matrix4 = (function () {
+ function Matrix4() {
+ this.temp = new Float32Array(16);
+ this.values = new Float32Array(16);
+ var v = this.values;
+ v[webgl.M00] = 1;
+ v[webgl.M11] = 1;
+ v[webgl.M22] = 1;
+ v[webgl.M33] = 1;
+ }
+
+ Matrix4.prototype.concat = function (other) {
+ var i, e, a, b, ai0, ai1, ai2, ai3;
+
+ // Calculate e = a * b
+ e = this.values;
+ a = this.values;
+ b = other.values;
+
+ // If e equals b, copy b to temporary matrix.
+ if (e === b) {
+ b = new Float32Array(16);
+ for (i = 0; i < 16; ++i) {
+ b[i] = e[i];
+ }
+ }
+
+ for (i = 0; i < 4; i++) {
+ ai0 = a[i]; ai1 = a[i + 4]; ai2 = a[i + 8]; ai3 = a[i + 12];
+ e[i] = ai0 * b[0] + ai1 * b[1] + ai2 * b[2] + ai3 * b[3];
+ e[i + 4] = ai0 * b[4] + ai1 * b[5] + ai2 * b[6] + ai3 * b[7];
+ e[i + 8] = ai0 * b[8] + ai1 * b[9] + ai2 * b[10] + ai3 * b[11];
+ e[i + 12] = ai0 * b[12] + ai1 * b[13] + ai2 * b[14] + ai3 * b[15];
+ }
+
+ return this;
+ };
+ Matrix4.prototype.set = function (values) {
+ this.values.set(values);
+ return this;
+ };
+ Matrix4.prototype.transpose = function () {
+ var t = this.temp;
+ var v = this.values;
+ t[webgl.M00] = v[webgl.M00];
+ t[webgl.M01] = v[webgl.M10];
+ t[webgl.M02] = v[webgl.M20];
+ t[webgl.M03] = v[webgl.M30];
+ t[webgl.M10] = v[webgl.M01];
+ t[webgl.M11] = v[webgl.M11];
+ t[webgl.M12] = v[webgl.M21];
+ t[webgl.M13] = v[webgl.M31];
+ t[webgl.M20] = v[webgl.M02];
+ t[webgl.M21] = v[webgl.M12];
+ t[webgl.M22] = v[webgl.M22];
+ t[webgl.M23] = v[webgl.M32];
+ t[webgl.M30] = v[webgl.M03];
+ t[webgl.M31] = v[webgl.M13];
+ t[webgl.M32] = v[webgl.M23];
+ t[webgl.M33] = v[webgl.M33];
+ return this.set(t);
+ };
+ Matrix4.prototype.identity = function () {
+ var v = this.values;
+ v[webgl.M00] = 1;
+ v[webgl.M01] = 0;
+ v[webgl.M02] = 0;
+ v[webgl.M03] = 0;
+ v[webgl.M10] = 0;
+ v[webgl.M11] = 1;
+ v[webgl.M12] = 0;
+ v[webgl.M13] = 0;
+ v[webgl.M20] = 0;
+ v[webgl.M21] = 0;
+ v[webgl.M22] = 1;
+ v[webgl.M23] = 0;
+ v[webgl.M30] = 0;
+ v[webgl.M31] = 0;
+ v[webgl.M32] = 0;
+ v[webgl.M33] = 1;
+ return this;
+ };
+ Matrix4.prototype.invert = function () {
+ var v = this.values;
+ var t = this.temp;
+ var l_det = v[webgl.M30] * v[webgl.M21] * v[webgl.M12] * v[webgl.M03] - v[webgl.M20] * v[webgl.M31] * v[webgl.M12] * v[webgl.M03] - v[webgl.M30] * v[webgl.M11] * v[webgl.M22] * v[webgl.M03]
+ + v[webgl.M10] * v[webgl.M31] * v[webgl.M22] * v[webgl.M03] + v[webgl.M20] * v[webgl.M11] * v[webgl.M32] * v[webgl.M03] - v[webgl.M10] * v[webgl.M21] * v[webgl.M32] * v[webgl.M03]
+ - v[webgl.M30] * v[webgl.M21] * v[webgl.M02] * v[webgl.M13] + v[webgl.M20] * v[webgl.M31] * v[webgl.M02] * v[webgl.M13] + v[webgl.M30] * v[webgl.M01] * v[webgl.M22] * v[webgl.M13]
+ - v[webgl.M00] * v[webgl.M31] * v[webgl.M22] * v[webgl.M13] - v[webgl.M20] * v[webgl.M01] * v[webgl.M32] * v[webgl.M13] + v[webgl.M00] * v[webgl.M21] * v[webgl.M32] * v[webgl.M13]
+ + v[webgl.M30] * v[webgl.M11] * v[webgl.M02] * v[webgl.M23] - v[webgl.M10] * v[webgl.M31] * v[webgl.M02] * v[webgl.M23] - v[webgl.M30] * v[webgl.M01] * v[webgl.M12] * v[webgl.M23]
+ + v[webgl.M00] * v[webgl.M31] * v[webgl.M12] * v[webgl.M23] + v[webgl.M10] * v[webgl.M01] * v[webgl.M32] * v[webgl.M23] - v[webgl.M00] * v[webgl.M11] * v[webgl.M32] * v[webgl.M23]
+ - v[webgl.M20] * v[webgl.M11] * v[webgl.M02] * v[webgl.M33] + v[webgl.M10] * v[webgl.M21] * v[webgl.M02] * v[webgl.M33] + v[webgl.M20] * v[webgl.M01] * v[webgl.M12] * v[webgl.M33]
+ - v[webgl.M00] * v[webgl.M21] * v[webgl.M12] * v[webgl.M33] - v[webgl.M10] * v[webgl.M01] * v[webgl.M22] * v[webgl.M33] + v[webgl.M00] * v[webgl.M11] * v[webgl.M22] * v[webgl.M33];
+ if (l_det == 0)
+ throw new Error("non-invertible matrix");
+ var inv_det = 1.0 / l_det;
+ t[webgl.M00] = v[webgl.M12] * v[webgl.M23] * v[webgl.M31] - v[webgl.M13] * v[webgl.M22] * v[webgl.M31] + v[webgl.M13] * v[webgl.M21] * v[webgl.M32]
+ - v[webgl.M11] * v[webgl.M23] * v[webgl.M32] - v[webgl.M12] * v[webgl.M21] * v[webgl.M33] + v[webgl.M11] * v[webgl.M22] * v[webgl.M33];
+ t[webgl.M01] = v[webgl.M03] * v[webgl.M22] * v[webgl.M31] - v[webgl.M02] * v[webgl.M23] * v[webgl.M31] - v[webgl.M03] * v[webgl.M21] * v[webgl.M32]
+ + v[webgl.M01] * v[webgl.M23] * v[webgl.M32] + v[webgl.M02] * v[webgl.M21] * v[webgl.M33] - v[webgl.M01] * v[webgl.M22] * v[webgl.M33];
+ t[webgl.M02] = v[webgl.M02] * v[webgl.M13] * v[webgl.M31] - v[webgl.M03] * v[webgl.M12] * v[webgl.M31] + v[webgl.M03] * v[webgl.M11] * v[webgl.M32]
+ - v[webgl.M01] * v[webgl.M13] * v[webgl.M32] - v[webgl.M02] * v[webgl.M11] * v[webgl.M33] + v[webgl.M01] * v[webgl.M12] * v[webgl.M33];
+ t[webgl.M03] = v[webgl.M03] * v[webgl.M12] * v[webgl.M21] - v[webgl.M02] * v[webgl.M13] * v[webgl.M21] - v[webgl.M03] * v[webgl.M11] * v[webgl.M22]
+ + v[webgl.M01] * v[webgl.M13] * v[webgl.M22] + v[webgl.M02] * v[webgl.M11] * v[webgl.M23] - v[webgl.M01] * v[webgl.M12] * v[webgl.M23];
+ t[webgl.M10] = v[webgl.M13] * v[webgl.M22] * v[webgl.M30] - v[webgl.M12] * v[webgl.M23] * v[webgl.M30] - v[webgl.M13] * v[webgl.M20] * v[webgl.M32]
+ + v[webgl.M10] * v[webgl.M23] * v[webgl.M32] + v[webgl.M12] * v[webgl.M20] * v[webgl.M33] - v[webgl.M10] * v[webgl.M22] * v[webgl.M33];
+ t[webgl.M11] = v[webgl.M02] * v[webgl.M23] * v[webgl.M30] - v[webgl.M03] * v[webgl.M22] * v[webgl.M30] + v[webgl.M03] * v[webgl.M20] * v[webgl.M32]
+ - v[webgl.M00] * v[webgl.M23] * v[webgl.M32] - v[webgl.M02] * v[webgl.M20] * v[webgl.M33] + v[webgl.M00] * v[webgl.M22] * v[webgl.M33];
+ t[webgl.M12] = v[webgl.M03] * v[webgl.M12] * v[webgl.M30] - v[webgl.M02] * v[webgl.M13] * v[webgl.M30] - v[webgl.M03] * v[webgl.M10] * v[webgl.M32]
+ + v[webgl.M00] * v[webgl.M13] * v[webgl.M32] + v[webgl.M02] * v[webgl.M10] * v[webgl.M33] - v[webgl.M00] * v[webgl.M12] * v[webgl.M33];
+ t[webgl.M13] = v[webgl.M02] * v[webgl.M13] * v[webgl.M20] - v[webgl.M03] * v[webgl.M12] * v[webgl.M20] + v[webgl.M03] * v[webgl.M10] * v[webgl.M22]
+ - v[webgl.M00] * v[webgl.M13] * v[webgl.M22] - v[webgl.M02] * v[webgl.M10] * v[webgl.M23] + v[webgl.M00] * v[webgl.M12] * v[webgl.M23];
+ t[webgl.M20] = v[webgl.M11] * v[webgl.M23] * v[webgl.M30] - v[webgl.M13] * v[webgl.M21] * v[webgl.M30] + v[webgl.M13] * v[webgl.M20] * v[webgl.M31]
+ - v[webgl.M10] * v[webgl.M23] * v[webgl.M31] - v[webgl.M11] * v[webgl.M20] * v[webgl.M33] + v[webgl.M10] * v[webgl.M21] * v[webgl.M33];
+ t[webgl.M21] = v[webgl.M03] * v[webgl.M21] * v[webgl.M30] - v[webgl.M01] * v[webgl.M23] * v[webgl.M30] - v[webgl.M03] * v[webgl.M20] * v[webgl.M31]
+ + v[webgl.M00] * v[webgl.M23] * v[webgl.M31] + v[webgl.M01] * v[webgl.M20] * v[webgl.M33] - v[webgl.M00] * v[webgl.M21] * v[webgl.M33];
+ t[webgl.M22] = v[webgl.M01] * v[webgl.M13] * v[webgl.M30] - v[webgl.M03] * v[webgl.M11] * v[webgl.M30] + v[webgl.M03] * v[webgl.M10] * v[webgl.M31]
+ - v[webgl.M00] * v[webgl.M13] * v[webgl.M31] - v[webgl.M01] * v[webgl.M10] * v[webgl.M33] + v[webgl.M00] * v[webgl.M11] * v[webgl.M33];
+ t[webgl.M23] = v[webgl.M03] * v[webgl.M11] * v[webgl.M20] - v[webgl.M01] * v[webgl.M13] * v[webgl.M20] - v[webgl.M03] * v[webgl.M10] * v[webgl.M21]
+ + v[webgl.M00] * v[webgl.M13] * v[webgl.M21] + v[webgl.M01] * v[webgl.M10] * v[webgl.M23] - v[webgl.M00] * v[webgl.M11] * v[webgl.M23];
+ t[webgl.M30] = v[webgl.M12] * v[webgl.M21] * v[webgl.M30] - v[webgl.M11] * v[webgl.M22] * v[webgl.M30] - v[webgl.M12] * v[webgl.M20] * v[webgl.M31]
+ + v[webgl.M10] * v[webgl.M22] * v[webgl.M31] + v[webgl.M11] * v[webgl.M20] * v[webgl.M32] - v[webgl.M10] * v[webgl.M21] * v[webgl.M32];
+ t[webgl.M31] = v[webgl.M01] * v[webgl.M22] * v[webgl.M30] - v[webgl.M02] * v[webgl.M21] * v[webgl.M30] + v[webgl.M02] * v[webgl.M20] * v[webgl.M31]
+ - v[webgl.M00] * v[webgl.M22] * v[webgl.M31] - v[webgl.M01] * v[webgl.M20] * v[webgl.M32] + v[webgl.M00] * v[webgl.M21] * v[webgl.M32];
+ t[webgl.M32] = v[webgl.M02] * v[webgl.M11] * v[webgl.M30] - v[webgl.M01] * v[webgl.M12] * v[webgl.M30] - v[webgl.M02] * v[webgl.M10] * v[webgl.M31]
+ + v[webgl.M00] * v[webgl.M12] * v[webgl.M31] + v[webgl.M01] * v[webgl.M10] * v[webgl.M32] - v[webgl.M00] * v[webgl.M11] * v[webgl.M32];
+ t[webgl.M33] = v[webgl.M01] * v[webgl.M12] * v[webgl.M20] - v[webgl.M02] * v[webgl.M11] * v[webgl.M20] + v[webgl.M02] * v[webgl.M10] * v[webgl.M21]
+ - v[webgl.M00] * v[webgl.M12] * v[webgl.M21] - v[webgl.M01] * v[webgl.M10] * v[webgl.M22] + v[webgl.M00] * v[webgl.M11] * v[webgl.M22];
+ v[webgl.M00] = t[webgl.M00] * inv_det;
+ v[webgl.M01] = t[webgl.M01] * inv_det;
+ v[webgl.M02] = t[webgl.M02] * inv_det;
+ v[webgl.M03] = t[webgl.M03] * inv_det;
+ v[webgl.M10] = t[webgl.M10] * inv_det;
+ v[webgl.M11] = t[webgl.M11] * inv_det;
+ v[webgl.M12] = t[webgl.M12] * inv_det;
+ v[webgl.M13] = t[webgl.M13] * inv_det;
+ v[webgl.M20] = t[webgl.M20] * inv_det;
+ v[webgl.M21] = t[webgl.M21] * inv_det;
+ v[webgl.M22] = t[webgl.M22] * inv_det;
+ v[webgl.M23] = t[webgl.M23] * inv_det;
+ v[webgl.M30] = t[webgl.M30] * inv_det;
+ v[webgl.M31] = t[webgl.M31] * inv_det;
+ v[webgl.M32] = t[webgl.M32] * inv_det;
+ v[webgl.M33] = t[webgl.M33] * inv_det;
+ return this;
+ };
+ Matrix4.prototype.determinant = function () {
+ var v = this.values;
+ return v[webgl.M30] * v[webgl.M21] * v[webgl.M12] * v[webgl.M03] - v[webgl.M20] * v[webgl.M31] * v[webgl.M12] * v[webgl.M03] - v[webgl.M30] * v[webgl.M11] * v[webgl.M22] * v[webgl.M03]
+ + v[webgl.M10] * v[webgl.M31] * v[webgl.M22] * v[webgl.M03] + v[webgl.M20] * v[webgl.M11] * v[webgl.M32] * v[webgl.M03] - v[webgl.M10] * v[webgl.M21] * v[webgl.M32] * v[webgl.M03]
+ - v[webgl.M30] * v[webgl.M21] * v[webgl.M02] * v[webgl.M13] + v[webgl.M20] * v[webgl.M31] * v[webgl.M02] * v[webgl.M13] + v[webgl.M30] * v[webgl.M01] * v[webgl.M22] * v[webgl.M13]
+ - v[webgl.M00] * v[webgl.M31] * v[webgl.M22] * v[webgl.M13] - v[webgl.M20] * v[webgl.M01] * v[webgl.M32] * v[webgl.M13] + v[webgl.M00] * v[webgl.M21] * v[webgl.M32] * v[webgl.M13]
+ + v[webgl.M30] * v[webgl.M11] * v[webgl.M02] * v[webgl.M23] - v[webgl.M10] * v[webgl.M31] * v[webgl.M02] * v[webgl.M23] - v[webgl.M30] * v[webgl.M01] * v[webgl.M12] * v[webgl.M23]
+ + v[webgl.M00] * v[webgl.M31] * v[webgl.M12] * v[webgl.M23] + v[webgl.M10] * v[webgl.M01] * v[webgl.M32] * v[webgl.M23] - v[webgl.M00] * v[webgl.M11] * v[webgl.M32] * v[webgl.M23]
+ - v[webgl.M20] * v[webgl.M11] * v[webgl.M02] * v[webgl.M33] + v[webgl.M10] * v[webgl.M21] * v[webgl.M02] * v[webgl.M33] + v[webgl.M20] * v[webgl.M01] * v[webgl.M12] * v[webgl.M33]
+ - v[webgl.M00] * v[webgl.M21] * v[webgl.M12] * v[webgl.M33] - v[webgl.M10] * v[webgl.M01] * v[webgl.M22] * v[webgl.M33] + v[webgl.M00] * v[webgl.M11] * v[webgl.M22] * v[webgl.M33];
+ };
+ Matrix4.prototype.translate = function (x, y, z) {
+ var v = this.values;
+ v[12] += v[0] * x + v[4] * y + v[8] * z;
+ v[13] += v[1] * x + v[5] * y + v[9] * z;
+ v[14] += v[2] * x + v[6] * y + v[10] * z;
+ v[15] += v[3] * x + v[7] * y + v[11] * z;
+ return this;
+ };
+
+ Matrix4.prototype.setX = function (x) {
+ var v = this.values;
+ v[12] = v[0] * x;
+ return this;
+ };
+ Matrix4.prototype.setY = function (y) {
+ var v = this.values;
+ v[13] = v[5] * y;
+ return this;
+ };
+ Matrix4.prototype.setPos2D = function (x, y) {
+ var v = this.values;
+ v[12] = v[0] * x + v[4] * y;
+ v[13] = v[1] * x + v[5] * y;
+ return this;
+ };
+ Matrix4.prototype.setRotate = function (angle, x, y, z) {
+ var v, s, c, len, rlen, nc, xy, yz, zx, xs, ys, zs;
+
+ angle = Math.PI * angle / 180;
+ v = this.values;
+
+ s = Math.sin(angle);
+ c = Math.cos(angle);
+
+ if (0 !== x && 0 === y && 0 === z) {
+ if (x < 0) s = -s;
+
+ v[0] = 1; v[4] = 0; v[8] = 0; v[12] = 0;
+ v[1] = 0; v[5] = c; v[9] = -s; v[13] = 0;
+ v[2] = 0; v[6] = s; v[10] = c; v[14] = 0;
+ v[3] = 0; v[7] = 0; v[11] = 0; v[15] = 1;
+
+ } else if (0 === x && 0 !== y && 0 === z) {
+ if (y < 0) s = -s;
+
+ v[0] = c; v[4] = 0; v[8] = s; v[12] = 0;
+ v[1] = 0; v[5] = 1; v[9] = 0; v[13] = 0;
+ v[2] = -s; v[6] = 0; v[10] = c; v[14] = 0;
+ v[3] = 0; v[7] = 0; v[11] = 0; v[15] = 1;
+ } else if (0 === x && 0 === y && 0 !== z) {
+ if (z < 0) s = -s;
+
+ v[0] = c; v[4] = -s; v[8] = 0; v[12] = 0;
+ v[1] = s; v[5] = c; v[9] = 0; v[13] = 0;
+ v[2] = 0; v[6] = 0; v[10] = 1; v[14] = 0;
+ v[3] = 0; v[7] = 0; v[11] = 0; v[15] = 1;
+ } else {
+ len = Math.sqrt(x * x + y * y + z * z);
+ if (len !== 1) {
+ rlen = 1 / len;
+ x *= rlen;
+ y *= rlen;
+ z *= rlen;
+ }
+ nc = 1 - c;
+ xy = x * y;
+ yz = y * z;
+ zx = z * x;
+ xs = x * s;
+ ys = y * s;
+ zs = z * s;
+
+ v[0] = x * x * nc + c;
+ v[1] = xy * nc + zs;
+ v[2] = zx * nc - ys;
+ v[3] = 0;
+
+ v[4] = xy * nc - zs;
+ v[5] = y * y * nc + c;
+ v[6] = yz * nc + xs;
+ v[7] = 0;
+
+ v[8] = zx * nc + ys;
+ v[9] = yz * nc - xs;
+ v[10] = z * z * nc + c;
+ v[11] = 0;
+
+ v[12] = 0;
+ v[13] = 0;
+ v[14] = 0;
+ v[15] = 1;
+ }
+
+ return this;
+ };
+ Matrix4.prototype.rotate = function (angle, x, y, z) {
+ return this.concat(new spine.webgl.Matrix4().setRotate(angle, x, y, z));
+ };
+ Matrix4.prototype.scale = function (x, y, z) {
+ var v = this.values;
+ v[0] *= x; v[4] *= y; v[8] *= z;
+ v[1] *= x; v[5] *= y; v[9] *= z;
+ v[2] *= x; v[6] *= y; v[10] *= z;
+ v[3] *= x; v[7] *= y; v[11] *= z;
+ return this;
+ };
+ Matrix4.prototype.copy = function () {
+ return new Matrix4().set(this.values);
+ };
+ Matrix4.prototype.projection = function (near, far, fovy, aspectRatio) {
+ this.identity();
+ var l_fd = (1.0 / Math.tan((fovy * (Math.PI / 180)) / 2.0));
+ var l_a1 = (far + near) / (near - far);
+ var l_a2 = (2 * far * near) / (near - far);
+ var v = this.values;
+ v[webgl.M00] = l_fd / aspectRatio;
+ v[webgl.M10] = 0;
+ v[webgl.M20] = 0;
+ v[webgl.M30] = 0;
+ v[webgl.M01] = 0;
+ v[webgl.M11] = l_fd;
+ v[webgl.M21] = 0;
+ v[webgl.M31] = 0;
+ v[webgl.M02] = 0;
+ v[webgl.M12] = 0;
+ v[webgl.M22] = l_a1;
+ v[webgl.M32] = -1;
+ v[webgl.M03] = 0;
+ v[webgl.M13] = 0;
+ v[webgl.M23] = l_a2;
+ v[webgl.M33] = 0;
+ return this;
+ };
+ Matrix4.prototype.ortho2d = function (x, y, width, height) {
+ return this.ortho(x, x + width, y, y + height, 0, 1);
+ };
+ Matrix4.prototype.ortho = function (left, right, bottom, top, near, far) {
+ this.identity();
+ var x_orth = 2 / (right - left);
+ var y_orth = 2 / (top - bottom);
+ var z_orth = -2 / (far - near);
+ var tx = -(right + left) / (right - left);
+ var ty = -(top + bottom) / (top - bottom);
+ var tz = -(far + near) / (far - near);
+ var v = this.values;
+ v[webgl.M00] = x_orth;
+ v[webgl.M10] = 0;
+ v[webgl.M20] = 0;
+ v[webgl.M30] = 0;
+ v[webgl.M01] = 0;
+ v[webgl.M11] = y_orth;
+ v[webgl.M21] = 0;
+ v[webgl.M31] = 0;
+ v[webgl.M02] = 0;
+ v[webgl.M12] = 0;
+ v[webgl.M22] = z_orth;
+ v[webgl.M32] = 0;
+ v[webgl.M03] = tx;
+ v[webgl.M13] = ty;
+ v[webgl.M23] = tz;
+ v[webgl.M33] = 1;
+ return this;
+ };
+ Matrix4.prototype.multiply = function (matrix) {
+ var t = this.temp;
+ var v = this.values;
+ var m = matrix.values;
+ t[webgl.M00] = v[webgl.M00] * m[webgl.M00] + v[webgl.M01] * m[webgl.M10] + v[webgl.M02] * m[webgl.M20] + v[webgl.M03] * m[webgl.M30];
+ t[webgl.M01] = v[webgl.M00] * m[webgl.M01] + v[webgl.M01] * m[webgl.M11] + v[webgl.M02] * m[webgl.M21] + v[webgl.M03] * m[webgl.M31];
+ t[webgl.M02] = v[webgl.M00] * m[webgl.M02] + v[webgl.M01] * m[webgl.M12] + v[webgl.M02] * m[webgl.M22] + v[webgl.M03] * m[webgl.M32];
+ t[webgl.M03] = v[webgl.M00] * m[webgl.M03] + v[webgl.M01] * m[webgl.M13] + v[webgl.M02] * m[webgl.M23] + v[webgl.M03] * m[webgl.M33];
+ t[webgl.M10] = v[webgl.M10] * m[webgl.M00] + v[webgl.M11] * m[webgl.M10] + v[webgl.M12] * m[webgl.M20] + v[webgl.M13] * m[webgl.M30];
+ t[webgl.M11] = v[webgl.M10] * m[webgl.M01] + v[webgl.M11] * m[webgl.M11] + v[webgl.M12] * m[webgl.M21] + v[webgl.M13] * m[webgl.M31];
+ t[webgl.M12] = v[webgl.M10] * m[webgl.M02] + v[webgl.M11] * m[webgl.M12] + v[webgl.M12] * m[webgl.M22] + v[webgl.M13] * m[webgl.M32];
+ t[webgl.M13] = v[webgl.M10] * m[webgl.M03] + v[webgl.M11] * m[webgl.M13] + v[webgl.M12] * m[webgl.M23] + v[webgl.M13] * m[webgl.M33];
+ t[webgl.M20] = v[webgl.M20] * m[webgl.M00] + v[webgl.M21] * m[webgl.M10] + v[webgl.M22] * m[webgl.M20] + v[webgl.M23] * m[webgl.M30];
+ t[webgl.M21] = v[webgl.M20] * m[webgl.M01] + v[webgl.M21] * m[webgl.M11] + v[webgl.M22] * m[webgl.M21] + v[webgl.M23] * m[webgl.M31];
+ t[webgl.M22] = v[webgl.M20] * m[webgl.M02] + v[webgl.M21] * m[webgl.M12] + v[webgl.M22] * m[webgl.M22] + v[webgl.M23] * m[webgl.M32];
+ t[webgl.M23] = v[webgl.M20] * m[webgl.M03] + v[webgl.M21] * m[webgl.M13] + v[webgl.M22] * m[webgl.M23] + v[webgl.M23] * m[webgl.M33];
+ t[webgl.M30] = v[webgl.M30] * m[webgl.M00] + v[webgl.M31] * m[webgl.M10] + v[webgl.M32] * m[webgl.M20] + v[webgl.M33] * m[webgl.M30];
+ t[webgl.M31] = v[webgl.M30] * m[webgl.M01] + v[webgl.M31] * m[webgl.M11] + v[webgl.M32] * m[webgl.M21] + v[webgl.M33] * m[webgl.M31];
+ t[webgl.M32] = v[webgl.M30] * m[webgl.M02] + v[webgl.M31] * m[webgl.M12] + v[webgl.M32] * m[webgl.M22] + v[webgl.M33] * m[webgl.M32];
+ t[webgl.M33] = v[webgl.M30] * m[webgl.M03] + v[webgl.M31] * m[webgl.M13] + v[webgl.M32] * m[webgl.M23] + v[webgl.M33] * m[webgl.M33];
+ return this.set(this.temp);
+ };
+ Matrix4.prototype.multiplyLeft = function (matrix) {
+ var t = this.temp;
+ var v = this.values;
+ var m = matrix.values;
+ t[webgl.M00] = m[webgl.M00] * v[webgl.M00] + m[webgl.M01] * v[webgl.M10] + m[webgl.M02] * v[webgl.M20] + m[webgl.M03] * v[webgl.M30];
+ t[webgl.M01] = m[webgl.M00] * v[webgl.M01] + m[webgl.M01] * v[webgl.M11] + m[webgl.M02] * v[webgl.M21] + m[webgl.M03] * v[webgl.M31];
+ t[webgl.M02] = m[webgl.M00] * v[webgl.M02] + m[webgl.M01] * v[webgl.M12] + m[webgl.M02] * v[webgl.M22] + m[webgl.M03] * v[webgl.M32];
+ t[webgl.M03] = m[webgl.M00] * v[webgl.M03] + m[webgl.M01] * v[webgl.M13] + m[webgl.M02] * v[webgl.M23] + m[webgl.M03] * v[webgl.M33];
+ t[webgl.M10] = m[webgl.M10] * v[webgl.M00] + m[webgl.M11] * v[webgl.M10] + m[webgl.M12] * v[webgl.M20] + m[webgl.M13] * v[webgl.M30];
+ t[webgl.M11] = m[webgl.M10] * v[webgl.M01] + m[webgl.M11] * v[webgl.M11] + m[webgl.M12] * v[webgl.M21] + m[webgl.M13] * v[webgl.M31];
+ t[webgl.M12] = m[webgl.M10] * v[webgl.M02] + m[webgl.M11] * v[webgl.M12] + m[webgl.M12] * v[webgl.M22] + m[webgl.M13] * v[webgl.M32];
+ t[webgl.M13] = m[webgl.M10] * v[webgl.M03] + m[webgl.M11] * v[webgl.M13] + m[webgl.M12] * v[webgl.M23] + m[webgl.M13] * v[webgl.M33];
+ t[webgl.M20] = m[webgl.M20] * v[webgl.M00] + m[webgl.M21] * v[webgl.M10] + m[webgl.M22] * v[webgl.M20] + m[webgl.M23] * v[webgl.M30];
+ t[webgl.M21] = m[webgl.M20] * v[webgl.M01] + m[webgl.M21] * v[webgl.M11] + m[webgl.M22] * v[webgl.M21] + m[webgl.M23] * v[webgl.M31];
+ t[webgl.M22] = m[webgl.M20] * v[webgl.M02] + m[webgl.M21] * v[webgl.M12] + m[webgl.M22] * v[webgl.M22] + m[webgl.M23] * v[webgl.M32];
+ t[webgl.M23] = m[webgl.M20] * v[webgl.M03] + m[webgl.M21] * v[webgl.M13] + m[webgl.M22] * v[webgl.M23] + m[webgl.M23] * v[webgl.M33];
+ t[webgl.M30] = m[webgl.M30] * v[webgl.M00] + m[webgl.M31] * v[webgl.M10] + m[webgl.M32] * v[webgl.M20] + m[webgl.M33] * v[webgl.M30];
+ t[webgl.M31] = m[webgl.M30] * v[webgl.M01] + m[webgl.M31] * v[webgl.M11] + m[webgl.M32] * v[webgl.M21] + m[webgl.M33] * v[webgl.M31];
+ t[webgl.M32] = m[webgl.M30] * v[webgl.M02] + m[webgl.M31] * v[webgl.M12] + m[webgl.M32] * v[webgl.M22] + m[webgl.M33] * v[webgl.M32];
+ t[webgl.M33] = m[webgl.M30] * v[webgl.M03] + m[webgl.M31] * v[webgl.M13] + m[webgl.M32] * v[webgl.M23] + m[webgl.M33] * v[webgl.M33];
+ return this.set(this.temp);
+ };
+ Matrix4.prototype.lookAt = function (position, direction, up) {
+ Matrix4.initTemps();
+ var xAxis = Matrix4.xAxis, yAxis = Matrix4.yAxis, zAxis = Matrix4.zAxis;
+ zAxis.setFrom(direction).normalize();
+ xAxis.setFrom(direction).normalize();
+ xAxis.cross(up).normalize();
+ yAxis.setFrom(xAxis).cross(zAxis).normalize();
+ this.identity();
+ var val = this.values;
+ val[webgl.M00] = xAxis.x;
+ val[webgl.M01] = xAxis.y;
+ val[webgl.M02] = xAxis.z;
+ val[webgl.M10] = yAxis.x;
+ val[webgl.M11] = yAxis.y;
+ val[webgl.M12] = yAxis.z;
+ val[webgl.M20] = -zAxis.x;
+ val[webgl.M21] = -zAxis.y;
+ val[webgl.M22] = -zAxis.z;
+ Matrix4.tmpMatrix.identity();
+ Matrix4.tmpMatrix.values[webgl.M03] = -position.x;
+ Matrix4.tmpMatrix.values[webgl.M13] = -position.y;
+ Matrix4.tmpMatrix.values[webgl.M23] = -position.z;
+ this.multiply(Matrix4.tmpMatrix);
+ return this;
+ };
+ Matrix4.initTemps = function () {
+ if (Matrix4.xAxis === null)
+ Matrix4.xAxis = new webgl.Vector3();
+ if (Matrix4.yAxis === null)
+ Matrix4.yAxis = new webgl.Vector3();
+ if (Matrix4.zAxis === null)
+ Matrix4.zAxis = new webgl.Vector3();
+ };
+ Matrix4.xAxis = null;
+ Matrix4.yAxis = null;
+ Matrix4.zAxis = null;
+ Matrix4.tmpMatrix = new Matrix4();
+ return Matrix4;
+ }());
+ webgl.Matrix4 = Matrix4;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var Mesh = (function () {
+ function Mesh(context, attributes, maxVertices, maxIndices) {
+ this.attributes = attributes;
+ this.verticesLength = 0;
+ this.dirtyVertices = false;
+ this.indicesLength = 0;
+ this.dirtyIndices = false;
+ this.elementsPerVertex = 0;
+ this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ this.elementsPerVertex = 0;
+ for (var i = 0; i < attributes.length; i++) {
+ this.elementsPerVertex += attributes[i].numElements;
+ }
+ this.vertices = new Float32Array(maxVertices * this.elementsPerVertex);
+ this.indices = new Uint16Array(maxIndices);
+ this.context.addRestorable(this);
+ }
+ Mesh.prototype.getAttributes = function () { return this.attributes; };
+ Mesh.prototype.maxVertices = function () { return this.vertices.length / this.elementsPerVertex; };
+ Mesh.prototype.numVertices = function () { return this.verticesLength / this.elementsPerVertex; };
+ Mesh.prototype.setVerticesLength = function (length) {
+ this.dirtyVertices = true;
+ this.verticesLength = length;
+ };
+ Mesh.prototype.getVertices = function () { return this.vertices; };
+ Mesh.prototype.maxIndices = function () { return this.indices.length; };
+ Mesh.prototype.numIndices = function () { return this.indicesLength; };
+ Mesh.prototype.setIndicesLength = function (length) {
+ this.dirtyIndices = true;
+ this.indicesLength = length;
+ };
+ Mesh.prototype.getIndices = function () { return this.indices; };
+ ;
+ Mesh.prototype.getVertexSizeInFloats = function () {
+ var size = 0;
+ for (var i = 0; i < this.attributes.length; i++) {
+ var attribute = this.attributes[i];
+ size += attribute.numElements;
+ }
+ return size;
+ };
+ Mesh.prototype.setVertices = function (vertices) {
+ this.dirtyVertices = true;
+ if (vertices.length > this.vertices.length)
+ throw Error("Mesh can't store more than " + this.maxVertices() + " vertices");
+ this.vertices.set(vertices, 0);
+ this.verticesLength = vertices.length;
+ };
+ Mesh.prototype.setIndices = function (indices) {
+ this.dirtyIndices = true;
+ if (indices.length > this.indices.length)
+ throw Error("Mesh can't store more than " + this.maxIndices() + " indices");
+ this.indices.set(indices, 0);
+ this.indicesLength = indices.length;
+ };
+ Mesh.prototype.draw = function (shader, primitiveType) {
+ this.drawWithOffset(shader, primitiveType, 0, this.indicesLength > 0 ? this.indicesLength : this.verticesLength / this.elementsPerVertex);
+ };
+ Mesh.prototype.drawWithOffset = function (shader, primitiveType, offset, count) {
+ var gl = this.context.gl;
+ if (this.dirtyVertices || this.dirtyIndices)
+ this.update();
+ this.bind(shader);
+ if (this.indicesLength > 0) {
+ gl.drawElements(primitiveType, count, gl.UNSIGNED_SHORT, offset * 2);
+ }
+ else {
+ gl.drawArrays(primitiveType, offset, count);
+ }
+ this.unbind(shader);
+ };
+ Mesh.prototype.bind = function (shader) {
+ var gl = this.context.gl;
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesBuffer);
+ var offset = 0;
+ for (var i = 0; i < this.attributes.length; i++) {
+ var attrib = this.attributes[i];
+ var location_1 = shader.getAttributeLocation(attrib.name);
+ gl.enableVertexAttribArray(location_1);
+ gl.vertexAttribPointer(location_1, attrib.numElements, gl.FLOAT, false, this.elementsPerVertex * 4, offset * 4);
+ offset += attrib.numElements;
+ }
+ if (this.indicesLength > 0)
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
+ };
+ Mesh.prototype.unbind = function (shader) {
+ var gl = this.context.gl;
+ for (var i = 0; i < this.attributes.length; i++) {
+ var attrib = this.attributes[i];
+ var location_2 = shader.getAttributeLocation(attrib.name);
+ gl.disableVertexAttribArray(location_2);
+ }
+ gl.bindBuffer(gl.ARRAY_BUFFER, null);
+ if (this.indicesLength > 0)
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
+ };
+ Mesh.prototype.update = function () {
+ var gl = this.context.gl;
+ if (this.dirtyVertices) {
+ if (!this.verticesBuffer) {
+ this.verticesBuffer = gl.createBuffer();
+ }
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, this.vertices.subarray(0, this.verticesLength), gl.DYNAMIC_DRAW);
+ this.dirtyVertices = false;
+ }
+ if (this.dirtyIndices) {
+ if (!this.indicesBuffer) {
+ this.indicesBuffer = gl.createBuffer();
+ }
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
+ gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices.subarray(0, this.indicesLength), gl.DYNAMIC_DRAW);
+ this.dirtyIndices = false;
+ }
+ };
+ Mesh.prototype.restore = function () {
+ this.verticesBuffer = null;
+ this.indicesBuffer = null;
+ this.update();
+ };
+ Mesh.prototype.dispose = function () {
+ this.context.removeRestorable(this);
+ var gl = this.context.gl;
+ gl.deleteBuffer(this.verticesBuffer);
+ gl.deleteBuffer(this.indicesBuffer);
+ };
+ return Mesh;
+ }());
+ webgl.Mesh = Mesh;
+ var VertexAttribute = (function () {
+ function VertexAttribute(name, type, numElements) {
+ this.name = name;
+ this.type = type;
+ this.numElements = numElements;
+ }
+ return VertexAttribute;
+ }());
+ webgl.VertexAttribute = VertexAttribute;
+ var Position2Attribute = (function (_super) {
+ __extends(Position2Attribute, _super);
+ function Position2Attribute() {
+ return _super.call(this, webgl.Shader.POSITION, VertexAttributeType.Float, 2) || this;
+ }
+ return Position2Attribute;
+ }(VertexAttribute));
+ webgl.Position2Attribute = Position2Attribute;
+ var Position3Attribute = (function (_super) {
+ __extends(Position3Attribute, _super);
+ function Position3Attribute() {
+ return _super.call(this, webgl.Shader.POSITION, VertexAttributeType.Float, 3) || this;
+ }
+ return Position3Attribute;
+ }(VertexAttribute));
+ webgl.Position3Attribute = Position3Attribute;
+ var TexCoordAttribute = (function (_super) {
+ __extends(TexCoordAttribute, _super);
+ function TexCoordAttribute(unit) {
+ if (unit === void 0) { unit = 0; }
+ return _super.call(this, webgl.Shader.TEXCOORDS + (unit == 0 ? "" : unit), VertexAttributeType.Float, 2) || this;
+ }
+ return TexCoordAttribute;
+ }(VertexAttribute));
+ webgl.TexCoordAttribute = TexCoordAttribute;
+ var ColorAttribute = (function (_super) {
+ __extends(ColorAttribute, _super);
+ function ColorAttribute() {
+ return _super.call(this, webgl.Shader.COLOR, VertexAttributeType.Float, 4) || this;
+ }
+ return ColorAttribute;
+ }(VertexAttribute));
+ webgl.ColorAttribute = ColorAttribute;
+ var Color2Attribute = (function (_super) {
+ __extends(Color2Attribute, _super);
+ function Color2Attribute() {
+ return _super.call(this, webgl.Shader.COLOR2, VertexAttributeType.Float, 4) || this;
+ }
+ return Color2Attribute;
+ }(VertexAttribute));
+ webgl.Color2Attribute = Color2Attribute;
+ var VertexAttributeType;
+ (function (VertexAttributeType) {
+ VertexAttributeType[VertexAttributeType["Float"] = 0] = "Float";
+ })(VertexAttributeType = webgl.VertexAttributeType || (webgl.VertexAttributeType = {}));
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var PolygonBatcher = (function () {
+ function PolygonBatcher(context, twoColorTint, maxVertices) {
+ if (twoColorTint === void 0) { twoColorTint = true; }
+ if (maxVertices === void 0) { maxVertices = 10920; }
+ this.isDrawing = false;
+ this.shader = null;
+ this.lastTexture = null;
+ this.verticesLength = 0;
+ this.indicesLength = 0;
+ if (maxVertices > 10920)
+ throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
+ this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ var attributes = twoColorTint ?
+ [new webgl.Position2Attribute(), new webgl.ColorAttribute(), new webgl.TexCoordAttribute(), new webgl.Color2Attribute()] :
+ [new webgl.Position2Attribute(), new webgl.ColorAttribute(), new webgl.TexCoordAttribute()];
+ this.mesh = new webgl.Mesh(context, attributes, maxVertices, maxVertices * 3);
+ this.srcBlend = this.context.gl.SRC_ALPHA;
+ this.dstBlend = this.context.gl.ONE_MINUS_SRC_ALPHA;
+ }
+ PolygonBatcher.prototype.begin = function (shader) {
+ var gl = this.context.gl;
+ if (this.isDrawing)
+ throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");
+ this.drawCalls = 0;
+ this.shader = shader;
+ this.lastTexture = null;
+ this.isDrawing = true;
+ gl.enable(gl.BLEND);
+ // gl.blendFunc(this.srcBlend, this.dstBlend);
+ gl.blendFuncSeparate(this.srcBlend, this.dstBlend, gl.ONE, this.dstBlend);
+ };
+ PolygonBatcher.prototype.setBlendMode = function (srcBlend, dstBlend) {
+ var gl = this.context.gl;
+ this.srcBlend = srcBlend;
+ this.dstBlend = dstBlend;
+ if (this.isDrawing) {
+ this.flush();
+ // gl.blendFunc(this.srcBlend, this.dstBlend);
+ gl.blendFuncSeparate(this.srcBlend, this.dstBlend, gl.ONE, this.dstBlend);
+ }
+ };
+ PolygonBatcher.prototype.draw = function (texture, vertices, indices) {
+ if (texture != this.lastTexture) {
+ this.flush();
+ this.lastTexture = texture;
+ }
+ else if (this.verticesLength + vertices.length > this.mesh.getVertices().length ||
+ this.indicesLength + indices.length > this.mesh.getIndices().length) {
+ this.flush();
+ }
+ var indexStart = this.mesh.numVertices();
+ this.mesh.getVertices().set(vertices, this.verticesLength);
+ this.verticesLength += vertices.length;
+ this.mesh.setVerticesLength(this.verticesLength);
+ var indicesArray = this.mesh.getIndices();
+ for (var i = this.indicesLength, j = 0; j < indices.length; i++, j++)
+ indicesArray[i] = indices[j] + indexStart;
+ this.indicesLength += indices.length;
+ this.mesh.setIndicesLength(this.indicesLength);
+ };
+ PolygonBatcher.prototype.flush = function () {
+ var gl = this.context.gl;
+ if (this.verticesLength == 0)
+ return;
+ this.lastTexture.bind();
+ this.mesh.draw(this.shader, gl.TRIANGLES);
+ this.verticesLength = 0;
+ this.indicesLength = 0;
+ this.mesh.setVerticesLength(0);
+ this.mesh.setIndicesLength(0);
+ this.drawCalls++;
+ };
+ PolygonBatcher.prototype.end = function () {
+ var gl = this.context.gl;
+ if (!this.isDrawing)
+ throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");
+ if (this.verticesLength > 0 || this.indicesLength > 0)
+ this.flush();
+ this.shader = null;
+ this.lastTexture = null;
+ this.isDrawing = false;
+ gl.disable(gl.BLEND);
+ };
+ PolygonBatcher.prototype.getDrawCalls = function () { return this.drawCalls; };
+ PolygonBatcher.prototype.dispose = function () {
+ this.mesh.dispose();
+ };
+ return PolygonBatcher;
+ }());
+ webgl.PolygonBatcher = PolygonBatcher;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var SceneRenderer = (function () {
+ function SceneRenderer(canvas, context, twoColorTint) {
+ if (twoColorTint === void 0) { twoColorTint = true; }
+ this.twoColorTint = false;
+ this.activeRenderer = null;
+ this.QUAD = [
+ 0, 0, 1, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1, 1, 0, 0,
+ ];
+ this.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
+ this.WHITE = new spine.Color(1, 1, 1, 1);
+ this.canvas = canvas;
+ this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ this.twoColorTint = twoColorTint;
+ this.camera = new webgl.OrthoCamera(canvas.width, canvas.height);
+ this.batcherShader = twoColorTint ? webgl.Shader.newTwoColoredTextured(this.context) : webgl.Shader.newColoredTextured(this.context);
+ this.batcher = new webgl.PolygonBatcher(this.context, twoColorTint);
+ this.shapesShader = webgl.Shader.newColored(this.context);
+ this.shapes = new webgl.ShapeRenderer(this.context);
+ this.skeletonRenderer = new webgl.SkeletonRenderer(this.context, twoColorTint);
+ this.skeletonDebugRenderer = new webgl.SkeletonDebugRenderer(this.context);
+ }
+ SceneRenderer.prototype.begin = function () {
+ this.camera.update();
+ this.enableRenderer(this.batcher);
+ };
+ SceneRenderer.prototype.drawSkeleton = function (skeleton, premultipliedAlpha, slotRangeStart, slotRangeEnd) {
+ if (premultipliedAlpha === void 0) { premultipliedAlpha = false; }
+ if (slotRangeStart === void 0) { slotRangeStart = -1; }
+ if (slotRangeEnd === void 0) { slotRangeEnd = -1; }
+ this.enableRenderer(this.batcher);
+ this.skeletonRenderer.premultipliedAlpha = premultipliedAlpha;
+ this.skeletonRenderer.draw(this.batcher, skeleton, slotRangeStart, slotRangeEnd);
+ };
+ SceneRenderer.prototype.drawSkeletonDebug = function (skeleton, premultipliedAlpha, ignoredBones) {
+ if (premultipliedAlpha === void 0) { premultipliedAlpha = false; }
+ if (ignoredBones === void 0) { ignoredBones = null; }
+ this.enableRenderer(this.shapes);
+ this.skeletonDebugRenderer.premultipliedAlpha = premultipliedAlpha;
+ this.skeletonDebugRenderer.draw(this.shapes, skeleton, ignoredBones);
+ };
+ SceneRenderer.prototype.drawTexture = function (texture, x, y, width, height, color) {
+ if (color === void 0) { color = null; }
+ this.enableRenderer(this.batcher);
+ if (color === null)
+ color = this.WHITE;
+ var quad = this.QUAD;
+ var i = 0;
+ quad[i++] = x;
+ quad[i++] = y;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 0;
+ quad[i++] = 1;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x + width;
+ quad[i++] = y;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 1;
+ quad[i++] = 1;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x + width;
+ quad[i++] = y + height;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 1;
+ quad[i++] = 0;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x;
+ quad[i++] = y + height;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ this.batcher.draw(texture, quad, this.QUAD_TRIANGLES);
+ };
+ SceneRenderer.prototype.drawTextureUV = function (texture, x, y, width, height, u, v, u2, v2, color) {
+ if (color === void 0) { color = null; }
+ this.enableRenderer(this.batcher);
+ if (color === null)
+ color = this.WHITE;
+ var quad = this.QUAD;
+ var i = 0;
+ quad[i++] = x;
+ quad[i++] = y;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = u;
+ quad[i++] = v;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x + width;
+ quad[i++] = y;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = u2;
+ quad[i++] = v;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x + width;
+ quad[i++] = y + height;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = u2;
+ quad[i++] = v2;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x;
+ quad[i++] = y + height;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = u;
+ quad[i++] = v2;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ this.batcher.draw(texture, quad, this.QUAD_TRIANGLES);
+ };
+ SceneRenderer.prototype.drawTextureRotated = function (texture, x, y, width, height, pivotX, pivotY, angle, color, premultipliedAlpha) {
+ if (color === void 0) { color = null; }
+ if (premultipliedAlpha === void 0) { premultipliedAlpha = false; }
+ this.enableRenderer(this.batcher);
+ if (color === null)
+ color = this.WHITE;
+ var quad = this.QUAD;
+ var worldOriginX = x + pivotX;
+ var worldOriginY = y + pivotY;
+ var fx = -pivotX;
+ var fy = -pivotY;
+ var fx2 = width - pivotX;
+ var fy2 = height - pivotY;
+ var p1x = fx;
+ var p1y = fy;
+ var p2x = fx;
+ var p2y = fy2;
+ var p3x = fx2;
+ var p3y = fy2;
+ var p4x = fx2;
+ var p4y = fy;
+ var x1 = 0;
+ var y1 = 0;
+ var x2 = 0;
+ var y2 = 0;
+ var x3 = 0;
+ var y3 = 0;
+ var x4 = 0;
+ var y4 = 0;
+ if (angle != 0) {
+ var cos = spine.MathUtils.cosDeg(angle);
+ var sin = spine.MathUtils.sinDeg(angle);
+ x1 = cos * p1x - sin * p1y;
+ y1 = sin * p1x + cos * p1y;
+ x4 = cos * p2x - sin * p2y;
+ y4 = sin * p2x + cos * p2y;
+ x3 = cos * p3x - sin * p3y;
+ y3 = sin * p3x + cos * p3y;
+ x2 = x3 + (x1 - x4);
+ y2 = y3 + (y1 - y4);
+ }
+ else {
+ x1 = p1x;
+ y1 = p1y;
+ x4 = p2x;
+ y4 = p2y;
+ x3 = p3x;
+ y3 = p3y;
+ x2 = p4x;
+ y2 = p4y;
+ }
+ x1 += worldOriginX;
+ y1 += worldOriginY;
+ x2 += worldOriginX;
+ y2 += worldOriginY;
+ x3 += worldOriginX;
+ y3 += worldOriginY;
+ x4 += worldOriginX;
+ y4 += worldOriginY;
+ var i = 0;
+ quad[i++] = x1;
+ quad[i++] = y1;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 0;
+ quad[i++] = 1;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x2;
+ quad[i++] = y2;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 1;
+ quad[i++] = 1;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x3;
+ quad[i++] = y3;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 1;
+ quad[i++] = 0;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x4;
+ quad[i++] = y4;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ this.batcher.draw(texture, quad, this.QUAD_TRIANGLES);
+ };
+ SceneRenderer.prototype.drawRegion = function (region, x, y, width, height, color, premultipliedAlpha) {
+ if (color === void 0) { color = null; }
+ if (premultipliedAlpha === void 0) { premultipliedAlpha = false; }
+ this.enableRenderer(this.batcher);
+ if (color === null)
+ color = this.WHITE;
+ var quad = this.QUAD;
+ var i = 0;
+ quad[i++] = x;
+ quad[i++] = y;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = region.u;
+ quad[i++] = region.v2;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x + width;
+ quad[i++] = y;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = region.u2;
+ quad[i++] = region.v2;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x + width;
+ quad[i++] = y + height;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = region.u2;
+ quad[i++] = region.v;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ quad[i++] = x;
+ quad[i++] = y + height;
+ quad[i++] = color.r;
+ quad[i++] = color.g;
+ quad[i++] = color.b;
+ quad[i++] = color.a;
+ quad[i++] = region.u;
+ quad[i++] = region.v;
+ if (this.twoColorTint) {
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ quad[i++] = 0;
+ }
+ this.batcher.draw(region.texture, quad, this.QUAD_TRIANGLES);
+ };
+ SceneRenderer.prototype.line = function (x, y, x2, y2, color, color2) {
+ if (color === void 0) { color = null; }
+ if (color2 === void 0) { color2 = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.line(x, y, x2, y2, color);
+ };
+ SceneRenderer.prototype.triangle = function (filled, x, y, x2, y2, x3, y3, color, color2, color3) {
+ if (color === void 0) { color = null; }
+ if (color2 === void 0) { color2 = null; }
+ if (color3 === void 0) { color3 = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.triangle(filled, x, y, x2, y2, x3, y3, color, color2, color3);
+ };
+ SceneRenderer.prototype.quad = function (filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
+ if (color === void 0) { color = null; }
+ if (color2 === void 0) { color2 = null; }
+ if (color3 === void 0) { color3 = null; }
+ if (color4 === void 0) { color4 = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.quad(filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4);
+ };
+ SceneRenderer.prototype.rect = function (filled, x, y, width, height, color) {
+ if (color === void 0) { color = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.rect(filled, x, y, width, height, color);
+ };
+ SceneRenderer.prototype.rectLine = function (filled, x1, y1, x2, y2, width, color) {
+ if (color === void 0) { color = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.rectLine(filled, x1, y1, x2, y2, width, color);
+ };
+ SceneRenderer.prototype.polygon = function (polygonVertices, offset, count, color) {
+ if (color === void 0) { color = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.polygon(polygonVertices, offset, count, color);
+ };
+ SceneRenderer.prototype.circle = function (filled, x, y, radius, color, segments) {
+ if (color === void 0) { color = null; }
+ if (segments === void 0) { segments = 0; }
+ this.enableRenderer(this.shapes);
+ this.shapes.circle(filled, x, y, radius, color, segments);
+ };
+ SceneRenderer.prototype.curve = function (x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
+ if (color === void 0) { color = null; }
+ this.enableRenderer(this.shapes);
+ this.shapes.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color);
+ };
+ SceneRenderer.prototype.end = function () {
+ if (this.activeRenderer === this.batcher)
+ this.batcher.end();
+ else if (this.activeRenderer === this.shapes)
+ this.shapes.end();
+ this.activeRenderer = null;
+ };
+ SceneRenderer.prototype.resize = function (resizeMode) {
+ var canvas = this.canvas;
+ var w = canvas.clientWidth;
+ var h = canvas.clientHeight;
+ if (canvas.width != w || canvas.height != h) {
+ canvas.width = w;
+ canvas.height = h;
+ }
+ this.context.gl.viewport(0, 0, canvas.width, canvas.height);
+ if (resizeMode === ResizeMode.Stretch) {
+ }
+ else if (resizeMode === ResizeMode.Expand) {
+ this.camera.setViewport(w, h);
+ }
+ else if (resizeMode === ResizeMode.Fit) {
+ var sourceWidth = canvas.width, sourceHeight = canvas.height;
+ var targetWidth = this.camera.viewportWidth, targetHeight = this.camera.viewportHeight;
+ var targetRatio = targetHeight / targetWidth;
+ var sourceRatio = sourceHeight / sourceWidth;
+ var scale = targetRatio < sourceRatio ? targetWidth / sourceWidth : targetHeight / sourceHeight;
+ this.camera.viewportWidth = sourceWidth * scale;
+ this.camera.viewportHeight = sourceHeight * scale;
+ }
+ this.camera.update();
+ };
+ SceneRenderer.prototype.enableRenderer = function (renderer) {
+ if (this.activeRenderer === renderer)
+ return;
+ this.end();
+ if (renderer instanceof webgl.PolygonBatcher) {
+ this.batcherShader.bind();
+ this.batcherShader.setUniform4x4f(webgl.Shader.MVP_MATRIX, this.camera.projectionView.values);
+ this.batcherShader.setUniformi("u_texture", 0);
+ this.batcher.begin(this.batcherShader);
+ this.activeRenderer = this.batcher;
+ }
+ else if (renderer instanceof webgl.ShapeRenderer) {
+ this.shapesShader.bind();
+ this.shapesShader.setUniform4x4f(webgl.Shader.MVP_MATRIX, this.camera.projectionView.values);
+ this.shapes.begin(this.shapesShader);
+ this.activeRenderer = this.shapes;
+ }
+ else {
+ this.activeRenderer = this.skeletonDebugRenderer;
+ }
+ };
+ SceneRenderer.prototype.dispose = function () {
+ this.batcher.dispose();
+ this.batcherShader.dispose();
+ this.shapes.dispose();
+ this.shapesShader.dispose();
+ this.skeletonDebugRenderer.dispose();
+ };
+ return SceneRenderer;
+ }());
+ webgl.SceneRenderer = SceneRenderer;
+ var ResizeMode;
+ (function (ResizeMode) {
+ ResizeMode[ResizeMode["Stretch"] = 0] = "Stretch";
+ ResizeMode[ResizeMode["Expand"] = 1] = "Expand";
+ ResizeMode[ResizeMode["Fit"] = 2] = "Fit";
+ })(ResizeMode = webgl.ResizeMode || (webgl.ResizeMode = {}));
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var Shader = (function () {
+ function Shader(context, vertexShader, fragmentShader) {
+ this.vertexShader = vertexShader;
+ this.fragmentShader = fragmentShader;
+ this.vs = null;
+ this.fs = null;
+ this.program = null;
+ this.tmp2x2 = new Float32Array(2 * 2);
+ this.tmp3x3 = new Float32Array(3 * 3);
+ this.tmp4x4 = new Float32Array(4 * 4);
+ this.vsSource = vertexShader;
+ this.fsSource = fragmentShader;
+ this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ this.context.addRestorable(this);
+ this.compile();
+ }
+ Shader.prototype.getProgram = function () { return this.program; };
+ Shader.prototype.getVertexShader = function () { return this.vertexShader; };
+ Shader.prototype.getFragmentShader = function () { return this.fragmentShader; };
+ Shader.prototype.getVertexShaderSource = function () { return this.vsSource; };
+ Shader.prototype.getFragmentSource = function () { return this.fsSource; };
+ Shader.prototype.compile = function () {
+ var gl = this.context.gl;
+ try {
+ this.vs = this.compileShader(gl.VERTEX_SHADER, this.vertexShader);
+ this.fs = this.compileShader(gl.FRAGMENT_SHADER, this.fragmentShader);
+ this.program = this.compileProgram(this.vs, this.fs);
+ }
+ catch (e) {
+ this.dispose();
+ throw e;
+ }
+ };
+ Shader.prototype.compileShader = function (type, source) {
+ var gl = this.context.gl;
+ var shader = gl.createShader(type);
+ gl.shaderSource(shader, source);
+ gl.compileShader(shader);
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
+ var error = "Couldn't compile shader: " + gl.getShaderInfoLog(shader);
+ gl.deleteShader(shader);
+ if (!gl.isContextLost())
+ throw new Error(error);
+ }
+ return shader;
+ };
+ Shader.prototype.compileProgram = function (vs, fs) {
+ var gl = this.context.gl;
+ var program = gl.createProgram();
+ gl.attachShader(program, vs);
+ gl.attachShader(program, fs);
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
+ var error = "Couldn't compile shader program: " + gl.getProgramInfoLog(program);
+ gl.deleteProgram(program);
+ if (!gl.isContextLost())
+ throw new Error(error);
+ }
+ return program;
+ };
+ Shader.prototype.restore = function () {
+ this.compile();
+ };
+ Shader.prototype.bind = function () {
+ this.context.gl.useProgram(this.program);
+ };
+ Shader.prototype.unbind = function () {
+ this.context.gl.useProgram(null);
+ };
+ Shader.prototype.setUniformi = function (uniform, value) {
+ this.context.gl.uniform1i(this.getUniformLocation(uniform), value);
+ };
+ Shader.prototype.setUniformf = function (uniform, value) {
+ this.context.gl.uniform1f(this.getUniformLocation(uniform), value);
+ };
+ Shader.prototype.setUniform2f = function (uniform, value, value2) {
+ this.context.gl.uniform2f(this.getUniformLocation(uniform), value, value2);
+ };
+ Shader.prototype.setUniform3f = function (uniform, value, value2, value3) {
+ this.context.gl.uniform3f(this.getUniformLocation(uniform), value, value2, value3);
+ };
+ Shader.prototype.setUniform4f = function (uniform, value, value2, value3, value4) {
+ this.context.gl.uniform4f(this.getUniformLocation(uniform), value, value2, value3, value4);
+ };
+ Shader.prototype.setUniform2x2f = function (uniform, value) {
+ var gl = this.context.gl;
+ this.tmp2x2.set(value);
+ gl.uniformMatrix2fv(this.getUniformLocation(uniform), false, this.tmp2x2);
+ };
+ Shader.prototype.setUniform3x3f = function (uniform, value) {
+ var gl = this.context.gl;
+ this.tmp3x3.set(value);
+ gl.uniformMatrix3fv(this.getUniformLocation(uniform), false, this.tmp3x3);
+ };
+ Shader.prototype.setUniform4x4f = function (uniform, value) {
+ var gl = this.context.gl;
+ this.tmp4x4.set(value);
+ gl.uniformMatrix4fv(this.getUniformLocation(uniform), false, this.tmp4x4);
+ };
+ Shader.prototype.getUniformLocation = function (uniform) {
+ var gl = this.context.gl;
+ var location = gl.getUniformLocation(this.program, uniform);
+ if (!location && !gl.isContextLost())
+ throw new Error("Couldn't find location for uniform " + uniform);
+ return location;
+ };
+ Shader.prototype.getAttributeLocation = function (attribute) {
+ var gl = this.context.gl;
+ var location = gl.getAttribLocation(this.program, attribute);
+ if (location == -1 && !gl.isContextLost())
+ throw new Error("Couldn't find location for attribute " + attribute);
+ return location;
+ };
+ Shader.prototype.dispose = function () {
+ this.context.removeRestorable(this);
+ var gl = this.context.gl;
+ if (this.vs) {
+ gl.deleteShader(this.vs);
+ this.vs = null;
+ }
+ if (this.fs) {
+ gl.deleteShader(this.fs);
+ this.fs = null;
+ }
+ if (this.program) {
+ gl.deleteProgram(this.program);
+ this.program = null;
+ }
+ };
+
+
+
+ Shader.newColoredTextured = function (context) {
+ var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tattribute vec2 " + Shader.TEXCOORDS + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_color;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_color = " + Shader.COLOR + ";\n\t\t\t\t\tv_texCoords = " + Shader.TEXCOORDS + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
+ var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_color;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tgl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n\t\t\t\t}\n\t\t\t";
+ return new Shader(context, vs, fs);
+ };
+ Shader.newTwoColoredTextured = function (context) {
+ var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR2 + ";\n\t\t\t\tattribute vec2 " + Shader.TEXCOORDS + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_light;\n\t\t\t\tvarying vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_light = " + Shader.COLOR + ";\n\t\t\t\t\tv_dark = " + Shader.COLOR2 + ";\n\t\t\t\t\tv_texCoords = " + Shader.TEXCOORDS + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
+ var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_light;\n\t\t\t\tvarying LOWP vec4 v_dark;\n\t\t\t\tvarying vec2 v_texCoords;\n\t\t\t\tuniform sampler2D u_texture;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tvec4 texColor = texture2D(u_texture, v_texCoords);\n\t\t\t\t\tgl_FragColor.a = texColor.a * v_light.a;\n\t\t\t\t\tgl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n\t\t\t\t}\n\t\t\t";
+ return new Shader(context, vs, fs);
+ };
+ Shader.newColored = function (context) {
+ var vs = "\n\t\t\t\tattribute vec4 " + Shader.POSITION + ";\n\t\t\t\tattribute vec4 " + Shader.COLOR + ";\n\t\t\t\tuniform mat4 " + Shader.MVP_MATRIX + ";\n\t\t\t\tvarying vec4 v_color;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tv_color = " + Shader.COLOR + ";\n\t\t\t\t\tgl_Position = " + Shader.MVP_MATRIX + " * " + Shader.POSITION + ";\n\t\t\t\t}\n\t\t\t";
+ var fs = "\n\t\t\t\t#ifdef GL_ES\n\t\t\t\t\t#define LOWP lowp\n\t\t\t\t\tprecision mediump float;\n\t\t\t\t#else\n\t\t\t\t\t#define LOWP\n\t\t\t\t#endif\n\t\t\t\tvarying LOWP vec4 v_color;\n\n\t\t\t\tvoid main () {\n\t\t\t\t\tgl_FragColor = v_color;\n\t\t\t\t}\n\t\t\t";
+ return new Shader(context, vs, fs);
+ };
+ Shader.MVP_MATRIX = "u_projTrans";
+ Shader.POSITION = "a_position";
+ Shader.COLOR = "a_color";
+ Shader.COLOR2 = "a_color2";
+ Shader.TEXCOORDS = "a_texCoords";
+ Shader.SAMPLER = "u_texture";
+ return Shader;
+ }());
+ webgl.Shader = Shader;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var ShapeRenderer = (function () {
+ function ShapeRenderer(context, maxVertices) {
+ if (maxVertices === void 0) { maxVertices = 10920; }
+ this.isDrawing = false;
+ this.shapeType = ShapeType.Filled;
+ this.color = new spine.Color(1, 1, 1, 1);
+ this.vertexIndex = 0;
+ this.tmp = new spine.Vector2();
+ if (maxVertices > 10920)
+ throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
+ this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ this.mesh = new webgl.Mesh(context, [new webgl.Position2Attribute(), new webgl.ColorAttribute()], maxVertices, 0);
+ this.srcBlend = this.context.gl.SRC_ALPHA;
+ this.dstBlend = this.context.gl.ONE_MINUS_SRC_ALPHA;
+ }
+ ShapeRenderer.prototype.begin = function (shader) {
+ if (this.isDrawing)
+ throw new Error("ShapeRenderer.begin() has already been called");
+ this.shader = shader;
+ this.vertexIndex = 0;
+ this.isDrawing = true;
+ var gl = this.context.gl;
+ gl.enable(gl.BLEND);
+ gl.blendFunc(this.srcBlend, this.dstBlend);
+ };
+ ShapeRenderer.prototype.setBlendMode = function (srcBlend, dstBlend) {
+ var gl = this.context.gl;
+ this.srcBlend = srcBlend;
+ this.dstBlend = dstBlend;
+ if (this.isDrawing) {
+ this.flush();
+ gl.blendFunc(this.srcBlend, this.dstBlend);
+ }
+ };
+ ShapeRenderer.prototype.setColor = function (color) {
+ this.color.setFromColor(color);
+ };
+ ShapeRenderer.prototype.setColorWith = function (r, g, b, a) {
+ this.color.set(r, g, b, a);
+ };
+ ShapeRenderer.prototype.point = function (x, y, color) {
+ if (color === void 0) { color = null; }
+ this.check(ShapeType.Point, 1);
+ if (color === null)
+ color = this.color;
+ this.vertex(x, y, color);
+ };
+ ShapeRenderer.prototype.line = function (x, y, x2, y2, color) {
+ if (color === void 0) { color = null; }
+ this.check(ShapeType.Line, 2);
+ var vertices = this.mesh.getVertices();
+ var idx = this.vertexIndex;
+ if (color === null)
+ color = this.color;
+ this.vertex(x, y, color);
+ this.vertex(x2, y2, color);
+ };
+ ShapeRenderer.prototype.triangle = function (filled, x, y, x2, y2, x3, y3, color, color2, color3) {
+ if (color === void 0) { color = null; }
+ if (color2 === void 0) { color2 = null; }
+ if (color3 === void 0) { color3 = null; }
+ this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
+ var vertices = this.mesh.getVertices();
+ var idx = this.vertexIndex;
+ if (color === null)
+ color = this.color;
+ if (color2 === null)
+ color2 = this.color;
+ if (color3 === null)
+ color3 = this.color;
+ if (filled) {
+ this.vertex(x, y, color);
+ this.vertex(x2, y2, color2);
+ this.vertex(x3, y3, color3);
+ }
+ else {
+ this.vertex(x, y, color);
+ this.vertex(x2, y2, color2);
+ this.vertex(x2, y2, color);
+ this.vertex(x3, y3, color2);
+ this.vertex(x3, y3, color);
+ this.vertex(x, y, color2);
+ }
+ };
+ ShapeRenderer.prototype.quad = function (filled, x, y, x2, y2, x3, y3, x4, y4, color, color2, color3, color4) {
+ if (color === void 0) { color = null; }
+ if (color2 === void 0) { color2 = null; }
+ if (color3 === void 0) { color3 = null; }
+ if (color4 === void 0) { color4 = null; }
+ this.check(filled ? ShapeType.Filled : ShapeType.Line, 3);
+ var vertices = this.mesh.getVertices();
+ var idx = this.vertexIndex;
+ if (color === null)
+ color = this.color;
+ if (color2 === null)
+ color2 = this.color;
+ if (color3 === null)
+ color3 = this.color;
+ if (color4 === null)
+ color4 = this.color;
+ if (filled) {
+ this.vertex(x, y, color);
+ this.vertex(x2, y2, color2);
+ this.vertex(x3, y3, color3);
+ this.vertex(x3, y3, color3);
+ this.vertex(x4, y4, color4);
+ this.vertex(x, y, color);
+ }
+ else {
+ this.vertex(x, y, color);
+ this.vertex(x2, y2, color2);
+ this.vertex(x2, y2, color2);
+ this.vertex(x3, y3, color3);
+ this.vertex(x3, y3, color3);
+ this.vertex(x4, y4, color4);
+ this.vertex(x4, y4, color4);
+ this.vertex(x, y, color);
+ }
+ };
+ ShapeRenderer.prototype.rect = function (filled, x, y, width, height, color) {
+ if (color === void 0) { color = null; }
+ this.quad(filled, x, y, x + width, y, x + width, y + height, x, y + height, color, color, color, color);
+ };
+ ShapeRenderer.prototype.rectLine = function (filled, x1, y1, x2, y2, width, color) {
+ if (color === void 0) { color = null; }
+ this.check(filled ? ShapeType.Filled : ShapeType.Line, 8);
+ if (color === null)
+ color = this.color;
+ var t = this.tmp.set(y2 - y1, x1 - x2);
+ t.normalize();
+ width *= 0.5;
+ var tx = t.x * width;
+ var ty = t.y * width;
+ if (!filled) {
+ this.vertex(x1 + tx, y1 + ty, color);
+ this.vertex(x1 - tx, y1 - ty, color);
+ this.vertex(x2 + tx, y2 + ty, color);
+ this.vertex(x2 - tx, y2 - ty, color);
+ this.vertex(x2 + tx, y2 + ty, color);
+ this.vertex(x1 + tx, y1 + ty, color);
+ this.vertex(x2 - tx, y2 - ty, color);
+ this.vertex(x1 - tx, y1 - ty, color);
+ }
+ else {
+ this.vertex(x1 + tx, y1 + ty, color);
+ this.vertex(x1 - tx, y1 - ty, color);
+ this.vertex(x2 + tx, y2 + ty, color);
+ this.vertex(x2 - tx, y2 - ty, color);
+ this.vertex(x2 + tx, y2 + ty, color);
+ this.vertex(x1 - tx, y1 - ty, color);
+ }
+ };
+ ShapeRenderer.prototype.x = function (x, y, size) {
+ this.line(x - size, y - size, x + size, y + size);
+ this.line(x - size, y + size, x + size, y - size);
+ };
+ ShapeRenderer.prototype.polygon = function (polygonVertices, offset, count, color) {
+ if (color === void 0) { color = null; }
+ if (count < 3)
+ throw new Error("Polygon must contain at least 3 vertices");
+ this.check(ShapeType.Line, count * 2);
+ if (color === null)
+ color = this.color;
+ var vertices = this.mesh.getVertices();
+ var idx = this.vertexIndex;
+ offset <<= 1;
+ count <<= 1;
+ var firstX = polygonVertices[offset];
+ var firstY = polygonVertices[offset + 1];
+ var last = offset + count;
+ for (var i = offset, n = offset + count - 2; i < n; i += 2) {
+ var x1 = polygonVertices[i];
+ var y1 = polygonVertices[i + 1];
+ var x2 = 0;
+ var y2 = 0;
+ if (i + 2 >= last) {
+ x2 = firstX;
+ y2 = firstY;
+ }
+ else {
+ x2 = polygonVertices[i + 2];
+ y2 = polygonVertices[i + 3];
+ }
+ this.vertex(x1, y1, color);
+ this.vertex(x2, y2, color);
+ }
+ };
+ ShapeRenderer.prototype.circle = function (filled, x, y, radius, color, segments) {
+ if (color === void 0) { color = null; }
+ if (segments === void 0) { segments = 0; }
+ if (segments === 0)
+ segments = Math.max(1, (6 * spine.MathUtils.cbrt(radius)) | 0);
+ if (segments <= 0)
+ throw new Error("segments must be > 0.");
+ if (color === null)
+ color = this.color;
+ var angle = 2 * spine.MathUtils.PI / segments;
+ var cos = Math.cos(angle);
+ var sin = Math.sin(angle);
+ var cx = radius, cy = 0;
+ if (!filled) {
+ this.check(ShapeType.Line, segments * 2 + 2);
+ for (var i = 0; i < segments; i++) {
+ this.vertex(x + cx, y + cy, color);
+ var temp_1 = cx;
+ cx = cos * cx - sin * cy;
+ cy = sin * temp_1 + cos * cy;
+ this.vertex(x + cx, y + cy, color);
+ }
+ this.vertex(x + cx, y + cy, color);
+ }
+ else {
+ this.check(ShapeType.Filled, segments * 3 + 3);
+ segments--;
+ for (var i = 0; i < segments; i++) {
+ this.vertex(x, y, color);
+ this.vertex(x + cx, y + cy, color);
+ var temp_2 = cx;
+ cx = cos * cx - sin * cy;
+ cy = sin * temp_2 + cos * cy;
+ this.vertex(x + cx, y + cy, color);
+ }
+ this.vertex(x, y, color);
+ this.vertex(x + cx, y + cy, color);
+ }
+ var temp = cx;
+ cx = radius;
+ cy = 0;
+ this.vertex(x + cx, y + cy, color);
+ };
+ ShapeRenderer.prototype.curve = function (x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments, color) {
+ if (color === void 0) { color = null; }
+ this.check(ShapeType.Line, segments * 2 + 2);
+ if (color === null)
+ color = this.color;
+ var subdiv_step = 1 / segments;
+ var subdiv_step2 = subdiv_step * subdiv_step;
+ var subdiv_step3 = subdiv_step * subdiv_step * subdiv_step;
+ var pre1 = 3 * subdiv_step;
+ var pre2 = 3 * subdiv_step2;
+ var pre4 = 6 * subdiv_step2;
+ var pre5 = 6 * subdiv_step3;
+ var tmp1x = x1 - cx1 * 2 + cx2;
+ var tmp1y = y1 - cy1 * 2 + cy2;
+ var tmp2x = (cx1 - cx2) * 3 - x1 + x2;
+ var tmp2y = (cy1 - cy2) * 3 - y1 + y2;
+ var fx = x1;
+ var fy = y1;
+ var dfx = (cx1 - x1) * pre1 + tmp1x * pre2 + tmp2x * subdiv_step3;
+ var dfy = (cy1 - y1) * pre1 + tmp1y * pre2 + tmp2y * subdiv_step3;
+ var ddfx = tmp1x * pre4 + tmp2x * pre5;
+ var ddfy = tmp1y * pre4 + tmp2y * pre5;
+ var dddfx = tmp2x * pre5;
+ var dddfy = tmp2y * pre5;
+ while (segments-- > 0) {
+ this.vertex(fx, fy, color);
+ fx += dfx;
+ fy += dfy;
+ dfx += ddfx;
+ dfy += ddfy;
+ ddfx += dddfx;
+ ddfy += dddfy;
+ this.vertex(fx, fy, color);
+ }
+ this.vertex(fx, fy, color);
+ this.vertex(x2, y2, color);
+ };
+ ShapeRenderer.prototype.vertex = function (x, y, color) {
+ var idx = this.vertexIndex;
+ var vertices = this.mesh.getVertices();
+ vertices[idx++] = x;
+ vertices[idx++] = y;
+ vertices[idx++] = color.r;
+ vertices[idx++] = color.g;
+ vertices[idx++] = color.b;
+ vertices[idx++] = color.a;
+ this.vertexIndex = idx;
+ };
+ ShapeRenderer.prototype.end = function () {
+ if (!this.isDrawing)
+ throw new Error("ShapeRenderer.begin() has not been called");
+ this.flush();
+ this.context.gl.disable(this.context.gl.BLEND);
+ this.isDrawing = false;
+ };
+ ShapeRenderer.prototype.flush = function () {
+ if (this.vertexIndex == 0)
+ return;
+ this.mesh.setVerticesLength(this.vertexIndex);
+ this.mesh.draw(this.shader, this.shapeType);
+ this.vertexIndex = 0;
+ };
+ ShapeRenderer.prototype.check = function (shapeType, numVertices) {
+ if (!this.isDrawing)
+ throw new Error("ShapeRenderer.begin() has not been called");
+ if (this.shapeType == shapeType) {
+ if (this.mesh.maxVertices() - this.mesh.numVertices() < numVertices)
+ this.flush();
+ else
+ return;
+ }
+ else {
+ this.flush();
+ this.shapeType = shapeType;
+ }
+ };
+ ShapeRenderer.prototype.dispose = function () {
+ this.mesh.dispose();
+ };
+ return ShapeRenderer;
+ }());
+ webgl.ShapeRenderer = ShapeRenderer;
+ var ShapeType;
+ (function (ShapeType) {
+ ShapeType[ShapeType["Point"] = 0] = "Point";
+ ShapeType[ShapeType["Line"] = 1] = "Line";
+ ShapeType[ShapeType["Filled"] = 4] = "Filled";
+ })(ShapeType = webgl.ShapeType || (webgl.ShapeType = {}));
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var SkeletonDebugRenderer = (function () {
+ function SkeletonDebugRenderer(context) {
+ this.boneLineColor = new spine.Color(1, 0, 0, 1);
+ this.boneOriginColor = new spine.Color(0, 1, 0, 1);
+ this.attachmentLineColor = new spine.Color(0, 0, 1, 0.5);
+ this.triangleLineColor = new spine.Color(1, 0.64, 0, 0.5);
+ this.pathColor = new spine.Color().setFromString("FF7F00");
+ this.clipColor = new spine.Color(0.8, 0, 0, 2);
+ this.aabbColor = new spine.Color(0, 1, 0, 0.5);
+ this.drawBones = true;
+ this.drawRegionAttachments = true;
+ this.drawBoundingBoxes = true;
+ this.drawMeshHull = true;
+ this.drawMeshTriangles = true;
+ this.drawPaths = true;
+ this.drawSkeletonXY = false;
+ this.drawClipping = true;
+ this.premultipliedAlpha = false;
+ this.scale = 1;
+ this.boneWidth = 2;
+ this.bounds = new spine.SkeletonBounds();
+ this.temp = new Array();
+ this.vertices = spine.Utils.newFloatArray(2 * 1024);
+ this.context = context instanceof webgl.ManagedWebGLRenderingContext ? context : new webgl.ManagedWebGLRenderingContext(context);
+ }
+ SkeletonDebugRenderer.prototype.draw = function (shapes, skeleton, ignoredBones) {
+ if (ignoredBones === void 0) { ignoredBones = null; }
+ var skeletonX = skeleton.x;
+ var skeletonY = skeleton.y;
+ var gl = this.context.gl;
+ var srcFunc = this.premultipliedAlpha ? gl.ONE : gl.SRC_ALPHA;
+ shapes.setBlendMode(srcFunc, gl.ONE_MINUS_SRC_ALPHA);
+ var bones = skeleton.bones;
+ if (this.drawBones) {
+ shapes.setColor(this.boneLineColor);
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (ignoredBones && ignoredBones.indexOf(bone.data.name) > -1)
+ continue;
+ if (bone.parent == null)
+ continue;
+ var x = skeletonX + bone.data.length * bone.a + bone.worldX;
+ var y = skeletonY + bone.data.length * bone.c + bone.worldY;
+ shapes.rectLine(true, skeletonX + bone.worldX, skeletonY + bone.worldY, x, y, this.boneWidth * this.scale);
+ }
+ if (this.drawSkeletonXY)
+ shapes.x(skeletonX, skeletonY, 4 * this.scale);
+ }
+ if (this.drawRegionAttachments) {
+ shapes.setColor(this.attachmentLineColor);
+ var slots = skeleton.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ var attachment = slot.getAttachment();
+ if (attachment instanceof spine.RegionAttachment) {
+ var regionAttachment = attachment;
+ var vertices = this.vertices;
+ regionAttachment.computeWorldVertices(slot.bone, vertices, 0, 2);
+ shapes.line(vertices[0], vertices[1], vertices[2], vertices[3]);
+ shapes.line(vertices[2], vertices[3], vertices[4], vertices[5]);
+ shapes.line(vertices[4], vertices[5], vertices[6], vertices[7]);
+ shapes.line(vertices[6], vertices[7], vertices[0], vertices[1]);
+ }
+ }
+ }
+ if (this.drawMeshHull || this.drawMeshTriangles) {
+ var slots = skeleton.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ var attachment = slot.getAttachment();
+ if (!(attachment instanceof spine.MeshAttachment))
+ continue;
+ var mesh = attachment;
+ var vertices = this.vertices;
+ mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, 2);
+ var triangles = mesh.triangles;
+ var hullLength = mesh.hullLength;
+ if (this.drawMeshTriangles) {
+ shapes.setColor(this.triangleLineColor);
+ for (var ii = 0, nn = triangles.length; ii < nn; ii += 3) {
+ var v1 = triangles[ii] * 2, v2 = triangles[ii + 1] * 2, v3 = triangles[ii + 2] * 2;
+ shapes.triangle(false, vertices[v1], vertices[v1 + 1], vertices[v2], vertices[v2 + 1], vertices[v3], vertices[v3 + 1]);
+ }
+ }
+ if (this.drawMeshHull && hullLength > 0) {
+ shapes.setColor(this.attachmentLineColor);
+ hullLength = (hullLength >> 1) * 2;
+ var lastX = vertices[hullLength - 2], lastY = vertices[hullLength - 1];
+ for (var ii = 0, nn = hullLength; ii < nn; ii += 2) {
+ var x = vertices[ii], y = vertices[ii + 1];
+ shapes.line(x, y, lastX, lastY);
+ lastX = x;
+ lastY = y;
+ }
+ }
+ }
+ }
+ if (this.drawBoundingBoxes) {
+ var bounds = this.bounds;
+ bounds.update(skeleton, true);
+ shapes.setColor(this.aabbColor);
+ shapes.rect(false, bounds.minX, bounds.minY, bounds.getWidth(), bounds.getHeight());
+ var polygons = bounds.polygons;
+ var boxes = bounds.boundingBoxes;
+ for (var i = 0, n = polygons.length; i < n; i++) {
+ var polygon = polygons[i];
+ shapes.setColor(boxes[i].color);
+ shapes.polygon(polygon, 0, polygon.length);
+ }
+ }
+ if (this.drawPaths) {
+ var slots = skeleton.slots;
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ var attachment = slot.getAttachment();
+ if (!(attachment instanceof spine.PathAttachment))
+ continue;
+ var path = attachment;
+ var nn = path.worldVerticesLength;
+ var world = this.temp = spine.Utils.setArraySize(this.temp, nn, 0);
+ path.computeWorldVertices(slot, 0, nn, world, 0, 2);
+ var color = this.pathColor;
+ var x1 = world[2], y1 = world[3], x2 = 0, y2 = 0;
+ if (path.closed) {
+ shapes.setColor(color);
+ var cx1 = world[0], cy1 = world[1], cx2 = world[nn - 2], cy2 = world[nn - 1];
+ x2 = world[nn - 4];
+ y2 = world[nn - 3];
+ shapes.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, 32);
+ shapes.setColor(SkeletonDebugRenderer.LIGHT_GRAY);
+ shapes.line(x1, y1, cx1, cy1);
+ shapes.line(x2, y2, cx2, cy2);
+ }
+ nn -= 4;
+ for (var ii = 4; ii < nn; ii += 6) {
+ var cx1 = world[ii], cy1 = world[ii + 1], cx2 = world[ii + 2], cy2 = world[ii + 3];
+ x2 = world[ii + 4];
+ y2 = world[ii + 5];
+ shapes.setColor(color);
+ shapes.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, 32);
+ shapes.setColor(SkeletonDebugRenderer.LIGHT_GRAY);
+ shapes.line(x1, y1, cx1, cy1);
+ shapes.line(x2, y2, cx2, cy2);
+ x1 = x2;
+ y1 = y2;
+ }
+ }
+ }
+ if (this.drawBones) {
+ shapes.setColor(this.boneOriginColor);
+ for (var i = 0, n = bones.length; i < n; i++) {
+ var bone = bones[i];
+ if (ignoredBones && ignoredBones.indexOf(bone.data.name) > -1)
+ continue;
+ shapes.circle(true, skeletonX + bone.worldX, skeletonY + bone.worldY, 3 * this.scale, SkeletonDebugRenderer.GREEN, 8);
+ }
+ }
+ if (this.drawClipping) {
+ var slots = skeleton.slots;
+ shapes.setColor(this.clipColor);
+ for (var i = 0, n = slots.length; i < n; i++) {
+ var slot = slots[i];
+ var attachment = slot.getAttachment();
+ if (!(attachment instanceof spine.ClippingAttachment))
+ continue;
+ var clip = attachment;
+ var nn = clip.worldVerticesLength;
+ var world = this.temp = spine.Utils.setArraySize(this.temp, nn, 0);
+ clip.computeWorldVertices(slot, 0, nn, world, 0, 2);
+ for (var i_12 = 0, n_2 = world.length; i_12 < n_2; i_12 += 2) {
+ var x = world[i_12];
+ var y = world[i_12 + 1];
+ var x2 = world[(i_12 + 2) % world.length];
+ var y2 = world[(i_12 + 3) % world.length];
+ shapes.line(x, y, x2, y2);
+ }
+ }
+ }
+ };
+ SkeletonDebugRenderer.prototype.dispose = function () {
+ };
+ SkeletonDebugRenderer.LIGHT_GRAY = new spine.Color(192 / 255, 192 / 255, 192 / 255, 1);
+ SkeletonDebugRenderer.GREEN = new spine.Color(0, 1, 0, 1);
+ return SkeletonDebugRenderer;
+ }());
+ webgl.SkeletonDebugRenderer = SkeletonDebugRenderer;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var Renderable = (function () {
+ function Renderable(vertices, numVertices, numFloats) {
+ this.vertices = vertices;
+ this.numVertices = numVertices;
+ this.numFloats = numFloats;
+ }
+ return Renderable;
+ }());
+ ;
+ var SkeletonRenderer = (function () {
+ function SkeletonRenderer(context, twoColorTint) {
+ if (twoColorTint === void 0) { twoColorTint = true; }
+ if (context instanceof webgl.ManagedWebGLRenderingContext) {
+ this.gl = context.gl;
+ } else {
+ this.gl = context;
+ }
+
+ this.premultipliedAlpha = false;
+ this.vertexEffect = null;
+ this.tempColor = new spine.Color();
+ this.tempColor2 = new spine.Color();
+ this.vertexSize = 2 + 2 + 4;
+ this.twoColorTint = false;
+ this.renderable = new Renderable(null, 0, 0);
+ this.clipper = new spine.SkeletonClipping();
+ this.temp = new spine.Vector2();
+ this.temp2 = new spine.Vector2();
+ this.temp3 = new spine.Color();
+ this.temp4 = new spine.Color();
+ this.twoColorTint = twoColorTint;
+ if (twoColorTint)
+ this.vertexSize += 4;
+ this.vertices = spine.Utils.newFloatArray(this.vertexSize * 1024);
+ }
+ SkeletonRenderer.prototype.getSlotsMask = function () {
+ var scale = this.outcropScale;
+ var angle = this.outcropAngle;
+ var gl = this.gl;
+
+ var ox = gl.canvas.width / 2;
+ var oy = gl.canvas.height / 2;
+ var x = this.outcropX;
+ var y = this.outcropY;
+ if (x == null)
+ x = ox;
+ if (y == null)
+ y = oy;
+
+ var offsetX = ox - x;
+ var offsetY = oy - y;
+ var t = offsetY + oy - (gl.canvas.height * 0.1);
+ var r = offsetX + ox;
+ var b = offsetY - oy;
+ var l = offsetX - ox;
+
+ t /= scale;
+ r /= scale;
+ b /= scale;
+ l /= scale;
+
+ slotsMask = this.slotsMask;
+ if (slotsMask == null) {
+ slotsMask = this.slotsMask = new spine.ClippingAttachment('outcrop');
+ slotsMask.vertices = new Array(8);
+ slotsMask.worldVerticesLength = slotsMask.vertices.length;
+ }
+
+ var verts = slotsMask.vertices;
+ verts[0] = l; verts[1] = t;
+ verts[2] = l; verts[3] = b;
+ verts[4] = r; verts[5] = b;
+ verts[6] = r; verts[7] = t;
+ if (angle) {
+ angle = angle / 180 * Math.PI;
+ var cosA = Math.cos(angle);
+ var sinA = Math.sin(angle);
+ var dx, dy;
+ for (var i = 0; i < 8; i += 2) {
+ dx = verts[i];
+ dy = verts[i + 1];
+ verts[i] = dx * cosA + dy * sinA;
+ verts[i + 1] = dy * cosA - dx * sinA;
+ }
+ }
+ return slotsMask;
+ };
+ SkeletonRenderer.prototype.draw = function (batcher, skeleton, slotRangeStart, slotRangeEnd) {
+ if (slotRangeStart === void 0) { slotRangeStart = -1; }
+ if (slotRangeEnd === void 0) { slotRangeEnd = -1; }
+ var gl = this.gl;
+ var clipper = this.clipper;
+ var premultipliedAlpha = this.premultipliedAlpha;
+ var twoColorTint = this.twoColorTint;
+ var blendMode = null;
+ var tempPos = this.temp;
+ var tempUv = this.temp2;
+ var tempLight = this.temp3;
+ var tempDark = this.temp4;
+ var renderable = this.renderable;
+ var uvs = null;
+ var triangles = null;
+ var drawOrder = skeleton.drawOrder;
+ var attachmentColor = null;
+ var skeletonColor = skeleton.color;
+ var vertexSize = twoColorTint ? 12 : 8;
+ var inRange = false;
+ if (slotRangeStart == -1)
+ inRange = true;
+ var hideSlots = this.hideSlots;
+ if (hideSlots && !Array.isArray(hideSlots))
+ hideSlots = [hideSlots];
+
+ var slotName;
+ var clipSlots;
+ var slotsMask;
+ if (this.outcropMask) {
+ clipSlots = this.clipSlots;
+ if (clipSlots) {
+ if (!Array.isArray(clipSlots))
+ clipSlots = [clipSlots];
+
+ slotsMask = this.getSlotsMask();
+ }
+ }
+
+ for (var i = 0, n = drawOrder.length; i < n; i++) {
+ var slot = drawOrder[i];
+
+ if (slotRangeStart >= 0 && slotRangeStart == slot.data.index) {
+ inRange = true;
+ }
+ if (!inRange) {
+ clipper.clipEndWithSlot(slot);
+ continue;
+ }
+ if (slotRangeEnd >= 0 && slotRangeEnd == slot.data.index) {
+ inRange = false;
+ }
+
+ var attachment = slot.getAttachment();
+ if (attachment && hideSlots) {
+ slotName = attachment.name;
+ if (slotName && hideSlots.indexOf(slotName) != -1) {
+ clipper.clipEndWithSlot(slot);
+ continue;
+ }
+ }
+
+ if (attachment && clipSlots) {
+ slotName = attachment.name;
+ if (slotName && clipSlots.indexOf(slotName) != -1) {
+ if (clipper.clipAttachment != slotsMask)
+ clipper.clipStart(false, slotsMask);
+ } else if (clipper.clipAttachment == slotsMask) {
+ clipper.clipEnd();
+ }
+ }
+
+ var texture = null;
+ var clippedVertexSize = clipper.isClipping() ? 2 : vertexSize;
+ if (attachment instanceof spine.RegionAttachment) {
+ var region = attachment;
+ renderable.vertices = this.vertices;
+ renderable.numVertices = 4;
+ renderable.numFloats = clippedVertexSize << 2;
+ region.computeWorldVertices(slot.bone, renderable.vertices, 0, clippedVertexSize);
+ triangles = SkeletonRenderer.QUAD_TRIANGLES;
+ uvs = region.uvs;
+ texture = region.region.renderObject.texture;
+ attachmentColor = region.color;
+ } else if (attachment instanceof spine.MeshAttachment) {
+ var mesh = attachment;
+ renderable.vertices = this.vertices;
+ renderable.numVertices = (mesh.worldVerticesLength >> 1);
+ renderable.numFloats = renderable.numVertices * clippedVertexSize;
+ if (renderable.numFloats > renderable.vertices.length) {
+ renderable.vertices = this.vertices = spine.Utils.newFloatArray(renderable.numFloats);
+ }
+ mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, renderable.vertices, 0, clippedVertexSize);
+ triangles = mesh.triangles;
+ texture = mesh.region.renderObject.texture;
+ uvs = mesh.uvs;
+ attachmentColor = mesh.color;
+ } else if (attachment instanceof spine.ClippingAttachment) {
+ var clip = (attachment);
+ if (!this.disableMask && !this.outcropMask) {
+ clipper.clipStart(slot, clip);
+ }
+ } else {
+ clipper.clipEndWithSlot(slot);
+ }
+
+ if (texture != null) {
+ var slotColor = slot.color;
+ var finalColor = this.tempColor;
+ finalColor.r = skeletonColor.r * slotColor.r * attachmentColor.r;
+ finalColor.g = skeletonColor.g * slotColor.g * attachmentColor.g;
+ finalColor.b = skeletonColor.b * slotColor.b * attachmentColor.b;
+ finalColor.a = skeletonColor.a * slotColor.a * attachmentColor.a * skeleton.opacity;
+ if (premultipliedAlpha) {
+ finalColor.r *= finalColor.a;
+ finalColor.g *= finalColor.a;
+ finalColor.b *= finalColor.a;
+ }
+ var darkColor = this.tempColor2;
+ if (slot.darkColor == null)
+ darkColor.set(0, 0, 0, 1.0);
+ else {
+ if (premultipliedAlpha) {
+ darkColor.r = slot.darkColor.r * finalColor.a;
+ darkColor.g = slot.darkColor.g * finalColor.a;
+ darkColor.b = slot.darkColor.b * finalColor.a;
+ } else {
+ darkColor.setFromColor(slot.darkColor);
+ }
+ darkColor.a = premultipliedAlpha ? 1.0 : 0.0;
+ }
+ var slotBlendMode = slot.data.blendMode;
+ if (slotBlendMode != blendMode) {
+ blendMode = slotBlendMode;
+ batcher.setBlendMode(webgl.WebGLBlendModeConverter.getSourceGLBlendMode(blendMode, premultipliedAlpha), webgl.WebGLBlendModeConverter.getDestGLBlendMode(blendMode));
+ }
+ if (clipper.isClipping()) {
+ clipper.clipTriangles(renderable.vertices, renderable.numFloats, triangles, triangles.length, uvs, finalColor, darkColor, twoColorTint);
+ var clippedVertices = new Float32Array(clipper.clippedVertices);
+ var clippedTriangles = clipper.clippedTriangles;
+ batcher.draw(texture, clippedVertices, clippedTriangles);
+ } else {
+ var verts = renderable.vertices;
+ if (!twoColorTint) {
+ for (var v = 2, u = 0, n_7 = renderable.numFloats; v < n_7; v += vertexSize, u += 2) {
+ verts[v] = finalColor.r;
+ verts[v + 1] = finalColor.g;
+ verts[v + 2] = finalColor.b;
+ verts[v + 3] = finalColor.a;
+ verts[v + 4] = uvs[u];
+ verts[v + 5] = uvs[u + 1];
+ }
+ } else {
+ for (var v = 2, u = 0, n_8 = renderable.numFloats; v < n_8; v += vertexSize, u += 2) {
+ verts[v] = finalColor.r;
+ verts[v + 1] = finalColor.g;
+ verts[v + 2] = finalColor.b;
+ verts[v + 3] = finalColor.a;
+ verts[v + 4] = uvs[u];
+ verts[v + 5] = uvs[u + 1];
+ verts[v + 6] = darkColor.r;
+ verts[v + 7] = darkColor.g;
+ verts[v + 8] = darkColor.b;
+ verts[v + 9] = darkColor.a;
+ }
+ }
+ var view = renderable.vertices.subarray(0, renderable.numFloats);
+ batcher.draw(texture, view, triangles);
+ }
+
+ clipper.clipEndWithSlot(slot);
+ }
+ }
+ clipper.clipEnd();
+ };
+ SkeletonRenderer.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
+ return SkeletonRenderer;
+ }());
+ webgl.SkeletonRenderer = SkeletonRenderer;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var Vector3 = (function () {
+ function Vector3(x, y, z) {
+ if (x === void 0) { x = 0; }
+ if (y === void 0) { y = 0; }
+ if (z === void 0) { z = 0; }
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+ Vector3.prototype.setFrom = function (v) {
+ this.x = v.x;
+ this.y = v.y;
+ this.z = v.z;
+ return this;
+ };
+ Vector3.prototype.set = function (x, y, z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ return this;
+ };
+ Vector3.prototype.add = function (v) {
+ this.x += v.x;
+ this.y += v.y;
+ this.z += v.z;
+ return this;
+ };
+ Vector3.prototype.sub = function (v) {
+ this.x -= v.x;
+ this.y -= v.y;
+ this.z -= v.z;
+ return this;
+ };
+ Vector3.prototype.scale = function (s) {
+ this.x *= s;
+ this.y *= s;
+ this.z *= s;
+ return this;
+ };
+ Vector3.prototype.normalize = function () {
+ var len = this.length();
+ if (len == 0)
+ return this;
+ len = 1 / len;
+ this.x *= len;
+ this.y *= len;
+ this.z *= len;
+ return this;
+ };
+ Vector3.prototype.cross = function (v) {
+ return this.set(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x);
+ };
+ Vector3.prototype.multiply = function (matrix) {
+ var l_mat = matrix.values;
+ return this.set(this.x * l_mat[webgl.M00] + this.y * l_mat[webgl.M01] + this.z * l_mat[webgl.M02] + l_mat[webgl.M03], this.x * l_mat[webgl.M10] + this.y * l_mat[webgl.M11] + this.z * l_mat[webgl.M12] + l_mat[webgl.M13], this.x * l_mat[webgl.M20] + this.y * l_mat[webgl.M21] + this.z * l_mat[webgl.M22] + l_mat[webgl.M23]);
+ };
+ Vector3.prototype.project = function (matrix) {
+ var l_mat = matrix.values;
+ var l_w = 1 / (this.x * l_mat[webgl.M30] + this.y * l_mat[webgl.M31] + this.z * l_mat[webgl.M32] + l_mat[webgl.M33]);
+ return this.set((this.x * l_mat[webgl.M00] + this.y * l_mat[webgl.M01] + this.z * l_mat[webgl.M02] + l_mat[webgl.M03]) * l_w, (this.x * l_mat[webgl.M10] + this.y * l_mat[webgl.M11] + this.z * l_mat[webgl.M12] + l_mat[webgl.M13]) * l_w, (this.x * l_mat[webgl.M20] + this.y * l_mat[webgl.M21] + this.z * l_mat[webgl.M22] + l_mat[webgl.M23]) * l_w);
+ };
+ Vector3.prototype.dot = function (v) {
+ return this.x * v.x + this.y * v.y + this.z * v.z;
+ };
+ Vector3.prototype.length = function () {
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
+ };
+ Vector3.prototype.distance = function (v) {
+ var a = v.x - this.x;
+ var b = v.y - this.y;
+ var c = v.z - this.z;
+ return Math.sqrt(a * a + b * b + c * c);
+ };
+ return Vector3;
+ }());
+ webgl.Vector3 = Vector3;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));
+var spine;
+(function (spine) {
+ var webgl;
+ (function (webgl) {
+ var ManagedWebGLRenderingContext = (function () {
+ function ManagedWebGLRenderingContext(canvasOrContext, contextConfig) {
+ if (contextConfig === void 0) { contextConfig = { alpha: "true" }; }
+ var _this = this;
+ this.restorables = new Array();
+ if (canvasOrContext instanceof HTMLCanvasElement) {
+ var canvas = canvasOrContext;
+ this.gl = (canvas.getContext("webgl", contextConfig) || canvas.getContext("experimental-webgl", contextConfig));
+ this.canvas = canvas;
+ canvas.addEventListener("webglcontextlost", function (e) {
+ var event = e;
+ if (e) {
+ e.preventDefault();
+ }
+ });
+ canvas.addEventListener("webglcontextrestored", function (e) {
+ for (var i = 0, n = _this.restorables.length; i < n; i++) {
+ _this.restorables[i].restore();
+ }
+ });
+ }
+ else {
+ this.gl = canvasOrContext;
+ this.canvas = this.gl.canvas;
+ }
+ }
+ ManagedWebGLRenderingContext.prototype.addRestorable = function (restorable) {
+ this.restorables.push(restorable);
+ };
+ ManagedWebGLRenderingContext.prototype.removeRestorable = function (restorable) {
+ var index = this.restorables.indexOf(restorable);
+ if (index > -1)
+ this.restorables.splice(index, 1);
+ };
+ return ManagedWebGLRenderingContext;
+ }());
+ webgl.ManagedWebGLRenderingContext = ManagedWebGLRenderingContext;
+ var WebGLBlendModeConverter = (function () {
+ function WebGLBlendModeConverter() {
+ }
+ WebGLBlendModeConverter.getDestGLBlendMode = function (blendMode) {
+ switch (blendMode) {
+ case spine.BlendMode.Normal: return WebGLBlendModeConverter.ONE_MINUS_SRC_ALPHA;
+ case spine.BlendMode.Additive: return WebGLBlendModeConverter.ONE;
+ case spine.BlendMode.Multiply: return WebGLBlendModeConverter.ONE_MINUS_SRC_ALPHA;
+ case spine.BlendMode.Screen: return WebGLBlendModeConverter.ONE_MINUS_SRC_ALPHA;
+ default: throw new Error("Unknown blend mode: " + blendMode);
+ }
+ };
+ WebGLBlendModeConverter.getSourceGLBlendMode = function (blendMode, premultipliedAlpha) {
+ if (premultipliedAlpha === void 0) { premultipliedAlpha = false; }
+ switch (blendMode) {
+ case spine.BlendMode.Normal: return premultipliedAlpha ? WebGLBlendModeConverter.ONE : WebGLBlendModeConverter.SRC_ALPHA;
+ case spine.BlendMode.Additive: return premultipliedAlpha ? WebGLBlendModeConverter.ONE : WebGLBlendModeConverter.SRC_ALPHA;
+ case spine.BlendMode.Multiply: return WebGLBlendModeConverter.DST_COLOR;
+ case spine.BlendMode.Screen: return WebGLBlendModeConverter.ONE;
+ default: throw new Error("Unknown blend mode: " + blendMode);
+ }
+ };
+ WebGLBlendModeConverter.ZERO = 0;
+ WebGLBlendModeConverter.ONE = 1;
+ WebGLBlendModeConverter.SRC_COLOR = 0x0300;
+ WebGLBlendModeConverter.ONE_MINUS_SRC_COLOR = 0x0301;
+ WebGLBlendModeConverter.SRC_ALPHA = 0x0302;
+ WebGLBlendModeConverter.ONE_MINUS_SRC_ALPHA = 0x0303;
+ WebGLBlendModeConverter.DST_ALPHA = 0x0304;
+ WebGLBlendModeConverter.ONE_MINUS_DST_ALPHA = 0x0305;
+ WebGLBlendModeConverter.DST_COLOR = 0x0306;
+ return WebGLBlendModeConverter;
+ }());
+ webgl.WebGLBlendModeConverter = WebGLBlendModeConverter;
+ })(webgl = spine.webgl || (spine.webgl = {}));
+})(spine || (spine = {}));