merged broken branches client with master branch and added first statehandling for card placement
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import pygame
|
||||
from Classes.Game.World import World
|
||||
from Classes.System.Network.NetworkManager import NetworkManager
|
||||
from Classes.System.Components.InputHandler import InputHandler
|
||||
|
||||
# the event the client sends to the server when it places a card
|
||||
def PlaceCard(networkManager: NetworkManager, card):
|
||||
def PlaceCard(tcpClient, card):
|
||||
# todo: send card information to the server
|
||||
# todo: required info is:
|
||||
# - position
|
||||
@@ -12,12 +12,24 @@ def PlaceCard(networkManager: NetworkManager, card):
|
||||
payload = {
|
||||
"event":"placecard",
|
||||
"card": card.getID(),
|
||||
"type": card.getType(),
|
||||
"pos": card.getPos(),
|
||||
}
|
||||
|
||||
networkManager.udp.send(payload)
|
||||
tcpClient.send(payload)
|
||||
|
||||
# the event send from the server to display a card on the field
|
||||
def CardPlaced(world:World, card:int, pos:pygame.Vector2):
|
||||
|
||||
def CardPlaced(world:World, card:int, type:str, owner:str, pos:pygame.Vector2, inputHandler:InputHandler):
|
||||
if type == "MonsterCard":
|
||||
world.spawnMonsterCard(f"Assets/Cards/{card}/", pos, inputHandler, owner)
|
||||
pass
|
||||
elif type == "SpellCard":
|
||||
world.spawnSpellCard(f"Assets/Cards/{card}/", pos, inputHandler, owner)
|
||||
pass
|
||||
elif type == "TrapCard":
|
||||
world.spawmTrapCard(f"Assets/Cards/{card}/", pos, inputHandler, owner)
|
||||
pass
|
||||
pass
|
||||
|
||||
def MovedCard(world:World, card:int, type:str, owner:str, oldPos:pygame.Vector2, newPos:pygame.Vector2, inputHandler:InputHandler):
|
||||
pass
|
||||
Reference in New Issue
Block a user