-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(location): show location stats on travel screen and explore screen
- Loading branch information
Showing
11 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
client/src/app/components/location-stats-button/location-stats-button.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<ion-button | ||
(click)="openModal()" | ||
size="small" | ||
class="icon-only" | ||
color="tertiary" | ||
> | ||
<ion-icon slot="icon-only" name="stats-chart"></ion-icon> | ||
</ion-button> |
Empty file.
30 changes: 30 additions & 0 deletions
30
client/src/app/components/location-stats-button/location-stats-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { LocationStatsModalComponent } from '@components/modals/location-stats/location-stats.component'; | ||
import { ModalController } from '@ionic/angular'; | ||
import { ContentService } from '@services/content.service'; | ||
|
||
@Component({ | ||
selector: 'app-location-stats-button', | ||
templateUrl: './location-stats-button.component.html', | ||
styleUrls: ['./location-stats-button.component.scss'], | ||
}) | ||
export class LocationStatsButtonComponent implements OnInit { | ||
@Input({ required: true }) location!: string; | ||
|
||
constructor( | ||
private modalCtrl: ModalController, | ||
private contentService: ContentService, | ||
) {} | ||
|
||
ngOnInit() {} | ||
|
||
async openModal() { | ||
const modal = await this.modalCtrl.create({ | ||
component: LocationStatsModalComponent, | ||
componentProps: { | ||
location: this.contentService.getLocation(this.location), | ||
}, | ||
}); | ||
await modal.present(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
client/src/app/components/modals/location-stats/location-stats.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>{{ location.name }} Stats</ion-title> | ||
|
||
<ion-buttons slot="end"> | ||
<ion-button color="medium" (click)="dismiss()">Close</ion-button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content class="ion-padding"> | ||
<ion-card> | ||
<ion-card-content> | ||
<ion-list> | ||
<ion-item *ngFor="let stat of displayStats"> | ||
<ion-label> | ||
<ion-row> | ||
<ion-col> | ||
{{ statNames[stat] }} | ||
</ion-col> | ||
|
||
<ion-col> | ||
{{ statFormatters[stat](location.baseStats[stat]) }} | ||
</ion-col> | ||
</ion-row> | ||
</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-card-content> | ||
</ion-card> | ||
</ion-content> |
Empty file.
56 changes: 56 additions & 0 deletions
56
client/src/app/components/modals/location-stats/location-stats.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { ILocation, LocationStat } from '@interfaces'; | ||
import { ModalController } from '@ionic/angular'; | ||
|
||
@Component({ | ||
selector: 'app-location-stats', | ||
templateUrl: './location-stats.component.html', | ||
styleUrls: ['./location-stats.component.scss'], | ||
}) | ||
export class LocationStatsModalComponent implements OnInit { | ||
@Input({ required: true }) location!: ILocation; | ||
|
||
public readonly displayStats: LocationStat[] = [ | ||
LocationStat.XPGain, | ||
LocationStat.CoinGain, | ||
LocationStat.ExploreSpeed, | ||
LocationStat.ItemFind, | ||
LocationStat.Wave, | ||
LocationStat.NPCEncounter, | ||
LocationStat.LocationFind, | ||
LocationStat.CollectibleFind, | ||
]; | ||
|
||
public readonly statNames: Record<LocationStat, string> = { | ||
[LocationStat.XPGain]: 'XP Gain', | ||
[LocationStat.CoinGain]: 'Coin Gain', | ||
[LocationStat.ExploreSpeed]: 'Explore Speed', | ||
[LocationStat.ItemFind]: 'Item Find Chance', | ||
[LocationStat.Wave]: 'Wave Chance', | ||
[LocationStat.NPCEncounter]: 'NPC Encounter Chance', | ||
[LocationStat.LocationFind]: 'Location Find Chance', | ||
[LocationStat.CollectibleFind]: 'Collectible Find Chance', | ||
}; | ||
|
||
public readonly statFormatters: Record< | ||
LocationStat, | ||
(value: number) => string | ||
> = { | ||
[LocationStat.XPGain]: (value) => `${value}%`, | ||
[LocationStat.CoinGain]: (value) => `${value}%`, | ||
[LocationStat.ExploreSpeed]: (value) => `${value}%`, | ||
[LocationStat.ItemFind]: (value) => `${value}%`, | ||
[LocationStat.Wave]: (value) => `${value}%`, | ||
[LocationStat.NPCEncounter]: (value) => `${value}%`, | ||
[LocationStat.LocationFind]: (value) => `${value}%`, | ||
[LocationStat.CollectibleFind]: (value) => `${value}%`, | ||
}; | ||
|
||
constructor(private modalController: ModalController) {} | ||
|
||
ngOnInit() {} | ||
|
||
dismiss() { | ||
this.modalController.dismiss(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters