コード例 #1
0
def post_start_game(source):
    """
    Puts an STARTGAME event on the event queue.
    
    Fields:
    type: STARTGAME
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":STARTGAME, "source":source}))
コード例 #2
0
def post_end_game(source):
    """
    Puts an ENDGAME event on the event queue.
    
    Fields:
    type: ENDGAME
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":ENDGAME, "source":source}))
コード例 #3
0
def post_end_turn(source, player_id):
    """
    Puts ENDTURN event on the pygame event queue.
    
    Fields:
    type    : ENDTURN
    playerid: id of the player who ended turn
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":ENDTURN, "source":source, "playerid":player_id}))
コード例 #4
0
def post_new_turn(source, player_id):
    """
    Puts NEWTURN event on the pygame event queue.
    
    Fields:
    type    : NEWTURN
    playerid: id of the player who start new turn.
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":NEWTURN, "source":source, "playerid":player_id}))
コード例 #5
0
def post_drop_dice(source, data):
    """
    Puts an DROPDICE event on the event queue.
    
    Fields:
    type : DROPDICE
    data : {landid: num_of_dices}
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":DROPDICE, "source":source, "data":data}))
コード例 #6
0
def post_chatmsg(source, msg):
    """
    Puts a new chat message on the eventqueue.
    
    Fields:
    type : CHATMSG
    msg  : text
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":CHATMSG, "source":source, "msg":msg}))
コード例 #7
0
def post_player_win(source, player_id):
    """
    Puts an PLAYERWIN event on the event queue
    
    Fields:
    type    : PLAYERWIN
    playerid: id of the player which is dead
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":PLAYERWIN, "source":source, \
                                               "playerid":player_id}))
コード例 #8
0
def post_gamestate_update(source, aggressor_id, defensor_id):
    """
    Puts ad GSUPDATE event on the event queue.
    
    Fields:
    type: GSUPDATE
    """
    print "eventtypes: post game state update"
    pygame_event_post(pygame_event(USEREVENT, {"usertype":GSUPDATE, "source":source, \
                                              "aggressorid":aggressor_id,
                                              "defensorid":defensor_id}))
コード例 #9
0
def post_select_result(source, land_id, result):
    """
    Puts SELECTRESULT event on the pygame event queue.
    
    Fields:
    type    : SELECTRESULT
    landid  : id of the land which was selected
    ressult : 0=select, 1=deselect
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":SELECTRESULT, "source":source, \
                                                  "landid":land_id, \
                                                  "result":result}))
コード例 #10
0
def post_select_land(source, player_id, land_id):
    """
    Puts SELECT event on the pygame event queue.
    
    Fields:
    type    : SELECT
    playerid: id of player
    landid  : id of the land which was selected
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":SELECT, "source":source, \
                                            "playerid":player_id, \
                                            "landid":land_id}))
コード例 #11
0
def post_attack_result(source, aggresor_id, defensor_id, results):
    """
    Puts ATTACKRESULT event on the pygame event queue.
    
    Fields:
    type        : ATTACKRESULT
    aggressorid : land id which is attacking
    defensorid  : land id which is defensing
    results     : result of the attack -> ((dice pips, sum),(dice pips, sum))
    """
    pygame_event_post(pygame_event(USEREVENT, {"usertype":ATTACKRESULT, "source":source, \
                                                  "aggressorid":aggresor_id,\
                                                  "defensorid":defensor_id,\
                                                  "results":results}))