merged broken branches client with master branch and added first statehandling for card placement

This commit is contained in:
2024-01-08 20:07:29 +01:00
parent 8f90633b16
commit 677552a617
53 changed files with 344 additions and 224 deletions

View File

@ -1,27 +1,37 @@
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
class TCPEventHandler:
def __init__(self, socket:socket):
self.tcp_socket = socket
def handleEvents(self, message):
def handleEvents(self, message, inputHandler:InputHandler, world:World):
if message["event"] == "login":
# todo: handle login response here
pass
elif message["event"] == "startgame":
# todo: handle starting the game here
print("game starts")
print("gamestart")
GameStart(world, message["hand"], inputHandler, world.getPlayer())
pass
class UDPEventHandler:
def __init__(self, socket:socket):
self.udp_socket = socket
def handleEvents(self, message):
if message["event"] == "PlaceCard":
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":
CardMoved(
world,
message["card"],
message["type"],
message["owner"],
pygame.Vector2(int(message["old_x"]), int(message["old_y"])),
pygame.Vector2(int(message["new_x"]), int(message["new_y"])),
inputHandler)
pass
elif message["event"] == "RemoveCard":
pass