Änderung: Erweiterung der Taxi-Map-Logik und Verbesserung der Benutzeroberfläche
Änderungen: - Hinzufügung neuer Modelle für TaxiMapTile, TaxiStreetName und TaxiMapTileStreet zur Unterstützung der Tile- und Straßennamen-Logik. - Anpassung der TaxiMap- und TaxiMapService-Logik zur Verwaltung von Tiles und Straßennamen. - Implementierung von Methoden zur Upsert-Logik für Tiles und Straßennamen in der TaxiMapService. - Verbesserung der Benutzeroberfläche in TaxiToolsView.vue zur Anzeige und Bearbeitung von Straßennamen und zusätzlichen Elementen. Diese Anpassungen verbessern die Funktionalität und Benutzererfahrung im Taxi-Minispiel erheblich, indem sie eine detailliertere Verwaltung von Karten und Straßennamen ermöglichen.
This commit is contained in:
@@ -106,6 +106,9 @@ import TaxiGameState from './taxi/taxiGameState.js';
|
||||
import TaxiLevelStats from './taxi/taxiLevelStats.js';
|
||||
import TaxiMapType from './taxi/taxiMapType.js';
|
||||
import TaxiMap from './taxi/taxiMap.js';
|
||||
import TaxiMapTile from './taxi/taxiMapTile.js';
|
||||
import TaxiStreetName from './taxi/taxiStreetName.js';
|
||||
import TaxiMapTileStreet from './taxi/taxiMapTileStreet.js';
|
||||
|
||||
export default function setupAssociations() {
|
||||
// RoomType 1:n Room
|
||||
@@ -801,4 +804,15 @@ export default function setupAssociations() {
|
||||
// Taxi Map associations
|
||||
TaxiMap.belongsTo(TaxiMapType, { foreignKey: 'mapTypeId', as: 'mapType' });
|
||||
TaxiMapType.hasMany(TaxiMap, { foreignKey: 'mapTypeId', as: 'maps' });
|
||||
|
||||
// Tiles
|
||||
TaxiMap.hasMany(TaxiMapTile, { foreignKey: 'mapId', as: 'tiles' });
|
||||
TaxiMapTile.belongsTo(TaxiMap, { foreignKey: 'mapId', as: 'map' });
|
||||
|
||||
// Street name models
|
||||
TaxiMapTileStreet.belongsTo(TaxiMap, { foreignKey: 'map_id', as: 'map' });
|
||||
TaxiMap.hasMany(TaxiMapTileStreet, { foreignKey: 'map_id', as: 'tileStreets' });
|
||||
|
||||
TaxiMapTileStreet.belongsTo(TaxiStreetName, { foreignKey: 'street_name_h_id', as: 'streetNameH' });
|
||||
TaxiMapTileStreet.belongsTo(TaxiStreetName, { foreignKey: 'street_name_v_id', as: 'streetNameV' });
|
||||
}
|
||||
|
||||
@@ -5,14 +5,18 @@ const ChatRight = sequelize.define('ChatRight', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true},
|
||||
autoIncrement: true
|
||||
},
|
||||
tr: {
|
||||
type: DataTypes.STRING(32),
|
||||
allowNull: false,
|
||||
unique: true}}, {
|
||||
unique: true
|
||||
}
|
||||
}, {
|
||||
schema: 'chat',
|
||||
tableName: 'rights',
|
||||
timestamps: false,
|
||||
underscored: true});
|
||||
underscored: true
|
||||
});
|
||||
|
||||
export default ChatRight;
|
||||
|
||||
@@ -96,9 +96,7 @@ import Match3UserProgress from './match3/userProgress.js';
|
||||
import Match3UserLevelProgress from './match3/userLevelProgress.js';
|
||||
|
||||
// — Taxi Minigame —
|
||||
import { TaxiGameState, TaxiLevelStats } from './taxi/index.js';
|
||||
import TaxiMap from './taxi/taxiMap.js';
|
||||
import TaxiMapType from './taxi/taxiMapType.js';
|
||||
import { TaxiGameState, TaxiLevelStats, TaxiMapType, TaxiMap, TaxiMapTile, TaxiStreetName, TaxiMapTileStreet } from './taxi/index.js';
|
||||
|
||||
// — Politische Ämter (Politics) —
|
||||
import PoliticalOfficeType from './falukant/type/political_office_type.js';
|
||||
@@ -241,6 +239,9 @@ const models = {
|
||||
TaxiLevelStats,
|
||||
TaxiMap,
|
||||
TaxiMapType,
|
||||
TaxiMapTile,
|
||||
TaxiStreetName,
|
||||
TaxiMapTileStreet,
|
||||
};
|
||||
|
||||
export default models;
|
||||
|
||||
@@ -2,5 +2,8 @@ import TaxiGameState from './taxiGameState.js';
|
||||
import TaxiLevelStats from './taxiLevelStats.js';
|
||||
import TaxiMapType from './taxiMapType.js';
|
||||
import TaxiMap from './taxiMap.js';
|
||||
import TaxiMapTile from './taxiMapTile.js';
|
||||
import TaxiStreetName from './taxiStreetName.js';
|
||||
import TaxiMapTileStreet from './taxiMapTileStreet.js';
|
||||
|
||||
export { TaxiGameState, TaxiLevelStats, TaxiMapType, TaxiMap };
|
||||
export { TaxiGameState, TaxiLevelStats, TaxiMapType, TaxiMap, TaxiMapTile, TaxiStreetName, TaxiMapTileStreet };
|
||||
|
||||
@@ -41,20 +41,12 @@ const TaxiGameState = sequelize.define('TaxiGameState', {
|
||||
allowNull: false,
|
||||
defaultValue: []
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
},
|
||||
updatedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
}
|
||||
// createdAt/updatedAt via timestamps
|
||||
}, {
|
||||
tableName: 'taxi_game_state',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{
|
||||
unique: true,
|
||||
|
||||
@@ -45,20 +45,12 @@ const TaxiLevelStats = sequelize.define('TaxiLevelStats', {
|
||||
allowNull: true,
|
||||
comment: 'Play time in seconds'
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
},
|
||||
updatedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
}
|
||||
// createdAt/updatedAt via timestamps
|
||||
}, {
|
||||
tableName: 'taxi_level_stat',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{
|
||||
unique: true,
|
||||
|
||||
@@ -38,11 +38,6 @@ const TaxiMap = sequelize.define('TaxiMap', {
|
||||
allowNull: false,
|
||||
comment: 'Reference to TaxiMapType'
|
||||
},
|
||||
mapData: {
|
||||
type: DataTypes.JSON,
|
||||
allowNull: false,
|
||||
comment: '2D array of map type IDs for each tile position'
|
||||
},
|
||||
isActive: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
@@ -54,20 +49,12 @@ const TaxiMap = sequelize.define('TaxiMap', {
|
||||
defaultValue: false,
|
||||
comment: 'Whether this is the default map for new games'
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
},
|
||||
updatedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
}
|
||||
// createdAt/updatedAt via timestamps
|
||||
}, {
|
||||
tableName: 'taxi_map',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{
|
||||
fields: ['name']
|
||||
|
||||
44
backend/models/taxi/taxiMapTile.js
Normal file
44
backend/models/taxi/taxiMapTile.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import { DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
|
||||
const TaxiMapTile = sequelize.define('TaxiMapTile', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
mapId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
x: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
y: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
tileType: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false,
|
||||
},
|
||||
meta: {
|
||||
type: DataTypes.JSON,
|
||||
allowNull: true,
|
||||
}
|
||||
}, {
|
||||
tableName: 'taxi_map_tile',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{ unique: true, fields: ['map_id','x','y'] },
|
||||
{ fields: ['map_id'] },
|
||||
{ fields: ['tile_type'] },
|
||||
]
|
||||
});
|
||||
|
||||
export default TaxiMapTile;
|
||||
|
||||
|
||||
45
backend/models/taxi/taxiMapTileStreet.js
Normal file
45
backend/models/taxi/taxiMapTileStreet.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import { DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
|
||||
const TaxiMapTileStreet = sequelize.define('TaxiMapTileStreet', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
mapId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
x: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
y: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
streetNameHId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
},
|
||||
streetNameVId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
}
|
||||
}, {
|
||||
tableName: 'taxi_map_tile_street',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{ unique: true, fields: ['map_id','x','y'] },
|
||||
{ fields: ['map_id'] },
|
||||
{ fields: ['street_name_h_id'] },
|
||||
{ fields: ['street_name_v_id'] }
|
||||
]
|
||||
});
|
||||
|
||||
export default TaxiMapTileStreet;
|
||||
|
||||
|
||||
@@ -26,20 +26,12 @@ const TaxiMapType = sequelize.define('TaxiMapType', {
|
||||
allowNull: false,
|
||||
defaultValue: true
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
},
|
||||
updatedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
}
|
||||
// createdAt/updatedAt via timestamps
|
||||
}, {
|
||||
tableName: 'taxi_map_type',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{
|
||||
unique: true,
|
||||
|
||||
24
backend/models/taxi/taxiStreetName.js
Normal file
24
backend/models/taxi/taxiStreetName.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
|
||||
const TaxiStreetName = sequelize.define('TaxiStreetName', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
}
|
||||
}, {
|
||||
tableName: 'taxi_street_name',
|
||||
schema: 'taxi',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
});
|
||||
|
||||
export default TaxiStreetName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user