Commit f8e83f39 authored by Romain DELEAU's avatar Romain DELEAU

update traces (without value)

parent 985cf310
...@@ -782,15 +782,18 @@ export class AppComponent { ...@@ -782,15 +782,18 @@ export class AppComponent {
verifyGame(): void { verifyGame(): void {
if (this.verifyIfAllDurationUnitAreSame()) { if (this.verifyIfAllDurationUnitAreSame()) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'verify_scenario', undefined, undefined, undefined, 'Scenario'));
const dialogRef = this.dialog.open(VerifyDialogComponent, { const dialogRef = this.dialog.open(VerifyDialogComponent, {
data: this.scenario data: this.scenario
}); });
} else { } else {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'failed_verify_scenario', undefined, undefined, undefined, 'Scenario'));
this._snackBar.open(this.translate.instant('verify_error'), '', { duration: 10000, panelClass: 'snackbar-fail' }); this._snackBar.open(this.translate.instant('verify_error'), '', { duration: 10000, panelClass: 'snackbar-fail' });
} }
} }
consultLegals(): void { consultLegals(): void {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'consult_legals'));
const dialogRef = this.dialog.open(LegalDialogComponent, { const dialogRef = this.dialog.open(LegalDialogComponent, {
maxWidth: '50vw', maxWidth: '50vw',
}); });
......
...@@ -21,69 +21,4 @@ export class Discussion { ...@@ -21,69 +21,4 @@ export class Discussion {
character: Character; character: Character;
isFirstDiscussion: boolean = false; isFirstDiscussion: boolean = false;
rewards: Reward[] = []; rewards: Reward[] = [];
addReward(): void {
this.rewards.push(new ObjectReward());
//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 'quest': this.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.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 'character': this.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 'object': this.rewards[index] = new ObjectReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'discussion': this.rewards[index] = new DiscussionReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[DiscussionReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
}
}
removeReward(index: number): void {
//const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
//dialogRef.afterClosed().subscribe(result => {
//if (result == true) {
this.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', '*'));
//}
//});
}
getQuestReward(index: number): QuestReward {
return this.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.rewards[index] as SkillReward;
}
getObjectReward(index: number): ObjectReward {
return this.rewards[index] as ObjectReward;
}
getDiscussionReward(index: number): DiscussionReward {
return this.rewards[index] as DiscussionReward;
}
changeQuestReward(roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
this.rewards[index] = reward;
}
} }
...@@ -16,70 +16,4 @@ export class Response { ...@@ -16,70 +16,4 @@ export class Response {
nextSentence: number = -1; nextSentence: number = -1;
idInterrogativeSentence: number = 0; idInterrogativeSentence: number = 0;
rewards: Reward[] = []; rewards: Reward[] = [];
addReward(): void {
this.rewards.push(new ObjectReward());
//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 'quest': this.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.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 'character': this.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 'object': this.rewards[index] = new ObjectReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'discussion': this.rewards[index] = new DiscussionReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[DiscussionReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
}
}
removeReward(index: number): void {
//const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
//dialogRef.afterClosed().subscribe(result => {
//if (result == true) {
this.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', '*'));
//}
//});
}
getQuestReward(index: number): QuestReward {
return this.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.rewards[index] as SkillReward;
}
getObjectReward(index: number): ObjectReward {
return this.rewards[index] as ObjectReward;
}
getDiscussionReward(index: number): DiscussionReward {
return this.rewards[index] as DiscussionReward;
}
changeQuestReward(roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
this.rewards[index] = reward;
}
} }
...@@ -15,69 +15,4 @@ export abstract class Sentence { ...@@ -15,69 +15,4 @@ export abstract class Sentence {
value: string = ''; value: string = '';
idDiscussion: number = 0; idDiscussion: number = 0;
rewards: Reward[] = []; rewards: Reward[] = [];
addReward(): void {
this.rewards.push(new ObjectReward());
//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 'quest': this.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.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 'character': this.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 'object': this.rewards[index] = new ObjectReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'discussion': this.rewards[index] = new DiscussionReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[DiscussionReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
}
}
removeReward(index: number): void {
//const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
//dialogRef.afterClosed().subscribe(result => {
//if (result == true) {
this.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', '*'));
//}
//});
}
getQuestReward(index: number): QuestReward {
return this.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.rewards[index] as SkillReward;
}
getObjectReward(index: number): ObjectReward {
return this.rewards[index] as ObjectReward;
}
getDiscussionReward(index: number): DiscussionReward {
return this.rewards[index] as DiscussionReward;
}
changeQuestReward(roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
this.rewards[index] = reward;
}
} }
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<mat-dialog-content> <mat-dialog-content>
<div class="form-intitule"> <div class="form-intitule">
<label for="intitule">{{'discussion_name_label' | translate}}</label> <label for="intitule">{{'discussion_name_label' | translate}}</label>
<input name="intitule" type="text" [(ngModel)]="discussion.name"/> <input name="intitule" type="text" [(ngModel)]="discussion.name" (change)="editTrace($event, 'Name_d', 'discussion_[ID:'+this.discussion.ID+']')"/>
</div> </div>
<div class="form-firstDiscussion" <div class="form-firstDiscussion"
[matTooltip]="translate.instant('discussion_firstDiscussion_tooltip')" [matTooltip]="translate.instant('discussion_firstDiscussion_tooltip')"
matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips || isSelectableAsFirstDiscussion()"> matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips || isSelectableAsFirstDiscussion()">
<input name="firstDiscussion" type="checkbox" [(ngModel)]="discussion.isFirstDiscussion" <input name="firstDiscussion" type="checkbox" [(ngModel)]="discussion.isFirstDiscussion"
[disabled]="!isSelectableAsFirstDiscussion()"/> [disabled]="!isSelectableAsFirstDiscussion()" (change)="checkboxTrace($event, 'firstDiscussion', 'discussion_[ID:'+this.discussion.ID+']')"/>
<label for="firstDiscussion">{{'discussion_firstDiscussion_label' | translate}}</label> <label for="firstDiscussion">{{'discussion_firstDiscussion_label' | translate}}</label>
</div> </div>
<div class="form-result"> <div class="form-result">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<div class="form-result-results-result" *ngFor="let reward of discussion.rewards, let rewardIndex = index"> <div class="form-result-results-result" *ngFor="let reward of discussion.rewards, let rewardIndex = index">
<div class="form-result-results-result-type"> <div class="form-result-results-result-type">
<label>{{'role_reward_type_label' | translate}}</label> <label>{{'role_reward_type_label' | translate}}</label>
<select [(ngModel)]="reward.type" (change)="discussion.changeRewardType(rewardIndex, reward.type)" <select [(ngModel)]="reward.type" (change)="changeRewardType(discussion, rewardIndex, reward.type)"
[matTooltip]="translate.instant('discussion_reward_type_discussion_tooltip')" [matTooltip]="translate.instant('discussion_reward_type_discussion_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option value="quest">{{'role_reward_type_newQuest' | translate}}</option> <option value="quest">{{'role_reward_type_newQuest' | translate}}</option>
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
</div> </div>
<div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'"> <div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'">
<select (change)="discussion.changeQuestReward(role.intitule, rewardIndex, $event)" <select (change)="changeQuestReward(discussion, role.intitule, rewardIndex, $event)"
[matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')" [matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option> <option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option>
<ng-container *ngFor="let mission of scenario.missions; let indexMission = index"> <ng-container *ngFor="let mission of scenario.missions; let indexMission = index">
<ng-container *ngFor="let quest of mission.roles; let indexRole = index"> <ng-container *ngFor="let quest of mission.roles; let indexRole = index">
<option [ngValue]="quest.questName" [selected]="discussion.getQuestReward(rewardIndex).intitule == quest.intitule && discussion.getQuestReward(rewardIndex).questName == quest.questName" <option [ngValue]="quest.questName" [selected]="getQuestReward(discussion, rewardIndex).intitule == quest.intitule && getQuestReward(discussion, rewardIndex).questName == quest.questName"
*ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName"> *ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName">
{{quest.questName}} {{quest.questName}}
</option> </option>
...@@ -51,10 +51,11 @@ ...@@ -51,10 +51,11 @@
</div> </div>
<div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'"> <div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'">
<input type="number" [(ngModel)]="discussion.getSkillReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getSkillReward(discussion, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'discussion_[ID:'+discussion.ID+']')"/>
<select [(ngModel)]="discussion.getSkillReward(rewardIndex).skill" <select [(ngModel)]="getSkillReward(discussion, rewardIndex).skill"
[matTooltip]="translate.instant('role_reward_type_skill_tooltip')" [matTooltip]="translate.instant('role_reward_type_skill_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_skill', 'discussion_[ID:'+discussion.ID+']')">
<ng-container *ngFor="let skill of role.ressources"> <ng-container *ngFor="let skill of role.ressources">
<option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option> <option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option>
</ng-container> </ng-container>
...@@ -62,17 +63,19 @@ ...@@ -62,17 +63,19 @@
</div> </div>
<div class="form-result-results-result-character" *ngIf="reward.type == 'character'"> <div class="form-result-results-result-character" *ngIf="reward.type == 'character'">
<select [(ngModel)]="discussion.getCharacterReward(rewardIndex).character" <select [(ngModel)]="getCharacterReward(discussion, rewardIndex).character"
[matTooltip]="translate.instant('role_reward_type_character_tooltip')" [matTooltip]="translate.instant('role_reward_type_character_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_character', 'discussion_[ID:'+discussion.ID+']')">
<option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option> <option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option>
</select> </select>
</div> </div>
<div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'"> <div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'">
<select [(ngModel)]="discussion.getDiscussionReward(rewardIndex).discussionId" <select [(ngModel)]="getDiscussionReward(discussion, rewardIndex).discussionId"
[matTooltip]="translate.instant('role_reward_type_discussion_tooltip')" [matTooltip]="translate.instant('role_reward_type_discussion_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_discussion', 'discussion_[ID:'+discussion.ID+']')">
<option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option> <option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option>
<ng-container *ngFor="let character of scenario.characters"> <ng-container *ngFor="let character of scenario.characters">
<optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)"> <optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)">
...@@ -85,10 +88,11 @@ ...@@ -85,10 +88,11 @@
</div> </div>
<div class="form-result-results-result-object" *ngIf="reward.type == 'object'"> <div class="form-result-results-result-object" *ngIf="reward.type == 'object'">
<input type="number" [(ngModel)]="discussion.getObjectReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getObjectReward(discussion, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'discussion_[ID:'+discussion.ID+']')"/>
<select [(ngModel)]="discussion.getObjectReward(rewardIndex).object" <select [(ngModel)]="getObjectReward(discussion, rewardIndex).object"
[matTooltip]="translate.instant('role_reward_type_object_tooltip')" [matTooltip]="translate.instant('role_reward_type_object_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_object', 'discussion_[ID:'+discussion.ID+']')">
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option> <option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container> </ng-container>
...@@ -98,10 +102,10 @@ ...@@ -98,10 +102,10 @@
</select> </select>
</div> </div>
<button mat-button class="form-result-button-remove" (click)="discussion.removeReward(rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button> <button mat-button class="form-result-button-remove" (click)="removeReward(discussion, rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button>
</div> </div>
<button mat-button class="form-result-button-add" (click)="discussion.addReward()"><mat-icon fontIcon="add"></mat-icon></button> <button mat-button class="form-result-button-add" (click)="addReward(discussion)"><mat-icon fontIcon="add"></mat-icon></button>
</div> </div>
</div> </div>
...@@ -125,19 +129,19 @@ ...@@ -125,19 +129,19 @@
<div class="form-sentence"> <div class="form-sentence">
<div class="form-sentence-sentence"> <div class="form-sentence-sentence">
<label for="sentence">{{'discussion_declarativeSentence' | translate}}</label> <label for="sentence">{{'discussion_declarativeSentence' | translate}}</label>
<textarea name="sentence" [(ngModel)]="sentence.value"></textarea> <textarea name="sentence" [(ngModel)]="sentence.value" (change)="editTrace($event, 'sentence', 'declarativeSentence_[ID:'+sentence.ID+']')"></textarea>
</div> </div>
<div class="form-sentence-firstSentence" <div class="form-sentence-firstSentence"
[matTooltip]="translate.instant('discussion_firstSentence_tooltip')" [matTooltip]="translate.instant('discussion_firstSentence_tooltip')"
matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips || discussion.firstSentenceID == -1 || discussion.firstSentenceID == sentence.ID"> matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips || discussion.firstSentenceID == -1 || discussion.firstSentenceID == sentence.ID">
<input name="firstSentence" type="checkbox" (click)="onCheckFirstSentence($event, sentence.ID)" <input name="firstSentence" type="checkbox" (click)="onCheckFirstSentence($event, sentence.ID)"
[checked]="discussion.firstSentenceID == sentence.ID ? true : false" [checked]="discussion.firstSentenceID == sentence.ID ? true : false"
[disabled]="discussion.firstSentenceID != -1 && discussion.firstSentenceID != sentence.ID"/> [disabled]="discussion.firstSentenceID != -1 && discussion.firstSentenceID != sentence.ID" (change)="checkboxTrace($event, 'firstSentence', 'declarativeSentence_[ID:'+sentence.ID+']')"/>
<label for="firstSentence">{{'discussion_firstSentence_label' | translate}}</label> <label for="firstSentence">{{'discussion_firstSentence_label' | translate}}</label>
</div> </div>
<div class="form-nextSentence"> <div class="form-nextSentence">
<label for="nextSentence">{{'discussion_nextSentence_label' | translate}}</label> <label for="nextSentence">{{'discussion_nextSentence_label' | translate}}</label>
<select name="nextSentence" [(ngModel)]="getSentenceAsDeclarativeSentence(sentence).nextSentence"> <select name="nextSentence" [(ngModel)]="getSentenceAsDeclarativeSentence(sentence).nextSentence" (change)="editTrace($event, 'nextSentence', 'declarativeSentence_[ID:'+sentence.ID+']')">
<option [ngValue]="-1" disabled selected>{{'discussion_nextSentence_placeholder' | translate}}</option> <option [ngValue]="-1" disabled selected>{{'discussion_nextSentence_placeholder' | translate}}</option>
<ng-container *ngFor="let nextSentence of role.sentences"> <ng-container *ngFor="let nextSentence of role.sentences">
<option [ngValue]="nextSentence.ID" *ngIf="sentence.ID != nextSentence.ID && sentence.idDiscussion == nextSentence.idDiscussion">ID: {{nextSentence.ID}}</option> <option [ngValue]="nextSentence.ID" *ngIf="sentence.ID != nextSentence.ID && sentence.idDiscussion == nextSentence.idDiscussion">ID: {{nextSentence.ID}}</option>
...@@ -156,7 +160,7 @@ ...@@ -156,7 +160,7 @@
<div class="form-result-results-result" *ngFor="let reward of sentence.rewards, let rewardIndex = index"> <div class="form-result-results-result" *ngFor="let reward of sentence.rewards, let rewardIndex = index">
<div class="form-result-results-result-type"> <div class="form-result-results-result-type">
<label>{{'role_reward_type_label' | translate}}</label> <label>{{'role_reward_type_label' | translate}}</label>
<select [(ngModel)]="reward.type" (change)="sentence.changeRewardType(rewardIndex, reward.type)" <select [(ngModel)]="reward.type" (change)="changeRewardType(sentence, rewardIndex, reward.type)"
[matTooltip]="translate.instant('discussion_reward_type_declarativeSentence_tooltip')" [matTooltip]="translate.instant('discussion_reward_type_declarativeSentence_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option value="quest">{{'role_reward_type_newQuest' | translate}}</option> <option value="quest">{{'role_reward_type_newQuest' | translate}}</option>
...@@ -168,13 +172,13 @@ ...@@ -168,13 +172,13 @@
</div> </div>
<div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'"> <div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'">
<select (change)="sentence.changeQuestReward(role.intitule, rewardIndex, $event)" <select (change)="changeQuestReward(sentence, role.intitule, rewardIndex, $event)"
[matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')" [matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option> <option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option>
<ng-container *ngFor="let mission of scenario.missions; let indexMission = index"> <ng-container *ngFor="let mission of scenario.missions; let indexMission = index">
<ng-container *ngFor="let quest of mission.roles; let indexRole = index"> <ng-container *ngFor="let quest of mission.roles; let indexRole = index">
<option [ngValue]="quest.questName" [selected]="sentence.getQuestReward(rewardIndex).intitule == quest.intitule && sentence.getQuestReward(rewardIndex).questName == quest.questName" <option [ngValue]="quest.questName" [selected]="getQuestReward(sentence, rewardIndex).intitule == quest.intitule && getQuestReward(sentence, rewardIndex).questName == quest.questName"
*ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName"> *ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName">
{{quest.questName}} {{quest.questName}}
</option> </option>
...@@ -184,10 +188,11 @@ ...@@ -184,10 +188,11 @@
</div> </div>
<div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'"> <div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'">
<input type="number" [(ngModel)]="sentence.getSkillReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getSkillReward(sentence, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'sentence_[ID:'+sentence.ID+']')"/>
<select [(ngModel)]="sentence.getSkillReward(rewardIndex).skill" <select [(ngModel)]="getSkillReward(sentence, rewardIndex).skill"
[matTooltip]="translate.instant('role_reward_type_skill_tooltip')" [matTooltip]="translate.instant('role_reward_type_skill_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_skill', 'sentence_[ID:'+sentence.ID+']')">
<ng-container *ngFor="let skill of role.ressources"> <ng-container *ngFor="let skill of role.ressources">
<option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option> <option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option>
</ng-container> </ng-container>
...@@ -195,17 +200,19 @@ ...@@ -195,17 +200,19 @@
</div> </div>
<div class="form-result-results-result-character" *ngIf="reward.type == 'character'"> <div class="form-result-results-result-character" *ngIf="reward.type == 'character'">
<select [(ngModel)]="sentence.getCharacterReward(rewardIndex).character" <select [(ngModel)]="getCharacterReward(sentence, rewardIndex).character"
[matTooltip]="translate.instant('role_reward_type_character_tooltip')" [matTooltip]="translate.instant('role_reward_type_character_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_character', 'sentence_[ID:'+sentence.ID+']')">
<option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option> <option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option>
</select> </select>
</div> </div>
<div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'"> <div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'">
<select [(ngModel)]="sentence.getDiscussionReward(rewardIndex).discussionId" <select [(ngModel)]="getDiscussionReward(sentence, rewardIndex).discussionId"
[matTooltip]="translate.instant('role_reward_type_discussion_tooltip')" [matTooltip]="translate.instant('role_reward_type_discussion_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_discussion', 'sentence_[ID:'+sentence.ID+']')">
<option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option> <option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option>
<ng-container *ngFor="let character of scenario.characters"> <ng-container *ngFor="let character of scenario.characters">
<optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)"> <optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)">
...@@ -218,10 +225,11 @@ ...@@ -218,10 +225,11 @@
</div> </div>
<div class="form-result-results-result-object" *ngIf="reward.type == 'object'"> <div class="form-result-results-result-object" *ngIf="reward.type == 'object'">
<input type="number" [(ngModel)]="sentence.getObjectReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getObjectReward(sentence, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'sentence_[ID:'+sentence.ID+']')"/>
<select [(ngModel)]="sentence.getObjectReward(rewardIndex).object" <select [(ngModel)]="getObjectReward(sentence, rewardIndex).object"
[matTooltip]="translate.instant('role_reward_type_object_tooltip')" [matTooltip]="translate.instant('role_reward_type_object_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_object', 'sentence_[ID:'+sentence.ID+']')">
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option> <option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container> </ng-container>
...@@ -231,10 +239,10 @@ ...@@ -231,10 +239,10 @@
</select> </select>
</div> </div>
<button mat-button class="form-result-button-remove" (click)="sentence.removeReward(rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button> <button mat-button class="form-result-button-remove" (click)="removeReward(sentence, rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button>
</div> </div>
<button mat-button class="form-result-button-add" (click)="sentence.addReward()"><mat-icon fontIcon="add"></mat-icon></button> <button mat-button class="form-result-button-add" (click)="addReward(sentence)"><mat-icon fontIcon="add"></mat-icon></button>
</div> </div>
</div> </div>
...@@ -256,14 +264,14 @@ ...@@ -256,14 +264,14 @@
<div class="form-sentence"> <div class="form-sentence">
<div class="form-sentence-sentence"> <div class="form-sentence-sentence">
<label for="sentence">{{'discussion_interrogativeSentence' | translate}}</label> <label for="sentence">{{'discussion_interrogativeSentence' | translate}}</label>
<textarea name="sentence" [(ngModel)]="sentence.value"></textarea> <textarea name="sentence" [(ngModel)]="sentence.value" (change)="editTrace($event, 'sentence', 'interrogativeSentence_[ID:'+sentence.ID+']')"></textarea>
</div> </div>
<div class="form-sentence-firstSentence" <div class="form-sentence-firstSentence"
[matTooltip]="translate.instant('discussion_firstSentence_tooltip')" [matTooltip]="translate.instant('discussion_firstSentence_tooltip')"
matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips || discussion.firstSentenceID == -1 || discussion.firstSentenceID == sentence.ID"> matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips || discussion.firstSentenceID == -1 || discussion.firstSentenceID == sentence.ID">
<input name="firstSentence" type="checkbox" (click)="onCheckFirstSentence($event, sentence.ID)" <input name="firstSentence" type="checkbox" (click)="onCheckFirstSentence($event, sentence.ID)"
[checked]="discussion.firstSentenceID == sentence.ID ? true : false" [checked]="discussion.firstSentenceID == sentence.ID ? true : false"
[disabled]="discussion.firstSentenceID != -1 && discussion.firstSentenceID != sentence.ID"/> [disabled]="discussion.firstSentenceID != -1 && discussion.firstSentenceID != sentence.ID" (change)="checkboxTrace($event, 'firstSentence', 'declarativeSentence_[ID:'+sentence.ID+']')"/>
<label for="firstSentence">{{'discussion_firstSentence_label' | translate}}</label> <label for="firstSentence">{{'discussion_firstSentence_label' | translate}}</label>
</div> </div>
<div class="form-result"> <div class="form-result">
...@@ -272,7 +280,7 @@ ...@@ -272,7 +280,7 @@
<div class="form-result-results-result" *ngFor="let reward of sentence.rewards, let rewardIndex = index"> <div class="form-result-results-result" *ngFor="let reward of sentence.rewards, let rewardIndex = index">
<div class="form-result-results-result-type"> <div class="form-result-results-result-type">
<label>{{'role_reward_type_label' | translate}}</label> <label>{{'role_reward_type_label' | translate}}</label>
<select [(ngModel)]="reward.type" (change)="sentence.changeRewardType(rewardIndex, reward.type)" <select [(ngModel)]="reward.type" (change)="changeRewardType(sentence, rewardIndex, reward.type)"
[matTooltip]="translate.instant('discussion_reward_type_interrogativeSentence_tooltip')" [matTooltip]="translate.instant('discussion_reward_type_interrogativeSentence_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option value="quest">{{'role_reward_type_newQuest' | translate}}</option> <option value="quest">{{'role_reward_type_newQuest' | translate}}</option>
...@@ -284,13 +292,13 @@ ...@@ -284,13 +292,13 @@
</div> </div>
<div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'"> <div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'">
<select (change)="sentence.changeQuestReward(role.intitule, rewardIndex, $event)" <select (change)="changeQuestReward(sentence, role.intitule, rewardIndex, $event)"
[matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')" [matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option> <option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option>
<ng-container *ngFor="let mission of scenario.missions; let indexMission = index"> <ng-container *ngFor="let mission of scenario.missions; let indexMission = index">
<ng-container *ngFor="let quest of mission.roles; let indexRole = index"> <ng-container *ngFor="let quest of mission.roles; let indexRole = index">
<option [ngValue]="quest.questName" [selected]="sentence.getQuestReward(rewardIndex).intitule == quest.intitule && sentence.getQuestReward(rewardIndex).questName == quest.questName" <option [ngValue]="quest.questName" [selected]="getQuestReward(sentence, rewardIndex).intitule == quest.intitule && getQuestReward(sentence, rewardIndex).questName == quest.questName"
*ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName"> *ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName">
{{quest.questName}} {{quest.questName}}
</option> </option>
...@@ -300,10 +308,11 @@ ...@@ -300,10 +308,11 @@
</div> </div>
<div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'"> <div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'">
<input type="number" [(ngModel)]="sentence.getSkillReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getSkillReward(sentence, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'sentence_[ID:'+sentence.ID+']')"/>
<select [(ngModel)]="sentence.getSkillReward(rewardIndex).skill" <select [(ngModel)]="getSkillReward(sentence, rewardIndex).skill"
[matTooltip]="translate.instant('role_reward_type_skill_tooltip')" [matTooltip]="translate.instant('role_reward_type_skill_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_skill', 'sentence_[ID:'+sentence.ID+']')">
<ng-container *ngFor="let skill of role.ressources"> <ng-container *ngFor="let skill of role.ressources">
<option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option> <option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option>
</ng-container> </ng-container>
...@@ -311,17 +320,19 @@ ...@@ -311,17 +320,19 @@
</div> </div>
<div class="form-result-results-result-character" *ngIf="reward.type == 'character'"> <div class="form-result-results-result-character" *ngIf="reward.type == 'character'">
<select [(ngModel)]="sentence.getCharacterReward(rewardIndex).character" <select [(ngModel)]="getCharacterReward(sentence, rewardIndex).character"
[matTooltip]="translate.instant('role_reward_type_character_tooltip')" [matTooltip]="translate.instant('role_reward_type_character_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_character', 'sentence_[ID:'+sentence.ID+']')">
<option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option> <option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option>
</select> </select>
</div> </div>
<div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'"> <div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'">
<select [(ngModel)]="sentence.getDiscussionReward(rewardIndex).discussionId" <select [(ngModel)]="getDiscussionReward(sentence, rewardIndex).discussionId"
[matTooltip]="translate.instant('role_reward_type_discussion_tooltip')" [matTooltip]="translate.instant('role_reward_type_discussion_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_discussion', 'sentence_[ID:'+sentence.ID+']')">
<option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option> <option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option>
<ng-container *ngFor="let character of scenario.characters"> <ng-container *ngFor="let character of scenario.characters">
<optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)"> <optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)">
...@@ -334,10 +345,11 @@ ...@@ -334,10 +345,11 @@
</div> </div>
<div class="form-result-results-result-object" *ngIf="reward.type == 'object'"> <div class="form-result-results-result-object" *ngIf="reward.type == 'object'">
<input type="number" [(ngModel)]="sentence.getObjectReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getObjectReward(sentence, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'sentence_[ID:'+sentence.ID+']')"/>
<select [(ngModel)]="sentence.getObjectReward(rewardIndex).object" <select [(ngModel)]="getObjectReward(sentence, rewardIndex).object"
[matTooltip]="translate.instant('role_reward_type_object_tooltip')" [matTooltip]="translate.instant('role_reward_type_object_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_object', 'sentence_[ID:'+sentence.ID+']')">
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option> <option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container> </ng-container>
...@@ -347,10 +359,10 @@ ...@@ -347,10 +359,10 @@
</select> </select>
</div> </div>
<button mat-button class="form-result-button-remove" (click)="sentence.removeReward(rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button> <button mat-button class="form-result-button-remove" (click)="removeReward(sentence, rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button>
</div> </div>
<button mat-button class="form-result-button-add" (click)="sentence.addReward()"><mat-icon fontIcon="add"></mat-icon></button> <button mat-button class="form-result-button-add" (click)="addReward(sentence)"><mat-icon fontIcon="add"></mat-icon></button>
</div> </div>
</div> </div>
<button mat-button class="form-sentence-addResponse" (click)="addResponse(getSentenceAsInterrogativeSentence(sentence))">{{'discussion_buttons_newResponse' | translate}}</button> <button mat-button class="form-sentence-addResponse" (click)="addResponse(getSentenceAsInterrogativeSentence(sentence))">{{'discussion_buttons_newResponse' | translate}}</button>
...@@ -368,11 +380,11 @@ ...@@ -368,11 +380,11 @@
<div class="form-sentence"> <div class="form-sentence">
<div class="form-sentence-sentence"> <div class="form-sentence-sentence">
<label for="sentence">{{'discussion_response' | translate}}</label> <label for="sentence">{{'discussion_response' | translate}}</label>
<textarea name="sentence" [(ngModel)]="response.value"></textarea> <textarea name="sentence" [(ngModel)]="response.value" (change)="editTrace($event, 'sentence', 'response_[ID:'+response.ID+']')"></textarea>
</div> </div>
<div class="form-nextSentence"> <div class="form-nextSentence">
<label for="nextSentence">{{'discussion_nextSentence_label' | translate}}</label> <label for="nextSentence">{{'discussion_nextSentence_label' | translate}}</label>
<select name="nextSentence" [(ngModel)]="response.nextSentence"> <select name="nextSentence" [(ngModel)]="response.nextSentence" (change)="editTrace($event, 'nextSentence', 'response_[ID:'+response.ID+']')">
<option [ngValue]="-1" disabled selected>{{'discussion_nextSentence_placeholder' | translate}}</option> <option [ngValue]="-1" disabled selected>{{'discussion_nextSentence_placeholder' | translate}}</option>
<ng-container *ngFor="let nextSentence of role.sentences"> <ng-container *ngFor="let nextSentence of role.sentences">
<option [ngValue]="nextSentence.ID" *ngIf="sentence.ID != nextSentence.ID && sentence.idDiscussion == nextSentence.idDiscussion">ID: {{nextSentence.ID}}</option> <option [ngValue]="nextSentence.ID" *ngIf="sentence.ID != nextSentence.ID && sentence.idDiscussion == nextSentence.idDiscussion">ID: {{nextSentence.ID}}</option>
...@@ -386,7 +398,7 @@ ...@@ -386,7 +398,7 @@
<div class="form-result-results-result" *ngFor="let reward of response.rewards, let rewardIndex = index"> <div class="form-result-results-result" *ngFor="let reward of response.rewards, let rewardIndex = index">
<div class="form-result-results-result-type"> <div class="form-result-results-result-type">
<label>{{'role_reward_type_label' | translate}}</label> <label>{{'role_reward_type_label' | translate}}</label>
<select [(ngModel)]="reward.type" (change)="response.changeRewardType(rewardIndex, reward.type)" <select [(ngModel)]="reward.type" (change)="changeRewardType(response, rewardIndex, reward.type)"
[matTooltip]="translate.instant('discussion_reward_type_response_tooltip')" [matTooltip]="translate.instant('discussion_reward_type_response_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option value="quest">{{'role_reward_type_newQuest' | translate}}</option> <option value="quest">{{'role_reward_type_newQuest' | translate}}</option>
...@@ -398,13 +410,13 @@ ...@@ -398,13 +410,13 @@
</div> </div>
<div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'"> <div class="form-result-results-result-quest" *ngIf="reward.type == 'quest'">
<select (change)="response.changeQuestReward(role.intitule, rewardIndex, $event)" <select (change)="changeQuestReward(response, role.intitule, rewardIndex, $event)"
[matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')" [matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option> <option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option>
<ng-container *ngFor="let mission of scenario.missions; let indexMission = index"> <ng-container *ngFor="let mission of scenario.missions; let indexMission = index">
<ng-container *ngFor="let quest of mission.roles; let indexRole = index"> <ng-container *ngFor="let quest of mission.roles; let indexRole = index">
<option [ngValue]="quest.questName" [selected]="response.getQuestReward(rewardIndex).intitule == quest.intitule && response.getQuestReward(rewardIndex).questName == quest.questName" <option [ngValue]="quest.questName" [selected]="getQuestReward(response, rewardIndex).intitule == quest.intitule && getQuestReward(response, rewardIndex).questName == quest.questName"
*ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName"> *ngIf="role.intitule && quest.questName && role.intitule == quest.intitule && role.questName != quest.questName">
{{quest.questName}} {{quest.questName}}
</option> </option>
...@@ -414,10 +426,11 @@ ...@@ -414,10 +426,11 @@
</div> </div>
<div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'"> <div class="form-result-results-result-skill" *ngIf="reward.type == 'skill'">
<input type="number" [(ngModel)]="response.getSkillReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getSkillReward(response, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'response_[ID:'+response.ID+']')"/>
<select [(ngModel)]="response.getSkillReward(rewardIndex).skill" <select [(ngModel)]="getSkillReward(response, rewardIndex).skill"
[matTooltip]="translate.instant('role_reward_type_skill_tooltip')" [matTooltip]="translate.instant('role_reward_type_skill_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_skill', 'response_[ID:'+response.ID+']')">
<ng-container *ngFor="let skill of role.ressources"> <ng-container *ngFor="let skill of role.ressources">
<option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option> <option [ngValue]="skill" *ngIf="skill.type == 'attribut'">{{skill.name}}</option>
</ng-container> </ng-container>
...@@ -425,17 +438,19 @@ ...@@ -425,17 +438,19 @@
</div> </div>
<div class="form-result-results-result-character" *ngIf="reward.type == 'character'"> <div class="form-result-results-result-character" *ngIf="reward.type == 'character'">
<select [(ngModel)]="response.getCharacterReward(rewardIndex).character" <select [(ngModel)]="getCharacterReward(response, rewardIndex).character"
[matTooltip]="translate.instant('role_reward_type_character_tooltip')" [matTooltip]="translate.instant('role_reward_type_character_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_character', 'response_[ID:'+response.ID+']')">
<option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option> <option [ngValue]="character" *ngFor="let character of scenario.characters">{{character.name}}</option>
</select> </select>
</div> </div>
<div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'"> <div class="form-result-results-result-discussion" *ngIf="reward.type == 'discussion'">
<select [(ngModel)]="response.getDiscussionReward(rewardIndex).discussionId" <select [(ngModel)]="getDiscussionReward(response, rewardIndex).discussionId"
[matTooltip]="translate.instant('role_reward_type_discussion_tooltip')" [matTooltip]="translate.instant('role_reward_type_discussion_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_discussion', 'response_[ID:'+response.ID+']')">
<option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option> <option [ngValue]="-1" selected disabled>{{'role_reward_type_discussion_placeholder' | translate}}</option>
<ng-container *ngFor="let character of scenario.characters"> <ng-container *ngFor="let character of scenario.characters">
<optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)"> <optgroup [label]="character.name" *ngIf="role.characterHasDiscussion(character)">
...@@ -448,10 +463,11 @@ ...@@ -448,10 +463,11 @@
</div> </div>
<div class="form-result-results-result-object" *ngIf="reward.type == 'object'"> <div class="form-result-results-result-object" *ngIf="reward.type == 'object'">
<input type="number" [(ngModel)]="response.getObjectReward(rewardIndex).quantity"/> <input type="number" [(ngModel)]="getObjectReward(response, rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity', 'response_[ID:'+response.ID+']')"/>
<select [(ngModel)]="response.getObjectReward(rewardIndex).object" <select [(ngModel)]="getObjectReward(response, rewardIndex).object"
[matTooltip]="translate.instant('role_reward_type_object_tooltip')" [matTooltip]="translate.instant('role_reward_type_object_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
(change)="editTrace($event, 'Reward_['+rewardIndex+']_object', 'response_[ID:'+response.ID+']')">
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option> <option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container> </ng-container>
...@@ -461,10 +477,10 @@ ...@@ -461,10 +477,10 @@
</select> </select>
</div> </div>
<button mat-button class="form-result-button-remove" (click)="response.removeReward(rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button> <button mat-button class="form-result-button-remove" (click)="removeReward(response, rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button>
</div> </div>
<button mat-button class="form-result-button-add" (click)="response.addReward()"><mat-icon fontIcon="add"></mat-icon></button> <button mat-button class="form-result-button-add" (click)="addReward(response)"><mat-icon fontIcon="add"></mat-icon></button>
</div> </div>
</div> </div>
<button mat-button class="form-sentence-delete" (click)="deleteResponse(getSentenceAsInterrogativeSentence(sentence), response.ID)" *ngIf="countResponses(sentence.ID) > 1">{{'discussion_buttons_deleteResponse' | translate}}</button> <button mat-button class="form-sentence-delete" (click)="deleteResponse(getSentenceAsInterrogativeSentence(sentence), response.ID)" *ngIf="countResponses(sentence.ID) > 1">{{'discussion_buttons_deleteResponse' | translate}}</button>
......
...@@ -11,6 +11,12 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service'; ...@@ -11,6 +11,12 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { SuppressDialogComponent } from '../suppress-dialog/suppress-dialog.component'; import { SuppressDialogComponent } from '../suppress-dialog/suppress-dialog.component';
import { QuestReward } from 'src/app/class/rewards/quest-reward/quest-reward'; import { QuestReward } from 'src/app/class/rewards/quest-reward/quest-reward';
import { Scenario } from 'src/app/class/scenario/scenario'; import { Scenario } from 'src/app/class/scenario/scenario';
import { PieceDetailsService } from 'src/app/services/piece-details/piece-details.service';
import { Trace } from 'src/app/class/trace/trace';
import { CharacterReward } from 'src/app/class/rewards/character-reward/character-reward';
import { DiscussionReward } from 'src/app/class/rewards/discussion-reward/discussion-reward';
import { ObjectReward } from 'src/app/class/rewards/object-reward/object-reward';
import { SkillReward } from 'src/app/class/rewards/skill-reward/skill-reward';
@Component({ @Component({
selector: 'app-discussion-dialog', selector: 'app-discussion-dialog',
...@@ -24,7 +30,7 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -24,7 +30,7 @@ export class DiscussionDialogComponent implements OnInit {
scenario: Scenario; scenario: Scenario;
constructor(public dialogRef: MatDialogRef<DiscussionDialogComponent>, constructor(public dialogRef: MatDialogRef<DiscussionDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogDiscussionData, protected translate: TranslateService, protected tooltipService: TooltipService, public dialog: MatDialog) { @Inject(MAT_DIALOG_DATA) public data: DialogDiscussionData, protected translate: TranslateService, protected tooltipService: TooltipService, public dialog: MatDialog, private pieceDetailsService: PieceDetailsService) {
this.role = this.data.role; this.role = this.data.role;
this.discussion = this.data.discussion; this.discussion = this.data.discussion;
this.scenario = this.data.scenario; this.scenario = this.data.scenario;
...@@ -72,6 +78,7 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -72,6 +78,7 @@ export class DiscussionDialogComponent implements OnInit {
newSentence.idDiscussion = this.discussion.ID; newSentence.idDiscussion = this.discussion.ID;
this.discussion.sentences.push(newSentence.ID); this.discussion.sentences.push(newSentence.ID);
this.role.sentences.push(newSentence); this.role.sentences.push(newSentence);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'all', 'declarativeSentence_[ID:'+newSentence.ID+']', '#D5D5FF'));
} }
deleteDeclarativeSentence(removedSentenceId: number) { deleteDeclarativeSentence(removedSentenceId: number) {
...@@ -97,10 +104,13 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -97,10 +104,13 @@ export class DiscussionDialogComponent implements OnInit {
}); });
} }
}); });
}
if (this.discussion.firstSentenceID == removedSentenceId) { if (this.discussion.firstSentenceID == removedSentenceId) {
this.discussion.firstSentenceID = -1; this.discussion.firstSentenceID = -1;
} }
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'all', 'declarativeSentence_[ID:'+removedSentenceId+']', '#D5D5FF'));
}
}); });
} }
...@@ -115,6 +125,7 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -115,6 +125,7 @@ export class DiscussionDialogComponent implements OnInit {
this.discussion.sentences.push(newSentence.ID); this.discussion.sentences.push(newSentence.ID);
this.role.sentences.push(newSentence); this.role.sentences.push(newSentence);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'all', 'interrogativeSentence_[ID:'+newSentence.ID+']', '#D5D5FF'));
} }
deleteInterrogativeSentence(removedSentenceId: number) { deleteInterrogativeSentence(removedSentenceId: number) {
...@@ -150,6 +161,7 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -150,6 +161,7 @@ export class DiscussionDialogComponent implements OnInit {
if (this.discussion.firstSentenceID == removedSentenceId) { if (this.discussion.firstSentenceID == removedSentenceId) {
this.discussion.firstSentenceID = -1; this.discussion.firstSentenceID = -1;
} }
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'all', 'interrogativeSentence_[ID:'+removedSentenceId+']', '#D5D5FF'));
} }
}); });
} }
...@@ -159,6 +171,7 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -159,6 +171,7 @@ export class DiscussionDialogComponent implements OnInit {
newResponse.idInterrogativeSentence = sentence.ID; newResponse.idInterrogativeSentence = sentence.ID;
sentence.responses.push(newResponse.ID); sentence.responses.push(newResponse.ID);
this.role.responses.push(newResponse); this.role.responses.push(newResponse);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'all', 'response_[ID:'+newResponse.ID+']', '#D5D5FF'));
} }
countResponses(sentenceId: number): number { countResponses(sentenceId: number): number {
...@@ -179,9 +192,166 @@ export class DiscussionDialogComponent implements OnInit { ...@@ -179,9 +192,166 @@ export class DiscussionDialogComponent implements OnInit {
sentence.responses.splice(sentenceResponseIndex,1); sentence.responses.splice(sentenceResponseIndex,1);
let responseIndex = this.role.responses.findIndex(response => response.ID == removedResponseId); let responseIndex = this.role.responses.findIndex(response => response.ID == removedResponseId);
this.role.responses.splice(responseIndex,1); this.role.responses.splice(responseIndex,1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'all', 'response_[ID:'+removedResponseId+']', '#D5D5FF'));
} }
}); });
} }
addReward(parent: Discussion | Sentence | Response): void {
parent.rewards.push(new ObjectReward());
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_[' + parent.rewards.length + ']', 'discussion_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_[' + parent.rewards.length + ']', 'sentence_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_[' + parent.rewards.length + ']', 'response_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
}
changeRewardType(parent: Discussion | Sentence | Response, index: number, type: string): void {
switch (type) {
case 'quest': parent.rewards[index] = new QuestReward();
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[QuestReward]', 'discussion_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[QuestReward]', 'sentence_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[QuestReward]', 'response_[ID:'+parent.ID+']', '#D5D5FF'));
}
break;
case 'skill': parent.rewards[index] = new SkillReward();
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[SkillReward]', 'discussion_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[SkillReward]', 'sentence_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[SkillReward]', 'response_[ID:'+parent.ID+']', '#D5D5FF'));
}
break;
case 'character': parent.rewards[index] = new CharacterReward();
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[CharacterReward]', 'discussion_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[CharacterReward]', 'sentence_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[CharacterReward]', 'response_[ID:'+parent.ID+']', '#D5D5FF'));
}
break;
case 'object': parent.rewards[index] = new ObjectReward();
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[DiscussionReward]', 'discussion_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[DiscussionReward]', 'sentence_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[DiscussionReward]', 'response_[ID:'+parent.ID+']', '#D5D5FF'));
}
break;
case 'discussion': parent.rewards[index] = new DiscussionReward();
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[DiscussionReward]', 'discussion_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[DiscussionReward]', 'sentence_[ID:'+parent.ID+']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'Reward_['+index+']_transform_into_[DiscussionReward]', 'response_[ID:'+parent.ID+']', '#D5D5FF'));
}
break;
}
}
removeReward(parent: Discussion | Sentence | Response, index: number): void {
const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
parent.rewards.splice(index, 1);
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_['+index+']', 'discussion_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_['+index+']', 'sentence_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_['+index+']', 'reponse_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
} else {
if (parent instanceof Discussion) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_delete', this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_['+index+']', 'discussion_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
if (parent instanceof Sentence) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_delete', this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_['+index+']', 'sentence_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
if (parent instanceof Response) {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_delete', this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, 'Reward_['+index+']', 'reponse_[ID:'+parent.ID+ ']', '#D5D5FF'));
}
}
});
}
getQuestReward(parent: Discussion | Sentence | Response, index: number): QuestReward {
return parent.rewards[index] as QuestReward;
}
getCharacterReward(parent: Discussion | Sentence | Response, index: number): CharacterReward {
return parent.rewards[index] as CharacterReward;
}
getSkillReward(parent: Discussion | Sentence | Response, index: number): SkillReward {
return parent.rewards[index] as SkillReward;
}
getObjectReward(parent: Discussion | Sentence | Response, index: number): ObjectReward {
return parent.rewards[index] as ObjectReward;
}
getDiscussionReward(parent: Discussion | Sentence | Response, index: number): DiscussionReward {
return parent.rewards[index] as DiscussionReward;
}
changeQuestReward(parent: Discussion | Sentence | Response, roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
parent.rewards[index] = reward;
let target: string = '';
if (parent instanceof Discussion) {
target = 'discussion_[ID:'+parent.ID+']';
}
if (parent instanceof Sentence) {
target = 'sentence_[ID:'+parent.ID+']';
}
if (parent instanceof Response) {
target = 'response_[ID:'+parent.ID+']';
}
this.editTrace(event, 'Reward_['+index+']_quest', target);
}
editTrace(event: any, source: string, target: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex, source, target, '#D5D5FF'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source, target, '#D5D5FF'));
}
}
checkboxTrace(event: any, source: string, target: string) {
if(event.target.checked) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'check', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, source, target, '#D5D5FF'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'uncheck', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, source, target, '#D5D5FF'));
}
}
} }
export interface DialogDiscussionData { export interface DialogDiscussionData {
......
...@@ -172,7 +172,7 @@ export class AnnexeTaskComponent implements OnInit { ...@@ -172,7 +172,7 @@ export class AnnexeTaskComponent implements OnInit {
onClickChange(type: string): void { onClickChange(type: string): void {
this.task.changeType(type); this.task.changeType(type);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform_into_['+type+']',this.missionIndex,this.roleIndex,'all','Side_task_['+this.i+';'+this.j+']', '#BCCECC')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.roleIndex,'all','Side_task_['+this.i+';'+this.j+']_transform_into_['+type+']', '#BCCECC'));
} }
changeDisplayPrerequires(): void { changeDisplayPrerequires(): void {
......
...@@ -135,7 +135,7 @@ export class FinalTaskComponent implements OnInit { ...@@ -135,7 +135,7 @@ export class FinalTaskComponent implements OnInit {
} }
this.task.changeType(type); this.task.changeType(type);
this.mission.equalizeLengths(); this.mission.equalizeLengths();
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform_into_['+type+']',this.missionIndex,this.roleIndex,'all','Final_task_['+this.i+';'+this.j+']', '#B28386')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.roleIndex,'all','Final_task_['+this.i+';'+this.j+']_transform_into_['+type+']', '#B28386'));
} }
onClickDelete(): void { onClickDelete(): void {
......
...@@ -137,7 +137,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -137,7 +137,7 @@ export class OptionnalTaskComponent implements OnInit {
if (this.role.countOptionnalTasksInColumn(this.role.getRealIndex(this.i,this.j)) < 2) { if (this.role.countOptionnalTasksInColumn(this.role.getRealIndex(this.i,this.j)) < 2) {
this._snackBar.open(this.translate.instant('snackbar_deleteOptionnalTask'), '', { duration: 5000, panelClass: 'snackbar-warning' }); this._snackBar.open(this.translate.instant('snackbar_deleteOptionnalTask'), '', { duration: 5000, panelClass: 'snackbar-warning' });
} }
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform_into_['+type+']',this.missionIndex,this.roleIndex,'all','Opt_task_['+this.i+';'+this.j+']', '#E8E3B3')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.roleIndex,'all','Opt_task_['+this.i+';'+this.j+']_transform_into_['+type+']', '#E8E3B3'));
} }
onClickDelete(): void { onClickDelete(): void {
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
<div class="piece-form-content piece-form-content-unity" *ngIf="unityService.unity_isActive"> <div class="piece-form-content piece-form-content-unity" *ngIf="unityService.unity_isActive">
<div class="piece-form-content-unity-type"> <div class="piece-form-content-unity-type">
<label for="type">{{'task_unity_type_label' | translate}}</label> <label for="type">{{'task_unity_type_label' | translate}}</label>
<select name="type" [(ngModel)]="task.typeUnity" (change)="task.resetUnityContent()"> <select name="type" [(ngModel)]="task.typeUnity" (change)="resetUnityContent()">
<option value="getObject">{{'task_unity_type_getObject' | translate}}</option> <option value="getObject">{{'task_unity_type_getObject' | translate}}</option>
<option value="character">{{'task_unity_type_character' | translate}}</option> <option value="character">{{'task_unity_type_character' | translate}}</option>
<!--<option value="combineObjects">{{'task_unity_type_combineObjects' | translate}}</option>--> <!--<option value="combineObjects">{{'task_unity_type_combineObjects' | translate}}</option>-->
...@@ -183,8 +183,8 @@ ...@@ -183,8 +183,8 @@
<div class="piece-form-content-unity-typeContent"> <div class="piece-form-content-unity-typeContent">
<div class="piece-form-content-unity-typeContent-getObject" *ngIf="task.typeUnity == 'getObject'"> <div class="piece-form-content-unity-typeContent-getObject" *ngIf="task.typeUnity == 'getObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/> <input type="number" [(ngModel)]="task.objectQuantity" (change)="editTrace($event, 'typeUnity_object_quantity')"/>
<select [(ngModel)]="task.object"> <select [(ngModel)]="task.object" (change)="editTrace($event, 'typeUnity_object_object')">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option> <option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option> <option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
</div> </div>
<div class="piece-form-content-unity-typeContent-character" *ngIf="task.typeUnity == 'character'"> <div class="piece-form-content-unity-typeContent-character" *ngIf="task.typeUnity == 'character'">
<select [(ngModel)]="task.character"> <select [(ngModel)]="task.character" (change)="editTrace($event, 'typeUnity_character')">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option> <option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option> <option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select> </select>
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
--> -->
<div class="piece-form-content-unity-typeContent-interactObject" *ngIf="task.typeUnity == 'interactObject'"> <div class="piece-form-content-unity-typeContent-interactObject" *ngIf="task.typeUnity == 'interactObject'">
<div class="piece-form-content-unity-typeContent-interactObject-select"> <div class="piece-form-content-unity-typeContent-interactObject-select">
<select [(ngModel)]="task.object"> <select [(ngModel)]="task.object" (change)="editTrace($event, 'typeUnity_interact_object')">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option> <option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option> <option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
</div> </div>
<div class="piece-form-content-unity-typeContent-interactObject-name"> <div class="piece-form-content-unity-typeContent-interactObject-name">
<input name="interactionName" type="text" [(ngModel)]="task.interactionName" [placeholder]="translate.instant('task_unity_interactName_placeholder')"/> <input name="interactionName" type="text" [(ngModel)]="task.interactionName" [placeholder]="translate.instant('task_unity_interactName_placeholder')" (change)="editTrace($event, 'typeUnity_interact_name')"/>
</div> </div>
</div> </div>
...@@ -314,11 +314,11 @@ ...@@ -314,11 +314,11 @@
<div class="piece-form-content-unity-infos"> <div class="piece-form-content-unity-infos">
<div class="piece-form-content-unity-infos-name"> <div class="piece-form-content-unity-infos-name">
<label for="name">{{'task_unity_name_label' | translate}}</label> <label for="name">{{'task_unity_name_label' | translate}}</label>
<input name="name" type="text" [(ngModel)]="task.name"/> <input name="name" type="text" [(ngModel)]="task.name" (change)="editTrace($event, 'Task_name')"/>
</div> </div>
<div class="piece-form-content-unity-infos-desc"> <div class="piece-form-content-unity-infos-desc">
<label for="description">{{'task_unity_desc_label' | translate}}</label> <label for="description">{{'task_unity_desc_label' | translate}}</label>
<textarea name="description" [(ngModel)]="task.objective"></textarea> <textarea name="description" [(ngModel)]="task.objective" (change)="editTrace($event, 'Task_description')"></textarea>
</div> </div>
</div> </div>
......
...@@ -136,7 +136,7 @@ export class TaskComponent implements OnInit { ...@@ -136,7 +136,7 @@ export class TaskComponent implements OnInit {
this.task.symbol.symbol = ''; this.task.symbol.symbol = '';
} }
this.task.changeType(type); this.task.changeType(type);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform_into_['+type+']',this.missionIndex,this.roleIndex,'all','Task_['+this.i+';'+this.j+']', '#B9DFE3')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.roleIndex,'all','Task_['+this.i+';'+this.j+']_transform_into_['+type+']', '#B9DFE3'));
} }
onClickDelete(): void { onClickDelete(): void {
...@@ -460,4 +460,13 @@ export class TaskComponent implements OnInit { ...@@ -460,4 +460,13 @@ export class TaskComponent implements OnInit {
removeExchangeReceiveObject(index: number): void { removeExchangeReceiveObject(index: number): void {
this.task.receiveObjects.splice(index,1); this.task.receiveObjects.splice(index,1);
} }
resetUnityContent(): void {
this.task.resetUnityContent();
switch (this.task.typeUnity) {
case 'getObject': new Trace(this.scenario.traces.length, 'transform', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, 'typeUnity_transform_into_[getObject]', 'Task_['+this.i+';'+this.j+']', '#B9DFE3'); break;
case 'character': new Trace(this.scenario.traces.length, 'transform', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, 'typeUnity_transform_into_[talkWith]', 'Task_['+this.i+';'+this.j+']', '#B9DFE3'); break;
case 'interactObject': new Trace(this.scenario.traces.length, 'transform', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, 'typeUnity_transform_into_[interactWith]', 'Task_['+this.i+';'+this.j+']', '#B9DFE3'); break;
}
}
} }
\ No newline at end of file
...@@ -12,6 +12,7 @@ import { Scenario } from 'src/app/class/scenario/scenario'; ...@@ -12,6 +12,7 @@ import { Scenario } from 'src/app/class/scenario/scenario';
import { DeclarativeSentence } from 'src/app/class/sentence/declarativeSentence/declarative-sentence'; import { DeclarativeSentence } from 'src/app/class/sentence/declarativeSentence/declarative-sentence';
import { InterrogativeSentence } from 'src/app/class/sentence/interrogativeSentence/interrogative-sentence'; import { InterrogativeSentence } from 'src/app/class/sentence/interrogativeSentence/interrogative-sentence';
import { Sentence } from 'src/app/class/sentence/sentence'; import { Sentence } from 'src/app/class/sentence/sentence';
import { Trace } from 'src/app/class/trace/trace';
import { DiscussionDialogComponent } from 'src/app/components/dialogs/discussion-dialog/discussion-dialog.component'; import { DiscussionDialogComponent } from 'src/app/components/dialogs/discussion-dialog/discussion-dialog.component';
import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component'; import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component';
import { PieceDetailsService } from 'src/app/services/piece-details/piece-details.service'; import { PieceDetailsService } from 'src/app/services/piece-details/piece-details.service';
...@@ -37,13 +38,15 @@ export class DiscussionsComponent implements OnInit { ...@@ -37,13 +38,15 @@ export class DiscussionsComponent implements OnInit {
addDiscussion() { addDiscussion() {
if (this.selectedCharacter && this.intitule) { if (this.selectedCharacter && this.intitule) {
let discussion = new Discussion(this.role.actualDiscussionID++, this.selectedCharacter, this.intitule); let discussionID: number = this.role.actualDiscussionID++;
let discussion = new Discussion(discussionID, this.selectedCharacter, this.intitule);
this.intitule = ''; this.intitule = '';
this.role.discussions.push(discussion); this.role.discussions.push(discussion);
const dialogRef = this.dialog.open(DiscussionDialogComponent, { const dialogRef = this.dialog.open(DiscussionDialogComponent, {
width: '60vw', width: '60vw',
data: { role: this.role, discussion: discussion, scenario: this.scenario } data: { role: this.role, discussion: discussion, scenario: this.scenario }
}); });
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, 'all', 'discussion_['+discussionID+']', '#D5D5FF'));
} }
} }
...@@ -52,6 +55,7 @@ export class DiscussionsComponent implements OnInit { ...@@ -52,6 +55,7 @@ export class DiscussionsComponent implements OnInit {
width: '60vw', width: '60vw',
data: { role: this.role, discussion: discussion, scenario: this.scenario } data: { role: this.role, discussion: discussion, scenario: this.scenario }
}); });
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'open_discussion', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, 'all', 'discussion_['+discussion.ID+']', '#D5D5FF'));
} }
deleteDiscussion(discussionIndex: number) { deleteDiscussion(discussionIndex: number) {
...@@ -119,7 +123,7 @@ export class DiscussionsComponent implements OnInit { ...@@ -119,7 +123,7 @@ export class DiscussionsComponent implements OnInit {
} }
} }
}); });
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, 'all', 'discussion_['+discussion.ID+']', '#D5D5FF'));
} }
}); });
} }
......
...@@ -15,7 +15,7 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt ...@@ -15,7 +15,7 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt
<textarea [(ngModel)]="task.repeat.while" (change)="editTrace($event,'repeat_stopCondition')"></textarea> <textarea [(ngModel)]="task.repeat.while" (change)="editTrace($event,'repeat_stopCondition')"></textarea>
</div> </div>
<div class="piece-form-missionRepeatLimit"> <div class="piece-form-missionRepeatLimit">
<input type="checkbox" [(ngModel)]="task.repeat.limitMissionRepeat"/> <input type="checkbox" [(ngModel)]="task.repeat.limitMissionRepeat" (change)="checkboxTrace($event, 'repeat_repeatLimit')"/>
<label>{{'repeat_missionRepeatLimit' | translate}}</label> <label>{{'repeat_missionRepeatLimit' | translate}}</label>
</div> </div>
</div> </div>
......
...@@ -45,4 +45,12 @@ export class RepeatComponent implements OnInit { ...@@ -45,4 +45,12 @@ export class RepeatComponent implements OnInit {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,this.formatTraceTarget(), '#A6C9EC')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,this.formatTraceTarget(), '#A6C9EC'));
} }
} }
checkboxTrace(event: any, source: string) {
if(event.target.checked) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'check', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, source, this.formatTraceTarget(), '#A6C9EC'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'uncheck', this.pieceDetailsService.missionIndex, this.pieceDetailsService.roleIndex, source, this.formatTraceTarget(), '#A6C9EC'));
}
}
} }
...@@ -21,8 +21,8 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt ...@@ -21,8 +21,8 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt
</div> </div>
--> -->
<div class="piece-form-content-object" *ngIf="reward.type == 'object'"> <div class="piece-form-content-object" *ngIf="reward.type == 'object'">
<input type="number" name="quantity" [(ngModel)]="getObjectReward(rewardIndex).quantity"/> <input type="number" name="quantity" [(ngModel)]="getObjectReward(rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity')"/>
<select name="object_name" [(ngModel)]="getObjectReward(rewardIndex).object"> <select name="object_name" [(ngModel)]="getObjectReward(rewardIndex).object" (change)="editTrace($event, 'Reward_['+rewardIndex+']_object')">
<option value="null" selected disabled>{{'rewards_object_placeholder' | translate}}</option> <option value="null" selected disabled>{{'rewards_object_placeholder' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources"> <ng-container *ngFor="let ressource of scenario.ressources">
<option *ngIf="ressource.type == 'ressource'" [ngValue]="ressource">{{ressource.name}}</option> <option *ngIf="ressource.type == 'ressource'" [ngValue]="ressource">{{ressource.name}}</option>
...@@ -33,14 +33,14 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt ...@@ -33,14 +33,14 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt
</select> </select>
</div> </div>
<div class="piece-form-content-character" *ngIf="reward.type == 'character'"> <div class="piece-form-content-character" *ngIf="reward.type == 'character'">
<select name="character" [(ngModel)]="getCharacterReward(rewardIndex).character"> <select name="character" [(ngModel)]="getCharacterReward(rewardIndex).character" (change)="editTrace($event, 'Reward_['+rewardIndex+']_character')">
<option value="null" selected disabled>{{'rewards_character_placeholder' | translate}}</option> <option value="null" selected disabled>{{'rewards_character_placeholder' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option> <option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select> </select>
</div> </div>
<div class="piece-form-content-skill" *ngIf="reward.type == 'skill'"> <div class="piece-form-content-skill" *ngIf="reward.type == 'skill'">
<input type="number" name="quantity" [(ngModel)]="getSkillReward(rewardIndex).quantity"/> <input type="number" name="quantity" [(ngModel)]="getSkillReward(rewardIndex).quantity" (change)="editTrace($event, 'Reward_['+rewardIndex+']_quantity')"/>
<select name="skill" [(ngModel)]="getSkillReward(rewardIndex).skill"> <select name="skill" [(ngModel)]="getSkillReward(rewardIndex).skill" (change)="editTrace($event, 'Reward_['+rewardIndex+']_skill')">
<option value="null" selected disabled>{{'rewards_skill_placeholder' | translate}}</option> <option value="null" selected disabled>{{'rewards_skill_placeholder' | translate}}</option>
<ng-container *ngFor="let ressource of pieceDetailsService.parentAsRole().ressources"> <ng-container *ngFor="let ressource of pieceDetailsService.parentAsRole().ressources">
<option *ngIf="ressource.type == 'attribut'" [ngValue]="ressource">{{ressource.name}}</option> <option *ngIf="ressource.type == 'attribut'" [ngValue]="ressource">{{ressource.name}}</option>
......
...@@ -46,6 +46,14 @@ export class RewardsComponent implements OnInit { ...@@ -46,6 +46,14 @@ export class RewardsComponent implements OnInit {
return res; return res;
} }
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,this.formatTraceTarget(), '#CFE3B9'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,this.formatTraceTarget(), '#CFE3B9'));
}
}
getCharacterReward(index: number): CharacterReward { getCharacterReward(index: number): CharacterReward {
return this.task.rewards[index] as CharacterReward; return this.task.rewards[index] as CharacterReward;
} }
......
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