From d11fd57d4f7a65310e2977a820b2606a8d312319 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Wed, 21 Sep 2022 05:41:01 +0000 Subject: [PATCH] =?UTF-8?q?slot=20game=20=EB=8B=A4=EC=9D=B4=EC=96=BC?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beteran/component/home.component.html | 12 +- .../beteran/component/home.component.ts | 42 +++++-- .../modules/beteran/compose/compose/index.ts | 3 + .../compose/slot-game-compose.component.html | 44 ++++++++ .../compose/slot-game-compose.component.ts | 105 ++++++++++++++++++ 5 files changed, 196 insertions(+), 10 deletions(-) create mode 100644 src/app/modules/beteran/compose/compose/slot-game-compose.component.html create mode 100644 src/app/modules/beteran/compose/compose/slot-game-compose.component.ts diff --git a/src/app/modules/beteran/component/home.component.html b/src/app/modules/beteran/component/home.component.html index 9b2d95b..9953282 100644 --- a/src/app/modules/beteran/component/home.component.html +++ b/src/app/modules/beteran/component/home.component.html @@ -126,7 +126,10 @@ target="_blank" rel="noreferrer" > --> -
+
--> -
+
--> -
+
{ + console.log('Slot game Compose dialog was closed!'); + }); + } + + onClickGame(vendor: Vendor, type: number): void { console.log(vendor.toString()); + this.getGameByParentId(vendor.getId()).then((result) => { const gameList = result.getGamesList(); - if (gameList.length === 0) { return; } + if (type === 2) { + this.showSlotDialog(vendor, gameList); + return; + } + const game = gameList[0]; let r = this.__gameService @@ -191,11 +218,12 @@ export class HomeComponent implements OnInit { .then((r) => { console.log('success', r.getUrl()); - window.open( - r.getUrl(), - 'gamepopup', - 'width=1400, height=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes' - ); + this.openGameWindow(r.getUrl()); + // window.open( + // r.getUrl(), + // 'gamepopup', + // 'width=1400, height=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes' + // ); }) .catch((e) => { console.log('fail', e); diff --git a/src/app/modules/beteran/compose/compose/index.ts b/src/app/modules/beteran/compose/compose/index.ts index 7d9ad72..3523f2b 100644 --- a/src/app/modules/beteran/compose/compose/index.ts +++ b/src/app/modules/beteran/compose/compose/index.ts @@ -7,6 +7,8 @@ import { WithdrawComposeComponent } from './withdraw-compose.component'; import { WithdrawHistoryComposeComponent } from './withdraw-history-compose.component'; import { SignUpComposeComponent } from './sign-up-compose.component'; import { SignInComposeComponent } from './sign-in-compose.component'; +import { SlotGameComposeComponent } from './slot-game-compose.component'; + export const COMPOSE = [ DepositComposeComponent, WithdrawComposeComponent, @@ -17,4 +19,5 @@ export const COMPOSE = [ NoticeComposeComponent, SignUpComposeComponent, SignInComposeComponent, + SlotGameComposeComponent, ]; diff --git a/src/app/modules/beteran/compose/compose/slot-game-compose.component.html b/src/app/modules/beteran/compose/compose/slot-game-compose.component.html new file mode 100644 index 0000000..515e65e --- /dev/null +++ b/src/app/modules/beteran/compose/compose/slot-game-compose.component.html @@ -0,0 +1,44 @@ +
+ +
+
{{ data.vendor.getName() }}
+ +
+
+
+
+ +
+ + +
+
+ {{ getSlotGameName(slot) }} +
+
+ {{ slot.getCategory() }} +
+
+
+ + +
+
+
+
+
diff --git a/src/app/modules/beteran/compose/compose/slot-game-compose.component.ts b/src/app/modules/beteran/compose/compose/slot-game-compose.component.ts new file mode 100644 index 0000000..b1ffd2a --- /dev/null +++ b/src/app/modules/beteran/compose/compose/slot-game-compose.component.ts @@ -0,0 +1,105 @@ +import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; + +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; +import { fuseAnimations } from '@fuse/animations'; +import { GameService } from 'app/modules/polyglot/api/services/game.service'; +import { Game } from 'app/modules/proto/models/api/game_pb'; +import { Vendor } from 'app/modules/proto/models/api/vendor_pb'; + +export interface SlotGameComposeData { + vendor: Vendor; + gameList: Game[]; +} +export interface SlotGameComposeResult { + choice: boolean; +} + +@Component({ + selector: 'slot-game-compose', + templateUrl: './slot-game-compose.component.html', + encapsulation: ViewEncapsulation.None, + animations: fuseAnimations, +}) +export class SlotGameComposeComponent implements OnInit { + /** + * Constructor + */ + constructor( + public matDialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: SlotGameComposeData, + private __gameService: GameService, + private _sanitizer: DomSanitizer + ) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Lifecycle hooks + // ----------------------------------------------------------------------------------------------------- + + /** + * On init + */ + ngOnInit(): void { + // Create the form + } + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Save and close + */ + saveAndClose(): void { + // Save the message as a draft + this.saveAsDraft(); + + // Close the dialog + this.matDialogRef.close(); + } + + /** + * Discard the message + */ + discard(): void {} + + /** + * Save the message as a draft + */ + saveAsDraft(): void {} + + private openSlotGameWindow(url: string): void { + window.open( + url, + 'gamepopup', + 'width=1400, height=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes' + ); + } + + onClickSlotGame(selectSlot: Game): void { + console.log(selectSlot); + let r = this.__gameService + .getGameUrl(this.data.vendor.getKey(), selectSlot.getKey()) + .then((r) => { + console.log('success', r.getUrl()); + + this.openSlotGameWindow(r.getUrl()); + }) + .catch((e) => { + console.log('fail', e); + }); + } + + getSlotGameName(slot: Game): string { + const namesJson = JSON.parse(slot.getNames()); + + return namesJson.ko; + } + + getSlotGameImage(slot: Game): SafeResourceUrl { + const imagePathUrl = this._sanitizer.bypassSecurityTrustResourceUrl( + slot.getImage() + ); + return !!imagePathUrl ? imagePathUrl : 'assets/images/beteran/allbet.jpg'; + } +}