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;
}
} }
...@@ -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