-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add monster icon component, monster fight action, ability to block ex…
…plore for secondary actions, fight store/actions
- Loading branch information
Showing
34 changed files
with
473 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
client/src/app/components/item-elements/item-elements.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
client/src/app/components/monster-icon/monster-icon.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<app-icon | ||
spritesheet="monsters" | ||
[sprite]="monster.sprite" | ||
[size]="size" | ||
*ngIf="monster" | ||
></app-icon> |
23 changes: 23 additions & 0 deletions
23
client/src/app/components/monster-icon/monster-icon.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
:host { | ||
display: inline-block; | ||
|
||
width: 64px; | ||
height: 64px; | ||
max-width: 64px; | ||
max-height: 64px; | ||
|
||
&.xsmall { | ||
width: 16px; | ||
height: 16px; | ||
max-width: 16px; | ||
max-height: 16px; | ||
} | ||
|
||
&.small { | ||
width: 32px; | ||
height: 32px; | ||
max-width: 32px; | ||
max-height: 32px; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
client/src/app/components/monster-icon/monster-icon.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, HostBinding, Input, OnInit } from '@angular/core'; | ||
import { IMonster } from '@interfaces'; | ||
|
||
@Component({ | ||
selector: 'app-monster-icon', | ||
templateUrl: './monster-icon.component.html', | ||
styleUrls: ['./monster-icon.component.scss'], | ||
}) | ||
export class MonsterIconComponent implements OnInit { | ||
@Input({ required: true }) monster!: IMonster; | ||
@Input() size: 'xsmall' | 'small' | 'normal' = 'normal'; | ||
|
||
@HostBinding('class') get sizeClass() { | ||
return this.size; | ||
} | ||
|
||
constructor() {} | ||
|
||
ngOnInit() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { IFight } from '@interfaces'; | ||
import * as jsonpatch from 'fast-json-patch'; | ||
|
||
export class SetFight { | ||
static type = '[Fight] Set'; | ||
constructor(public fight: IFight) {} | ||
} | ||
|
||
export class ApplyFightPatches { | ||
static type = '[Fight] Apply Patches'; | ||
constructor(public patches: jsonpatch.Operation[]) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { applyFightPatches, setFight } from '@stores/fight/fight.functions'; | ||
import { IAttachment } from '../../interfaces'; | ||
import { ApplyFightPatches, SetFight } from './fight.actions'; | ||
|
||
export const attachments: IAttachment[] = [ | ||
{ action: SetFight, handler: setFight }, | ||
{ action: ApplyFightPatches, handler: applyFightPatches }, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { IFightStore } from '@interfaces'; | ||
import { StateContext } from '@ngxs/store'; | ||
import { applyPatch } from 'fast-json-patch'; | ||
import { ApplyFightPatches, SetFight } from './fight.actions'; | ||
|
||
export const defaultStore: () => IFightStore = () => ({ | ||
version: 0, | ||
fight: { | ||
id: '', | ||
attackers: [], | ||
defenders: [], | ||
involvedPlayers: [], | ||
tiles: [], | ||
}, | ||
}); | ||
|
||
export function setFight(ctx: StateContext<IFightStore>, { fight }: SetFight) { | ||
ctx.patchState({ fight }); | ||
} | ||
|
||
export function applyFightPatches( | ||
ctx: StateContext<IFightStore>, | ||
{ patches }: ApplyFightPatches, | ||
) { | ||
const fight = ctx.getState().fight; | ||
|
||
applyPatch(fight, patches); | ||
|
||
ctx.patchState({ fight }); | ||
} |
Oops, something went wrong.