Skip to content

Commit

Permalink
Merge pull request #2597 from Joywin2412/master
Browse files Browse the repository at this point in the history
ability toggling cancel icon, fixes #2170
  • Loading branch information
DreadKnight authored Aug 13, 2024
2 parents 42528ac + eeacdf6 commit 95e2416
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/style/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@
&.nextIcon {
background-image: url('~assets/icons/next.svg') !important;
}
&.cancelIcon {
background-image: url('~assets/icons/cancel.svg') !important;
}

&.upgraded.noclick:hover:before {
opacity: 1;
Expand Down
42 changes: 38 additions & 4 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ export class UI {
$button: $j('.ability[ability="' + i + '"]'),
hasShortcut: true,
click: () => {


this.clickedAbility = i;

const game = this.game;
if (this.selectedAbility != i) {
if (this.dashopen) {
Expand All @@ -279,10 +283,38 @@ export class UI {
const ability = game.activeCreature.abilities[i];
// Passive ability icon can cycle between usable abilities
if (i == 0) {
// Joywin
const selectedAbility = this.selectNextAbility();
const creature = game.activeCreature;


if (selectedAbility > 0) {
this.abilitiesButtons.forEach((btn, index) => {
if (index === 0) {
btn.$button.removeClass('cancelIcon')
btn.$button.removeClass('nextIcon')

console.log(btn.$button);
this.clickedAbility = -1
}
});
b.cssTransition('nextIcon', 1000);


} else if (selectedAbility === -1) {
this.abilitiesButtons.forEach((btn, index) => {
console.log(this.clickedAbility);
if (index === 0) {
btn.$button.removeClass('nextIcon')
btn.$button.removeClass('cancelIcon')
this.clickedAbility = -1;
}
});
b.cssTransition('cancelIcon', 1000);

}


return;
}
// Colored frame around selected ability
Expand Down Expand Up @@ -575,7 +607,7 @@ export class UI {
this.selectedCreature = '';
this.selectedPlayer = 0;
this.selectedAbility = -1;

this.clickedAbility = -1;
this.queueAnimSpeed = 500; // ms
this.dashAnimSpeed = 250; // ms

Expand Down Expand Up @@ -1517,9 +1549,11 @@ export class UI {
* @param{boolean} [randomize] - True selects a random creature from the grid.
*/
toggleDash(randomize) {
const game = this.game;
const game = this.game,
creature = game.activeCreature;

if (this.$dash.hasClass('active')) {
if (this.$dash.hasClass('active')) {
this.clickedAbility = -1;
this.closeDash();
return;
}
Expand Down Expand Up @@ -2469,4 +2503,4 @@ const utils = {
};
};
},
};
};

0 comments on commit 95e2416

Please sign in to comment.