This commit is contained in:
Chris Chen
2025-11-05 15:21:42 -08:00
parent d20f2a37c4
commit 716e25f0ba
20 changed files with 502 additions and 53 deletions
@@ -10,7 +10,19 @@
<div class="tp-box g-height-300 g-height-350--sm g-height-500--md" [@flipState]="flip">
<div class="tp-box__side tp-box__front ">
<img class="MD2HeroCard " src="{{hero.imgUrl}}" (click)="toggleFlip()">
<div class="row">
<div class="col-6">
<!-- show hero stand image -->
<img src="{{imgUrl('Heros/'+className+'.jpg')}}" (click)="toggleFlip()">
</div>
<div class="col-6">
<!-- show skill html -->
<div [innerHTML]="hero.skillHtml"></div>
<!-- show shadow skill html -->
<div [innerHTML]="hero.shadowSkillHtml"></div>
</div>
</div>
<!-- <img class="MD2HeroCard " src="{{imgUrl('Heros/'+className+'.jpg')}}" (click)="toggleFlip()"> -->
<div class="d-none d-sm-block">
<div *ngIf="hero.uiActivating&&hero.remainActions>0">
@@ -11,8 +11,9 @@ import { ADButtonColor, ADButtons } from '../../../ui/alert-dlg/alert-dlg.model'
import { ArrayUtils } from '../../../utilities/array-utils';
import { StringUtils } from '../../../utilities/string-utils';
import { DebounceTimer } from '../../../utilities/timer-utils';
import { HeroClass, MD2HeroInfo, MD2Icon } from '../massive-darkness2.model';
import { HeroClass, MD2HeroInfo, MD2HeroProfile, MD2Icon } from '../massive-darkness2.model';
import { MD2Base } from '../MD2Base';
import { MD2HeroProfileService } from '../service/massive-darkness2.service';
@Component({
selector: 'ngx-hero-dashboard',
@@ -55,16 +56,7 @@ export class HeroDashboardComponent extends MD2Base implements OnInit {
new DropDownOption(HeroClass.Druid, 'Druid'),
];
heros = [] as MD2HeroInfo[];
wizards: MD2HeroInfo[] = [
new MD2HeroInfo({ name: 'Ajax', mpMaximum: 6, hpMaximum: 4, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Baldric', mpMaximum: 5, hpMaximum: 4, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Ego', mpMaximum: 5, hpMaximum: 6, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Elias', mpMaximum: 6, hpMaximum: 5, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Megan', mpMaximum: 5, hpMaximum: 5, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Moira', mpMaximum: 6, hpMaximum: 5, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Myriam', mpMaximum: 7, hpMaximum: 4, skillHtml: '', shadowSkillHtml: '' }),
new MD2HeroInfo({ name: 'Valdis', mpMaximum: 6, hpMaximum: 4, skillHtml: '', shadowSkillHtml: '' })
]
heroProfiles: MD2HeroProfile[] = [];
public get hero() {
return this.md2Service.playerHero;
@@ -73,6 +65,7 @@ export class HeroDashboardComponent extends MD2Base implements OnInit {
constructor(
private gameRoomService: GameRoomService,
public md2Service: MD2Service,
private heroProfileService: MD2HeroProfileService,
protected stateService: StateService,
protected route: ActivatedRoute,
protected cdRef: ChangeDetectorRef,
@@ -100,6 +93,7 @@ export class HeroDashboardComponent extends MD2Base implements OnInit {
initHero() {
this.gameRoomService.gameRoomId = this.roomId;
if (!this.md2Service.heros.some(h => h.playerInfo.signalRClientId == this.stateService.loginUserService.userAccess.signalRSessionId)) {
this.msgBoxService.showInputbox('Select Hero Class', '', { dropDownOptions: this.classOptions, inputType: 'dropdown' })
.pipe(first()).subscribe(heroClass => {
if (heroClass != null) {
@@ -124,21 +118,24 @@ export class HeroDashboardComponent extends MD2Base implements OnInit {
initClassHeroList(heroClass: HeroClass) {
this.heros = [];
this.className = HeroClass[heroClass];
this.fileList(`Heros/${this.className}`).pipe(first()).subscribe(fileNames => {
for (let i = 0; i < fileNames.length; i++) {
const heroNames = fileNames[i].split('.')[0].split('-');
this.heroProfileService.getAll().pipe(first()).subscribe(result => {
this.heroProfiles = result;
for (let i = 0; i < this.heroProfiles.length; i++) {
const heroProfile = this.heroProfiles[i];
this.heros.push(new MD2HeroInfo({
name: heroNames[0].replace('/', ''),
mpMaximum: Number.parseInt(heroNames[1]),
hpMaximum: Number.parseInt(heroNames[2]),
imgUrl: this.imgUrl(`Heros/${this.className}/${fileNames[i]}`),
name: heroProfile.title,
mpMaximum: heroProfile.mana,
hpMaximum: heroProfile.hp,
skillHtml: heroProfile.skillHtml,
shadowSkillHtml: heroProfile.shadowSkillHtml,
class: heroClass
}))
}
this.heros = ArrayUtils.Shuffle(this.heros);//.sort((a, b) => StringUtils.compareSemVer(a.name, b.name));
this.showHeroList(heroClass, 0);
});
}
showHeroList(heroClass: HeroClass, index: number) {
let className = HeroClass[heroClass];