2024-03-29 08:04:07 -07:00

64 lines
2.0 KiB
TypeScript

import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { NbDialogRef } from '@nebular/theme';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { MD2Service } from '../../../../services/MD2/md2.service';
import { MsgBoxService } from '../../../../services/msg-box.service';
import { StateService } from '../../../../services/state.service';
import { MobDlgType, MD2Icon, MD2HeroInfo, RoundPhase } from '../../massive-darkness2.model';
import { MobSkill, IBossFight } from '../../massive-darkness2.model.boss';
import { MD2ComponentBase } from '../../MD2Base';
import { SpawnMobDlgComponent } from '../../mobs/spawn-mob-dlg/spawn-mob-dlg.component';
@Component({
selector: 'ngx-boss-activation',
templateUrl: './boss-activation.component.html',
styleUrls: ['./boss-activation.component.scss']
})
export class BossActivationComponent implements OnInit {
boss: IBossFight;
bossAction: MobSkill;
currentAction: number;
allActions: number;
MobDlgType = MobDlgType;
mode: MobDlgType = MobDlgType.Activating;
title: string;
titleHtml: string;
actionHtml: string;
MD2Icon = MD2Icon;
beenAttackedHero = [] as MD2HeroInfo[];
attackTarget: string;
otherAttackTarget: string;
constructor(
private dlgRef: NbDialogRef<SpawnMobDlgComponent>,
public md2Service: MD2Service,
protected stateService: StateService,
protected route: ActivatedRoute,
protected cdRef: ChangeDetectorRef,
) {
this.md2Service.refreshUI$.pipe(takeUntil(this.destroy$)).subscribe(result => {
if (!this.cdRef['destroyed']) {
this.cdRef.detectChanges();
}
});
}
private destroy$: Subject<void> = new Subject<void>();
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
ngOnInit(): void {
}
close() {
//this.boss.standUrl
this.md2Service.info.roundPhase = RoundPhase.HeroPhase;
this.dlgRef.close();
}
}