Esempio n. 1
0
    def __init__(self):
        DefaultView.__init__(self)

        path = bge.logic.expandPath("//")

        self.bgImage = bgui.Image(self, "bgImage", img=path+"textures/bg.JPG", size=[1, 1])

        bgui.Label(self.bgImage, "mainLabel", pos=[0.4, 0.5], text="Highscore!  ", pt_size=self.ptGross,
            options=bgui.BGUI_DEFAULT)
        bgui.Label(self.bgImage, "cLabel", pos=[0, 0], text="(c) 2013, capgeti, v0.9", pt_size=self.ptKlein)

        self.gameMenu = bgui.Frame(self.bgImage, "gameMenu", size=[0.3, 0.7], pos=[0.02, 0.15], border=1)

        self.backButton = bgui.FrameButton(self.gameMenu, 'backButton', text='Zurück', pt_size=self.ptNormal,
            size=[0.7, 0.1], pos=[0.3, 0.75], options=bgui.BGUI_DEFAULT | bgui.BGUI_CENTERX)
        self.backButton.on_click = self.forBack

        bge.logic.loadGlobalDict()

        if not "highScore" in bge.logic.globalDict:
            bge.logic.globalDict['highScore'] = list()

        scores = bge.logic.globalDict['highScore']
        if not scores:
            return

        scores.sort(key=lambda tup: tup[1])
        scores.reverse()

        for i, score in enumerate(scores):
            wer = str(i+1) + ") " + score[0] + ": " + str(score[1])
            bgui.Label(self.bgImage, "highScore" + str(i), text=wer, pt_size=self.ptNormal-13, pos=[0.1, 0.6 - (i * 0.05)])
Esempio n. 2
0
    def __init__(self):
        DefaultView.__init__(self)

        width = bge.render.getWindowWidth()
        height = bge.render.getWindowHeight()

        aspect = width / height

        self.itemcount = 3
        self.items = []

        self.createHPView(aspect)
        self.createPointView(aspect)
        self.createWaveView(aspect)
        self.createMunintionView(aspect)
        self.createItemList(aspect)
        self.createMainMenu()

        # Game Over Label
        self.gameOver = bgui.Frame(self, "gameOver", size=[0.4, 0.7], pos=[0.35, 0.15], border=1)

        self.gameOverLabel = bgui.Label(
            self.gameOver, "gameOverLabel", text="Game Over!", pt_size=self.ptSehrGross, pos=[0.1, 0.83]
        )
        self.gameOverPunktestand = bgui.Label(
            self.gameOver, "gameOverPunktestand", text="Punkte:", pt_size=self.ptGross, pos=[0.1, 0.67]
        )

        self.gameOverNameLabel = bgui.Label(
            self.gameOver,
            "gameOverNameLabel",
            text="Bitte gib deinen Namen ein:",
            pt_size=self.ptNormal,
            pos=[0.1, 0.55],
        )

        self.gameOverSaveButton = bgui.FrameButton(
            self.gameOver, "saveButton", text="Eintragen", pt_size=self.ptNormal, size=[0.4, 0.1], pos=[0.05, 0.05]
        )
        self.gameOverSaveButton.on_click = self.savePoints

        self.gameOverCancelButton = bgui.FrameButton(
            self.gameOver,
            "gameOverCancelButton",
            text="Hauptmenü",
            pt_size=self.ptNormal,
            size=[0.4, 0.1],
            pos=[0.55, 0.05],
        )
        self.gameOverCancelButton.on_click = self.showMainMenu

        self.gameOverNameBox = bgui.TextInput(
            self.gameOver,
            "gameOverNameBox",
            text="<Name>",
            pt_size=self.ptNormal,
            pos=[0.1, 0.4],
            size=[0.8, 0.1],
            input_options=bgui.BGUI_INPUT_SELECT_ALL,
        )

        self.gameOver.visible = False
        print("init")