コード例 #1
0
    def init(self):
        self.game_data = {}
        self.game_data['character_file'] = []

        #I18N: The title of the screen where players can choose their character.
        self.name = _("characters")

        #create a character file to have the [?] image
        self.game_data['character_file'].append(join('characters', 'none'))
        self.character = []
        #I18N: in the character screen, to select no character for this player
        #I18N: (with the [?] icon)
        self.character.append(_("None"))
        #create a character for every directory in the characters directory.
        files = os.listdir(join(CONFIG.system_path, 'characters'))
        files.sort()

        self.load_chararacters(files)

        self.add(VBox())

        self.portrait = Image(join(self.game_data['character_file'][0],
            "portrait.png"))

        self.player_spinner = Spinner(self.character)
        player_vbox = VBox()
        player_vbox.add(Label(_('Player name'), align='center'))
        player_vbox.add(TextEntry(_('unnamed player')))
        player_vbox.add(Spinner(self.character))
        player_vbox.add(self.portrait, margin_left=65, margin=5, size=(50, 50))

        hbox = HBox()
        # adding the two box which contains the spinner and the name of the
        # characters
        hbox.add(player_vbox, margin=400)
        self.widget.add(hbox, margin=150)

        #create a level image for every directory in the level directory.
        files = os.listdir(os.path.join( CONFIG.system_path, 'levels'))
        files.sort()

        coverflow_data = self.load_levels(files)

        self.coverflow = Coverflow(coverflow_data)
        self.widget.add(self.coverflow, size=(800, 275))

        #next button to go to the level screen
        self.widget.add(Button(_("Start")),
            margin=83,
            align="center")

        #back button to come back to main screen
        self.widget.add(Button(_('Back')),
            margin=20,
            align="center")
コード例 #2
0
    def init(self):
        self.game_data = {}
        self.game_data['character_file'] = []

        #I18N: The title of the screen where players can choose their character.
        self.name = _("characters")

        #create a character file to have the [?] image
        self.game_data['character_file'].append(join('characters', 'none'))
        self.character = []
        #I18N: in the character screen, to select no character for this player
        #I18N: (with the [?] icon)
        self.character.append(_("None"))
        #create a character for every directory in the characters directory.
        files = os.listdir(join(CONFIG.system_path, 'characters'))
        files.sort()

        self.load_chararacters(files)

        self.add(VBox())

        self.portrait = Image(
            join(self.game_data['character_file'][0], "portrait.png"))

        self.player_spinner = Spinner(self.character)
        player_vbox = VBox()
        player_vbox.add(Label(_('Player name'), align='center'))
        player_vbox.add(TextEntry(_('unnamed player')))
        player_vbox.add(Spinner(self.character))
        player_vbox.add(self.portrait, margin_left=65, margin=5, size=(50, 50))

        hbox = HBox()
        # adding the two box which contains the spinner and the name of the
        # characters
        hbox.add(player_vbox, margin=400)
        self.widget.add(hbox, margin=150)

        #create a level image for every directory in the level directory.
        files = os.listdir(os.path.join(CONFIG.system_path, 'levels'))
        files.sort()

        coverflow_data = self.load_levels(files)

        self.coverflow = Coverflow(coverflow_data)
        self.widget.add(self.coverflow, size=(800, 275))

        #next button to go to the level screen
        self.widget.add(Button(_("Start")), margin=83, align="center")

        #back button to come back to main screen
        self.widget.add(Button(_('Back')), margin=20, align="center")
コード例 #3
0
            self.player_spinner.append(Spinner(self.character))
            #I18N: %s is the player number, it can be Player 1, Player2...
            self.player_vbox[i].add(Label(_("Player %s").replace(
                "%s", str(i+1))))
            self.player_vbox[i].add(self.player_spinner[-1])
            self.player_vbox[i].add(self.portraits[-1],
                margin_left=65,
                margin=5,
                size=(50, 50))
            self.player_vbox[i].add(
                    self.checkboxes_ai[-1],
                    margin_left=(180 - self.checkboxes_ai[-1].width) / 2)


        hbox = HBox()
        # adding the two box which contains the spinner and the name of the
        # characters
        for vbox in self.player_vbox:
            hbox.add(vbox, margin=20)
        self.widget.add(hbox, margin=50)

        #next button to go to the level screen
        self.widget.add(Button(_("Next")),
            margin=83,
            align="center")

        #back button to come back to main screen
        self.widget.add(Button(_('Back')),
            margin=20,
            align="center")
コード例 #4
0
                           "portrait.png")))

            self.player_spinner.append(Spinner(self.character))
            #I18N: %s is the player number, it can be Player 1, Player2...
            self.player_vbox[i].add(
                Label(_("Player %s").replace("%s", str(i + 1))))
            self.player_vbox[i].add(self.player_spinner[-1])
            self.player_vbox[i].add(self.portraits[-1],
                                    margin_left=65,
                                    margin=5,
                                    size=(50, 50))
            self.player_vbox[i].add(
                self.checkboxes_ai[-1],
                margin_left=(180 - self.checkboxes_ai[-1].width) / 2)

        hbox = HBox()
        # adding the two box which contains the spinner and the name of the
        # characters
        for vbox in self.player_vbox:
            hbox.add(vbox, margin=20)
        self.widget.add(hbox, margin=50)

        #next button to go to the level screen
        self.widget.add(Button(_("Next")), margin=83, align="center")

        #back button to come back to main screen
        self.widget.add(Button(_('Back')), margin=20, align="center")

    def callback(self, action):
        if action in self.player_spinner:
            #get the index of the player
コード例 #5
0
    def init(self):
        self.add(VBox())
        self.name = _("Keyboard Options")

        hbox = HBox()
        hbox.add(Label(" "), size=(80, 20))
        for img in ['left.png', 'right.png', 'top.png', 'bottom.png']:
            hbox.add(Image(join(
                'gui',
                CONFIG.general.THEME,
                img)),
                size=(40, 30),
                margin=30)


        hbox.add(Label('B'), size=(30, 40), margin=40, align="center")
        hbox.add(Label('A'), size=(30, 40), margin=40, align="center")
        hbox.add(Label(_("Shield")), size=(60, 40), margin=10, align="center")
        self.widget.add(hbox)
        actions = ['Left', 'Right', 'Up', 'Down', 'A', 'B', 'Shield']

        #one iteration per player
        for i in xrange(1, 5):
            hbox = HBox()
            hbox.add(Label('Player ' + str(i + 1)), size=(80, 50))

            for action in actions:
                w = KeyboardWidget(getattr(CONFIG.keyboard, 
                                       "PL{0}_{1}".format(i, action.upper())))
                w.set_id("PL{0}_{1}".format(i, action.upper()))
                hbox.add(w, size=(40, 40), margin=30)

            self.widget.add(hbox)

        self.widget.add(Button(_('Back')), align="center")
        self.widget.update_pos()