stripped game specific logic from engine started working on engine approach

This commit is contained in:
2024-02-28 21:18:11 +01:00
parent 57621537c4
commit f82d0145dd
12 changed files with 2 additions and 795 deletions

View File

@ -2,40 +2,10 @@ import socket
import pygame
from Classes.Game.Events.PlaceCard import CardPlaced
from Classes.System.Components.InputHandler import InputHandler
from Classes.Game.World import World
from Classes.Game.Events.GameStart import GameStart
from Classes.Game.Player import Player
from Classes.Game.Events.Login import LoginResponse
class TCPEventHandler:
def __init__(self, socket:socket):
self.tcp_socket = socket
def handleEvents(self, message, inputHandler:InputHandler, world:World):
print(message)
if message["event"] == "loginresponse":
LoginResponse(message, world)
pass
elif message["event"] == "startgame":
print(world.player)
# world.player.setMana(message["player"]["mana"])
# world.player.setHp(message["player"]["hp"])
GameStart(world, message["player"]["hand"], inputHandler, world.getPlayer(), Player(message["enemy"]["hp"],0,message["enemy"]["name"], message["enemy"]["id"]))
pass
elif message["event"] == "placecard":
CardPlaced(world, message["card"], message["type"], message["owner"], pygame.Vector2(int(message["x"]), int(message["y"]), inputHandler))
pass
elif message["event"] == "MoveCard":
pass
elif message["event"] == "RemoveCard":
pass
elif message["event"] == "AttackCard":
pass
elif message["event"] == "AttackPlayer":
pass
elif message["event"] == "ActivateEffectCard":
pass
elif message["event"] == "ActivateMonsterCard":
pass
def handleEvents(self, message, inputHandler:InputHandler):
pass