Ejemplo n.º 1
0
def pressed_clickables(mouse_pos, storage='buttons'):
    datastore = Datastore()
    storage = datastore.get_storage(storage)
    clicked = []
    for name, button in storage.iteritems():
        if button.mouse_hovering(mouse_pos):
            clicked.append((name, button))
    return clicked
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
def pressed_clickables(mouse_pos, storage='buttons'):
    datastore = Datastore()
    storage = datastore.get_storage(storage)
    clicked = []
    for name, button in storage.iteritems():
        if button.mouse_hovering(mouse_pos):
            if button.confirmed_click():
                clicked.append((name, button))
    return clicked
Ejemplo 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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
def enable_adjacent_territories(origin):
    datastore = Datastore()
    assets = datastore.get_storage('territories')
    assets[origin.name].disabled = False
    for neighbour in origin.neighbours.values():
        assets[neighbour.name].disabled = False
Ejemplo n.º 7
0
def disable_enemy_territories(player):
    datastore = Datastore()
    for asset in datastore.get_storage('territories').values():
        if asset.territory.owner != player:
            asset.disabled = True
Ejemplo n.º 8
0
def get_all_clickables():
    datastore = Datastore()
    return list(datastore.get_storage('buttons').values()) + \
        list(datastore.get_storage('territories').values())
Ejemplo n.º 9
0
def enable_adjacent_territories(origin):
    datastore = Datastore()
    assets = datastore.get_storage('territories')
    assets[origin.name].disabled = False
    for neighbour in origin.neighbours.values():
        assets[neighbour.name].disabled = False
Ejemplo n.º 10
0
def disable_enemy_territories(player):
    datastore = Datastore()
    for asset in datastore.get_storage('territories').values():
        if asset.territory.owner != player:
            asset.disabled = True
Ejemplo n.º 11
0
def get_all_clickables():
    datastore = Datastore()
    return datastore.get_storage('buttons').values() + \
           datastore.get_storage('territories').values()