Commit 34f8d656 authored by Romain DELEAU's avatar Romain DELEAU

Task unity mode + fix on clear character in task reward on character delete +...

Task unity mode + fix on clear character in task reward on character delete + fix en translate of 'plan de relance'
parent 22308e3a
......@@ -179,7 +179,7 @@
<img class="langIcon" [src]="'./assets/lang/icons/'+selectedLang+'.png'"/>
<span>{{'lang_label' | translate}}</span>
</button>
<span mat-menu-item (click)="unityService.unity_isActive = !unityService.unity_isActive; unityTrace($event)"
<span mat-menu-item (click)="unityService.unity_isActive = !unityService.unity_isActive; unityTrace($event); minimapService.reset()"
[matTooltip]="translate.instant('unity_tooltip')"
matTooltipPosition="left" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<input name="unity" type="checkbox" [(ngModel)]="unityService.unity_isActive"/>
......
......@@ -334,6 +334,68 @@ export class AppComponent {
let i: number = scenario.characters.findIndex(element => element.name == (task.reward as Character).name && element.description == (task.reward as Character).description && element.color == (task.reward as Character).color);
task.reward = scenario.characters[i];
}
if ((task.typeUnity == 'getObject' || task.typeUnity == 'depositObject' || task.typeUnity == 'interactObject') && task.object) {
if (scenario.ressources.some(element => element.name == (task.object as Ressource).name && element.number == (task.object as Ressource).number && element.type == (task.object as Ressource).type)) {
let i: number = scenario.ressources.findIndex(element => element.name == (task.object as Ressource).name && element.number == (task.object as Ressource).number && element.type == (task.object as Ressource).type);
task.object = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == (task.object as Ressource).name && element.number == (task.object as Ressource).number && element.type == (task.object as Ressource).type);
task.object = role.ressources[i];
}
}
if ((task.typeUnity == 'askTooSeeRole' || task.typeUnity == 'talkWithRole') && task.role) {
mission.roles.forEach(role => {
if (role.intitule == task.role) {
task.role == role.intitule;
}
});
}
if ((task.typeUnity == 'character' || task.typeUnity == 'exchangeObjects') && task.character) {
scenario.characters.forEach(character => {
if (character.color == task.character?.color && character.description == task.character.description && character.name == task.character.name && character.tel == task.character.tel) {
task.character = character;
}
});
}
if ((task.typeUnity == 'combineObjects')) {
task.combineObjects.forEach((combineObject, index) => {
if (combineObject[0] != null) {
if (scenario.ressources.some(element => element.name == (combineObject[0] as Ressource).name && element.number == (combineObject[0] as Ressource).number && element.type == (combineObject[0] as Ressource).type)) {
let i: number = scenario.ressources.findIndex(element => element.name == (combineObject[0] as Ressource).name && element.number == (combineObject[0] as Ressource).number && element.type == (combineObject[0] as Ressource).type);
task.combineObjects[index][0] = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == (combineObject[0] as Ressource).name && element.number == (combineObject[0] as Ressource).number && element.type == (combineObject[0] as Ressource).type);
task.combineObjects[index][0] = role.ressources[i];
}
}
});
}
if ((task.typeUnity == 'exchangeObjects')) {
task.giveObjects.forEach((giveObject, index) => {
if (giveObject[0] != null) {
if (scenario.ressources.some(element => element.name == (giveObject[0] as Ressource).name && element.number == (giveObject[0] as Ressource).number && element.type == (giveObject[0] as Ressource).type)) {
let i: number = scenario.ressources.findIndex(element => element.name == (giveObject[0] as Ressource).name && element.number == (giveObject[0] as Ressource).number && element.type == (giveObject[0] as Ressource).type);
task.giveObjects[index][0] = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == (giveObject[0] as Ressource).name && element.number == (giveObject[0] as Ressource).number && element.type == (giveObject[0] as Ressource).type);
task.giveObjects[index][0] = role.ressources[i];
}
}
})
task.receiveObjects.forEach((receiveObject, index) => {
if (receiveObject[0] != null) {
if (scenario.ressources.some(element => element.name == (receiveObject[0] as Ressource).name && element.number == (receiveObject[0] as Ressource).number && element.type == (receiveObject[0] as Ressource).type)) {
let i: number = scenario.ressources.findIndex(element => element.name == (receiveObject[0] as Ressource).name && element.number == (receiveObject[0] as Ressource).number && element.type == (receiveObject[0] as Ressource).type);
task.receiveObjects[index][0] = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == (receiveObject[0] as Ressource).name && element.number == (receiveObject[0] as Ressource).number && element.type == (receiveObject[0] as Ressource).type);
task.receiveObjects[index][0] = role.ressources[i];
}
}
})
}
}
});
});
......
......@@ -21,6 +21,18 @@ export class Task {
characters: Character[] = [];
repeat: Repeat = new Repeat();
name: string = '';
typeUnity: string = 'getObject';
objectQuantity: number = 1;
object: Ressource | null = null;
interactionName: string = '';
character: Character | null = null;
combineObjects: (Ressource | number | null)[][] = [[null,1],[null,1]]; // [0] = Ressource & [1] = quantity
giveObjects: (Ressource | number | null)[][] = [[null,1]];
receiveObjects: (Ressource | number | null)[][] = [[null,1]];
other: string = '';
role: string = ''; //role.intitule
supplementaryRole!: SupplementaryRole;
interrupt: string = '';
......@@ -47,4 +59,16 @@ export class Task {
this.reward = null;
this.rewardQuantity = 1;
}
public resetUnityContent(): void {
this.object = null;
this.objectQuantity = 1;
this.character = null;
this.combineObjects = [[null,1],[null,1]];
this.giveObjects = [[null,1]];
this.receiveObjects = [[null,1]];
this.other = '';
this.role = '';
this.interactionName = '';
}
}
......@@ -52,6 +52,9 @@ export class GameCharactersComponent implements OnInit {
task.resetReward();
task.rewardType = 'none';
}
if (task?.typeUnity == 'character' || task?.typeUnity == 'exchangeObjects') {
task.character = null;
}
}
});
});
......@@ -86,10 +89,13 @@ export class GameCharactersComponent implements OnInit {
if (typeof i !== 'undefined' && i !== -1) {
task?.characters.splice(i, 1);
}
if (task?.rewardType == 'character') {
if (task?.rewardType == 'character' && task.reward == this.scenario.characters[index]) {
task.resetReward();
task.rewardType = 'none';
}
if ((task?.typeUnity == 'character' || task?.typeUnity == 'exchangeObjects') && task.character == this.scenario.characters[index]) {
task.character = null;
}
});
});
});
......
......@@ -113,6 +113,26 @@ export class RoleComponent implements OnInit {
task.resetReward();
task.rewardType = 'none';
}
if (task?.typeUnity == 'getObject' || task?.typeUnity == 'combineObjects' || task?.typeUnity == 'exchangeObjects' || task?.typeUnity == 'depositObject' || task?.typeUnity == 'interactObject') {
if (task.object == ressource) {
task.object = null;
}
task.combineObjects.forEach((object, i) => {
if (object[0] == ressource) {
task.combineObjects[i][0] = null;
}
});
task.giveObjects.forEach((object, i) => {
if (object[0] == ressource) {
task.giveObjects[i][0] = null;
}
});
task.receiveObjects.forEach((object, i) => {
if (object[0] == ressource) {
task.receiveObjects[i][0] = null;
}
});
}
});
});
});
......@@ -130,6 +150,19 @@ export class RoleComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
let missionIndex: number = this.scenario.missions.findIndex(mission => mission == this.mission);
if (result == true) {
this.mission.roles.forEach(role => {
role.tasks.forEach(inlineTask => {
inlineTask.forEach(task => {
if (task instanceof Task) {
if (task.typeUnity == 'talkWithRole' || task.typeUnity == 'askToSeeRole') {
if (task.role == role.intitule) {
task.role = '';
}
}
}
});
});
});
this.mission.roles.splice(this.i, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',missionIndex,this.i,'all','Role_['+(this.i)+']','#9AD5EC'));
this.minimapService.reset();
......@@ -187,6 +220,26 @@ export class RoleComponent implements OnInit {
task.resetReward();
task.rewardType = 'none';
}
if (task?.typeUnity == 'getObject' || task?.typeUnity == 'combineObjects' || task?.typeUnity == 'exchangeObjects' || task?.typeUnity == 'depositObject' || task?.typeUnity == 'interactObject') {
if (task.object == this.role.ressources[index]) {
task.object = null;
}
task.combineObjects.forEach((object, i) => {
if (object[0] == this.role.ressources[index]) {
task.combineObjects[i][0] = null;
}
});
task.giveObjects.forEach((object, i) => {
if (object[0] == this.role.ressources[index]) {
task.giveObjects[i][0] = null;
}
});
task.receiveObjects.forEach((object, i) => {
if (object[0] == this.role.ressources[index]) {
task.receiveObjects[i][0] = null;
}
});
}
});
});
this.role.ressources.splice(index, 1);
......
......@@ -53,6 +53,26 @@ export class RulesComponent implements OnInit {
task.resetReward();
task.rewardType = 'none';
}
if (task?.typeUnity == 'getObject' || task?.typeUnity == 'combineObjects' || task?.typeUnity == 'exchangeObjects' || task?.typeUnity == 'depositObject' || task?.typeUnity == 'interactObject') {
if (task.object == ressource) {
task.object = null;
}
task.combineObjects.forEach((object, i) => {
if (object[0] == ressource) {
task.combineObjects[i][0] = null;
}
});
task.giveObjects.forEach((object, i) => {
if (object[0] == ressource) {
task.giveObjects[i][0] = null;
}
});
task.receiveObjects.forEach((object, i) => {
if (object[0] == ressource) {
task.receiveObjects[i][0] = null;
}
});
}
}
});
});
......@@ -91,6 +111,26 @@ export class RulesComponent implements OnInit {
task.resetReward();
task.rewardType = 'none';
}
if (task?.typeUnity == 'getObject' || task?.typeUnity == 'combineObjects' || task?.typeUnity == 'exchangeObjects' || task?.typeUnity == 'depositObject' || task?.typeUnity == 'interactObject') {
if (task.object == this.scenario.ressources[index]) {
task.object = null;
}
task.combineObjects.forEach((object, i) => {
if (object[0] == this.scenario.ressources[index]) {
task.combineObjects[i][0] = null;
}
});
task.giveObjects.forEach((object, i) => {
if (object[0] == this.scenario.ressources[index]) {
task.giveObjects[i][0] = null;
}
});
task.receiveObjects.forEach((object, i) => {
if (object[0] == this.scenario.ressources[index]) {
task.receiveObjects[i][0] = null;
}
});
}
});
});
});
......
......@@ -121,9 +121,173 @@
<mat-icon class="piece-form-top-repeat" fontIcon="refresh" *ngIf="task.repeat.iteration > 0 || task.repeat.while != ''"></mat-icon>
</div>
<textarea class="piece-form-content" [(ngModel)]="task.objective" (change)="editTrace($event,'Task_action')" [style.background-image]="(i == findFirstIndexOfTaskType('annexe')[0] && j == findFirstIndexOfTaskType('annexe')[1]) ? urlIcon : ''"
*ngIf="!unityService.unity_isActive"
[placeholder]="translate.instant('annexeTask_action_placeholder')"
[matTooltip]="translate.instant('task_action_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
<div class="piece-form-content piece-form-content-unity" *ngIf="unityService.unity_isActive">
<div class="piece-form-content-unity-type">
<label for="type">{{'task_unity_type_label' | translate}}</label>
<select name="type" [(ngModel)]="task.typeUnity" (change)="task.resetUnityContent()">
<option value="getObject">{{'task_unity_type_getObject' | translate}}</option>
<option value="character">{{'task_unity_type_character' | translate}}</option>
<option value="combineObjects">{{'task_unity_type_combineObjects' | translate}}</option>
<option value="talkWithRole">{{'task_unity_type_talkWithRole' | translate}}</option>
<option value="exchangeObjects">{{'task_unity_type_exchangeObjects' | translate}}</option>
<option value="depositObject">{{'task_unity_type_depositObject' | translate}}</option>
<option value="askToSeeRole">{{'task_unity_type_askToSeeRole' | translate}}</option>
<option value="interactObject">{{'task_unity_type_interactObject' | translate}}</option>
<option value="other">{{'task_unity_type_other' | translate}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent">
<div class="piece-form-content-unity-typeContent-getObject" *ngIf="task.typeUnity == 'getObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngIf="role2 != role">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-character" *ngIf="task.typeUnity == 'character'">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent-combineObjects" *ngIf="task.typeUnity == 'combineObjects'">
<div class="piece-form-content-unity-typeContent-combineObjects-element" *ngFor="let element of task.combineObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeCombineObject(elementIndex)" *ngIf="task.combineObjects.length > 2"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-combineObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addCombineObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-talkWithRole" *ngIf="task.typeUnity == 'talkWithRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects" *ngIf="task.typeUnity == 'exchangeObjects'">
<div class="piece-form-content-unity-typeContent-exchangeObjects-give">
<label>{{'task_unity_exchangeObjects_give_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.giveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeGiveObject(elementIndex)" *ngIf="task.giveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeGiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects-receive">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
<label>{{'task_unity_exchangeObjects_receive_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.receiveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeReceiveObject(elementIndex)" *ngIf="task.receiveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeReceiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
</div>
<div class="piece-form-content-unity-typeContent-depositObject" *ngIf="task.typeUnity == 'depositObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-askToSeeRole" *ngIf="task.typeUnity == 'askToSeeRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject" *ngIf="task.typeUnity == 'interactObject'">
<div class="piece-form-content-unity-typeContent-interactObject-select">
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject-name">
<input name="interactionName" type="text" [(ngModel)]="task.interactionName" [placeholder]="translate.instant('task_unity_interactName_placeholder')"/>
</div>
</div>
<div class="piece-form-content-unity-typeContent-other" *ngIf="task.typeUnity == 'other'">
<textarea [(ngModel)]="task.other"></textarea>
</div>
</div>
<div class="piece-form-content-unity-infos">
<div class="piece-form-content-unity-infos-name">
<label for="name">{{'task_unity_name_label' | translate}}</label>
<input name="name" type="text" [(ngModel)]="task.name"/>
</div>
<div class="piece-form-content-unity-infos-desc">
<label for="description">{{'task_unity_desc_label' | translate}}</label>
<textarea name="description" [(ngModel)]="task.objective"></textarea>
</div>
</div>
</div>
<div class="piece-form-bottom">
<div class="piece-form-bottom-duration"
[matTooltip]="translate.instant('task_duration_tooltip')"
......
......@@ -282,6 +282,132 @@
margin-top: 10px;
height: 100%;
margin-bottom: 10px;
&-unity {
display: flex;
flex-direction: column;
max-width: 355px;
select {
width: 80%;
height: 35px;
}
input {
width: 74%;
height: 25px;
}
textarea {
flex-grow: 0;
width: 74%;
border-radius: 10px;
height: 40px;
}
&-type, &-typeContent {
display: flex;
justify-content: space-between;
}
&-typeContent {
height: 109px;
margin-top: 2px;
margin-bottom: 5px;
overflow-y: auto;
justify-content: right;
&-button {
background-color: white;
width: 64px;
height: 35px;
margin-right: 5px;
border-radius: 10px;
&-add {
position: relative;
left: 100%;
transform: translateX(-100%);
}
}
&-getObject, &-depositObject, &-combineObjects-element-object, &-exchangeObjects-element-object {
width: 80%;
display: flex;
justify-content: space-between;
input {
width: 10%;
}
}
&-character, &-talkWithRole, &-askToSeeRole, &-other {
display: flex;
justify-content: right;
width: 100%;
}
&-combineObjects, &-exchangeObjects {
display: flex;
flex-direction: column;
&-element {
display: flex;
justify-content: right;
}
}
&-exchangeObjects {
&-give {
padding-bottom: 2px;
border-bottom: solid 1px black;
}
&-receive {
padding-top: 2px;
display: flex;
flex-direction: column;
}
}
&-interactObject {
display: flex;
flex-direction: column;
justify-content: right;
width: 100%;
&-select {
display: flex;
justify-content: right;
margin-bottom: 2px;
}
&-name {
display: flex;
justify-content: right;
}
}
}
&-infos {
display: flex;
flex-direction: column;
&-name, &-desc {
display: flex;
justify-content: space-between;
width: 100%;
}
&-name {
margin-bottom: 2px;
}
}
}
}
&-bottom {
......
......@@ -18,6 +18,7 @@ import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core';
import { TutorialService } from 'src/app/services/tutorial/tutorial.service';
import { FinishTutorialComponent } from 'src/app/components/snackbars/finish-tutorial/finish-tutorial.component';
import { UnityService } from 'src/app/services/unity/unity.service';
@Component({
selector: 'app-annexe-task',
......@@ -45,7 +46,7 @@ export class AnnexeTaskComponent implements OnInit {
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog,
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService, private tutorialService: TutorialService) { }
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService, private tutorialService: TutorialService, protected unityService: UnityService) { }
ngOnInit(): void {
this.setPieceWidth();
......@@ -351,4 +352,28 @@ export class AnnexeTaskComponent implements OnInit {
editMoveTrace(event: any, source: string): void {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'move',this.missionIndex,this.roleIndex,source,'Side_task_['+this.i+';'+this.j+']', '#BCCECC'));
}
addCombineObject(): void {
this.task.combineObjects.push([null,1]);
}
removeCombineObject(index: number): void {
this.task.combineObjects.splice(index,1);
}
addExchangeGiveObject(): void {
this.task.giveObjects.push([null,1]);
}
removeExchangeGiveObject(index: number): void {
this.task.giveObjects.splice(index,1);
}
addExchangeReceiveObject(): void {
this.task.receiveObjects.push([null,1]);
}
removeExchangeReceiveObject(index: number): void {
this.task.receiveObjects.splice(index,1);
}
}
......@@ -154,9 +154,173 @@
</button>
</div>
<textarea class="piece-form-content" [(ngModel)]="task.objective" (change)="editTrace($event,'Task_action')" [style.background-image]="(i == findFirstIndexOfTaskType('final')[0] && j == findFirstIndexOfTaskType('final')[1]) ? urlIcon : ''"
*ngIf="!unityService.unity_isActive"
[placeholder]="translate.instant('finalTask_action_placeholder')"
[matTooltip]="translate.instant('task_action_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
<div class="piece-form-content piece-form-content-unity" *ngIf="unityService.unity_isActive">
<div class="piece-form-content-unity-type">
<label for="type">{{'task_unity_type_label' | translate}}</label>
<select name="type" [(ngModel)]="task.typeUnity" (change)="task.resetUnityContent()">
<option value="getObject">{{'task_unity_type_getObject' | translate}}</option>
<option value="character">{{'task_unity_type_character' | translate}}</option>
<option value="combineObjects">{{'task_unity_type_combineObjects' | translate}}</option>
<option value="talkWithRole">{{'task_unity_type_talkWithRole' | translate}}</option>
<option value="exchangeObjects">{{'task_unity_type_exchangeObjects' | translate}}</option>
<option value="depositObject">{{'task_unity_type_depositObject' | translate}}</option>
<option value="askToSeeRole">{{'task_unity_type_askToSeeRole' | translate}}</option>
<option value="interactObject">{{'task_unity_type_interactObject' | translate}}</option>
<option value="other">{{'task_unity_type_other' | translate}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent">
<div class="piece-form-content-unity-typeContent-getObject" *ngIf="task.typeUnity == 'getObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngIf="role2 != role">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-character" *ngIf="task.typeUnity == 'character'">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent-combineObjects" *ngIf="task.typeUnity == 'combineObjects'">
<div class="piece-form-content-unity-typeContent-combineObjects-element" *ngFor="let element of task.combineObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeCombineObject(elementIndex)" *ngIf="task.combineObjects.length > 2"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-combineObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addCombineObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-talkWithRole" *ngIf="task.typeUnity == 'talkWithRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects" *ngIf="task.typeUnity == 'exchangeObjects'">
<div class="piece-form-content-unity-typeContent-exchangeObjects-give">
<label>{{'task_unity_exchangeObjects_give_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.giveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeGiveObject(elementIndex)" *ngIf="task.giveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeGiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects-receive">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
<label>{{'task_unity_exchangeObjects_receive_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.receiveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeReceiveObject(elementIndex)" *ngIf="task.receiveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeReceiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
</div>
<div class="piece-form-content-unity-typeContent-depositObject" *ngIf="task.typeUnity == 'depositObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-askToSeeRole" *ngIf="task.typeUnity == 'askToSeeRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject" *ngIf="task.typeUnity == 'interactObject'">
<div class="piece-form-content-unity-typeContent-interactObject-select">
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject-name">
<input name="interactionName" type="text" [(ngModel)]="task.interactionName" [placeholder]="translate.instant('task_unity_interactName_placeholder')"/>
</div>
</div>
<div class="piece-form-content-unity-typeContent-other" *ngIf="task.typeUnity == 'other'">
<textarea [(ngModel)]="task.other"></textarea>
</div>
</div>
<div class="piece-form-content-unity-infos">
<div class="piece-form-content-unity-infos-name">
<label for="name">{{'task_unity_name_label' | translate}}</label>
<input name="name" type="text" [(ngModel)]="task.name"/>
</div>
<div class="piece-form-content-unity-infos-desc">
<label for="description">{{'task_unity_desc_label' | translate}}</label>
<textarea name="description" [(ngModel)]="task.objective"></textarea>
</div>
</div>
</div>
<div class="piece-form-bottom">
<div class="piece-form-bottom-duration"
[matTooltip]="translate.instant('task_duration_tooltip')"
......
......@@ -325,6 +325,132 @@
margin-top: 10px;
height: 100%;
margin-bottom: 10px;
&-unity {
display: flex;
flex-direction: column;
max-width: 355px;
select {
width: 80%;
height: 35px;
}
input {
width: 74%;
height: 25px;
}
textarea {
flex-grow: 0;
width: 74%;
border-radius: 10px;
height: 40px;
}
&-type, &-typeContent {
display: flex;
justify-content: space-between;
}
&-typeContent {
height: 109px;
margin-top: 2px;
margin-bottom: 5px;
overflow-y: auto;
justify-content: right;
&-button {
background-color: white;
width: 64px;
height: 35px;
margin-right: 5px;
border-radius: 10px;
&-add {
position: relative;
left: 100%;
transform: translateX(-100%);
}
}
&-getObject, &-depositObject, &-combineObjects-element-object, &-exchangeObjects-element-object {
width: 80%;
display: flex;
justify-content: space-between;
input {
width: 10%;
}
}
&-character, &-talkWithRole, &-askToSeeRole, &-other {
display: flex;
justify-content: right;
width: 100%;
}
&-combineObjects, &-exchangeObjects {
display: flex;
flex-direction: column;
&-element {
display: flex;
justify-content: right;
}
}
&-exchangeObjects {
&-give {
padding-bottom: 2px;
border-bottom: solid 1px black;
}
&-receive {
padding-top: 2px;
display: flex;
flex-direction: column;
}
}
&-interactObject {
display: flex;
flex-direction: column;
justify-content: right;
width: 100%;
&-select {
display: flex;
justify-content: right;
margin-bottom: 2px;
}
&-name {
display: flex;
justify-content: right;
}
}
}
&-infos {
display: flex;
flex-direction: column;
&-name, &-desc {
display: flex;
justify-content: space-between;
width: 100%;
}
&-name {
margin-bottom: 2px;
}
}
}
}
&-bottom {
......
......@@ -16,6 +16,7 @@ import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identi
import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core';
import { UnityService } from 'src/app/services/unity/unity.service';
@Component({
selector: 'app-final-task',
......@@ -43,7 +44,7 @@ export class FinalTaskComponent implements OnInit {
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog,
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService) { }
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService, protected unityService: UnityService) { }
ngOnInit(): void {
this.setPieceWidth();
......@@ -359,4 +360,28 @@ export class FinalTaskComponent implements OnInit {
editMoveTrace(event: any, source: string): void {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'move',this.missionIndex,this.roleIndex,source,'Final_task_['+this.i+';'+this.j+']', '#B28386'));
}
addCombineObject(): void {
this.task.combineObjects.push([null,1]);
}
removeCombineObject(index: number): void {
this.task.combineObjects.splice(index,1);
}
addExchangeGiveObject(): void {
this.task.giveObjects.push([null,1]);
}
removeExchangeGiveObject(index: number): void {
this.task.giveObjects.splice(index,1);
}
addExchangeReceiveObject(): void {
this.task.receiveObjects.push([null,1]);
}
removeExchangeReceiveObject(index: number): void {
this.task.receiveObjects.splice(index,1);
}
}
......@@ -155,9 +155,173 @@
</button>
</div>
<textarea class="piece-form-content" [(ngModel)]="task.objective" (change)="editTrace($event,'Task_action')" [style.background-image]="(i == findFirstIndexOfTaskType('optionnal')[0] && j == findFirstIndexOfTaskType('optionnal')[1]) ? urlIcon : ''"
*ngIf="!unityService.unity_isActive"
[placeholder]="translate.instant('optionnalTask_action_placeholder')"
[matTooltip]="translate.instant('task_action_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
<div class="piece-form-content piece-form-content-unity" *ngIf="unityService.unity_isActive">
<div class="piece-form-content-unity-type">
<label for="type">{{'task_unity_type_label' | translate}}</label>
<select name="type" [(ngModel)]="task.typeUnity" (change)="task.resetUnityContent()">
<option value="getObject">{{'task_unity_type_getObject' | translate}}</option>
<option value="character">{{'task_unity_type_character' | translate}}</option>
<option value="combineObjects">{{'task_unity_type_combineObjects' | translate}}</option>
<option value="talkWithRole">{{'task_unity_type_talkWithRole' | translate}}</option>
<option value="exchangeObjects">{{'task_unity_type_exchangeObjects' | translate}}</option>
<option value="depositObject">{{'task_unity_type_depositObject' | translate}}</option>
<option value="askToSeeRole">{{'task_unity_type_askToSeeRole' | translate}}</option>
<option value="interactObject">{{'task_unity_type_interactObject' | translate}}</option>
<option value="other">{{'task_unity_type_other' | translate}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent">
<div class="piece-form-content-unity-typeContent-getObject" *ngIf="task.typeUnity == 'getObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngIf="role2 != role">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-character" *ngIf="task.typeUnity == 'character'">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent-combineObjects" *ngIf="task.typeUnity == 'combineObjects'">
<div class="piece-form-content-unity-typeContent-combineObjects-element" *ngFor="let element of task.combineObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeCombineObject(elementIndex)" *ngIf="task.combineObjects.length > 2"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-combineObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addCombineObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-talkWithRole" *ngIf="task.typeUnity == 'talkWithRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects" *ngIf="task.typeUnity == 'exchangeObjects'">
<div class="piece-form-content-unity-typeContent-exchangeObjects-give">
<label>{{'task_unity_exchangeObjects_give_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.giveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeGiveObject(elementIndex)" *ngIf="task.giveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeGiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects-receive">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
<label>{{'task_unity_exchangeObjects_receive_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.receiveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeReceiveObject(elementIndex)" *ngIf="task.receiveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeReceiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
</div>
<div class="piece-form-content-unity-typeContent-depositObject" *ngIf="task.typeUnity == 'depositObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-askToSeeRole" *ngIf="task.typeUnity == 'askToSeeRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject" *ngIf="task.typeUnity == 'interactObject'">
<div class="piece-form-content-unity-typeContent-interactObject-select">
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject-name">
<input name="interactionName" type="text" [(ngModel)]="task.interactionName" [placeholder]="translate.instant('task_unity_interactName_placeholder')"/>
</div>
</div>
<div class="piece-form-content-unity-typeContent-other" *ngIf="task.typeUnity == 'other'">
<textarea [(ngModel)]="task.other"></textarea>
</div>
</div>
<div class="piece-form-content-unity-infos">
<div class="piece-form-content-unity-infos-name">
<label for="name">{{'task_unity_name_label' | translate}}</label>
<input name="name" type="text" [(ngModel)]="task.name"/>
</div>
<div class="piece-form-content-unity-infos-desc">
<label for="description">{{'task_unity_desc_label' | translate}}</label>
<textarea name="description" [(ngModel)]="task.objective"></textarea>
</div>
</div>
</div>
<div class="piece-form-bottom">
<div class="piece-form-bottom-duration"
[matTooltip]="translate.instant('task_duration_tooltip')"
......
......@@ -333,9 +333,134 @@
}
&-content {
margin-top: 10px;
height: 100%;
margin-bottom: 10px;
&-unity {
display: flex;
flex-direction: column;
max-width: 355px;
select {
width: 80%;
height: 35px;
}
input {
width: 74%;
height: 25px;
}
textarea {
flex-grow: 0;
width: 74%;
border-radius: 10px;
height: 40px;
}
&-type, &-typeContent {
display: flex;
justify-content: space-between;
}
&-typeContent {
height: 109px;
margin-top: 2px;
margin-bottom: 5px;
overflow-y: auto;
justify-content: right;
&-button {
background-color: white;
width: 64px;
height: 35px;
margin-right: 5px;
border-radius: 10px;
&-add {
position: relative;
left: 100%;
transform: translateX(-100%);
}
}
&-getObject, &-depositObject, &-combineObjects-element-object, &-exchangeObjects-element-object {
width: 80%;
display: flex;
justify-content: space-between;
input {
width: 10%;
}
}
&-character, &-talkWithRole, &-askToSeeRole, &-other {
display: flex;
justify-content: right;
width: 100%;
}
&-combineObjects, &-exchangeObjects {
display: flex;
flex-direction: column;
&-element {
display: flex;
justify-content: right;
}
}
&-exchangeObjects {
&-give {
padding-bottom: 2px;
border-bottom: solid 1px black;
}
&-receive {
padding-top: 2px;
display: flex;
flex-direction: column;
}
}
&-interactObject {
display: flex;
flex-direction: column;
justify-content: right;
width: 100%;
&-select {
display: flex;
justify-content: right;
margin-bottom: 2px;
}
&-name {
display: flex;
justify-content: right;
}
}
}
&-infos {
display: flex;
flex-direction: column;
&-name, &-desc {
display: flex;
justify-content: space-between;
width: 100%;
}
&-name {
margin-bottom: 2px;
}
}
}
}
&-bottom {
......
......@@ -18,6 +18,7 @@ import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core';
import { MoveOptionnalTasksComponent } from 'src/app/components/snackbars/move-optionnal-tasks/move-optionnal-tasks.component';
import { DeleteOptionnalTasksComponent } from 'src/app/components/snackbars/delete-optionnal-tasks/delete-optionnal-tasks.component';
import { UnityService } from 'src/app/services/unity/unity.service';
@Component({
selector: 'app-optionnal-task',
......@@ -45,7 +46,7 @@ export class OptionnalTaskComponent implements OnInit {
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog,
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService) { }
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService, protected unityService: UnityService) { }
ngOnInit(): void {
this.setPieceWidth();
......@@ -386,4 +387,28 @@ export class OptionnalTaskComponent implements OnInit {
editMoveTrace(event: any, source: string): void {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'move',this.missionIndex,this.roleIndex,source,'Opt_task_['+this.i+';'+this.j+']', '#E8E3B3'));
}
addCombineObject(): void {
this.task.combineObjects.push([null,1]);
}
removeCombineObject(index: number): void {
this.task.combineObjects.splice(index,1);
}
addExchangeGiveObject(): void {
this.task.giveObjects.push([null,1]);
}
removeExchangeGiveObject(index: number): void {
this.task.giveObjects.splice(index,1);
}
addExchangeReceiveObject(): void {
this.task.receiveObjects.push([null,1]);
}
removeExchangeReceiveObject(index: number): void {
this.task.receiveObjects.splice(index,1);
}
}
......@@ -153,9 +153,174 @@
</button>
</div>
<textarea class="piece-form-content" [(ngModel)]="task.objective" (change)="editTrace($event,'Task_action'); validTutorialPhase6();" [style.background-image]="(i == findFirstIndexOfTaskType('normal')[0] && j == findFirstIndexOfTaskType('normal')[1]) ? urlIcon : ''"
*ngIf="!unityService.unity_isActive"
[placeholder]="translate.instant('normalTask_action_placeholder')"
[matTooltip]="translate.instant('task_action_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
<div class="piece-form-content piece-form-content-unity" *ngIf="unityService.unity_isActive">
<div class="piece-form-content-unity-type">
<label for="type">{{'task_unity_type_label' | translate}}</label>
<select name="type" [(ngModel)]="task.typeUnity" (change)="task.resetUnityContent()">
<option value="getObject">{{'task_unity_type_getObject' | translate}}</option>
<option value="character">{{'task_unity_type_character' | translate}}</option>
<option value="combineObjects">{{'task_unity_type_combineObjects' | translate}}</option>
<option value="talkWithRole">{{'task_unity_type_talkWithRole' | translate}}</option>
<option value="exchangeObjects">{{'task_unity_type_exchangeObjects' | translate}}</option>
<option value="depositObject">{{'task_unity_type_depositObject' | translate}}</option>
<option value="askToSeeRole">{{'task_unity_type_askToSeeRole' | translate}}</option>
<option value="interactObject">{{'task_unity_type_interactObject' | translate}}</option>
<option value="other">{{'task_unity_type_other' | translate}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent">
<div class="piece-form-content-unity-typeContent-getObject" *ngIf="task.typeUnity == 'getObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngIf="role2 != role">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-character" *ngIf="task.typeUnity == 'character'">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
</div>
<div class="piece-form-content-unity-typeContent-combineObjects" *ngIf="task.typeUnity == 'combineObjects'">
<div class="piece-form-content-unity-typeContent-combineObjects-element" *ngFor="let element of task.combineObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeCombineObject(elementIndex)" *ngIf="task.combineObjects.length > 2"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-combineObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addCombineObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-talkWithRole" *ngIf="task.typeUnity == 'talkWithRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects" *ngIf="task.typeUnity == 'exchangeObjects'">
<div class="piece-form-content-unity-typeContent-exchangeObjects-give">
<label>{{'task_unity_exchangeObjects_give_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.giveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeGiveObject(elementIndex)" *ngIf="task.giveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeGiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
<div class="piece-form-content-unity-typeContent-exchangeObjects-receive">
<select [(ngModel)]="task.character">
<option [ngValue]="null" selected disabled>{{'task_unity_characterName_label' | translate}}</option>
<option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
</select>
<label>{{'task_unity_exchangeObjects_receive_label' | translate}}</label>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element" *ngFor="let element of task.receiveObjects, let elementIndex = index">
<button mat-button class="piece-form-content-unity-typeContent-button" (click)="removeExchangeReceiveObject(elementIndex)" *ngIf="task.receiveObjects.length > 1"><mat-icon fontIcon="remove"></mat-icon></button>
<div class="piece-form-content-unity-typeContent-exchangeObjects-element-object">
<input type="number" [(ngModel)]="element[1]"/>
<select [(ngModel)]="element[0]">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
</div>
<button mat-button class="piece-form-content-unity-typeContent-button piece-form-content-unity-typeContent-button-add" (click)="addExchangeReceiveObject()"><mat-icon fontIcon="add"></mat-icon></button>
</div>
</div>
<div class="piece-form-content-unity-typeContent-depositObject" *ngIf="task.typeUnity == 'depositObject'">
<input type="number" [(ngModel)]="task.objectQuantity"/>
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of role.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-askToSeeRole" *ngIf="task.typeUnity == 'askToSeeRole'">
<select [(ngModel)]="task.role">
<option [ngValue]="''" selected disabled>{{'task_unity_roleName_label' | translate}}</option>
<ng-container *ngFor="let selectableRole of mission.roles">
<option *ngIf="selectableRole != role && selectableRole.intitule != ''">{{selectableRole.intitule}}</option>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject" *ngIf="task.typeUnity == 'interactObject'">
<div class="piece-form-content-unity-typeContent-interactObject-select">
<select [(ngModel)]="task.object">
<option [ngValue]="null" selected disabled>{{'task_unity_objectName_label' | translate}}</option>
<ng-container *ngFor="let ressource of scenario.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
<ng-container *ngFor="let role2 of mission.roles">
<ng-container *ngFor="let ressource of role2.ressources">
<option [ngValue]="ressource" *ngIf="ressource.type == 'ressource'">{{ressource.name}}</option>
</ng-container>
</ng-container>
</select>
</div>
<div class="piece-form-content-unity-typeContent-interactObject-name">
<input name="interactionName" type="text" [(ngModel)]="task.interactionName" [placeholder]="translate.instant('task_unity_interactName_placeholder')"/>
</div>
</div>
<div class="piece-form-content-unity-typeContent-other" *ngIf="task.typeUnity == 'other'">
<textarea [(ngModel)]="task.other"></textarea>
</div>
</div>
<div class="piece-form-content-unity-infos">
<div class="piece-form-content-unity-infos-name">
<label for="name">{{'task_unity_name_label' | translate}}</label>
<input name="name" type="text" [(ngModel)]="task.name"/>
</div>
<div class="piece-form-content-unity-infos-desc">
<label for="description">{{'task_unity_desc_label' | translate}}</label>
<textarea name="description" [(ngModel)]="task.objective"></textarea>
</div>
</div>
</div>
<div class="piece-form-bottom">
<div class="piece-form-bottom-duration"
[matTooltip]="translate.instant('task_duration_tooltip')"
......
......@@ -333,6 +333,132 @@
margin-top: 10px;
height: 100%;
margin-bottom: 10px;
&-unity {
display: flex;
flex-direction: column;
max-width: 355px;
select {
width: 80%;
height: 35px;
}
input {
width: 74%;
height: 25px;
}
textarea {
flex-grow: 0;
width: 74%;
border-radius: 10px;
height: 40px;
}
&-type, &-typeContent {
display: flex;
justify-content: space-between;
}
&-typeContent {
height: 109px;
margin-top: 2px;
margin-bottom: 5px;
overflow-y: auto;
justify-content: right;
&-button {
background-color: white;
width: 64px;
height: 35px;
margin-right: 5px;
border-radius: 10px;
&-add {
position: relative;
left: 100%;
transform: translateX(-100%);
}
}
&-getObject, &-depositObject, &-combineObjects-element-object, &-exchangeObjects-element-object {
width: 80%;
display: flex;
justify-content: space-between;
input {
width: 10%;
}
}
&-character, &-talkWithRole, &-askToSeeRole, &-other {
display: flex;
justify-content: right;
width: 100%;
}
&-combineObjects, &-exchangeObjects {
display: flex;
flex-direction: column;
&-element {
display: flex;
justify-content: right;
}
}
&-exchangeObjects {
&-give {
padding-bottom: 2px;
border-bottom: solid 1px black;
}
&-receive {
padding-top: 2px;
display: flex;
flex-direction: column;
}
}
&-interactObject {
display: flex;
flex-direction: column;
justify-content: right;
width: 100%;
&-select {
display: flex;
justify-content: right;
margin-bottom: 2px;
}
&-name {
display: flex;
justify-content: right;
}
}
}
&-infos {
display: flex;
flex-direction: column;
&-name, &-desc {
display: flex;
justify-content: space-between;
width: 100%;
}
&-name {
margin-bottom: 2px;
}
}
}
}
&-bottom {
......
......@@ -17,6 +17,7 @@ import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core';
import { TutorialService } from 'src/app/services/tutorial/tutorial.service';
import { UnityService } from 'src/app/services/unity/unity.service';
@Component({
selector: 'app-task',
......@@ -44,7 +45,8 @@ export class TaskComponent implements OnInit {
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog,
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService, private tutorialService: TutorialService) { }
private _snackBar: MatSnackBar, private minimapService: MinimapService, protected translate: TranslateService, private tutorialService: TutorialService,
protected unityService: UnityService) { }
ngOnInit(): void {
this.setPieceWidth();
......@@ -416,4 +418,28 @@ export class TaskComponent implements OnInit {
this.tutorialService.validPhase();
}
}
addCombineObject(): void {
this.task.combineObjects.push([null,1]);
}
removeCombineObject(index: number): void {
this.task.combineObjects.splice(index,1);
}
addExchangeGiveObject(): void {
this.task.giveObjects.push([null,1]);
}
removeExchangeGiveObject(index: number): void {
this.task.giveObjects.splice(index,1);
}
addExchangeReceiveObject(): void {
this.task.receiveObjects.push([null,1]);
}
removeExchangeReceiveObject(index: number): void {
this.task.receiveObjects.splice(index,1);
}
}
\ No newline at end of file
......@@ -205,6 +205,24 @@
"task_transform_annexeTask": "Convert to Side task",
"task_transform_optionnalTask": "Convert to Alternative Task",
"task_transform_finalTask": "Convert to Final Task",
"task_unity_type_label": "Type:",
"task_unity_type_getObject": "Retrieve an item",
"task_unity_type_character": "Talk to an NPC",
"task_unity_type_combineObjects": "Combine objects",
"task_unity_type_talkWithRole": "Talk to another role",
"task_unity_type_exchangeObjects": "Exchange objects",
"task_unity_type_depositObject": "Deposit an object",
"task_unity_type_askToSeeRole": "Ask to see the role",
"task_unity_type_interactObject": "Interact with an object",
"task_unity_type_other": "Other",
"task_unity_objectName_label": "Name of the object",
"task_unity_roleName_label": "Name of the role",
"task_unity_characterName_label": "Name of the character",
"task_unity_interactName_placeholder": "Name of the interaction",
"task_unity_exchangeObjects_give_label": "Give:",
"task_unity_exchangeObjects_receive_label": "To receive:",
"task_unity_name_label": "Name:",
"task_unity_desc_label": "Descr:",
"normalTask_title": "Task",
"normalTask_action_placeholder": "Ordering the main HTML tags",
"normalTask_add": "Add a Task",
......@@ -374,7 +392,7 @@
"legals_dysfunction_title": "Dysfunction and viruses.",
"legals_dysfunction_content": "IMT Nord Europe cannot be held responsible for direct or indirect damages, losses, or expenses resulting from the use of this website, or the inability of a third party to use it, or from a malfunction, interruption, virus, or a problem with the line or system.",
"legals_credits_title": "Credits",
"legals_credits_content1": "The texts on this site are licensed under CC-BY-NC-SA (Creative Commons with permission for use under the conditions of attribution, non-commercial use, and sharing under the same initial terms).\n\nIcons created by max.icons and Freepik, sourced from: www.flaticon.com and are licensed under CC-BY 3.0.\n\nDevelopment: Romain Deleau\n\nWeb design: Gaëlle Guigon\n\nThese works are part of the Nucléofil project, funded by the government as part of the recovery plan.",
"legals_credits_content1": "The texts on this site are licensed under CC-BY-NC-SA (Creative Commons with permission for use under the conditions of attribution, non-commercial use, and sharing under the same initial terms).\n\nIcons created by max.icons and Freepik, sourced from: www.flaticon.com and are licensed under CC-BY 3.0.\n\nDevelopment: Romain Deleau\n\nWeb design: Gaëlle Guigon\n\nThese works are part of the Nucléofil project, funded by the government as part of the stimulus package.",
"legals_credits_content2": "Additionally, they are the subject of a doctoral thesis at Sorbonne Université (at LIP6 in the team MOCAH), in collaboration with IMT Nord Europe.",
"legals_cookies_title": "Cookies",
"legals_cookies_content": "We do not record any cookies and do not save any personal data!",
......
......@@ -205,6 +205,24 @@
"task_transform_annexeTask": "Transformer en Tâche annexe",
"task_transform_optionnalTask": "Transformer en Tâche alternative",
"task_transform_finalTask": "Transformer en Tâche finale",
"task_unity_type_label": "Type :",
"task_unity_type_getObject": "Récupérer un objet",
"task_unity_type_character": "Parler à un PNJ",
"task_unity_type_combineObjects": "Combiner des objets",
"task_unity_type_talkWithRole": "Parler avec un autre rôle",
"task_unity_type_exchangeObjects": "Échanger des objets",
"task_unity_type_depositObject": "Déposer un objet",
"task_unity_type_askToSeeRole": "Demander à voir le rôle",
"task_unity_type_interactObject": "Interagir avec un objet",
"task_unity_type_other": "Autre",
"task_unity_objectName_label": "Nom de l'objet",
"task_unity_roleName_label": "Nom du rôle",
"task_unity_characterName_label": "Nom du personnage",
"task_unity_interactName_placeholder": "Nom de l'interaction",
"task_unity_exchangeObjects_give_label": "Donne :",
"task_unity_exchangeObjects_receive_label": "A recevoir :",
"task_unity_name_label": "Nom :",
"task_unity_desc_label": "Descr :",
"normalTask_title": "Tâche",
"normalTask_action_placeholder": "Positionner dans l'ordre les balises HTML principales",
"normalTask_add": "Ajouter une Tâche",
......
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