Finished sprite CRUD in asset manager, removed unused DB field, renamed files for consistency

This commit is contained in:
Dennis Postma 2024-07-23 00:16:25 +02:00
parent bea76e9ace
commit 7531385912
16 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `isAnimated` on the `Sprite` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE `Sprite` DROP COLUMN `isAnimated`;

View File

@ -27,7 +27,6 @@ model Sprite {
frameSpeed Int @default(0) frameSpeed Int @default(0)
frameWidth Int @default(0) frameWidth Int @default(0)
frameHeight Int @default(0) frameHeight Int @default(0)
isAnimated Boolean @default(false)
isLooping Boolean @default(false) isLooping Boolean @default(false)
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt

View File

@ -7,6 +7,10 @@ type Payload = {
name: string name: string
origin_x: number origin_x: number
origin_y: number origin_y: number
frameSpeed: number
frameWidth: number
frameHeight: number
isLooping: boolean
} }
/** /**
@ -28,7 +32,11 @@ export default function (socket: TSocket, io: Server) {
data: { data: {
name: data.name, name: data.name,
origin_x: data.origin_x, origin_x: data.origin_x,
origin_y: data.origin_y origin_y: data.origin_y,
frameSpeed: data.frameSpeed,
frameWidth: data.frameWidth,
frameHeight: data.frameHeight,
isLooping: data.isLooping
} }
}) })

View File

@ -10,6 +10,7 @@ interface IPayload {
width: number width: number
height: number height: number
tiles: string[][] tiles: string[][]
pvp: boolean
zoneEventTiles: ZoneEventTile[] zoneEventTiles: ZoneEventTile[]
zoneObjects: ZoneObject[] zoneObjects: ZoneObject[]
} }
@ -41,6 +42,8 @@ export default function (socket: TSocket, io: Server) {
return return
} }
console.log(data);
await prisma.zone.update({ await prisma.zone.update({
where: { where: {
id: data.zoneId id: data.zoneId
@ -50,6 +53,7 @@ export default function (socket: TSocket, io: Server) {
width: data.width, width: data.width,
height: data.height, height: data.height,
tiles: data.tiles, tiles: data.tiles,
pvp: data.pvp,
zoneEventTiles: { zoneEventTiles: {
deleteMany: { deleteMany: {
zoneId: data.zoneId // Ensure only event tiles related to the zone are deleted zoneId: data.zoneId // Ensure only event tiles related to the zone are deleted