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, 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 = new Subject(); ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } ngOnInit(): void { } close() { //this.boss.standUrl this.md2Service.info.roundPhase = RoundPhase.HeroPhase; this.dlgRef.close(); } }