Exemplo n.º 1
0
def add_buttons(picasso):
    datastore = Datastore()
    next_button = assets.clickable.ClickableAsset(
        100, 500, 100, 100, 'NEXT')
    datastore.add_entry('next', next_button, 'buttons')

    for button in datastore.get_storage('buttons').values():
        picasso.add_asset('1_buttons', button)
Exemplo n.º 2
0
def initialize_other_graphic_assets(picasso, game_master):
    datastore = Datastore()
    current_player_asset = assets.text.CurrentPlayerAsset(
            100, 100, game_master)
    picasso.add_asset('4_current_player', current_player_asset)
    datastore.add_entry('current_player', current_player_asset)
    feedback_asset = assets.text.TextAsset(100, 650, 
            'choose territory to attack')
    datastore.add_entry('attack_feedback', feedback_asset)
Exemplo n.º 3
0
def add_buttons(picasso):
    datastore = Datastore()
    #next_button = assets.clickable.ClickableAsset(
    #    1000, 635, 120, 65, 'NEXT')
    next_button = assets.clickable.ImageButtonAsset(
        1000, 635, 'assets/art/gui/button_next_up.png',
        'assets/art/gui/button_next_down.png')
    datastore.add_entry('next', next_button, 'buttons')

    for button in datastore.get_storage('buttons').values():
        picasso.add_asset('1_buttons', button)
Exemplo n.º 4
0
def add_buttons(picasso):
    datastore = Datastore()
    #next_button = assets.clickable.ClickableAsset(
    #    1000, 635, 120, 65, 'NEXT')
    next_button = assets.clickable.ImageButtonAsset(
        1000, 635,
        'assets/art/gui/button_next_up.png',
        'assets/art/gui/button_next_down.png'
    )
    datastore.add_entry('next', next_button, 'buttons')

    for button in datastore.get_storage('buttons').values():
        picasso.add_asset('1_buttons', button)
Exemplo n.º 5
0
def add_state_indicators(picasso, game_master):
    datastore = Datastore()
    pos_x = 867
    state_indicators = {
        'reinforce': (pos_x, 548),
        'attack': (pos_x, 600),
        'fortify': (pos_x, 652),
    }
    for state, coordinate in state_indicators.iteritems():
        asset = assets.image.ToggleImageAsset(coordinate[0], coordinate[1],
            "assets/art/gui/button_%s_highlight.png" % state)
        datastore.add_entry(state, asset, 'states')
        picasso.add_asset(UI_OVERLAY_LEVEL0, asset)
Exemplo n.º 6
0
def initialize_territories(picasso, game_master):
    datastore = Datastore()
    for continent, territories in game_master.board.continents.iteritems():
        for territory_name, territory in territories.iteritems():
            coordinate = territory_coordinates[continent][territory_name]
            graphic_asset = build_territory_asset(continent, territory, coordinate[0], coordinate[1])
            army_count_asset = assets.territory.ArmyCountAsset(graphic_asset)
            picasso.add_asset('3_territories', graphic_asset)
            picasso.add_asset('4_army_count', army_count_asset)
            
            datastore.add_entry(territory_name, graphic_asset, 'territories')
    risk.logger.debug("assigning player colours")
    build_player_colour_mapping(game_master.players)
Exemplo n.º 7
0
def add_state_indicators(picasso, game_master):
    datastore = Datastore()
    pos_x = 867
    state_indicators = {
        'reinforce': (pos_x, 548),
        'attack': (pos_x, 600),
        'fortify': (pos_x, 652),
    }
    for state, coordinate in state_indicators.items():
        asset = assets.image.ToggleImageAsset(coordinate[0], coordinate[1],
                                              "assets/art/gui/button_%s_highlight.png" % state)
        datastore.add_entry(state, asset, 'states')
        picasso.add_asset(UI_OVERLAY_LEVEL0, asset)
Exemplo n.º 8
0
def initialize_territories(picasso, game_master):
    datastore = Datastore()
    for continent, territories in game_master.board.continents.iteritems():
        for territory_name, territory in territories.iteritems():
            coordinate = territory_coordinates[continent][territory_name]
            graphic_asset = build_territory_asset(continent, territory,
                                                  coordinate[0], coordinate[1])
            army_count_asset = assets.territory.ArmyCountAsset(graphic_asset)
            picasso.add_asset('3_territories', graphic_asset)
            picasso.add_asset('4_army_count', army_count_asset)

            datastore.add_entry(territory_name, graphic_asset, 'territories')
    risk.logger.debug("assigning player colours")
    build_player_colour_mapping(game_master.players)
Exemplo n.º 9
0
def show_bot_player_hint(game_master):
    datastore = Datastore()
    picasso = get_picasso()
    if not datastore.has_entry('bot_player_hint'):
        hint_asset = assets.text.CentredTextAsset(INFO_PANEL_X, INFO_PANEL_Y, 
                    INFO_PANEL_WIDTH, INFO_PANEL_HEIGHT, 
                    "AI TAKING TURNS...",
                    bold=True)
        datastore.add_entry('bot_player_hint', hint_asset)
    hint_asset = datastore.get_entry('bot_player_hint')
    if isinstance(game_master.current_player(), risk.ai.bots.BasicRiskBot):
        picasso.add_asset(UI_OVERLAY_LEVEL0, hint_asset)
    else:
        picasso.remove_asset(UI_OVERLAY_LEVEL0, hint_asset)
Exemplo n.º 10
0
def show_bot_player_hint(game_master):
    datastore = Datastore()
    picasso = get_picasso()
    if not datastore.has_entry('bot_player_hint'):
        hint_asset = assets.text.CentredTextAsset(INFO_PANEL_X, INFO_PANEL_Y,
                                                  INFO_PANEL_WIDTH, INFO_PANEL_HEIGHT,
                                                  "AI TAKING TURNS...",
                                                  bold=True)
        datastore.add_entry('bot_player_hint', hint_asset)
    hint_asset = datastore.get_entry('bot_player_hint')
    if isinstance(game_master.current_player(), risk.ai.bots.BasicRiskBot):
        picasso.add_asset(UI_OVERLAY_LEVEL0, hint_asset)
    else:
        picasso.remove_asset(UI_OVERLAY_LEVEL0, hint_asset)
Exemplo n.º 11
0
def initialize_other_graphic_assets(picasso, game_master):
    picasso = get_picasso()
    datastore = Datastore()
    #current_player_asset = assets.text.CurrentPlayerAsset(
    #        100, 100, game_master)
    #picasso.add_asset('4_current_player', current_player_asset)
    #datastore.add_entry('current_player', current_player_asset)
    feedback_asset = assets.text.TextAsset(100, 650,
                                           'choose territory to attack')
    datastore.add_entry('attack_feedback', feedback_asset)
    game_info_asset = assets.gameplay.PlayersAsset(30, 550, game_master)
    picasso.add_asset(UI_OVERLAY_LEVEL0, game_info_asset)
    datastore.add_entry('game_info', game_info_asset)
    add_state_indicators(picasso, game_master)
    player_background_asset = assets.base.ColourBlockAsset(
        1000, 548, 123, 80, assets.base.BLACK)
    human_player_asset = assets.base.ColourBlockAsset(1002, 550, 119, 76,
                                                      assets.base.GREY)
    datastore.add_entry('player_colour', human_player_asset)
    picasso.add_asset(UI_OVERLAY_LEVEL0, player_background_asset)
    picasso.add_asset(UI_OVERLAY_LEVEL1, human_player_asset)
Exemplo n.º 12
0
def initialize_other_graphic_assets(picasso, game_master):
    picasso = get_picasso()
    datastore = Datastore()
    #current_player_asset = assets.text.CurrentPlayerAsset(
    #        100, 100, game_master)
    #picasso.add_asset('4_current_player', current_player_asset)
    #datastore.add_entry('current_player', current_player_asset)
    feedback_asset = assets.text.TextAsset(100, 650, 
            'choose territory to attack')
    datastore.add_entry('attack_feedback', feedback_asset)
    game_info_asset = assets.gameplay.PlayersAsset(30, 550, game_master)
    picasso.add_asset(UI_OVERLAY_LEVEL0, game_info_asset)
    datastore.add_entry('game_info', game_info_asset)
    add_state_indicators(picasso, game_master)
    player_background_asset = assets.base.ColourBlockAsset(
        1000, 548, 123, 80, assets.base.BLACK)
    human_player_asset = assets.base.ColourBlockAsset(
        1002, 550, 119, 76, assets.base.GREY)
    datastore.add_entry('player_colour', human_player_asset)
    picasso.add_asset(UI_OVERLAY_LEVEL0, player_background_asset)
    picasso.add_asset(UI_OVERLAY_LEVEL1, human_player_asset)
Exemplo n.º 13
0
def add_overlay(picasso):
    datastore = Datastore()
    overlay = assets.image.ImageAsset(0, 0, DEFAULT_OVERLAY)
    datastore.add_entry('overlay', overlay)
    picasso.add_asset('0_overlay', overlay)
Exemplo n.º 14
0
def add_overlay(picasso):
    datastore = Datastore()
    overlay = assets.image.ImageAsset(0, 0, DEFAULT_OVERLAY)
    datastore.add_entry('overlay', overlay)
    picasso.add_asset('0_overlay', overlay)