Пример #1
0
def intel_menu(screen, my_nation, all_nations):
    insert_dem = [0, 32, 300, 704]
    # Should change based on player count
    co_splash = [255, 255, 153]

    # Button info:
    button_color = cncc.get_color("inactive_button")
    text_color = cncc.get_color("inactive_text")
    button_prompt_color = cncc.get_color("active_button")
    text_prompt_color = cncc.get_color("active_text")

    # Draw outside rectangle
    pygame.draw.rect(screen, co_splash, insert_dem)
    menu_buttons = []

    # Draw tile name
    title_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 24)
    detail_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 12)
    cncc.draw_notice(screen, "Intelligence Report", title_font,
                     [0, 64, 300, 30], co_splash, [0, 0, 0])

    # Your nations status
    cncc.draw_notice(screen, "My Components:" + str(my_nation.score),
                     detail_font, [0, 128, 300, 30], co_splash, [0, 0, 0])
    cncc.draw_notice(screen, "Spies Available", detail_font, [0, 160, 300, 30],
                     co_splash, [0, 0, 0])

    cursor_x = 192
    # All other nations
    for this_nation in all_nations:
        # No need to draw your own nation
        if this_nation.playername == my_nation.playername:
            continue
        cncc.draw_notice(
            screen,
            this_nation.playername + " Components:" + str(this_nation.score),
            detail_font, [0, cursor_x, 300, 30], co_splash, [0, 0, 0])
        cursor_x = cursor_x + 32
        menu_buttons.append(
            cncc.a_button("Coup", "coup", this_nation, detail_font,
                          [0, cursor_x, 99, 30], button_color, text_color,
                          button_prompt_color, text_prompt_color))
        menu_buttons.append(
            cncc.a_button("Observe", "observe", this_nation, detail_font,
                          [100, cursor_x, 99, 30], button_color, text_color,
                          button_prompt_color, text_prompt_color))
        menu_buttons.append(
            cncc.a_button("Counter", "counter", this_nation, detail_font,
                          [200, cursor_x, 99, 30], button_color, text_color,
                          button_prompt_color, text_prompt_color))
        cursor_x = cursor_x + 32

    # print(cursor_x)
    # cncc.draw_notice(screen,"Reset Spies",detail_font,[0,cursor_x,300,30],co_splash,[0,0,0])
    menu_buttons.append(
        cncc.a_button("Reset Spies", "spy_reset", None, detail_font,
                      [0, cursor_x, 300, 30], button_color, text_color,
                      button_prompt_color, text_prompt_color))

    return menu_buttons
Пример #2
0
def main_menu(screen):
    insert_dem = [0, 32, 128, 160]
    co_splash = [255, 255, 153]

    button_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 16)
    mainmenu_buttons = []
    button_color = cncc.get_color("inactive_button")
    text_color = cncc.get_color("inactive_text")
    button_prompt_color = cncc.get_color("active_button")
    text_prompt_color = cncc.get_color("active_text")

    # Draw outside rectangle
    pygame.draw.rect(screen, co_splash, insert_dem)

    # Draw tile name

    mainmenu_buttons.append(
        cncc.a_button("Change Game", "load", None, button_font,
                      [0, 64, 128, 32], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("Options", "opt", None, button_font, [0, 96, 128, 32],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("Quit", "quit", None, button_font, [0, 128, 128, 32],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    return mainmenu_buttons
Пример #3
0
def gamebar_buttons():

    button_icon = []
    button_icon.append(pygame.image.load('./images/icons/icon_menu.png'))
    button_icon.append(pygame.image.load('./images/icons/icon_intel.png'))
    button_icon.append(pygame.image.load('./images/icons/icon_mssg.png'))
    button_icon.append(pygame.image.load('./images/icons/icon_submit.png'))

    # Button Objects

    gb_buttons = []
    gb_buttons.append(
        cncc.a_button("", "menu", None, None, [0, 0, 32, 32], [0, 0, 0],
                      [0, 255, 0], [255, 0, 0], [0, 0, 255], button_icon[0]))
    gb_buttons.append(
        cncc.a_button("", "intel", None, None, [32, 0, 32, 32], [0, 0, 0],
                      [0, 255, 0], [255, 0, 0], [0, 0, 255], button_icon[1]))
    gb_buttons.append(
        cncc.a_button("", "mssg", None, None, [64, 0, 32, 32], [0, 0, 0],
                      [0, 255, 0], [255, 0, 0], [0, 0, 255], button_icon[2]))
    gb_buttons.append(
        cncc.a_button("", "submit", None, None, [96, 0, 32, 32], [0, 0, 0],
                      [0, 255, 0], [255, 0, 0], [0, 0, 255], button_icon[3]))

    return gb_buttons
Пример #4
0
def hex_buttons():
    button_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 18)
    button_color = cncc.get_color("inactive_button")
    text_color = cncc.get_color("inactive_text")
    button_prompt_color = cncc.get_color("active_button")
    text_prompt_color = cncc.get_color("active_text")

    unit_buttons = []
    unit_buttons.append(
        cncc.a_button("Support", "support", None, button_font,
                      [0, 160, 128, 32], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    unit_buttons.append(
        cncc.a_button("Disband", "disband", None, button_font,
                      [128, 160, 128, 32], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    return unit_buttons
Пример #5
0
def make_mainmenu_buttons():
    button_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 24)
    mainmenu_buttons = []
    button_color = cncc.get_color("inactive_button")
    text_color = cncc.get_color("inactive_text")
    button_prompt_color = cncc.get_color("active_button")
    text_prompt_color = cncc.get_color("active_text")

    mainmenu_buttons.append(
        cncc.a_button("Test", "test", None, button_font, [500, 372, 240, 64],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("New Game", "new", None, button_font,
                      [500, 436, 240, 64], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("Join Game", "join", None, button_font,
                      [500, 500, 240, 64], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("Load Game", "load", None, button_font,
                      [500, 564, 240, 64], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("Options", "opt", None, button_font, [500, 628, 240, 64],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    mainmenu_buttons.append(
        cncc.a_button("Credits", "credits", None, button_font,
                      [500, 692, 240, 64], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    return mainmenu_buttons
Пример #6
0
def make_game(gameDisplay, clock_1, mm_buttons):
    custom_menu = []
    frequency_menu = []

    button_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 18)
    mainmenu_buttons = []
    button_color = cncc.get_color("inactive_button")
    text_color = cncc.get_color("inactive_text")
    button_prompt_color = cncc.get_color("active_button")
    text_prompt_color = cncc.get_color("active_text")
    button_select_color = cncc.get_color("selected_button")
    text_select_color = cncc.get_color("selected_text")

    # Game Options
    # Game Name
    # Game Password
    # Player Count
    # 6 or 8
    custom_menu.append(
        cncc.a_button("6", "pc_6", None, button_font, [608, 256, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    custom_menu.append(
        cncc.a_button("8", "pc_8", None, button_font, [672, 256, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    # Messaging
    # Standard
    # Airwaves (Broadcast All)
    # Grey
    # Radio Silence
    custom_menu.append(
        cncc.a_button("Standard", "comm_standard", None, button_font,
                      [400, 352, 128, 48], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    custom_menu.append(
        cncc.a_button("Open Airwaves", "comm_airwaves", None, button_font,
                      [528, 352, 128, 48], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    custom_menu.append(
        cncc.a_button("Grey Comms", "comm_grey", None, button_font,
                      [656, 352, 128, 48], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    custom_menu.append(
        cncc.a_button("Radio Silence", "comm_silence", None, button_font,
                      [784, 352, 128, 48], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    # Game Length
    # Short - 2 components
    # Medium - 3 components
    # Long - 5 Components
    custom_menu.append(
        cncc.a_button("Short", "cp_2", None, button_font, [512, 448, 128, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    custom_menu.append(
        cncc.a_button("Medium", "cp_3", None, button_font, [640, 448, 128, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    custom_menu.append(
        cncc.a_button("Long", "cp_5", None, button_font, [768, 448, 128, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    # Turn Length
    # Quick
    # Marathon
    custom_menu.append(
        cncc.a_button("Quick", "clock_quick", None, button_font,
                      [528, 544, 128, 48], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    custom_menu.append(
        cncc.a_button("Marathon", "clock_long", None, button_font,
                      [656, 544, 128, 48], button_color, text_color,
                      button_prompt_color, text_prompt_color))
    # If marathon - turn pauses
    frequency_menu.append(
        cncc.a_button("Mn", "sd_mn", None, button_font, [416, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    frequency_menu.append(
        cncc.a_button("Tu", "sd_tu", None, button_font, [480, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    frequency_menu.append(
        cncc.a_button("Wd", "sd_wd", None, button_font, [544, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    frequency_menu.append(
        cncc.a_button("Th", "sd_th", None, button_font, [608, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    frequency_menu.append(
        cncc.a_button("Fr", "sd_fr", None, button_font, [672, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    frequency_menu.append(
        cncc.a_button("Sa", "sd_sa", None, button_font, [736, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))
    frequency_menu.append(
        cncc.a_button("Su", "sd_su", None, button_font, [800, 640, 64, 48],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))

    # Launch game button
    custom_menu.append(
        cncc.a_button("Launch Game!", "launch", None, button_font,
                      [480, 688, 256, 64], button_color, text_color,
                      button_prompt_color, text_prompt_color))

    # TODO: Add back button
    custom_menu.append(
        cncc.a_button("Back", "back", None, button_font, [64, 64, 128, 64],
                      button_color, text_color, button_prompt_color,
                      text_prompt_color))

    title_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 32)
    title_text = "New Custom Game"
    TitleSurf, TitleRect = cncc.text_objects(title_text, title_font,
                                             [153, 102, 51])
    # TODO: Pass along display info
    TitleRect.center = ((1280 / 2), 50)

    playing = True
    click_select = None

    # Game parameters is the returned value to the map maker
    # [name,passowrd,player_count,communication,score,clock,turn_frequency]

    game_params = ["", "", "", "", "", "", "", []]

    while playing:

        gameDisplay.blit(TitleSurf, TitleRect)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                intro = False
                cncc.game_quit()

            # Only looking for a click
            if event.type == pygame.MOUSEBUTTONUP:
                x, y = event.pos
                if event.button == 1:
                    nada = True
                    # Check if it was a hex
                    for my_button in custom_menu:
                        if my_button.but_rect.collidepoint(x, y):
                            # Find out what type of button was clicked and put the correct id in the game params
                            if my_button.button_id.startswith("pc_"):
                                game_params[2] = my_button.button_id
                            elif my_button.button_id.startswith("comm_"):
                                game_params[3] = my_button.button_id
                            elif my_button.button_id.startswith("cp_"):
                                game_params[4] = my_button.button_id
                            elif my_button.button_id.startswith("clock_"):
                                game_params[5] = my_button.button_id
                            elif my_button.button_id == "launch":
                                print(game_params)
                            elif my_button.button_id == "back":
                                draw_main(mm_buttons, gameDisplay)
                            click_select = my_button
                            nada = False
                    if nada:
                        click_select = None

        # Do something with the button presss
        if click_select:
            pass

        # Draw Display
        gameDisplay.fill(cncc.get_color("bg"))

        gameDisplay.blit(TitleSurf, TitleRect)

        # Draw lables
        cncc.draw_notice(gameDisplay, "Player Count", button_font,
                         [640, 208, 128, 48], [30, 30, 30], [200, 200, 200],
                         None)
        cncc.draw_notice(gameDisplay, "Comms Style", button_font,
                         [640, 304, 128, 48], [30, 30, 30], [200, 200, 200],
                         None)
        cncc.draw_notice(gameDisplay, "Game Length", button_font,
                         [640, 400, 128, 48], [30, 30, 30], [200, 200, 200],
                         None)
        cncc.draw_notice(gameDisplay, "Turn Length", button_font,
                         [640, 496, 128, 48], [30, 30, 30], [200, 200, 200],
                         None)

        # Draw Buttons
        for this_button in custom_menu:
            # Skip selected button
            if this_button.button_id in game_params:
                cncc.draw_notice(gameDisplay, this_button.message, button_font,
                                 this_button.button_dem, button_select_color,
                                 text_select_color)
                continue
            this_button.draw(gameDisplay)
            # 	def __init__(self,message,button_id,data,font,button_dem,sq_co=[255,255,255],tx_co=[0,0,0],sq_p_co=[255,255,255],tx_p_co=[0,0,0],img_file=None):

        # If a marathon game is selected, draw the frequency buttons to record their responses

        pygame.display.update()
        clock_1.tick(90)
Пример #7
0
def draw_hex_popup(screen, my_hex, hex_icons, my_nation):
    # Draw information on this hex
    insert_dem = [0, 32, 384, 384]
    co_splash = [255, 255, 153]

    # Draw outside rectangle
    pygame.draw.rect(screen, co_splash, insert_dem)

    # Draw tile name
    title_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 24)
    detail_font = pygame.font.Font('./fonts/steam_punk_flyer.ttf', 12)
    cncc.draw_notice(screen, my_hex.name, title_font, [0, 64, 300, 30],
                     co_splash, [0, 0, 0])

    if my_hex.controller != None:
        cncc.draw_notice(screen, my_hex.controller.playername, detail_font,
                         [0, 96, 150, 30], co_splash, [0, 0, 0])
    else:
        cncc.draw_notice(screen, "Free.", detail_font, [0, 96, 150, 30],
                         co_splash, [0, 0, 0])

    # Draw Tile Type
    if my_hex.hex_type == "metro":
        cncc.draw_notice(screen, "Metropolis", detail_font, [0, 128, 150, 30],
                         co_splash, [0, 0, 0])
    elif my_hex.hex_type == "mine":
        cncc.draw_notice(screen, "Mine", detail_font, [0, 128, 150, 30],
                         co_splash, [0, 0, 0])
    elif my_hex.hex_type == "wastes":
        cncc.draw_notice(screen, "Wasteland", detail_font, [0, 128, 150, 30],
                         co_splash, [0, 0, 0])
    elif my_hex.hex_type == "wilds":
        cncc.draw_notice(screen, "Wilderness", detail_font, [0, 128, 150, 30],
                         co_splash, [0, 0, 0])
    else:
        # Should only happen in error
        cncc.draw_notice(screen, "Unknown.", detail_font, [0, 128, 150, 30],
                         co_splash, [0, 0, 0])

    # Draw information based on available information level
    if my_hex.infolevel == 2:
        # See all detail in this hex
        cncc.draw_notice(screen, "Total Automatons:" + str(my_hex.autos),
                         detail_font, [0, 160, 150, 30], co_splash, [0, 0, 0])
        cncc.draw_notice(screen, "Available Coal:" + str(my_hex.av_coal),
                         detail_font, [0, 192, 150, 30], co_splash, [0, 0, 0])
        cncc.draw_notice(screen, "Coal Reserve:" + str(my_hex.mine),
                         detail_font, [0, 224, 150, 30], co_splash, [0, 0, 0])
        if my_hex.command == None:
            cncc.draw_notice(
                screen,
                "No directive for this quadrent yet.  Will conserve by default.",
                detail_font, [0, 192, 150, 30], co_splash, [0, 0, 0])
        else:
            cncc.draw_notice(screen, my_hex.command, detail_font,
                             [0, 192, 150, 30], co_splash, [0, 0, 0])
    elif my_hex.infolevel == 1:
        # See how much "stuff" is here
        cncc.draw_notice(screen, "Total Material:" + str(my_hex.material),
                         detail_font, [0, 160, 150, 30], co_splash, [0, 0, 0])
    elif my_hex.infolevel == 0:
        cncc.draw_notice(screen, "Quadrent too far", detail_font,
                         [0, 160, 150, 30], co_splash, [0, 0, 0])
        cncc.draw_notice(screen, "away to assess.", detail_font,
                         [0, 192, 150, 30], co_splash, [0, 0, 0])
    else:
        cncc.draw_notice(screen, "Quit cheating!", detail_font,
                         [0, 160, 150, 30], co_splash, [0, 0, 0])

    # Write the queued order if one exsists

    # Debug info level
    cncc.draw_notice(screen, "Info Level:" + str(my_hex.infolevel),
                     detail_font, [0, 256, 150, 30], co_splash, [0, 0, 0])
    cncc.draw_notice(
        screen, "Cordinates:" + str(my_hex.row) + ":" + str(my_hex.col) + ":" +
        str(my_hex.sss), detail_font, [0, 288, 150, 30], co_splash, [0, 0, 0])

    context_menu = []

    if my_hex.hex_type == "wastes" or my_hex.controller != my_nation:
        # No buttons
        return context_menu
    else:
        context_menu.append(
            cncc.a_button("", "conserve", my_hex, None, [256, 64, 64, 64],
                          [0, 0, 0], [0, 255, 0], [255, 0, 0], [0, 0, 255],
                          hex_icons[0]))
        context_menu.append(
            cncc.a_button("", "defend", my_hex, None, [320, 64, 64, 64],
                          [0, 0, 0], [0, 255, 0], [255, 0, 0], [0, 0, 255],
                          hex_icons[1]))
        if my_hex.mine > 0:
            # If there is anything aviable, construct it
            context_menu.append(
                cncc.a_button("", "extract", my_hex, None, [256, 128, 64, 64],
                              [0, 0, 0], [0, 255, 0], [255, 0, 0], [0, 0, 255],
                              hex_icons[2]))
        else:
            # Just an empty button
            pass
        if my_hex.autos > 0:
            # If there is anything aviable, construct it
            context_menu.append(
                cncc.a_button("", "build_autos", my_hex, None,
                              [320, 128, 64, 64], [0, 0, 0], [0, 255, 0],
                              [255, 0, 0], [0, 0, 255], hex_icons[3]))
        else:
            # Just an empty button
            pass
        if my_hex.hex_type == "metro":
            if my_hex.av_coal >= 25:
                context_menu.append(
                    cncc.a_button("", "build_airship", my_hex, None,
                                  [256, 192, 64, 64], [0, 0, 0], [0, 255, 0],
                                  [255, 0, 0], [0, 0, 255], hex_icons[4]))
                context_menu.append(
                    cncc.a_button("", "build_landship", my_hex, None,
                                  [320, 192, 64, 64], [0, 0, 0], [0, 255, 0],
                                  [255, 0, 0], [0, 0, 255], hex_icons[5]))
                context_menu.append(
                    cncc.a_button("", "build_extractor", my_hex, None,
                                  [256, 256, 64, 64], [0, 0, 0], [0, 255, 0],
                                  [255, 0, 0], [0, 0, 255], hex_icons[3]))
                context_menu.append(
                    cncc.a_button("", "build_device", my_hex, None,
                                  [320, 256, 64, 64], [0, 0, 0], [0, 255, 0],
                                  [255, 0, 0], [0, 0, 255], hex_icons[3]))
            else:
                pass
            if my_hex.av_coal >= 100:
                context_menu.append(
                    cncc.a_button("", "build_component", my_hex, None,
                                  [288, 320, 64, 64], [0, 0, 0], [0, 255, 0],
                                  [255, 0, 0], [0, 0, 255], hex_icons[3]))
            else:
                pass
            # Check if you have enough components
            comp_count = 0
            for mech in my_hex.wm:
                if mech == "component":
                    comp_count = comp_count + 1

            if comp_count >= 3 and my_hex.av_coal >= 200:
                context_menu.append(
                    cncc.a_button("", "launch", my_hex, None,
                                  [288, 288, 64, 64], [0, 0, 0], [0, 255, 0],
                                  [255, 0, 0], [0, 0, 255], hex_icons[3]))
            else:
                pass
        return context_menu