示例#1
0
    def __init__(self):
        """Initializes the options menu."""
        super(self.__class__, self).__init__('Options')

        items = [self.create_resolution_item(), self.create_volume_item()]

        self.create_menu(items, menu.shake(), menu.shake_back())
示例#2
0
    def __init__(self):
        super(MainMenu, self).__init__()

        self.font_title['font_name'] = 'Arial'
        self.font_title['font_size'] = 50
        self.font_title['color'] = (255, 255, 255, 255)

        self.font_item['font_name'] = 'Arial',
        self.font_item['color'] = (32, 16, 32, 255)
        self.font_item['font_size'] = 32

        self.font_item_selected['font_name'] = 'Arial'
        self.font_item_selected['color'] = (32, 16, 32, 255)
        self.font_item_selected['font_size'] = 46

        self.menu_anchor_y = CENTER
        self.menu_anchor_x = CENTER

        items = [
            MenuItem('New Game', self.on_new_game),
            MenuItem('Options', self.on_options),
            MenuItem('Scores', self.on_scores),
            MenuItem('Quit', self.on_quit)
        ]

        self.create_menu(items, shake(), shake_back())
示例#3
0
    def __init__(self):
        super( MainMenu, self).__init__('LUCA')

        #self.select_sound = soundex.load('move.mp3')

        # you can override the font that will be used for the title and the items
        # you can also override the font size and the colors. see menu.py for
        # more info
        #self.font_title['font_name'] = 'Edit Undo Line BRK'
        self.font_title['font_size'] = 72
        self.font_title['color'] = colors.rgba(colors.base03)

        self.font_item['font_name'] = 'Edit Undo Line BRK',
        self.font_item['color'] = colors.rgba(colors.base03)
        self.font_item['font_size'] = 32
        self.font_item_selected['font_name'] = 'Edit Undo Line BRK'
        self.font_item_selected['color'] = colors.rgba(colors.color[random.randint(0,7)])
        self.font_item_selected['font_size'] = 46


        # example: menus can be vertical aligned and horizontal aligned
        self.menu_anchor_y = menu.CENTER
        self.menu_anchor_x = menu.CENTER

        items = []

        items.append( menu.MenuItem('New Game', self.on_new_game) )
        #items.append( MenuItem('Options', self.on_options) )
        #items.append( MenuItem('Scores', self.on_scores) )
        items.append( menu.MenuItem('Quit', self.on_quit) )

        self.create_menu( items, menu.shake(), menu.shake_back() )
示例#4
0
    def __init__(self):
        super(OptionMenu, self).__init__("REVERSI !")

        self.font_title['font_name'] = 'Blood Of Dracula'
        self.font_title['font_size'] = 72
        self.font_title['color'] = (255, 16, 16, 255)

        self.font_item['font_name'] = 'You Are Loved'
        self.font_item_selected['font_name'] = 'Blood Of Dracula'

        self.menu_valign = BOTTOM
        self.menu_halign = RIGHT

        global dificuldade
        dificuldade = "macaco"

        itens = []
        self.dificuldades = ['macaco', 'golfinho']
        self.teste = MultipleMenuItem("Dificuldade:", self.hardWay,
                                      self.dificuldades, 0)
        print(self.teste.idx)
        itens.append(MenuItem('Fullscreen', self.on_fullscreen))
        itens.append(self.teste)
        itens.append(ToggleMenuItem('Show FPS: ', self.on_show_fps, True))
        itens.append(MenuItem('OK', self.on_quit))
        self.create_menu(itens, shake(), shake_back())
示例#5
0
	def __init__(self):
		super().__init__(_("Quit?"))

		items = [
			MenuItem(_("Yes"), self.onYes),
			MenuItem(_("No"), self.onNo),
		]
		self.create_menu(items, shake(), shake_back())
示例#6
0
 def __init__(self):
     super().__init__()
     self.font_item['font_name'] = '黑体'
     self.font_item_selected['font_name'] = '黑体'
     l = []
     l.append(MenuItem('继续游戏', self.on_resume))
     l.append(MenuItem('键位设置', self.on_setting))
     l.append(MenuItem('返回主菜单', self.on_back_to_mainmenu))
     self.create_menu(l, shake(), shake_back())
示例#7
0
文件: race.py 项目: jtietema/racer
    def __init__(self):
        menu.Menu.__init__(self, 'Paused')

        items = [
            menu.MenuItem('Resume game', self.on_resume),
            menu.MenuItem('Leave race', director.pop)
        ]

        self.create_menu(items, menu.shake(), menu.shake_back())
示例#8
0
 def __init__(self):
     super().__init__(' ')
     l = []
     l.append(ImageMenuItem('pic/kaishi.png', self.on_start))
     l.append(ImageMenuItem('pic/keys.png', self.on_setting))
     l.append(ImageMenuItem('pic/jifen.png', self.on_score))
     l.append(ImageMenuItem('pic/lianji.png', self.on_connect))
     l.append(ImageMenuItem('pic/tuichu.png', self.on_quit))
     self.create_menu(l, shake(), shake_back())
示例#9
0
    def __init__(self):
        """Initializes the new game menu."""
        super(self.__class__, self).__init__('New Game')

        items = [
            menu.EntryMenuItem('Server:', self.on_server_text, ''),
            menu.MenuItem('Start', self.on_start)
        ]

        self.create_menu(items, menu.shake(), menu.shake_back())
示例#10
0
 def __init__(self):
     super().__init__()
     self.font_item['font_name'] = '黑体'
     self.font_item_selected['font_name'] = '黑体'
     self.l = []
     self.l.append(MenuItem('建立主机', self.sethost))
     self.l.append(EntryMenuItem('目标IP:', self.connect, '127.0.0.1'))
     self.l.append(MenuItem('确认连接', self.try_connect))
     self.l.append(MenuItem('返回', self.on_back_to_mainmenu))
     self.create_menu(self.l, shake(), shake_back())
示例#11
0
    def __init__(self):
        """Creates the main menu for the game."""
        super(self.__class__, self).__init__('Tank Battle')

        items = [
            menu.MenuItem('New Game', self.on_new_game),
            menu.MenuItem('Options', self.on_options),
            menu.MenuItem('Quit', self.on_quit_button)
        ]

        self.create_menu(items, menu.shake(), menu.shake_back())
 def __init__( self ):
     super( MainMenu, self ).__init__("TITLE" )
     items = [
         ( MenuItem('Item 1', self.on_quit ) ),
         ( MenuItem('Item 2', self.on_quit ) ),
         ( MenuItem('Item 3', self.on_quit ) ),
         ( MenuItem('Item 4', self.on_quit ) ),
     ]
     self.create_menu( items, selected_effect=shake(),
                       unselected_effect=shake_back(),
                       layout_strategy=fixedPositionMenuLayout(
                         [(450, 300), (130, 200), (200, 100), (400, 50)]))
示例#13
0
文件: race.py 项目: jtietema/racer
    def __init__(self):
        super(ResultsMenu, self).__init__('Results')

        if state.cup.has_next_track():
            items = [
                menu.MenuItem('Next race', self.on_next_race),
                menu.MenuItem('Back to Main Menu', self.on_back)
            ]
        else:
            items = [menu.MenuItem('Proceed', self.on_proceed)]

        self.create_menu(items, menu.shake(), menu.shake_back())
 def __init__( self ):
     super( MainMenu, self ).__init__("TITLE" )
     items = [
         ( MenuItem('Item 1', self.on_quit ) ), 
         ( MenuItem('Item 2', self.on_quit ) ),
         ( MenuItem('Item 3', self.on_quit ) ),
         ( MenuItem('Item 4', self.on_quit ) ),
     ]
     self.create_menu( items, selected_effect=shake(),
                       unselected_effect=shake_back(),
                       layout_strategy=fixedPositionMenuLayout(
                         [(450, 300), (130, 200), (200, 100), (400, 50)]))
示例#15
0
    def __init__(self):
        super(MainMenu, self).__init__()

        items = []
        self.title=""
        items.append(MenuItem('Play', self.on_new_game))
#        items.append(MenuItem('Scores', self.on_score))
        items.append(MenuItem('Story', self.on_story))
        items.append(MenuItem('Credits', self.on_credits))
#        items.append(MenuItem('Editor', self.on_editor,delay = 1.2))
#        items.append(MenuItem('Options', self.on_configure))
        items.append(MenuItem('Quit', self.on_quit))
        self.create_menu(items, zoom_in(1.4), zoom_out(), shake())
示例#16
0
    def __init__(self):
        super(MainMenu, self).__init__()

        items = []
        self.title = ""
        items.append(MenuItem('Play', self.on_new_game))
        #        items.append(MenuItem('Scores', self.on_score))
        items.append(MenuItem('Story', self.on_story))
        items.append(MenuItem('Credits', self.on_credits))
        #        items.append(MenuItem('Editor', self.on_editor,delay = 1.2))
        #        items.append(MenuItem('Options', self.on_configure))
        items.append(MenuItem('Quit', self.on_quit))
        self.create_menu(items, zoom_in(1.4), zoom_out(), shake())
示例#17
0
文件: rpg3.py 项目: jrecuero/rpg3
 def __init__(self):
     """
     """
     super(SkillMenu, self).__init__('Skills')
     # Change font size for different menu items.
     self.font_title['font_size']          = 16
     self.font_item['font_size']           = 8
     self.font_item_selected['font_size']  = 10
     items = [(MenuItem('Axe', self.on_quit)), (MenuItem('Bow', self.on_quit)), ]
     self.create_menu(items,
                      selected_effect=shake(),
                      unselected_effect=shake_back(),
                      layout_strategy=fixedPositionMenuLayout([(250, 460), (250, 430)], ))
示例#18
0
    def __init__(self):
        super(OptionsMenu, self).__init__('SpaceWars')

        self.font_title = {
            'text': 'SpaceWars',
            'font_name': FONT['header'],
            'font_size': FONT['header_size'],
            'color': FONT['white'],
            'bold': True,
            'anchor_y': 'center',
            'anchor_x': 'center',
        }

        self.font_item = {
            'font_name': FONT['body'],
            'font_size': FONT['body_size'],
            'anchor_y': 'center',
            'anchor_x': 'center',
            'color': FONT['gray'],
        }

        self.font_item_selected = {
            'font_name': FONT['body'],
            'font_size': FONT['body_size_selected'],
            'bold': False,
            'anchor_y': 'center',
            'anchor_x': 'center',
            'color': FONT['white'],
        }
        self.sound = 0

        self.menu_anchor_y = CENTER
        self.menu_anchor_x = CENTER
        self.show_fullscreen = False
        items = []

        self.volumes = ['Mute', 'Sound in space?']
        items.append(
            MultipleMenuItem('SFX volume: ', self.on_sfx_volume, self.volumes,
                             self.sound))
        items.append(
            MultipleMenuItem('Music volume: ', self.on_sfx_volume,
                             self.volumes, self.sound))
        items.append(
            ToggleMenuItem('Show FPS:', self.on_show_fps, director.show_FPS))
        items.append(
            ToggleMenuItem('Fullscreen:', self.on_fullscreen,
                           self.show_fullscreen))
        items.append(MenuItem('Back', self.on_quit))

        self.create_menu(items, shake(), shake_back())
示例#19
0
    def __init__(self):
        super(BaseMenu, self).__init__()
        self.font_item['font_size'] = 40
        self.font_item_selected['font_size'] = self.font_item['font_size']
        self.font_item['color'] = (255, 255, 255, 255)
        self.font_item_selected['color'] = (192, 192, 192, 255)
        # self.start_menu = menu.ImageMenuItem('img/btn1.png', self.start_game)
        self.end_menu = menu.ImageMenuItem('img/btn3.png', self.end_game)

        menu_items = self.menu_items()
        menu_items.append(self.end_menu)
        self.create_menu(menu_items,
                         selected_effect=menu.shake(),
                         activated_effect=menu.shake_back())
示例#20
0
    def __init__(self):
        super(ConfigMenuMenu, self).__init__('')

        self.font_title['font_size'] = 20
        self.font_item_selected['font_size'] = 20
        self.font_item['font_size'] = 20
        
        l = []
        volumes = ['Mute', '10','20', '30', '40', '50', '60', '70', '80', '90', 'Max']
        l.append( MultipleMenuItem('Music Volume: ', self.on_music_volume, volumes, 7))
        l.append( MultipleMenuItem('SFX Volume: ', self.on_sfx_volume, volumes, 7))
        l.append( MenuItem('Fullscreen', self.on_fullscreen))
        l.append( MenuItem('Back', self.on_quit))
        self.create_menu(l, zoom_in(1.4), zoom_out(), shake())
示例#21
0
	def __init__(self):
		super().__init__("Collision")

		# Initialize game options
		self.options = Options()
		if self.options.fullscreen: director.window.set_fullscreen(True)

		# Add the items and create the menu
		items = [
			MenuItem(_("Play"), self.onPlay),
			MenuItem(_("Options"), self.onOptions),
			MenuItem(_("High Scores"), self.onHighScores),
			MenuItem(_("Quit"), self.on_quit),
		]
		self.create_menu(items, shake(), shake_back())
示例#22
0
	def __init__(self, menuLayer):
		super().__init__(_("Options"))
		self.menuLayer = menuLayer

		# Add the items and create the menu
		items = [
			MultiMenuItem(_("Type: "), self.onType,
			              [_("Time"), _("Coins")], self.menuLayer.options.type),
			MultiMenuItem(_("Difficulty: "), self.onDifficulty,
			              [_("Easy"), _("Medium"), _("Hard")],
			              self.menuLayer.options.difficulty),
			ToggleMenuItem(_("Full screen: "), self.onFullscreen,
			               self.menuLayer.options.fullscreen),
			MenuItem(_("< Back"), self.on_quit),
		]
		self.create_menu(items, shake(), shake_back())
示例#23
0
    def __init__(self):
        super(OptionMenu, self).__init__("GROSSINI'S SISTERS")

        self.font_title['font_name'] = 'You Are Loved'
        self.font_title['font_size'] = 72

        self.font_item['font_name'] = 'You Are Loved'
        self.font_item_selected['font_name'] = 'You Are Loved'

        self.menu_valign = BOTTOM
        self.menu_halign = RIGHT

        items = []
        items.append(MenuItem('Fullscreen', self.on_fullscreen))
        items.append(ToggleMenuItem('Show FPS: ', self.on_show_fps, True))
        items.append(MenuItem('OK', self.on_quit))
        self.create_menu(items, shake(), shake_back())
    def __init__(self):
        super(MainMenu, self).__init__('Zombie')
        #self.select_sound = soundex.load('move.mp3')

        # you can override the font that will be used for the title and the items
        self.font_title['font_name'] = 'Times New Roman'
        self.font_title['font_size'] = 32
        self.font_title['color'] = (204,164,164,255)

        self.font_item['font_name'] = 'Times New Roman'
        self.font_item['color'] = (128,128,128,255)
        self.font_item['font_size'] = 16
        self.font_item_selected['font_name'] = 'Times New Roman'
        self.font_item_selected['color'] = (255,255,255,255)
        self.font_item_selected['font_size'] = 24

        # you can also override the font size and the colors. see menu.py for
        # more info

        # example: menus can be vertical aligned and horizontal aligned
        self.menu_anchor_y = 'center'
        self.menu_anchor_x = 'center'

        items = []
        
        items.append(MenuItem('New Game', self.new_game))
        items.append(MenuItem('Quit', self.quit))

        #self.volumes = ['Mute','10','20','30','40','50','60','70','80','90','100']

        #items.append( MultipleMenuItem(
                        #'SFX volume: ', 
                        #self.on_sfx_volume,
                        #self.volumes,
                        #int(soundex.sound_vol * 10) )
                    #)
        #items.append( MultipleMenuItem(
                        #'Music volume: ', 
                        #self.on_music_volume,
                        #self.volumes,
                        #int(soundex.music_player.volume * 10) )
                    #)
        #items.append( ToggleMenuItem('Show FPS:', self.on_show_fps, director.show_FPS) )
        #items.append( MenuItem('Fullscreen', self.on_fullscreen) )
        #items.append( MenuItem('Back', self.on_quit) )
        self.create_menu(items, shake(), shake_back())
示例#25
0
    def __init__(self, controller):
        super().__init__('Options')
        self.ctrl = controller

        set_menu_style(self)

        items = [
            menu.ToggleMenuItem('Show FPS:', self.on_show_fps,
                                director.show_FPS),
            menu.MenuItem('FullScreen', self.on_full_screen),
            menu.MenuItem('Back', self.on_quit)
        ]

        self.create_menu(
            items,
            selected_effect=menu.shake(),
            unselected_effect=menu.shake_back(),
        )
示例#26
0
    def __init__(self):
        super(ConfigMenuMenu, self).__init__('')

        self.font_title['font_size'] = 20
        self.font_item_selected['font_size'] = 20
        self.font_item['font_size'] = 20

        l = []
        volumes = [
            'Mute', '10', '20', '30', '40', '50', '60', '70', '80', '90', 'Max'
        ]
        l.append(
            MultipleMenuItem('Music Volume: ', self.on_music_volume, volumes,
                             7))
        l.append(
            MultipleMenuItem('SFX Volume: ', self.on_sfx_volume, volumes, 7))
        l.append(MenuItem('Fullscreen', self.on_fullscreen))
        l.append(MenuItem('Back', self.on_quit))
        self.create_menu(l, zoom_in(1.4), zoom_out(), shake())
示例#27
0
    def __init__(self):
        """ Set style and caption. Add items. Generate menu """
        super().__init__("Lazy Bomberman")
        """
        self.font_title['font_name'] = 'Edit Undo Line BRK'
        self.font_title['font_size'] = 72
        self.font_title['color'] = (204,164,164,255)

        self.font_item['font_name'] = 'Edit Undo Line BRK',
        self.font_item['color'] = (32,16,32,255)
        self.font_item['font_size'] = 32
        self.font_item_selected['font_name'] = 'Edit Undo Line BRK'
        self.font_item_selected['color'] = (32,16,32,255)
        self.font_item_selected['font_size'] = 46
        """
        items = []
        items.append(menu.MenuItem("New game", self.on_new_game))
        items.append(menu.MenuItem("Exit", self.on_exit))
        self.create_menu(items, menu.shake(), menu.shake_back())
示例#28
0
    def __init__(self):
        super(MainMenu, self).__init__('PyHammerfight')
        self.menu_anchor_x = CENTER
        self.menu_anchor_y = CENTER

        self.font_title['font_name'] = 'Edit Undo Line BRK'
        self.font_title['font_size'] = 72
        self.font_title['color'] = (255, 255, 255, 255)
        self.font_item['font_name'] = 'Edit Undo Line BRK',
        self.font_item['font_size'] = 46
        self.font_item['color'] = (255, 255, 255, 200)
        self.font_item_selected['font_name'] = 'Edit Undo Line BRK'
        self.font_item_selected['font_size'] = 56
        self.font_item_selected['color'] = (255, 255, 255, 255)

        items = [MenuItem('Start', self.on_start_game),
                 # MenuItem('Options', self.on_options),
                 # MenuItem('Scores', self.on_scores),
                 MenuItem('Quit', self.on_quit)]
        self.create_menu(items, shake(), shake_back())
示例#29
0
    def __init__(self, controller):
        super().__init__('HearthStone')
        self.ctrl = controller

        set_menu_style(self)

        # [NOTE] Menu can only contain items, it cannot contain other child, such as Label.
        # Menu items
        items = [
            menu.MenuItem('New Game', self.on_new_game),
            menu.MenuItem('Deck', self.on_deck),
            menu.MenuItem('Options', self.on_options),
            menu.MenuItem('Exit', self.on_quit),
        ]

        self.create_menu(
            items,
            selected_effect=menu.shake(),
            unselected_effect=menu.shake_back(),
            # activated_effect=actions.ScaleTo(1.15, duration=0.2),
        )
示例#30
0
    def __init__(self, controller):
        super().__init__('Deck')

        self.ctrl = controller

        set_menu_style(self, item_size=24)

        window_size = director.get_window_size()

        items = [
            menu.MenuItem('Back', self.on_quit),
        ]
        items_positions = [
            abs_pos(0.95, 0.05, window_size),
        ]

        self.create_menu(
            items,
            selected_effect=menu.shake(),
            unselected_effect=menu.shake_back(),
            layout_strategy=menu.fixedPositionMenuLayout(items_positions),
        )
示例#31
0
    def __init__(self, title='SpaceWars', menu_items=[]):
        super(MainMenu, self).__init__()
        self.menu_items = []

        self.font_title = {
            'text': 'SpaceWars',
            'font_name': FONT['header'],
            'font_size': FONT['header_size'],
            'color': FONT['white'],
            'bold': True,
            'anchor_y': 'center',
            'anchor_x': 'center',
        }
        self.title_text = self.title = "SpaceWars"

        self.font_item = {
            'font_name': FONT['body'],
            'font_size': FONT['body_size'],
            'anchor_y': 'center',
            'anchor_x': 'center',
            'color': FONT['gray'],
        }

        self.font_item_selected = {
            'font_name': FONT['body'],
            'font_size': FONT['body_size_selected'],
            'bold': False,
            'anchor_y': 'center',
            'anchor_x': 'center',
            'color': FONT['white'],
        }

        if not menu_items:
            self.build_default_menu()

        for menu_item in menu_items:
            self.build_menu(menu_item)

        self.create_menu(self.menu_items, shake(), shake_back())
示例#32
0
    def __init__(self):
        super(MainMenu, self).__init__('PyHammerfight')
        self.menu_anchor_x = CENTER
        self.menu_anchor_y = CENTER

        self.font_title['font_name'] = 'Edit Undo Line BRK'
        self.font_title['font_size'] = 72
        self.font_title['color'] = (255, 255, 255, 255)
        self.font_item['font_name'] = 'Edit Undo Line BRK',
        self.font_item['font_size'] = 46
        self.font_item['color'] = (255, 255, 255, 200)
        self.font_item_selected['font_name'] = 'Edit Undo Line BRK'
        self.font_item_selected['font_size'] = 56
        self.font_item_selected['color'] = (255, 255, 255, 255)

        items = [
            MenuItem('Start', self.on_start_game),
            # MenuItem('Options', self.on_options),
            # MenuItem('Scores', self.on_scores),
            MenuItem('Quit', self.on_quit)
        ]
        self.create_menu(items, shake(), shake_back())
示例#33
0
    def __init__(self):
        super(MainMenu, self).__init__("MEDUSA GAME")

        self.font_title['font_name'] = 'Edit Undo Line BRK'
        self.font_title['font_size'] = 60
        self.font_title['color'] = (204, 164, 164, 255)

        self.font_item['font_name'] = 'Edit Undo Line BRK'
        self.font_item['font_size'] = 32
        self.font_item['color'] = (32, 16, 32, 255)

        self.font_item_selected['font_name'] = 'Edit Undo Line BRK'
        self.font_item_selected['font_size'] = 46
        self.font_item_selected['color'] = (32, 16, 32, 255)

        items = []

        items.append(menu.MenuItem('Login', self.login_game))
        items.append(menu.MenuItem('Register', self.register_game))
        items.append(menu.MenuItem('More Game', self.more_game))
        items.append(menu.MenuItem('Quit', self.on_quit))

        self.create_menu(items, menu.shake(), menu.shake_back())
示例#34
0
    def __init__(self, map_scene):
        super(MapOptionMenu, self).__init__("GROSSINI'S SISTERS")

        self.font_title['font_name'] = 'You Are Loved'
        self.font_title['font_size'] = 62

        self.font_item['font_name'] = 'You Are Loved'
        self.font_item_selected['font_name'] = 'You Are Loved'

        self.menu_valign = BOTTOM
        self.menu_halign = LEFT
        self.map_scene = map_scene

        items = []
        #items.append(MenuItem('Fullscreen', self.on_fullscreen))
        #items.append(ToggleMenuItem('Show FPS: ', self.on_show_fps, True))
        items.append(
            MenuItem('Generate new Background Image',
                     self.generate_new_background))
        items.append(MenuItem('Generate new Map', self.generate_new_map))
        items.append(MenuItem('Save Map', self.save_map))
        items.append(MenuItem('Load Map', self.load_map))
        items.append(MenuItem('OK', self.on_quit))
        self.create_menu(items, shake(), shake_back())
示例#35
0
    def __init__(self):
        Menu.__init__(self, title="Main Menu")

        self.menu_valign = CENTER
        self.menu_halign = CENTER

        items = [
            MenuItem("Demo", self.start_demo),
        ]

        self.player_team = Team(Pokemon.from_dex("Lycanroc-Dusk"),
                                Pokemon.from_dex("Aegislash-Shield"),
                                Pokemon.from_dex("Aegislash-Blade"))
        self.enemy_team = Team(Pokemon.from_dex("Charizard-Mega-Y"),
                               Pokemon.from_dex("Amoonguss"),
                               Pokemon.from_dex("Charizard-Mega-X"))

        self.player_team.set_orientation(constants.BACK_FACING)
        self.enemy_team.set_orientation(constants.FRONT_FACING)

        self.battle_layer = DoubleBattleLayer(self.player_team,
                                              self.enemy_team, "darkbeach")

        self.create_menu(items, shake(), shake_back())
示例#36
0
 def create_animated_menu(self, items):
     from cocos.menu import shake, shake_back
     
     self.create_menu(items, selected_effect=shake(), unselected_effect=shake_back())
示例#37
0
文件: gui.py 项目: GeoffreYu/Versus
 def create(self, **kw):
     menu_items = []
     seq = ("Play", "Quit")
     for k in seq:
         menu_items.append(ccmn.MenuItem(k, kw[k]))
     self.create_menu(menu_items, ccmn.shake(), ccmn.shake_back())
    def __init__(self):
        from cocos.director import director
        from cocos.menu import ImageMenuItem, fixedPositionMenuLayout
        from math import floor
        from pyglet.resource import location
        
        super(InventoryMenu, self).__init__('Inventory')
        #self.select_sound = soundex.load('move.mp3')
        
        width, height = director.window.get_size()
        
        self.rows = 8
        self.columns = 10
        self.item_width = width / self.columns
        self.item_height = height / self.rows

        # you can override the font that will be used for the title and the items
        self.font_title['font_name'] = 'Times New Roman'
        self.font_title['font_size'] = 32
        self.font_title['color'] = (204,164,164,255)

        self.font_item['font_name'] = 'Times New Roman'
        self.font_item['color'] = (128,128,128,255)
        self.font_item['font_size'] = 32
        self.font_item_selected['font_name'] = 'Times New Roman'
        self.font_item_selected['color'] = (255,255,255,255)
        self.font_item_selected['font_size'] = 32

        # you can also override the font size and the colors. see menu.py for
        # more info

        # example: menus can be vertical aligned and horizontal aligned
        self.menu_anchor_y = 'center'
        self.menu_anchor_x = 'center'
        
        items = ['colt_45.png'] * 70
        menu_items = []
        item_positions = []
        
        for index, item in enumerate(items):
            menu_items.append(ImageMenuItem(item, self.new_game))
            print(((index % self.columns) * self.item_width) + (self.item_width / 2), height - ((floor(index / self.rows) + 1) * self.item_height) - (self.item_height / 2))
            item_positions.append((
                ((index % self.columns) * self.item_width) + (self.item_width / 2),
                height - ((floor(index / self.columns) + 1) * self.item_height) - (self.item_height / 2),
            ))
        
        print(menu_items)
        print(item_positions)
        
        

        #self.volumes = ['Mute','10','20','30','40','50','60','70','80','90','100']

        #items.append( MultipleMenuItem(
                        #'SFX volume: ', 
                        #self.on_sfx_volume,
                        #self.volumes,
                        #int(soundex.sound_vol * 10) )
                    #)
        #items.append( MultipleMenuItem(
                        #'Music volume: ', 
                        #self.on_music_volume,
                        #self.volumes,
                        #int(soundex.music_player.volume * 10) )
                    #)
        #items.append( ToggleMenuItem('Show FPS:', self.on_show_fps, director.show_FPS) )
        #items.append( MenuItem('Fullscreen', self.on_fullscreen) )
        #items.append( MenuItem('Back', self.on_quit) )
        self.create_menu(menu_items, shake(), shake_back(),
                         layout_strategy=fixedPositionMenuLayout(item_positions))