Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cancel icon and fixed the temporary display #2597

Merged
merged 10 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = {
};
};
},
};
};
Loading