Commit 2757521d authored by Romain DELEAU's avatar Romain DELEAU

Traces on Characters/Rules pieces

parent fb73c7b0
......@@ -16,18 +16,18 @@
<mat-icon fontIcon="person_add"></mat-icon>
<div class="piece-form-character-create-top-name">
<label for="name">Nom</label>
<input name="name" type="text" [(ngModel)]="newCharacter.name"/>
<input name="name" type="text" [(ngModel)]="newCharacter.name" (change)="editTrace($event,'newCharacter_name')"/>
</div>
</div>
<div class="piece-form-create-infos">
<div class="piece-form-character-create-infos-description">
<label for="description">Description</label>
<textarea class="background" name="description" [(ngModel)]="newCharacter.description"></textarea>
<textarea class="background" name="description" [(ngModel)]="newCharacter.description" (change)="editTrace($event,'newCharacter_description')"></textarea>
</div>
<div class="piece-form-character-create-infos-color">
<label for="color">Couleur</label>
<input name="color" type="color" [(ngModel)]="newCharacter.color"/>
<input name="color" type="color" [(ngModel)]="newCharacter.color" (change)="editTrace($event,'newCharacter_color')"/>
</div>
</div>
<button mat-button (click)="createCharacter()">Créer</button>
......@@ -39,18 +39,18 @@
<mat-icon fontIcon="person"></mat-icon>
<div class="piece-form-character-create-top-name">
<label for="name">Nom</label>
<input name="name" type="text" [(ngModel)]="character.name"/>
<input name="name" type="text" [(ngModel)]="character.name" (change)="editTrace($event,'Character_['+index+']_name')"/>
</div>
</div>
<div class="piece-form-create-infos">
<div class="piece-form-character-create-infos-description">
<label for="description">Description</label>
<textarea name="description" [(ngModel)]="character.description"></textarea>
<textarea name="description" [(ngModel)]="character.description" (change)="editTrace($event,'Character_['+index+']_description')"></textarea>
</div>
<div class="piece-form-character-create-infos-color">
<label for="color">Couleur</label>
<input name="color" type="color" [(ngModel)]="character.color"/>
<input name="color" type="color" [(ngModel)]="character.color" (change)="editTrace($event,'Character_['+index+']_color')"/>
</div>
</div>
<button mat-button (click)="deleteCharacter(index)">Supprimer</button>
......
......@@ -7,6 +7,7 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia
import { Character } from 'src/app/class/character/character';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { Task } from 'src/app/class/task/task';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-game-characters',
......@@ -45,6 +46,9 @@ export class GameCharactersComponent implements OnInit {
});
});
});
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,'all','Characters','#CE7B66'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_erase',undefined,undefined,'all','Characters','#CE7B66'));
}
});
}
......@@ -53,6 +57,7 @@ export class GameCharactersComponent implements OnInit {
if (this.newCharacter.name != '') {
this.scenario.characters.push(this.newCharacter);
this.newCharacter = new Character();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',undefined,undefined,'all','Characters_['+(this.scenario.characters.length-1)+']','#CE7B66'));
}
}
......@@ -73,9 +78,18 @@ export class GameCharactersComponent implements OnInit {
});
});
this.scenario.characters.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',undefined,undefined,'all','Characters_['+index+']','#CE7B66'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',undefined,undefined,'all','Characters_['+index+']','#CE7B66'));
}
});
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',undefined,undefined,source,'Characters', '#EAC19B'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,source,'Characters', '#EAC19B'));
}
}
}
......@@ -10,7 +10,7 @@
<div class="piece-form">
<div class="piece-form-rules">
<div class="piece-form-title">Règles du jeu</div>
<textarea [(ngModel)]="scenario.gameRules"
<textarea [(ngModel)]="scenario.gameRules" (change)="editTrace($event,'rules')"
matTooltip="Éléments importants à prendre en compte dans les règles du jeu"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
......@@ -22,11 +22,11 @@
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<div class="piece-form-ressources-object-infos-name">
<label for="name">Nom</label>
<input name="name" type="text" [(ngModel)]="ressource.name"/>
<input name="name" type="text" [(ngModel)]="ressource.name" (change)="editTrace($event,'Ressource_['+i+']_name')"/>
</div>
<div class="piece-form-ressources-object-infos-quantity">
<label for="quantity">Quantité</label>
<input name="quantity" type="number" min="1"[(ngModel)]="ressource.number"/>
<input name="quantity" type="number" min="1"[(ngModel)]="ressource.number" (change)="editTrace($event,'Ressource_['+i+']_quantity')"/>
</div>
<button mat-button (click)="removeRessource(i)"><mat-icon fontIcon="remove"></mat-icon></button>
</div>
......
......@@ -7,6 +7,7 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { PieceDetailsService } from 'src/app/services/piece-details/piece-details.service';
import { Task } from 'src/app/class/task/task';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-rules',
......@@ -32,7 +33,6 @@ export class RulesComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.scenario.gameRules = '';
//this.scenario.ressources = [];
this.scenario.ressources.forEach((ressource, i) => {
this.scenario.missions.forEach(mission => {
mission.roles.forEach(role => {
......@@ -51,12 +51,16 @@ export class RulesComponent implements OnInit {
});
});
this.scenario.ressources = [];
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,'all','Rules', '#C6C2BD'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_erase',undefined,undefined,'all','Rules', '#C6C2BD'));
}
});
}
addRessource(): void {
this.scenario.ressources.push(new Ressource());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',undefined,undefined,'Ressource_['+(this.scenario.traces.length-1)+']','Rules', '#C6C2BD'));
}
removeRessource(index: number): void {
......@@ -77,7 +81,18 @@ export class RulesComponent implements OnInit {
});
});
this.scenario.ressources.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',undefined,undefined,'Ressource_['+index+']','Rules', '#C6C2BD'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',undefined,undefined,'Ressource_['+index+']','Rules', '#C6C2BD'));
}
});
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',undefined,undefined,source,'Rules', '#C6C2BD'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,source,'Rules', '#C6C2BD'));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment