Commit 1b3cf6c9 authored by Romain DELEAU's avatar Romain DELEAU

export unity/disable unused task in unity mode

parent 26778f08
This diff is collapsed.
......@@ -345,7 +345,7 @@
}
}
::ng-deep .mat-expansion-panel-content {
::ng-deep .mat-menu-item {
font-family: 'Glacial Indifference', sans-serif;
font-size: 16px;
}
\ No newline at end of file
......@@ -46,6 +46,7 @@ import { DeclarativeSentence } from './class/sentence/declarativeSentence/declar
import { ObjectReward } from './class/rewards/object-reward/object-reward';
import { DiscussionReward } from './class/rewards/discussion-reward/discussion-reward';
import { RoleEducationnalObjective } from './class/role-educationnal-objective/role-educationnal-objective';
import { ExportUnity } from './class/exportUnity/export-unity';
@Component({
selector: 'app-root',
......@@ -140,9 +141,6 @@ export class AppComponent {
changeMode(): void {
this.unityService.unity_isActive = !this.unityService.unity_isActive
if (this.unityService.unity_isActive) {
alert(this.translate.instant('unity_export_notavailable'))
}
}
downloadManual(): void {
......@@ -605,6 +603,29 @@ export class AppComponent {
}
}
exportRoleToUnity(role: Role, roleIndex: number, missionIndex: number) {
let exporter = new ExportUnity(this.scenario, role);
let fileName: string = '';
if (role.intitule) {
fileName = role.intitule+' - '+this.translate.instant('siderTitle_mission')+' '+(missionIndex+1)+(this.scenario.projectName ? ' - '+this.scenario.projectName : '')+' - RLG Maker Export';
} else {
fileName = this.translate.instant('siderTitle_role')+' '+(roleIndex+1)+' - '+this.translate.instant('siderTitle_mission')+' '+(missionIndex+1)+(this.scenario.projectName ? ' - '+this.scenario.projectName : '')+' - RLG Maker Export';
}
try {
const jsonString = exporter.exportRoleToUnity();
const blob = new Blob([jsonString], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = fileName;
link.href = url;
link.click();
URL.revokeObjectURL(url);
} catch {
this._snackBar.open(this.translate.instant('snackbar_unity_exportFailed'), '', { duration: 10000, panelClass: 'snackbar-fail' });
}
}
zoomIn(): void {
if (this.zoomService.zoom < 1.5) {
const element = this.elementRef.nativeElement.querySelector('.container-appMouseWheelZoom');
......
import { ExportUnity } from './export-unity';
describe('ExportUnity', () => {
it('should create an instance', () => {
expect(new ExportUnity()).toBeTruthy();
});
});
This diff is collapsed.
......@@ -190,6 +190,7 @@
position: absolute;
left: -20px;
top: 200px;
z-index: 101;
}
}
......
......@@ -230,6 +230,7 @@
position: absolute;
left: -20px;
top: 200px;
z-index: 101;
}
}
......
......@@ -241,6 +241,7 @@
position: absolute;
left: -20px;
top: 200px;
z-index: 101;
}
}
......
<div class="piece" [ngStyle]="{'width': pieceWidth+'px'}" (mouseover)="displayMenu='show'" (mouseleave)="displayMenu='hide'; displaySymbolChoice='hide'" (click)="onClickPiece()"
<div class="piece" [ngStyle]="{'width': pieceWidth+'px'}" (mouseover)="displayMenu='show'" (mouseleave)="displayMenu='hide'; displaySymbolChoice='hide'" (click)="!unityService.unity_isActive ? onClickPiece() : ''"
[style.background]="task.supplementaryRole ?
'linear-gradient(140deg, var(--piece-background-color) 0%, var(--piece-background-color) 55%,'+task.supplementaryRole.color+' 55%,'+task.supplementaryRole.color+' 100%)'
: 'var(--piece-background-color)'"
......@@ -138,27 +138,30 @@
<div class="piece-form-top">
<input class="piece-form-top-identifier" name="identifier" type="text" [(ngModel)]="task.identifier" (change)="changeIdentifier($event)" placeholder="A" min="1" maxlength="5"
[matTooltip]="translate.instant('task_identifier_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"/>
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
[disabled]="unityService.unity_isActive"/>
<div class="piece-form-top-title">{{'randomEvent_title1' | translate}}<br>{{'randomEvent_title2' | translate}}</div>
<mat-icon class="piece-form-top-comment" fontIcon="comment" *ngIf="task.comments.length > 0"></mat-icon>
<mat-icon class="piece-form-top-repeat" fontIcon="refresh" *ngIf="(task.repeat.iteration > 0 || task.repeat.while != '' || task.repeat.limitMissionRepeat) && !unityService.unity_isActive"></mat-icon>
<span class="piece-form-top-repeat-off" *ngIf="(task.repeat.iteration == 0 && task.repeat.while == '') && task.repeat.limitMissionRepeat && !unityService.unity_isActive"></span>
<button mat-button class="piece-form-top-symbol" (click)="changeDisplaySymbolChoice()"
[matTooltip]="translate.instant('task_common_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
[disabled]="unityService.unity_isActive">
<mat-icon *ngIf="task.symbol.symbol" [style.color]="task.symbol.color" [fontIcon]="task.symbol.symbol"></mat-icon>
</button>
</div>
<textarea class="piece-form-content" [(ngModel)]="task.objective" (change)="editTrace($event,'Task_action')" [style.background-image]="(i == findFirstIndexOfTaskType('event')[0] && j == findFirstIndexOfTaskType('event')[1]) ? urlIcon : ''"
[placeholder]="translate.instant('randomEvent_action_placeholder')"
[matTooltip]="translate.instant('task_action_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
[disabled]="unityService.unity_isActive"></textarea>
<div class="piece-form-bottom">
<div class="piece-form-bottom-duration"
[matTooltip]="translate.instant('task_duration_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<input name="value" type="number" [(ngModel)]="task.duration" (input)="durationChange()" min="0" (change)="task.duration < 0 ? task.duration = 0 : ''; editTrace($event,'Task_duration')"/>
<select name="unite" [(ngModel)]="task.durationUnit" (change)="durationChange(); editTrace($event,'Task_duration_unit')">
<input name="value" type="number" [(ngModel)]="task.duration" (input)="durationChange()" min="0" (change)="task.duration < 0 ? task.duration = 0 : ''; editTrace($event,'Task_duration')" [disabled]="unityService.unity_isActive"/>
<select name="unite" [(ngModel)]="task.durationUnit" (change)="durationChange(); editTrace($event,'Task_duration_unit')" [disabled]="unityService.unity_isActive">
<option value="UT">{{'task_duration_ut' | translate}}</option>
<option value="min">{{'task_duration_min' | translate}}</option>
<option value="tours">{{'task_duration_turn' | translate}}</option>
......@@ -170,9 +173,13 @@
<mat-icon class="piece-form-bottom-interrupt" fontIcon="front_hand" *ngIf="task.interrupt != '' && !unityService.unity_isActive"></mat-icon>
<button mat-button class="piece-form-bottom-prerequires" (click)="changeDisplayPrerequires()"
[matTooltip]="translate.instant('task_prerequire_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
[disabled]="unityService.unity_isActive">
{{'task_prerequire_label' | translate}}
</button>
</div>
</div>
<div [ngClass]="unityService.unity_isActive ? 'disabledTask' : ''" [ngStyle]="{'width': pieceWidth+'px'}" [matTooltip]="translate.instant('task_unity_disabledTask_tooltip')" matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips"></div>
<div [ngClass]="unityService.unity_isActive ? 'disabledTask-attach-right' : ''"></div>
</div>
......@@ -232,6 +232,7 @@
position: absolute;
left: -20px;
top: 200px;
z-index: 101;
}
}
......
<div class="piece" (mouseover)="displayMenu='show'" (mouseleave)="displayMenu='hide'" (click)="onClickPiece()"
<div class="piece" (mouseover)="displayMenu='show'" (mouseleave)="displayMenu='hide'" (click)="!unityService.unity_isActive ? onClickPiece() : ''"
[class]="pieceDetailsService.piece == task ? 'isActive' : 'border'">
<div class="piece-attach piece-attach-left"></div>
......@@ -106,7 +106,8 @@
<textarea [(ngModel)]="task.objective" [(ngModel)]="task.objective" (change)="editTrace($event,'Task_action')" [style.background-image]="(i == findFirstIndexOfTaskType('repeat')[0] && j == findFirstIndexOfTaskType('repeat')[1]) ? urlIcon : ''"
[placeholder]="translate.instant('repeatTask_action_placeholder')"
[matTooltip]="translate.instant('task_action_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
[disabled]="unityService.unity_isActive"></textarea>
<mat-icon class="piece-form-comment" fontIcon="comment" *ngIf="task.comments.length > 0"></mat-icon>
<mat-icon class="piece-form-repeat" fontIcon="refresh" *ngIf="(task.repeat.iteration > 0 || task.repeat.while != '' || task.repeat.limitMissionRepeat) && !unityService.unity_isActive"></mat-icon>
<span class="piece-form-repeat-off" *ngIf="(task.repeat.iteration == 0 && task.repeat.while == '') && task.repeat.limitMissionRepeat && !unityService.unity_isActive"></span>
......@@ -116,8 +117,11 @@
<mat-icon class="piece-form-interrupt" fontIcon="front_hand" *ngIf="task.interrupt != '' && !unityService.unity_isActive"></mat-icon>
<button mat-button class="piece-form-prerequires" (click)="changeDisplayPrerequires()"
[matTooltip]="translate.instant('task_prerequire_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
[disabled]="unityService.unity_isActive">
{{'task_prerequire_label' | translate}}
</button>
</div>
<div [ngClass]="unityService.unity_isActive ? 'disabledTask' : ''" [matTooltip]="translate.instant('task_unity_disabledTask_tooltip')" matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips"></div>
</div>
......@@ -73,6 +73,7 @@
position: absolute;
left: -20px;
top: 200px;
z-index: 101;
}
}
......@@ -268,4 +269,10 @@
.isActive::after, .border::after {
border-top-right-radius: 50%;
border-bottom-right-radius: 50%;
}
.disabledTask {
border-top-right-radius: 50%;
border-bottom-right-radius: 50%;
width: 400px;
}
\ No newline at end of file
......@@ -16,7 +16,8 @@
<div>
<mat-icon fontIcon="change_circle" [matMenuTriggerFor]="menuChange"
[matTooltip]="translate.instant('task_transform_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"
*ngIf="!unityService.unity_isActive"></mat-icon>
<mat-menu #menuChange="matMenu">
<button class="piece-menu-changeMenuButton" [style.background-color]="'#bccecc'" mat-menu-item (click)="onClickChange('annexe')">{{'task_transform_annexeTask' | translate}}</button>
<button class="piece-menu-changeMenuButton" [style.background-color]="'#e8e3b3'" mat-menu-item (click)="onClickChange('optionnal')">{{'task_transform_optionnalTask' | translate}}</button>
......@@ -171,11 +172,11 @@
<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="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>
</select>
</div>
......@@ -204,7 +205,7 @@
<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>
......@@ -288,7 +289,7 @@
</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">
......
......@@ -238,6 +238,7 @@
position: absolute;
left: -20px;
top: 200px;
z-index: 101;
}
}
......
......@@ -17,10 +17,11 @@
"enableHelp_label": "Enable the tooltips",
"enableHelp_tooltip": "Description of each element of the RLG Maker.",
"unity_label": "Integrate the game into Unity",
"unity_tooltip": "Usage in a specific game template. Contact gaelle.guigon@imt-nord-europe.fr for more information.",
"unity_export_notavailable": "Attention, file export for the Unity application is not yet available in this version, only editing of the scenario in preparation is possible",
"unity_tooltip": "Usage in a specific game template. Contact gaelle.guigon@imt-nord-europe.fr for more information. Only normal tasks are active in this mode.",
"download_label": "Download this scenario",
"download_tooltip": "Download a backup of the scenario.",
"exportUnity_label": "Export Role",
"exportUnity_tooltip": "Export the desired role in a format readable by the third-party application. Contact gaelle.guigon@imt-nord-europe.fr for more information. Attention, an exported file cannot be used to reload a saved scenario in RLG Maker.",
"upload_label": "Import a scenario",
"upload_tooltip": "Import a backup of the scenario.",
"manual_label": "Download the guide",
......@@ -40,6 +41,7 @@
"snackbar_roleName": "Attention, this title is already used in this Mission",
"snackbar_moveOptionnalTask": "Make sure to keep alternative tasks grouped in the same column",
"snackbar_deleteOptionnalTask": "Attention, alternative tasks go in pairs at minimum, ensure that the user always has a choice between several of these tasks",
"snackbar_unity_exportFailed": "Export failed, please ensure all exported fields are properly filled",
"siderTitle_game": "Game",
"siderTitle_mission": "Mission",
......@@ -231,6 +233,7 @@
"task_unity_exchangeObjects_receive_label": "To receive:",
"task_unity_name_label": "Name:",
"task_unity_desc_label": "Descr:",
"task_unity_disabledTask_tooltip": "Task disabled, only normal tasks are enabled in Unity mode",
"task_copy_snackbar": "Task copied, go to another role to paste it\nSome fields are not copied, make sure to manually verify the information when pasting",
"normalTask_title": "Task",
"normalTask_action_placeholder": "Ordering the main HTML tags",
......
......@@ -17,10 +17,11 @@
"enableHelp_label": "Activer les aides",
"enableHelp_tooltip": "Descriptif de chaque élément du RLG Maker.",
"unity_label": "Intégrer le jeu sous Unity",
"unity_tooltip": "Utilisation dans un template de jeu précis. Contacter gaelle.guigon@imt-nord-europe.fr pour plus d'informations.",
"unity_export_notavailable": "Attention, l'export de fichier pour l'application Unity n'est pas encore disponible dans cette version, seule l'édition du scénario en prévision est possible",
"unity_tooltip": "Utilisation dans un template de jeu précis. Contacter gaelle.guigon@imt-nord-europe.fr pour plus d'informations. Seules les tâches normale sont actives dans ce mode.",
"download_label": "Télécharger ce scénario",
"download_tooltip": "Télécharger une sauvegarde du scénario.",
"exportUnity_label": "Exporter un rôle",
"exportUnity_tooltip": "Exporter le rôle voulu au format lisible par l'application tierce. Contacter gaelle.guigon@imt-nord-europe.fr pour plus d'informations. Attention, un fichier exporté ne peut être utilisé pour recharger une sauvegarde du scénario dans RLG Maker.",
"upload_label": "Importer un scénario",
"upload_tooltip": "Importer une sauvegarde du scénario.",
"manual_label": "Télécharger le guide",
......@@ -40,6 +41,7 @@
"snackbar_roleName": "Attention, cet intitulé est déjà utilisé dans cette Mission",
"snackbar_moveOptionnalTask": "Veillez à garder les tâches alternatives groupées dans la même colonne",
"snackbar_deleteOptionnalTask": "Attention, les tâches alternatives vont au minimum par deux, veillez à ce que l'utilisateur ait toujours le choix entre plusieurs de ces tâches",
"snackbar_unity_exportFailed": "Export échoué, veillez à vérifier que tous les champs exportés soient bien remplis",
"siderTitle_game": "Jeu",
"siderTitle_mission": "Mission",
......@@ -231,6 +233,7 @@
"task_unity_exchangeObjects_receive_label": "A recevoir :",
"task_unity_name_label": "Nom :",
"task_unity_desc_label": "Descr :",
"task_unity_disabledTask_tooltip": "Tâche désactivée, seules les tâches normales sont activées en mode Unity",
"task_copy_snackbar": "Tâche copiée, rendez-vous dans un autre rôle pour le coller\nCertains champs ne sont pas copiés, veillez à vérifier manuellement les informations lors du collage",
"normalTask_title": "Tâche",
"normalTask_action_placeholder": "Positionner dans l'ordre les balises HTML principales",
......
......@@ -101,6 +101,36 @@ $highlight-color: #009b00;
border: 1px solid black;
}
select:disabled, button:disabled {
opacity: 0.5;
color: black !important;
}
.disabledTask {
background-color: #d3d3d3;
opacity: 0.6;
height: 400px;
position: absolute;
top: 0;
z-index: 100;
&-attach-right {
width: 40px;
height: 40px;
transform: translateY(-50%) rotate(45deg);
position: absolute;
right: -20px;
top: 200px;
background-color: #d3d3d3;
opacity: 0.6;
pointer-events: none;
z-index: 100;
clip-path: polygon(0 0, 100% 100%, 100% 0);
}
}
.snackbar-fail {
background-color: #de3e44;
color: white;
......
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