Commit baf24c4c authored by Romain DELEAU's avatar Romain DELEAU

trace on download/upload/game-objective/game-context/mission-objective/mission-context/role

parent f4aa56e2
......@@ -31,6 +31,7 @@ import { Title } from '@angular/platform-browser';
import { MatSnackBar } from '@angular/material/snack-bar';
import { LoadingsucessSnackbarComponent } from './components/snackbars/loadingsucess-snackbar/loadingsucess-snackbar.component';
import { LoadingfailSnackbarComponent } from './components/snackbars/loadingfail-snackbar/loadingfail-snackbar.component';
import { Trace } from './class/trace/trace';
@Component({
selector: 'app-root',
......@@ -79,6 +80,7 @@ export class AppComponent {
this.titleService.setTitle('RLG Maker - '+this.scenario.projectName);
}
this.scenario.tooltips = this.tooltipService.activatedTooltips;
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'save', undefined, undefined, 'all', 'Scenario'));
const jsonString = JSON.stringify(this.scenario);
const blob = new Blob([jsonString], { type: 'application/json' });
const url = URL.createObjectURL(blob);
......@@ -87,6 +89,8 @@ export class AppComponent {
link.href = url;
link.click();
URL.revokeObjectURL(url);
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_save', undefined, undefined, 'all', 'Scenario'));
}
});
}
......@@ -227,6 +231,7 @@ export class AppComponent {
});
this.scenario = scenario;
this.pieceDetailsService.piece = this.scenario;
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'import', undefined, undefined, 'all', 'Scenario'));
if (scenario.projectName) {
this.titleService.setTitle('RLG Maker - ' + this.scenario.projectName);
} else {
......
......@@ -4,6 +4,7 @@ import { GameEducationnalObjective } from "../game-educationnal-objective/game-e
import { Mission } from "../mission/mission";
import { Ressource } from "../ressource/ressource";
import { Comment } from "../comment/comment";
import { Trace } from "../trace/trace";
export class Scenario {
......@@ -16,4 +17,5 @@ export class Scenario {
comments: Comment[] = [];
projectName: string = '';
tooltips: boolean = true;
traces: Trace[] = [new Trace(0, 'new', undefined, undefined, 'all', 'Scenario')];
}
\ No newline at end of file
import { Trace } from './trace';
describe('Trace', () => {
it('should create an instance', () => {
expect(new Trace()).toBeTruthy();
});
});
export class Trace {
sequence: number;
timestamp: string;
action: string;
mission?: number;
role?: number;
case?: string;
target?: string;
color?: string;
flag?: string;
constructor(sequence: number, action: string, mission?: number, role?: number, Case?: string, target?: string, color?: string, flag?: string) {
this.sequence = sequence;
this.timestamp = new Date().toLocaleString('fr');
this.action = action;
this.mission = mission;
this.role = role;
this.case = Case;
this.target = target;
this.color = color;
this.flag = flag;
}
}
......@@ -21,7 +21,7 @@
<mat-icon class="piece-form-comment" fontIcon="comment" *ngIf="scenario.missions[i].comments.length > 0"></mat-icon>
<div class="piece-form-objective">
<label for="objective">Commun pour la mission {{i+1}}</label>
<textarea name="objective" [(ngModel)]="educationnalObjective.objective" placeholder="Comprendre les rôles impliqués dans la conception d'un site web"
<textarea name="objective" [(ngModel)]="educationnalObjective.objective" (change)="editTrace($event, 'Obj_m')" placeholder="Comprendre les rôles impliqués dans la conception d'un site web"
matTooltip="Ce que l’on veut atteindre en situation de formation. Commencer chaque objectif par un verbe. Si votre jeu est composé de plusieurs missions, distinguez les objectifs globaux du jeu et les objectifs de chaque mission"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
......
......@@ -8,6 +8,7 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { CreateDialogComponent } from 'src/app/components/dialogs/create-dialog/create-dialog.component';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-educational-objective',
......@@ -35,7 +36,10 @@ export class EducationalObjectiveComponent implements OnInit {
const dialogRef = this.dialog.open(CreateDialogComponent, { data: 'une nouvelle Mission' });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.scenario.missions.push(new Mission());
this.scenario.missions.push(new Mission());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.i,undefined,'all','Mission_['+(this.scenario.missions.length-1)+']'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_new',this.i,undefined,'all','Mission_['+(this.scenario.missions.length-1)+']'));
}
});
}
......@@ -44,7 +48,10 @@ export class EducationalObjectiveComponent implements OnInit {
const dialogRef = this.dialog.open(CleanDialogComponent, { data: 'Objectif pédagogique de la mission '+(this.i+1) });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.educationnalObjective.objective = '';
this.educationnalObjective.objective = '';
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.i,undefined,'all','Obj_m_['+(this.i)+']','#D0BBDB'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_erase',this.i,undefined,'all','Obj_m_['+(this.i)+']','#D0BBDB'));
}
});
}
......@@ -53,7 +60,10 @@ export class EducationalObjectiveComponent implements OnInit {
const dialogRef = this.dialog.open(SuppressDialogComponent, { data: 'cette Mission '+(this.i+1) });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.scenario.missions.splice(this.i, 1);
this.scenario.missions.splice(this.i, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.i,undefined,undefined,'Mission_['+(this.i)+']'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.i,undefined,undefined,'Mission_['+(this.i)+']'));
}
});
}
......@@ -66,4 +76,11 @@ export class EducationalObjectiveComponent implements OnInit {
return res;
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',this.i,undefined,source,'Obj_m', '#D0BBDB'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.i,undefined,source,'Obj_m', '#D0BBDB'));
}
}
}
......@@ -13,31 +13,31 @@
<div class="piece-form-title">Contexte du jeu</div>
<div class="piece-form-universe">
<label for="univers">Univers</label>
<input name="univers" type="text" [(ngModel)]="gameContext.univers" placeholder="Réaliste"
<input name="univers" type="text" [(ngModel)]="gameContext.univers" (change)="editTrace($event, 'Universe')" placeholder="Réaliste"
matTooltip="Est-ce que le jeu est réaliste ou est-il futuriste, médiéval-fantastique, post-apocalyptique, est-ce la science-fiction ?"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"/>
</div>
<div class="piece-form-support">
<label for="support">Medium / Support(s)</label>
<input name="support" type="text" [(ngModel)]="gameContext.support" placeholder="Ordinateur en 3D"
<input name="support" type="text" [(ngModel)]="gameContext.support" (change)="editTrace($event, 'Medium')" placeholder="Ordinateur en 3D"
matTooltip="Votre jeu sera-t-il sur ordinateur, en VR, sur tablette / smartphone ou sans technologie particulière ?"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"/>
</div>
<div class="piece-form-duration">
<label for="duration">Durée</label>
<input name="duration" type="text" [(ngModel)]="gameContext.duration" placeholder="3h"
<input name="duration" type="text" [(ngModel)]="gameContext.duration" (change)="editTrace($event, 'Duration_g')" placeholder="3h"
matTooltip="Combien de temps va durer le jeu ? Sachant que le jeu comporte 1 ou plusieurs missions. Une mission peut être la durée d’une séance de cours et le jeu se déroulerait sur plusieurs séances de cours."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"/>
</div>
<div class="piece-form-intrigue">
<label for="intrigue">Intrigue</label>
<textarea name="intrigue" [(ngModel)]="gameContext.intrigue" placeholder="Vous êtes stagiaire dans une agence de communication et devez faire vos preuves pour être embauché.e"
<textarea name="intrigue" [(ngModel)]="gameContext.intrigue" (change)="editTrace($event, 'Plot_g')" placeholder="Vous êtes stagiaire dans une agence de communication et devez faire vos preuves pour être embauché.e"
matTooltip="Quelle est l’histoire du jeu ? Quel est l’enjeu pour les joueurs ?"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
<div class="piece-form-other">
<label for="other">Autre</label>
<textarea name="other" [(ngModel)]="gameContext.other" placeholder="Contexte d’utilisation : lieu, présence de tuteur/formateur, à quel moment du cursus utiliser ce jeu, matériel nécessaire"
<textarea name="other" [(ngModel)]="gameContext.other" (change)="editTrace($event, 'Other_g')" placeholder="Contexte d’utilisation : lieu, présence de tuteur/formateur, à quel moment du cursus utiliser ce jeu, matériel nécessaire"
matTooltip="Tout autre élément que vous souhaiteriez prendre en compte dans le jeu et non défini dans les tuiles"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
......
......@@ -5,6 +5,7 @@ import { PieceDetailsService } from 'src/app/services/piece-details/piece-detail
import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-game-context',
......@@ -31,7 +32,10 @@ export class GameContextComponent implements OnInit {
this.gameContext.support = '';
this.gameContext.duration = '';
this.gameContext.intrigue = '';
this.gameContext.other = '';
this.gameContext.other = '';
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,'all','Context_g','#B6CC87'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_erase',undefined,undefined,'all','Context_g','#B6CC87'));
}
});
}
......@@ -40,4 +44,11 @@ export class GameContextComponent implements OnInit {
this.pieceDetailsService.piece = this.scenario;
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',undefined,undefined,source,'Context_g', '#B6CC87'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,source,'Context_g', '#B6CC87'));
}
}
}
......@@ -14,7 +14,7 @@
<mat-icon class="piece-form-comment" fontIcon="comment" *ngIf="scenario.comments.length > 0"></mat-icon>
<div class="piece-form-objective">
<label for="objective">Commun pour le jeu</label>
<textarea name="objective" [(ngModel)]="gameEducationnalObjective.objective" placeholder="- Améliorer les softskills&#10;- Apprendre à coopérer"
<textarea name="objective" [(ngModel)]="gameEducationnalObjective.objective" (change)="editTrace($event, 'Obj_game')" placeholder="- Améliorer les softskills&#10;- Apprendre à coopérer"
matTooltip="Ce que l’on veut atteindre en situation de formation. Commencer chaque objectif par un verbe. Si votre jeu est composé de plusieurs missions, distinguez les objectifs globaux du jeu et les objectifs de chaque mission."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
......
......@@ -5,6 +5,7 @@ import { PieceDetailsService } from 'src/app/services/piece-details/piece-detail
import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-game-educationnal-objective',
......@@ -31,8 +32,19 @@ export class GameEducationnalObjectiveComponent implements OnInit {
const dialogRef = this.dialog.open(CleanDialogComponent, { data: 'Objectif pédagogique' });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.gameEducationnalObjective.objective = '';
this.gameEducationnalObjective.objective = '';
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,'all','Obj_g','#BAC5D8'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_erase',undefined,undefined,'all','Obj_g','#BAC5D8'));
}
});
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',undefined,undefined,source,'Obj_g', '#BAC5D8'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',undefined,undefined,source,'Obj_g', '#BAC5D8'));
}
}
}
......@@ -20,25 +20,25 @@
<div class="piece-form-title">Contexte de la mission {{i+1}}</div>
<div class="piece-form-duration">
<label for="duration">Durée</label>
<input name="duration" type="text" [(ngModel)]="missionContext.duration" placeholder="1h"
<input name="duration" type="text" [(ngModel)]="missionContext.duration" (change)="editTrace($event, 'Duration_m')" placeholder="1h"
matTooltip="Combien de temps va durer la mission ?"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"/>
</div>
<div class="piece-form-intrigue">
<label for="intrigue">Intrigue</label>
<textarea name="intrigue" [(ngModel)]="missionContext.intrigue" placeholder="Concevez un site web ergonomique pour votre premier client"
<textarea name="intrigue" [(ngModel)]="missionContext.intrigue" (change)="editTrace($event, 'Plot_m')" placeholder="Concevez un site web ergonomique pour votre premier client"
matTooltip="Quelle est l’histoire de la mission ? Quel est l’enjeu pour les joueurs ?"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
<div class="piece-form-communication">
<label for="communication">Moyen(s) de communication</label>
<textarea name="communication" [(ngModel)]="missionContext.communication"
<textarea name="communication" [(ngModel)]="missionContext.communication" (change)="editTrace($event, 'Communication')" placeholder="Chat en ligne, vocal en ligne, face à face, talkie walkie, pigeon voyageur..."
matTooltip="Comment les joueurs vont-ils communiquer entre eux : à l'oral, par chat, en vocal sur ordinateur, par messages, etc."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
<div class="piece-form-divers">
<label for="divers">Autre</label>
<textarea name="divers" [(ngModel)]="missionContext.various" placeholder="Contexte d’utilisation : lieu, présence de tuteur/formateur, à quel moment du cursus utiliser ce jeu, matériel nécessaire"
<textarea name="divers" [(ngModel)]="missionContext.various" (change)="editTrace($event, 'Other_m')" placeholder="Contexte d’utilisation : lieu, présence de tuteur/formateur, à quel moment du cursus utiliser ce jeu, matériel nécessaire, public cible"
matTooltip="Tout autre élément que vous souhaiteriez prendre en compte dans la mission et non défini dans les tuiles"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
</div>
......
......@@ -8,6 +8,7 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { CreateDialogComponent } from 'src/app/components/dialogs/create-dialog/create-dialog.component';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-mission-context',
......@@ -35,7 +36,10 @@ export class MissionContextComponent implements OnInit {
const dialogRef = this.dialog.open(CreateDialogComponent, { data: 'une nouvelle Mission' });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.scenario.missions.push(new Mission());
this.scenario.missions.push(new Mission());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.i,undefined,'all','Mission_['+(this.scenario.missions.length-1)+']'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_new',this.i,undefined,'all','Mission_['+(this.scenario.missions.length-1)+']'));
}
});
}
......@@ -47,7 +51,10 @@ export class MissionContextComponent implements OnInit {
this.missionContext.duration = '';
this.missionContext.intrigue = '';
this.missionContext.communication = '';
this.missionContext.various = '';
this.missionContext.various = '';
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.i,undefined,'all','Context_m_['+(this.i)+']','#EAC19B'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_erase',this.i,undefined,'all','Context_m_['+(this.i)+']','#EAC19B'));
}
});
}
......@@ -56,7 +63,10 @@ export class MissionContextComponent implements OnInit {
const dialogRef = this.dialog.open(SuppressDialogComponent, { data: 'cette Mission '+(this.i+1) });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.scenario.missions.splice(this.i, 1);
this.scenario.missions.splice(this.i, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.i,undefined,'all','Mission_['+(this.i)+']'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.i,undefined,'all','Mission_['+(this.i)+']'));
}
});
}
......@@ -69,4 +79,11 @@ export class MissionContextComponent implements OnInit {
return res;
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',this.i,undefined,source,'Context_m', '#EAC19B'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.i,undefined,source,'Context_m', '#EAC19B'));
}
}
}
This diff is collapsed.
......@@ -17,6 +17,7 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { CreateDialogComponent } from 'src/app/components/dialogs/create-dialog/create-dialog.component';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-role',
......@@ -48,7 +49,9 @@ export class RoleComponent implements OnInit {
const dialogRef = this.dialog.open(CreateDialogComponent, { data: 'un nouveau Rôle pour la Mission '+(this.missionIndex+1) });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.mission.roles.push(new Role());
this.mission.roles.push(new Role());
let missionIndex: number = this.scenario.missions.findIndex(mission => mission == this.mission);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',missionIndex,this.i,'all','Role_['+(this.mission.roles.length-1)+']','#9AD5EC'));
}
});
}
......@@ -74,7 +77,8 @@ export class RoleComponent implements OnInit {
});
});
});
this.role.ressources = [];
this.role.ressources = [];
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.missionIndex,this.i,'all','Role_['+(this.i)+']','#9AD5EC'));
}
});
}
......@@ -83,7 +87,9 @@ export class RoleComponent implements OnInit {
const dialogRef = this.dialog.open(SuppressDialogComponent, { data: 'ce Rôle '+(this.role.intitule ? '<'+this.role.intitule+'>' : this.i+1) });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.mission.roles.splice(this.i, 1);
this.mission.roles.splice(this.i, 1);
let missionIndex: number = this.scenario.missions.findIndex(mission => mission == this.mission);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',missionIndex,this.i,'all','Role_['+(this.i)+']','#9AD5EC'));
}
});
}
......@@ -98,6 +104,7 @@ export class RoleComponent implements OnInit {
addEducationnalObjective(): void {
this.role.educationnalObjectives.push(new RoleEducationnalObjective());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.missionIndex,this.i,'Obj_['+(this.role.educationnalObjectives.length-1)+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
removeEducationnalObjective(index: number): void {
......@@ -105,12 +112,16 @@ export class RoleComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.role.educationnalObjectives.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.i,'Obj_['+(index)+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.missionIndex,this.i,'Obj_['+(index)+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
});
}
addRessource(): void {
this.role.ressources.push(new Ressource());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.missionIndex,this.i,'skill/ressource_['+this.role.ressources.length+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
removeRessource(index: number): void {
......@@ -126,13 +137,17 @@ export class RoleComponent implements OnInit {
});
});
});
this.role.ressources.splice(index, 1);
this.role.ressources.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.i,'Skill/Ressource_['+index+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.missionIndex,this.i,'Skill/Ressource_['+index+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
});
}
addSupplementaryRole(): void {
this.role.supplementaryRoles.push(new SupplementaryRole());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.missionIndex,this.i,'Secondary_role_['+this.role.supplementaryRoles.length+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
removeSupplementaryRole(index: number) {
......@@ -140,22 +155,32 @@ export class RoleComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.role.supplementaryRoles.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.i,'Secondary_role_['+index+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.missionIndex,this.i,'Secondary_role_['+index+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
});
}
addReward(): void {
this.role.rewards.push(new QuestReward());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.missionIndex,this.i,'Reward_['+this.role.rewards.length+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
changeRewardType(index: number, type: string): void {
switch(type) {
case 'objects': this.role.rewards[index] = new ObjectsReward(); break;
case 'quest': this.role.rewards[index] = new QuestReward(); break;
case 'skill': this.role.rewards[index] = new SkillReward(); break;
case 'objective': this.role.rewards[index] = new ObjectiveReward(); break;
case 'character': this.role.rewards[index] = new CharacterReward(); break;
case 'other': this.role.rewards[index] = new OtherReward(); break;
case 'objects': this.role.rewards[index] = new ObjectsReward();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectsReward]', 'Role_['+this.i+']', '#9AD5EC', '*')); break;
case 'quest': this.role.rewards[index] = new QuestReward();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[QuestReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));break;
case 'skill': this.role.rewards[index] = new SkillReward();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[SkillReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));break;
case 'objective': this.role.rewards[index] = new ObjectiveReward();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectiveReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));break;
case 'character': this.role.rewards[index] = new CharacterReward();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[CharacterReward]', 'Role_['+this.i+']', '#9AD5EC', '*')); break;
case 'other': this.role.rewards[index] = new OtherReward();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[OtherReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));break;
}
}
......@@ -163,7 +188,10 @@ export class RoleComponent implements OnInit {
const dialogRef = this.dialog.open(SuppressDialogComponent, { data: 'cette Récompense' });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.role.rewards.splice(index, 1);
this.role.rewards.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.i,'Reward_['+index+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.missionIndex,this.i,'Reward_['+index+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
});
}
......@@ -194,6 +222,7 @@ export class RoleComponent implements OnInit {
addObject(index: number): void {
this.getObjectsReward(index).objects.push(new Ressource);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.missionIndex,this.i,'Reward_['+index+']_object_['+this.getObjectsReward(index).objects.length+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
removeObject(i: number, j: number): void {
......@@ -201,6 +230,9 @@ export class RoleComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.getObjectsReward(i).objects.splice(j, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.i,'Reward_['+i+']_object_['+j+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'cancel_delete',this.missionIndex,this.i,'Reward_['+i+']_object_['+j+']', 'Role_['+this.i+']', '#9AD5EC', '*'));
}
});
}
......@@ -211,5 +243,14 @@ export class RoleComponent implements OnInit {
reward.intitule = this.role.intitule;
reward.questName = value;
this.role.rewards[index] = reward;
this.editTrace(event, 'Reward_['+index+']_quest');
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',this.missionIndex,this.i,source,'Role_['+(this.i)+']', '#9AD5EC','*'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.missionIndex,this.i,source,'Role_['+(this.i)+']', '#9AD5EC','*'));
}
}
}
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