diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts index 92cb57a..20c56c3 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts @@ -44,6 +44,8 @@ import { SpellService } from '../services/spell.service'; import { WeaponService } from '../services/weapon.service'; import { ArmorService } from '../services/armor.service'; import { OtherEquipmentService } from '../services/other-equipment.service'; +import { ThrowPrimaryAbilityComponent } from './components/throws/throw-primary-ability/throw-primary-ability.component'; +import { MatRadioModule } from '@angular/material/radio'; import { GameMasterMonstersTableComponent } from './components/game-master-monsters-table/game-master-monsters-table.component'; import { MonsterService } from '../services/monster.service'; import { SpellDetailsDialogComponent } from './components/spell-details-dialog/spell-details-dialog.component'; @@ -64,6 +66,7 @@ import { GameMasterShopkeepersTableComponent } from './components/game-master-sh GameMasterArmorsTableComponent, GameMasterWeaponsTableComponent, GameMasterCharacterActionsDialogComponent, + ThrowPrimaryAbilityComponent, GameMasterMonstersTableComponent, SpellDetailsDialogComponent, GameMasterShopkeepersTableComponent, @@ -94,6 +97,7 @@ import { GameMasterShopkeepersTableComponent } from './components/game-master-sh MatTableModule, MatSortModule, MatTooltipModule, + MatRadioModule, ], providers: [ UserService, @@ -112,6 +116,7 @@ import { GameMasterShopkeepersTableComponent } from './components/game-master-sh GameMasterMonstersTableComponent, AbilitiesComponent, GameMasterCharacterActionsDialogComponent, + ThrowPrimaryAbilityComponent, SpellDetailsDialogComponent, GameMasterShopkeepersTableComponent, ], diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.css index cc66099..f053ea1 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.css +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.css @@ -19,7 +19,13 @@ padding-bottom: 15px; } -@media (max-width: 468px) { +@media (max-width: 365px) { + #main { + width: 315px; + } +} + +@media (min-width: 365px) and (max-width: 468px) { #main { width: 340px; } @@ -27,7 +33,7 @@ @media (min-width: 468px) and (max-width: 768px) { #main { - width: 420px; + width: 410px; } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.html index f85cbf5..86bfa75 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.html +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.html @@ -1,19 +1,19 @@
-
{{ability.value}}
+
{{ability.value}}
Mod: {{ability.modification > 0? '+' + ability.modification : + ability.modification}}
{{ability.name}}
-
ST: {{ability.savingThrows > 0? '+' + ability.savingThrows : ability.savingThrows}}
+
ST: {{ability.savingThrows > 0? '+' + ability.savingThrows : ability.savingThrows}}
- + {{skill.name}}     diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.ts index d6eb61d..01c921f 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/ability-card/ability-card.component.ts @@ -1,5 +1,7 @@ import { Component, Input, OnInit } from '@angular/core'; -import {CharacterStatsViewModel} from '../../../types/viewmodels/character-viewmodels/CharacterStatsViewModel'; +import { CharacterStatsViewModel } from '../../../types/viewmodels/character-viewmodels/CharacterStatsViewModel'; +import { ThrowPrimaryAbilityComponent } from '../throws/throw-primary-ability/throw-primary-ability.component'; +import { MatDialog } from '@angular/material'; @Component({ selector: 'app-ability-card', @@ -11,7 +13,8 @@ export class AbilityCardComponent implements OnInit { @Input() headStyle: { bgColor: string; textColor: string }; @Input() contentStyle: { bgColor: string; textColor: string }; - constructor() {} + constructor(public dialog: MatDialog) { + } ngOnInit() { if (this.ability.skills != null) { @@ -42,4 +45,15 @@ export class AbilityCardComponent implements OnInit { break; } } + + public OpenThrowDialog(abilityName: string, abilityValue: number, abilityMod: number): void { + this.dialog.open(ThrowPrimaryAbilityComponent, { + data: { + abilityName: abilityName, + abilityValue: abilityValue, + abilityMod: abilityMod, + } + }); + } } + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.css index 544e80b..95aaff4 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.css +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.css @@ -1,5 +1,9 @@ @import "../../../styles.css"; +.toggle-class{ + margin: 5px; +} + .menu-spacer { flex: 1 1 auto; } @@ -37,7 +41,7 @@ } .ability_card_container { - margin: 5%; + margin: 2%; display: flex; justify-content: center; align-items: center; diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.css new file mode 100644 index 0000000..072bf7e --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.css @@ -0,0 +1,167 @@ +.throw-container { + top: 50%; +} + +.radio-group { + display: flex; + flex-direction: column; +} + +.radio-button { + padding: 3%; + border: 1px #e9cca7 solid; + border-radius: 10px; + margin-bottom: 5%; + font-size: 14px; + text-align: center; +} + +.radio-button:hover { + opacity: 0.5; +} + +::ng-deep.mat-dialog-container { + background-color: #102028; + color: whitesmoke; + box-shadow: -1px 3px 48px 23px rgba(0,0,0,0.82); +} +.header-throw-dialog { + color: orange; + background-color: #102028; +} + +.content-throw-dialog { + background-color: #102028; + color: orange; + height: 400px; + display: block; +} + +.throw-dialog-actions { + background-color: #102028; + color: orange; +} + +.button-dialog:hover { + opacity: 0.5; +} + +#radio-group-label-class { + margin-bottom: 5%; +} + +.mat-divider--custom-style{ + background-color: #9e8b6e; + margin-bottom: 20px; + box-shadow: 0 1px 0 0 #d8d8d8; +} + +.score-result { + font-size: 16px; + font-weight: bold; + height: 180px; + display: flex; + flex-direction: column; + flex-wrap: wrap; + justify-content: space-between; + text-align: center; + align-items: center +} + +.score-result>* { + flex: 1 1 80px; +} + +.box { + padding: 2px; + width: 165px; + height: 85px; + world-wrap: break-word; + border: 1px #e9cca7 solid; + border-radius: 10px; +} + +.box--ability { + paddin-top: 25px; + padding-left: 2px; + padding-right: 2px; + padding-bottom: 2px; + height: 170px; + width: 165px; + world-wrap: break-word; + border: 1px #e9cca7 solid; + border-radius: 10px; +} + +.box--ability > div { + padding-top: 40%; +} + +@media (max-width: 365px) { + .content-throw-dialog { + height: 350px; + } + .radio-button { + padding: 5%; + font-size: 12px; + } + #main { + width: 320px; + } + .score-result { + font-size: 14px; + } + .box { + width: 100px; + height: 85px; + } + + .box--ability { + height: 170px; + width: 100px; + } +} + +@media (min-width: 365px) and (max-width: 468px) { + #main { + width: 340px; + } + .score-result { + font-size: 15px; + } + .box { + width: 110px; + height: 85px; + } + + .box--ability { + height: 170px; + width: 110px; + } +} + +@media (min-width: 468px) and (max-width: 768px) { + #main { + width: 410px; + } + .score-result { + font-size: 15px; + } + .box { + width: 120px; + height: 85px; + } + + .box--ability { + height: 170px; + width: 120px; + } +} + +@media (min-width: 768px) { + #main { + width: 480px; + } +} + + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.html new file mode 100644 index 0000000..3c66a85 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.html @@ -0,0 +1,42 @@ +
+
+ Click to roll the {{abilityName}} +
+ +
+ + + + + + + Normal throw on ability + + + Hidden throw for Game Master + + + +
+ Your score has been send to Game Master +
+
+
Your roll result is:

{{score}}

+
Your roll with modification is:

{{score+abilityMod}}

+
+
+ Ability value:

{{abilityValue}}

+
+
+
+ +
+ +
+ +
+
+ diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.spec.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.spec.ts new file mode 100644 index 0000000..70facd1 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ThrowPrimaryAbilityComponent } from './throw-primary-ability.component'; + +describe('ThrowPrimaryAbilityComponent', () => { + let component: ThrowPrimaryAbilityComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ThrowPrimaryAbilityComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ThrowPrimaryAbilityComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.ts new file mode 100644 index 0000000..42fa488 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/throws/throw-primary-ability/throw-primary-ability.component.ts @@ -0,0 +1,52 @@ +import {Component, Inject, Input, OnInit} from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { AbilitiesComponent } from '../../abilities/abilities.component'; + +@Component({ + selector: 'app-throw-primary-ability', + templateUrl: './throw-primary-ability.component.html', + styleUrls: ['./throw-primary-ability.component.css'] +}) +export class ThrowPrimaryAbilityComponent implements OnInit { + score: number; + checked = false; + choosedThrow: string; + throws: string[] = [`Normal throw on ability`, 'Hidden throw for Game Master']; + showSendToGMMessage: boolean; + + @Input() abilityName: string; + @Input() abilityValue: number; + @Input() abilityMod: number; + @Input() message: string; + + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any + ) {} + + ngOnInit() { + this.abilityName = this.data.abilityName; + this.abilityValue = this.data.abilityValue; + this.abilityMod = this.data.abilityMod; + } + + getRandomNumberBetween(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min)) + min; +} + + getResultOfRoll(choice: string) { + switch (choice) { + case 'normal': + this.score = this.getRandomNumberBetween(1, 20); + this.showSendToGMMessage = false; + break; + case 'hidden': + this.score = null; + this.showSendToGMMessage = true; + //TODO tutaj bedzie wyslanie rzutu do GM + break; + } + } +}