Änderung: Bereinigung und Optimierung der Taxi-Map-Logik

Änderungen:
- Entfernen der Methode `getMapByPosition` aus dem `TaxiMapController` und der zugehörigen Logik im `TaxiMapService`, um die Komplexität zu reduzieren.
- Anpassung der Datenbankmodelle für `TaxiMap`, `TaxiLevelStats` und `TaxiMapType`, um die Tabellennamen zu vereinheitlichen.
- Aktualisierung der Routen im `taxiMapRouter`, um die entfernte Funktionalität zu reflektieren.
- Hinzufügung von neuen Importen in `index.js`, um die neuen Modelle zu integrieren.
- Verbesserung der Benutzeroberfläche durch neue Erfolgsmeldungen in den Übersetzungsdateien für die Admin-Oberfläche.

Diese Anpassungen tragen zur Vereinfachung der Codebasis und zur Verbesserung der Benutzererfahrung im Taxi-Minispiel bei.
This commit is contained in:
Torsten Schulz (local)
2025-09-15 19:28:57 +02:00
parent f343509d85
commit 935928af75
12 changed files with 35 additions and 172 deletions

View File

@@ -8,7 +8,7 @@
<SimpleTabs v-model="activeTab" :tabs="tabs" />
<!-- Map bearbeiten Tab -->
<!-- {{ $t('admin.taxiTools.mapEditor.title') }} Tab -->
<div v-if="activeTab === 'map-editor'" class="taxi-tools-admin">
<div class="section-header">
<h2>{{ $t('admin.taxiTools.mapEditor.title') }}</h2>
@@ -68,14 +68,6 @@
<div class="map-editor-container">
<!-- Spielbrett (links) -->
<div class="game-board">
<div class="board-info">
<p>Größe: {{ boardWidth }}x{{ boardHeight }}</p>
<p>Position: ({{ minX }}, {{ minY }}) - ({{ maxX }}, {{ maxY }})</p>
<div v-if="selectedCellKey" class="selection-info">
<p><strong>Ausgewählte Position:</strong> ({{ getCellPosition(selectedCellKey).x }}, {{ getCellPosition(selectedCellKey).y }})</p>
<p>Wählen Sie rechts ein Tile aus, um es hier zu platzieren.</p>
</div>
</div>
<div class="board-grid" :style="boardGridStyle">
<div
v-for="y in range(minY, maxY)"
@@ -96,7 +88,6 @@
:alt="getCellAtPosition(x, y).tileType"
class="tile-image"
/>
<div v-else class="position-label">{{x}},{{y}}</div>
</div>
</div>
</div>
@@ -171,14 +162,6 @@
<div class="map-editor-container">
<!-- Spielbrett (links) -->
<div class="game-board">
<div class="board-info">
<p>Größe: {{ boardWidth }}x{{ boardHeight }}</p>
<p>Position: ({{ minX }}, {{ minY }}) - ({{ maxX }}, {{ maxY }})</p>
<div v-if="selectedCellKey" class="selection-info">
<p><strong>Ausgewählte Position:</strong> ({{ getCellPosition(selectedCellKey).x }}, {{ getCellPosition(selectedCellKey).y }})</p>
<p>Wählen Sie rechts ein Tile aus, um es hier zu platzieren.</p>
</div>
</div>
<div class="board-grid" :style="boardGridStyle">
<div
v-for="y in range(minY, maxY)"
@@ -199,7 +182,6 @@
:alt="getCellAtPosition(x, y).tileType"
class="tile-image"
/>
<div v-else class="position-label">{{x}},{{y}}</div>
</div>
</div>
</div>
@@ -240,17 +222,22 @@
</div>
</div>
</div>
<!-- Message Dialog -->
<MessageDialog ref="messageDialog" />
</div>
</template>
<script>
import SimpleTabs from '../../components/SimpleTabs.vue';
import MessageDialog from '../../dialogues/standard/MessageDialog.vue';
import apiClient from '../../utils/axios.js';
export default {
name: 'AdminTaxiToolsView',
components: {
SimpleTabs
SimpleTabs,
MessageDialog
},
data() {
return {
@@ -487,9 +474,6 @@ export default {
},
getRelevantNeighbors(x, y, tileType) {
console.log('=== getRelevantNeighbors DEBUG ===');
console.log('Getting neighbors for tile:', tileType, 'at position:', { x, y });
const neighbors = [];
switch (tileType) {
@@ -550,9 +534,6 @@ export default {
return [];
}
console.log('Relevant neighbors calculated:', neighbors);
console.log('=====================================');
return neighbors;
},
@@ -684,19 +665,6 @@ export default {
return mapData;
},
calculatePosition() {
if (Object.keys(this.boardCells).length === 0) {
return { x: 1, y: 1 };
}
// Position basiert auf dem ersten platzierten Tile
const firstTile = Object.values(this.boardCells).find(cell => cell.tileType);
if (firstTile) {
return { x: firstTile.x, y: firstTile.y };
}
return { x: this.minX, y: this.minY };
},
cancelEdit() {
this.editingMap = null;
@@ -713,20 +681,19 @@ export default {
async saveMap() {
try {
const position = this.calculatePosition();
const mapData = {
...this.mapForm,
width: this.boardWidth,
height: this.boardHeight,
tileSize: 50,
positionX: position.x,
positionY: position.y,
mapTypeId: 1, // Standard Map-Typ
mapData: this.generateMapData()
};
let savedMap;
if (this.selectedMapId !== 'new') {
const isUpdate = this.selectedMapId !== 'new';
if (isUpdate) {
// Map aktualisieren
const response = await apiClient.put(`/api/taxi-maps/maps/${this.selectedMapId}`, mapData);
savedMap = response.data.data;
@@ -741,6 +708,10 @@ export default {
this.selectedCellKey = null;
this.selectedTileType = null;
this.loadMaps();
// Erfolgsmeldung anzeigen
const message = isUpdate ? 'admin.taxiTools.mapEditor.updateSuccess' : 'admin.taxiTools.mapEditor.createSuccess';
this.$refs.messageDialog.open(`tr:${message}`);
} catch (error) {
console.error('Fehler beim Speichern der Map:', error);
alert('Fehler beim Speichern der Map');
@@ -752,6 +723,9 @@ export default {
try {
await apiClient.delete(`/api/taxi-maps/maps/${mapId}`);
this.loadMaps();
// Erfolgsmeldung anzeigen
this.$refs.messageDialog.open('tr:admin.taxiTools.mapEditor.deleteSuccess');
} catch (error) {
console.error('Fehler beim Löschen der Map:', error);
}
@@ -897,32 +871,6 @@ export default {
max-width: 600px;
}
.board-info {
margin-bottom: 10px;
padding: 10px;
background: #f0f0f0;
border-radius: 4px;
font-size: 14px;
color: #666;
}
.board-info p {
margin: 2px 0;
}
.selection-info {
margin-top: 10px;
padding: 8px;
background: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 4px;
font-size: 13px;
}
.selection-info p {
margin: 2px 0;
color: #856404;
}
.board-grid {
border: 2px solid #333;
@@ -953,11 +901,6 @@ export default {
transform: scale(1.05);
}
.position-label {
font-size: 10px;
color: #666;
font-weight: bold;
}
.board-cell.selected {
border: 3px solid #ffd700; /* Gelb für ausgewählte Zelle */