Mise en place de l'export foundry ; modification des Arc, chapitres et scènes..... => Suppression de la section maps pour arc, chapitres ; et dans scène on importe les maps format foundry (image / vidéo + json)
This commit is contained in:
@@ -38,16 +38,40 @@
|
||||
<small class="field-hint">{{ 'sceneEdit.illustrationsHint' | translate }}</small>
|
||||
</div>
|
||||
|
||||
<!-- Cartes & plans (galerie editable, rendu maps) -->
|
||||
<!-- Battlemap Foundry : media + sidecar JSON Universal VTT (non affichee, export only) -->
|
||||
<div class="field">
|
||||
<label>{{ 'sceneEdit.mapsLabel' | translate }}</label>
|
||||
<app-image-gallery
|
||||
[imageIds]="mapImageIds"
|
||||
[editable]="true"
|
||||
[layout]="'MAPS'"
|
||||
(imageIdsChange)="mapImageIds = $event">
|
||||
</app-image-gallery>
|
||||
<small class="field-hint">{{ 'sceneEdit.mapsHint' | translate }}</small>
|
||||
<label>{{ 'sceneEdit.battlemapLabel' | translate }}</label>
|
||||
<small class="field-hint">{{ 'sceneEdit.battlemapHint' | translate }}</small>
|
||||
|
||||
<div class="battlemap-slot">
|
||||
<span class="battlemap-slot-label">{{ 'sceneEdit.battlemapMedia' | translate }}</span>
|
||||
@if (battlemapMediaFileId) {
|
||||
<span class="battlemap-file">{{ battlemapMediaName || ('sceneEdit.battlemapAttached' | translate) }}</span>
|
||||
<button type="button" class="battlemap-remove" (click)="removeBattlemapMedia()">
|
||||
{{ 'sceneEdit.battlemapRemove' | translate }}
|
||||
</button>
|
||||
} @else {
|
||||
<label class="battlemap-pick">
|
||||
{{ (battlemapUploadingMedia ? 'sceneEdit.battlemapUploading' : 'sceneEdit.battlemapChoose') | translate }}
|
||||
<input type="file" accept="image/*,video/mp4,video/webm" hidden (change)="onBattlemapMediaSelected($event)" />
|
||||
</label>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="battlemap-slot">
|
||||
<span class="battlemap-slot-label">{{ 'sceneEdit.battlemapData' | translate }}</span>
|
||||
@if (battlemapDataFileId) {
|
||||
<span class="battlemap-file">{{ battlemapDataName || ('sceneEdit.battlemapAttached' | translate) }}</span>
|
||||
<button type="button" class="battlemap-remove" (click)="removeBattlemapData()">
|
||||
{{ 'sceneEdit.battlemapRemove' | translate }}
|
||||
</button>
|
||||
} @else {
|
||||
<label class="battlemap-pick">
|
||||
{{ (battlemapUploadingData ? 'sceneEdit.battlemapUploading' : 'sceneEdit.battlemapChoose') | translate }}
|
||||
<input type="file" accept=".json,.dd2vtt,.uvtt,application/json" hidden (change)="onBattlemapDataSelected($event)" />
|
||||
</label>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
|
||||
@@ -3,6 +3,44 @@
|
||||
max-width: 760px;
|
||||
}
|
||||
|
||||
// Widget battlemap (export Foundry) : deux emplacements media + sidecar JSON.
|
||||
.battlemap-slot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.5rem 0;
|
||||
|
||||
.battlemap-slot-label {
|
||||
min-width: 160px;
|
||||
font-size: 0.9rem;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.battlemap-file {
|
||||
font-size: 0.9rem;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.battlemap-pick {
|
||||
cursor: pointer;
|
||||
padding: 0.35rem 0.75rem;
|
||||
border: 1px dashed currentColor;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.battlemap-remove {
|
||||
background: none;
|
||||
border: none;
|
||||
color: inherit;
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
// Header local : titre à gauche, actions (Assistant IA) à droite.
|
||||
.page-header {
|
||||
display: flex;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { switchMap } from 'rxjs/operators';
|
||||
import { LucideAngularModule, Trash2, Sparkles } from 'lucide-angular';
|
||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { CampaignService } from '../../../services/campaign.service';
|
||||
import { StoredFileService } from '../../../services/stored-file.service';
|
||||
import { CharacterService } from '../../../services/character.service';
|
||||
import { NpcService } from '../../../services/npc.service';
|
||||
import { RandomTableService } from '../../../services/random-table.service';
|
||||
@@ -70,7 +71,14 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
availableEnemies: Enemy[] = [];
|
||||
enemyIds: string[] = [];
|
||||
illustrationImageIds: string[] = [];
|
||||
mapImageIds: string[] = [];
|
||||
|
||||
/** Battlemap Foundry : paire { media + sidecar JSON Universal VTT }. Non affichee. */
|
||||
battlemapMediaFileId: string | null = null;
|
||||
battlemapDataFileId: string | null = null;
|
||||
battlemapMediaName: string | null = null;
|
||||
battlemapDataName: string | null = null;
|
||||
battlemapUploadingMedia = false;
|
||||
battlemapUploadingData = false;
|
||||
|
||||
/** Scènes du chapitre courant (hors scène éditée) — alimente le dropdown des cibles. */
|
||||
siblingScenes: Scene[] = [];
|
||||
@@ -87,6 +95,7 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private campaignService: CampaignService,
|
||||
private storedFileService: StoredFileService,
|
||||
private characterService: CharacterService,
|
||||
private npcService: NpcService,
|
||||
private randomTableService: RandomTableService,
|
||||
@@ -161,7 +170,18 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
this.enemyIds = [...(scene.enemyIds ?? [])];
|
||||
this.selectedIcon = scene.icon ?? null;
|
||||
this.illustrationImageIds = [...(scene.illustrationImageIds ?? [])];
|
||||
this.mapImageIds = [...(scene.mapImageIds ?? [])];
|
||||
this.battlemapMediaFileId = scene.battlemapMediaFileId ?? null;
|
||||
this.battlemapDataFileId = scene.battlemapDataFileId ?? null;
|
||||
this.battlemapMediaName = null;
|
||||
this.battlemapDataName = null;
|
||||
if (this.battlemapMediaFileId) {
|
||||
this.storedFileService.getById(this.battlemapMediaFileId)
|
||||
.subscribe({ next: f => this.battlemapMediaName = f.filename, error: () => {} });
|
||||
}
|
||||
if (this.battlemapDataFileId) {
|
||||
this.storedFileService.getById(this.battlemapDataFileId)
|
||||
.subscribe({ next: f => this.battlemapDataName = f.filename, error: () => {} });
|
||||
}
|
||||
this.siblingScenes = chapterScenes.filter(s => s.id !== this.sceneId);
|
||||
this.branches = (scene.branches ?? []).map(b => ({ ...b }));
|
||||
this.rooms = (scene.rooms ?? []).map(r => ({ ...r, branches: [...(r.branches ?? [])] }));
|
||||
@@ -200,7 +220,8 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
enemyIds: this.enemyIds,
|
||||
relatedPageIds: this.relatedPageIds,
|
||||
illustrationImageIds: this.illustrationImageIds,
|
||||
mapImageIds: this.mapImageIds,
|
||||
battlemapMediaFileId: this.battlemapMediaFileId,
|
||||
battlemapDataFileId: this.battlemapDataFileId,
|
||||
branches: this.branches,
|
||||
rooms: this.rooms,
|
||||
icon: this.selectedIcon
|
||||
@@ -253,6 +274,53 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
this.branches[index].condition = value;
|
||||
}
|
||||
|
||||
// ─────────────── Battlemap Foundry (media + sidecar JSON) ───────────────
|
||||
// On NE supprime PAS le binaire au "retirer" (juste la reference locale) :
|
||||
// si l'utilisateur annule le formulaire, la scene garde son fichier intact.
|
||||
// Le binaire orphelin eventuel est inoffensif (nettoyage ulterieur possible).
|
||||
|
||||
onBattlemapMediaSelected(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
this.battlemapUploadingMedia = true;
|
||||
this.storedFileService.upload(file).subscribe({
|
||||
next: f => {
|
||||
this.battlemapMediaFileId = f.id;
|
||||
this.battlemapMediaName = f.filename;
|
||||
this.battlemapUploadingMedia = false;
|
||||
},
|
||||
error: () => { this.battlemapUploadingMedia = false; }
|
||||
});
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
onBattlemapDataSelected(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
this.battlemapUploadingData = true;
|
||||
this.storedFileService.upload(file).subscribe({
|
||||
next: f => {
|
||||
this.battlemapDataFileId = f.id;
|
||||
this.battlemapDataName = f.filename;
|
||||
this.battlemapUploadingData = false;
|
||||
},
|
||||
error: () => { this.battlemapUploadingData = false; }
|
||||
});
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
removeBattlemapMedia(): void {
|
||||
this.battlemapMediaFileId = null;
|
||||
this.battlemapMediaName = null;
|
||||
}
|
||||
|
||||
removeBattlemapData(): void {
|
||||
this.battlemapDataFileId = null;
|
||||
this.battlemapDataName = null;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
// Volontairement vide : la sidebar reste prise en charge par le composant
|
||||
// suivant (autre sous-route ou le composant detail parent) qui appellera
|
||||
|
||||
Reference in New Issue
Block a user