Beispiel #1
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 0.5),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.lblVictory = DirectLabel(
            frameColor=(0.0, 0.0, 0.0, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.2, 0.2, 0.2),
            text='Won Fight',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblVictory.setTransparency(0)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
Beispiel #2
0
def __createUnknown(self, filename, xPos, zPos):
    name = filename
    if len(filename) > 10:
        name = ""
        for i in range(math.ceil(len(filename) / 10)):
            name += filename[i * 10:i * 10 + 10] + "\n"
        name = name[:-1]
    lbl = DirectLabel(
        parent=self.container.getCanvas(),
        image=loader.load_texture(f"{self.iconDir}/File.png",
                                  loaderOptions=self.imageOpts),
        image_scale=35,
        image_color=self.theme.unknown_image_tint,
        relief=1,
        frameColor=(0.7, 0.7, 0.7, 0),
        frameSize=(-40, 40, -40, 40),
        pos=LPoint3f(xPos, 0, zPos),
        text=name,
        text_scale=12,
        text_pos=(0, -40),
        text_fg=self.theme.default_text_color,
    )
    lbl.bind(DGG.MWDOWN, self.scroll, [0.01])
    lbl.bind(DGG.MWUP, self.scroll, [-0.01])
    lbl.setTransparency(TransparencyAttrib.M_multisample)
Beispiel #3
0
class HUD(DirectObject):
    def __init__(self):

        self.winXhalf = base.win.getXSize() / 2
        self.winYhalf = base.win.getYSize() / 2

        croshairsize = 0.05#17.0

        self.crosshair = OnscreenImage(
            image = os.path.join("..", "data", "crosshair.png"),
            scale = (croshairsize, 1, croshairsize),
            #pos = (self.winXhalf - croshairsize/2.0, 0, -self.winYhalf - croshairsize/2.0)
            pos = (0, 0, 0)
            )
        self.crosshair.setTransparency(1)

        self.ammo = DirectLabel(
            scale = 0.15,
            text = "100/100",
            pos = (base.a2dLeft + 0.025, 0.0, base.a2dBottom + 0.05),
            text_align = TextNode.ALeft,
            frameColor = (0, 0, 0, 0),
            text_fg = (1,1,1,1),
            text_shadow = (0, 0, 0, 1),
            text_shadowOffset = (0.05, 0.05)
            )
        self.ammo.setTransparency(1)

        self.nowPlaying = DirectLabel(
            scale = 0.05,
            text = "Now Playing: Echovolt - Nothing to Fear",
            pos = (base.a2dLeft + 0.025, 0.0, base.a2dTop - 0.05),
            text_align = TextNode.ALeft,
            frameColor = (0, 0, 0, 0),
            text_fg = (1,1,1,1)
            )
        self.nowPlaying.setTransparency(1)

        self.accept("window-event", self.recalcAspectRatio)
        self.hide()

    def show(self):
        self.crosshair.show()
        self.nowPlaying.show()
        self.ammo.show()

    def hide(self):
        self.crosshair.hide()
        self.nowPlaying.hide()
        self.ammo.hide()

    def updateAmmo(self, maxAmmo, ammo):
        self.ammo["text"] = "%02d/%02d" % (maxAmmo, ammo)

    def recalcAspectRatio(self, window):
        self.ammo.setPos(base.a2dLeft + 0.025, 0.0, base.a2dBottom + 0.05)
        self.ammo.setPos(base.a2dLeft + 0.025, 0.0, base.a2dTop - 0.05)
Beispiel #4
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 0.75),
            frameSize=(-1, 1, -1, 1),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(1)

        self.btnQuit = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.75),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quit',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["quitRoom"],
            pressEffect=1,
        )
        self.btnQuit.setTransparency(0)

        self.lblMessage = DirectLabel(
            frameColor=(0.0, 0.0, 0.0, 0.0),
            frameSize=(-2.981, 3.106, -0.325, 0.725),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.2, 0.2, 0.2),
            text='Player A Won',
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblMessage.setTransparency(0)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
 def __createUnknown(self, filename, xPos, zPos):
     name = filename
     if len(filename) > 10:
         name = ""
         for i in range(math.ceil(len(filename)/10)):
             name += filename[i*10:i*10+10]+"\n"
         name = name[:-1]
     lbl = DirectLabel(
         parent=self.container.getCanvas(),
         image="icons/File.png",
         image_scale=35,
         image_color=(0.9,0.5,0.5,1),
         relief=1,
         frameColor = (0.7, 0.7, 0.7, 0),
         frameSize=(-40, 40, -40, 40),
         pos=LPoint3f(xPos, 0, zPos),
         text = name,
         text_scale=12,
         text_pos=(0,-40),
     )
     lbl.bind(DGG.MWDOWN, self.scroll, [0.01])
     lbl.bind(DGG.MWUP, self.scroll, [-0.01])
     lbl.setTransparency(TransparencyAttrib.M_multisample)
Beispiel #6
0
def __createUnknown(self, entry, xPos, zPos):
    name = entry.name
    lbl = DirectLabel(
        parent=self.container.getCanvas(),
        image=loader.load_texture(f"{self.iconDir}/File.png", loaderOptions=self.imageOpts),
        image_scale=16,
        image_pos=(16,0,0),
        image_color=self.theme.unknown_image_tint,
        relief=1,
        frameColor = (0.7, 0.7, 0.7, 0),
        frameSize=(0, self.screenWidthPxHalf*2, -16, 16),
        pos=LPoint3f(xPos, 0, zPos),
        text = name,
        text_align=TextNode.ALeft,
        text_scale=12,
        text_pos=(32,-4),
        text_fg=self.theme.default_text_color,
    )

    lblInfo = __createMIMEInfo(self, lbl, entry)

    lbl.bind(DGG.MWDOWN, self.scroll, [0.01])
    lbl.bind(DGG.MWUP, self.scroll, [-0.01])
    lbl.setTransparency(TransparencyAttrib.M_multisample)
Beispiel #7
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmRoomEntry = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1.0, 1.0, -0.1, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmRoomEntry.setTransparency(0)

        self.lblRoomName = DirectLabel(
            frameSize=(0.075, 15.0, -0.2, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.975, 0, -0.065),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Room Name',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmRoomEntry,
        )
        self.lblRoomName.setTransparency(0)

        self.lblPlayerCount = DirectLabel(
            frameSize=(-1.15, 1.25, -0.2, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.15, 0, -0.065),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='0/4',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmRoomEntry,
        )
        self.lblPlayerCount.setTransparency(0)

        self.lblGameType = DirectLabel(
            frameSize=(-4.0, 4.0, -0.2, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.125, 0, -0.065),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Game Type',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmRoomEntry,
        )
        self.lblGameType.setTransparency(0)

        self.btnJoin = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pad=(0.1, 0.1),
            pos=LPoint3f(0.855, 0, -0.075),
            scale=LVecBase3f(0.075, 0.075, 0.075),
            text='Join',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmRoomEntry,
            command=base.messenger.send,
            extraArgs=["room_join"],
        )
        self.btnJoin.setTransparency(0)

        self.lblDifficulty = DirectLabel(
            frameSize=(-4.0, 4.0, -0.2, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.545, 0, -0.065),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Difficulty',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmRoomEntry,
        )
        self.lblDifficulty.setTransparency(0)

    def show(self):
        self.frmRoomEntry.show()

    def hide(self):
        self.frmRoomEntry.hide()

    def destroy(self):
        self.frmRoomEntry.destroy()
Beispiel #8
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmBack = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 1.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmBack.setTransparency(0)

        self.pg671 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.893750011920929, 1.0187499523162842,
                       -0.11250001192092896, 0.7124999761581421),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.5),
            scale=LVecBase3f(0.2, 0.2, 0.2),
            text='END',
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg671.setTransparency(0)

        self.lblEnding = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.025, 0, -0.675),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text="You've found ending x/x",
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.lblEnding.setTransparency(0)

        self.pg6340 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-0.893750011920929, 1.0187499523162842,
                       -0.11250001192092896, 0.7124999761581421),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.125, 0, 0.65),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='the',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg6340.setTransparency(0)

        self.pg1228 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.35),
            scale=LVecBase3f(0.05, 0.1, 0.056),
            text='A Game By',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg1228.setTransparency(0)

        self.pg1785 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.275),
            scale=LVecBase3f(0.08, 0.1, 0.08),
            text='Fireclaw',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg1785.setTransparency(0)

        self.pg4435 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.175),
            scale=LVecBase3f(0.05, 0.1, 0.056),
            text='Music from Jamendo by Golden Antelope',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg4435.setTransparency(0)

        self.pg5320 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-8.0, 8.0, -0.325, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.1),
            scale=LVecBase3f(0.05, 0.1, 0.056),
            text='Audio from freesound by reinsamba',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmBack,
        )
        self.pg5320.setTransparency(0)

    def show(self):
        self.frmBack.show()

    def hide(self):
        self.frmBack.hide()

    def destroy(self):
        self.frmBack.destroy()
Beispiel #9
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1.777778, 1.77777778, -1.1638, 1.1638),
            hpr=LVecBase3f(0, 0, 0),
            image='assets/menu/Background.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(1.77778, 1, 1.1638),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.frmSinglePlayerCreateGame = DirectFrame(
            borderWidth=(0.01, 0.01),
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.65, 0.65, -0.55, 0.55),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.425, 0, 0),
            relief=5,
            parent=self.frmMain,
        )
        self.frmSinglePlayerCreateGame.setTransparency(0)

        self.lblHeader = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.425),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Singleplayer Game',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.lblHeader.setTransparency(0)

        self.lblGameType = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, 0.225),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Game Type',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.lblGameType.setTransparency(0)

        self.lblNumNPCs = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, -0.125),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Number of NPCs ',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.lblNumNPCs.setTransparency(0)

        self.optionNumNPCs = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.07500000298023224, 3.012500149011612,
                       -0.11250001192092896, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.2, 0, -0.115),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475,
                            -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            item0_text_wordwrap=None,
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.optionNumNPCs.setTransparency(0)

        self.optionGameType = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.07500000298023224, 3.012500149011612,
                       -0.11250001192092896, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.2, 0, 0.22),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475,
                            -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            item0_text_wordwrap=None,
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.optionGameType.setTransparency(0)

        self.btnStart = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.35, 0, -0.45),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Start',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
            command=base.messenger.send,
            extraArgs=["singlePlayerCreateGame_start"],
        )
        self.btnStart.setTransparency(0)

        self.lblPlayerClass = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, 0.05),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Player Class',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.lblPlayerClass.setTransparency(0)

        self.optionPlayerClass = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.07500000298023224, 3.012500149011612,
                       -0.11250001192092896, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.2, 0, 0.055),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475,
                            -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            item0_text_wordwrap=None,
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.optionPlayerClass.setTransparency(0)

        self.btnCancel = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.325, 0, -0.45),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Cancel',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
            command=base.messenger.send,
            extraArgs=["singlePlayerCreateGame_back"],
        )
        self.btnCancel.setTransparency(0)

        self.lblDifficulty = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, -0.29),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Difficulty',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.lblDifficulty.setTransparency(0)

        self.optionDifficulty = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.07500000298023224, 3.012500149011612,
                       -0.11250001192092896, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.2, 0, -0.29),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475,
                            -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            item0_text_wordwrap=None,
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmSinglePlayerCreateGame,
        )
        self.optionDifficulty.setTransparency(0)

        self.frmPlayerInfo = DirectFrame(
            borderWidth=(0.01, 0.01),
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.5, 0.5, -0.55, 0.55),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.765, 0, 0),
            relief=3,
            parent=self.frmMain,
        )
        self.frmPlayerInfo.setTransparency(0)

        self.lblInfoHeader = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.45),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Info',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmPlayerInfo,
        )
        self.lblInfoHeader.setTransparency(0)

        self.frmImageHero = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.15, 0.15, -0.2, 0.2),
            hpr=LVecBase3f(0, 0, 0),
            image=
            '/home/fireclaw/workspace/Ankandora/AnkandoraLight/design/guiGraphics/heroArcher.png',
            pos=LPoint3f(-0.275, 0, 0.195),
            image_scale=LVecBase3f(0.15, 1, 0.2),
            image_pos=LPoint3f(0, 0, 0),
            parent=self.frmPlayerInfo,
        )
        self.frmImageHero.setTransparency(1)

        self.lblClassDescription = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.12, 0, 0.31),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='The archer shoots from afar and gains the first-strike',
            text_align=TextNode.A_left,
            text_scale=(0.6, 0.6),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=10.0,
            parent=self.frmPlayerInfo,
        )
        self.lblClassDescription.setTransparency(0)

        self.lblHealth = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.28, 0, -0.1),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Health',
            text_align=TextNode.A_center,
            text_scale=(0.7, 0.7),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmPlayerInfo,
        )
        self.lblHealth.setTransparency(0)

        self.lblAttack = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.275, 0, -0.285),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Attack',
            text_align=TextNode.A_center,
            text_scale=(0.7, 0.7),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmPlayerInfo,
        )
        self.lblAttack.setTransparency(0)

        self.lblHealthValue = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.275, 0, -0.17),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='7',
            text_align=TextNode.A_center,
            text_scale=(0.6, 0.6),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmPlayerInfo,
        )
        self.lblHealthValue.setTransparency(0)

        self.lblAttackValue = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.275, 0, -0.36),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='4',
            text_align=TextNode.A_center,
            text_scale=(0.6, 0.6),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.frmPlayerInfo,
        )
        self.lblAttackValue.setTransparency(0)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
Beispiel #10
0
class PlayerHUD():
    def __init__(self):
        #
        # Player status section
        #
        heartscale = (0.1, 1, 0.1)
        self.heart1 = OnscreenImage(image="HeartIcon.png",
                                    scale=heartscale,
                                    pos=(0.2, 0, -0.15))
        self.heart1.setTransparency(True)
        self.heart1.reparentTo(base.a2dTopLeft)
        self.heart2 = OnscreenImage(image="HeartIcon.png",
                                    scale=heartscale,
                                    pos=(0.45, 0, -0.15))
        self.heart2.setTransparency(True)
        self.heart2.reparentTo(base.a2dTopLeft)
        self.heart3 = OnscreenImage(image="HeartIcon.png",
                                    scale=heartscale,
                                    pos=(0.7, 0, -0.15))
        self.heart3.setTransparency(True)
        self.heart3.reparentTo(base.a2dTopLeft)

        self.keys = DirectLabel(text="x0",
                                frameColor=(0, 0, 0, 0),
                                text_fg=(1, 1, 1, 1),
                                text_scale=1.8,
                                text_pos=(1, -0.25, 0),
                                text_align=TextNode.ALeft,
                                image="Keys.png",
                                pos=(0.2, 0, -0.4))
        self.keys.setScale(0.085)
        self.keys.setTransparency(True)
        self.keys.reparentTo(base.a2dTopLeft)

        self.actionKey = DirectLabel(frameColor=(0, 0, 0, 0),
                                     text_fg=(1, 1, 1, 1),
                                     scale=0.15,
                                     pos=(0, 0, 0.15),
                                     text=_("Action: E/Enter"))
        self.actionKey.setTransparency(True)
        self.actionKey.reparentTo(base.a2dBottomCenter)
        self.actionKey.hide()

    def show(self):
        self.keys.show()

    def hide(self):
        self.heart1.hide()
        self.heart2.hide()
        self.heart3.hide()
        self.keys.hide()
        self.hideActionKey()

    def setHealthStatus(self, value):
        """this function will set the health image in the top righthand corner
        according to the given value, where value is a integer between 0 and 100
        """
        if value >= 1: self.heart1.show()
        else: self.heart1.hide()
        if value >= 2: self.heart2.show()
        else: self.heart2.hide()
        if value >= 3: self.heart3.show()
        else: self.heart3.hide()

    def showActionKey(self):
        self.actionKey.show()

    def hideActionKey(self):
        self.actionKey.hide()

    def updateKeyCount(self, numKeys):
        self.keys["text"] = "x%d" % numKeys
Beispiel #11
0
class GUI:
    def __init__(self, rootParent=None):
        
        self.frmInventory = DirectFrame(
            frameColor=(0.2, 0.2, 0.2, 1.0),
            frameSize=(-0.3, 0.3, -0.5, 0.5),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, 0.2),
            parent=rootParent,
        )
        self.frmInventory.setTransparency(0)

        self.frmContent = DirectScrolledFrame(
            canvasSize=(-0.8, 0.8, -0.8, 0.8),
            frameColor=(0.2, 0.2, 0.2, 1.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.475, 0, 0.1),
            scrollBarWidth=0.08,
            state='normal',
            horizontalScroll_borderWidth=(0.01, 0.01),
            horizontalScroll_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_pos=LPoint3f(0, 0, 0),
            horizontalScroll_decButton_borderWidth=(0.01, 0.01),
            horizontalScroll_decButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_decButton_pos=LPoint3f(0, 0, 0),
            horizontalScroll_incButton_borderWidth=(0.01, 0.01),
            horizontalScroll_incButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_incButton_pos=LPoint3f(0, 0, 0),
            horizontalScroll_thumb_borderWidth=(0.01, 0.01),
            horizontalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_thumb_pos=LPoint3f(0, 0, 0),
            verticalScroll_borderWidth=(0.01, 0.01),
            verticalScroll_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_pos=LPoint3f(0, 0, 0),
            verticalScroll_decButton_borderWidth=(0.01, 0.01),
            verticalScroll_decButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_decButton_pos=LPoint3f(0, 0, 0),
            verticalScroll_incButton_borderWidth=(0.01, 0.01),
            verticalScroll_incButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_incButton_pos=LPoint3f(0, 0, 0),
            verticalScroll_thumb_borderWidth=(0.01, 0.01),
            verticalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_thumb_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmContent.setTransparency(1)

        self.btnQuit = DirectButton(
            frameSize=(-3.0, 3.0, -0.3, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, -0.85),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quit',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["quitGame"],
            pressEffect=1,
        )
        self.btnQuit.setTransparency(0)

        self.btnAudioToggle = DirectButton(
            frameSize=(-3.0, 3.0, -0.3, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, -0.7),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Audio On',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["toggleAudio"],
            pressEffect=1,
        )
        self.btnAudioToggle.setTransparency(0)

        self.frmBorderOverlay = DirectFrame(
            frameColor=(1.0, 1.0, 1.0, 0.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            image='gameScreen/border.png',
            pos=LPoint3f(-0.475, 0, 0.1),
            image_scale=LVecBase3f(0.8, 1, 0.8),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmBorderOverlay.setTransparency(1)

        self.lblInventory = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.725, 0, 0.775),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Inventory',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.9, 0.9, 0.9, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lblInventory.setTransparency(0)

        self.lblStory = DirectLabel(
            frameSize=(-0.125, 12.0, -0.313, 0.925),
            hpr=LVecBase3f(0, 0, 0),
            pad=(0.2, 0.2),
            pos=LPoint3f(-1.26, 0, -0.845),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            text_align=TextNode.A_left,
            text_scale=(0.4, 0.4),
            text_pos=(0.0, 0.4),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=29.8,
            parent=rootParent,
        )
        self.lblStory.setTransparency(0)

        self.btnContinue = DirectButton(
            frameSize=(-1.8, 1.8, -0.3, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.145, 0, -0.845),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Cont.',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
            command=base.messenger.send,
            extraArgs=["story_continue"],
            pressEffect=1,
        )
        self.btnContinue.setTransparency(0)

        self.frmFadeOverlay = DirectFrame(
            frameColor=(0.0, 0.0, 0.0, 1.0),
            frameSize=(-0.8, 0.8, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.475, 0, 0.1),
            parent=rootParent,
        )
        self.frmFadeOverlay.setTransparency(1)


    def show(self):
        self.frmInventory.show()
        self.frmContent.show()
        self.btnQuit.show()
        self.btnAudioToggle.show()
        self.frmBorderOverlay.show()
        self.lblInventory.show()
        self.lblStory.show()
        self.btnContinue.show()
        self.frmFadeOverlay.show()

    def hide(self):
        self.frmInventory.hide()
        self.frmContent.hide()
        self.btnQuit.hide()
        self.btnAudioToggle.hide()
        self.frmBorderOverlay.hide()
        self.lblInventory.hide()
        self.lblStory.hide()
        self.btnContinue.hide()
        self.frmFadeOverlay.hide()

    def destroy(self):
        self.frmInventory.destroy()
        self.frmContent.destroy()
        self.btnQuit.destroy()
        self.btnAudioToggle.destroy()
        self.frmBorderOverlay.destroy()
        self.lblInventory.destroy()
        self.lblStory.destroy()
        self.btnContinue.destroy()
        self.frmFadeOverlay.destroy()
Beispiel #12
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1.777778, 1.77777778, -1.1638, 1.1638),
            hpr=LVecBase3f(0, 0, 0),
            image='assets/menu/Background.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(1.77778, 1, 1.1638),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.frmMenu = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.4, 0.4, -0.5, 0.5),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=self.frmMain,
        )
        self.frmMenu.setTransparency(0)

        self.btnSingleplayer = DirectButton(
            frameSize=(-4.0, 4.0, -0.4, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.2),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Singleplayer',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMenu,
            command=base.messenger.send,
            extraArgs=["menu_singleplayer"],
        )
        self.btnSingleplayer.setTransparency(0)

        self.btnMultiplayer = DirectButton(
            frameSize=(-4.0, 4.0, -0.4, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.025),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Multiplayer',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMenu,
            command=base.messenger.send,
            extraArgs=["menu_multiplayer"],
        )
        self.btnMultiplayer.setTransparency(0)

        self.btnOptions = DirectButton(
            frameSize=(-4.0, 4.0, -0.4, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.15),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Options',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMenu,
            command=base.messenger.send,
            extraArgs=["menu_options"],
        )
        self.btnOptions.setTransparency(0)

        self.btnQuit = DirectButton(
            frameSize=(-4.0, 4.0, -0.4, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.325),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quit',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMenu,
            command=base.messenger.send,
            extraArgs=["menu_quit"],
        )
        self.btnQuit.setTransparency(0)

        self.lblLogo = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-6.0, 6.0, -1.5, 1.5),
            hpr=LVecBase3f(0, 0, 0),
            image='./assets/menu/Banner.png',
            pos=LPoint3f(0, 0, 0.475),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            image_scale=LVecBase3f(6, 1, 1.5),
            image_pos=LPoint3f(0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMenu,
        )
        self.lblLogo.setTransparency(1)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
Beispiel #13
0
class Menu(DirectObject):
    def __init__(self):
        #self.accept("RatioChanged", self.recalcAspectRatio)
        self.accept("window-event", self.recalcAspectRatio)

        self.frameMain = DirectFrame(
            # size of the frame
            frameSize = (base.a2dLeft, base.a2dRight,
                         base.a2dTop, base.a2dBottom),
            # position of the frame
            pos = (0, 0, 0),
            # tramsparent bg color
            frameColor = (0, 0, 0, 0),
            sortOrder = 0)

        self.background = OnscreenImage("MenuBGLogo.png")
        self.background.reparentTo(self.frameMain)

        self.nowPlaying = DirectLabel(
            scale = 0.05,
            text = "Now Playing: Eraplee Noisewall Orchestra - Bermuda Fire",
            pos = (base.a2dLeft + 0.025, 0.0, base.a2dBottom + 0.05),
            text_align = TextNode.ALeft,
            frameColor = (0, 0, 0, 0),
            text_fg = (1,1,1,1)
            )
        self.nowPlaying.setTransparency(1)
        self.nowPlaying.reparentTo(self.frameMain)

        maps = loader.loadModel('button_maps.egg')
        btnGeom = (maps.find('**/ButtonReady'),
                    maps.find('**/ButtonClick'),
                    maps.find('**/ButtonRollover'),
                    maps.find('**/ButtonDisabled'))

        self.btnStart = self.createButton("Start", btnGeom, 0.25, self.btnStart_Click)
        self.btnStart.reparentTo(self.frameMain)

        self.btnQuit = self.createButton("Quit", btnGeom, -0.25, self.btnQuit_Click)
        self.btnQuit.reparentTo(self.frameMain)

        self.recalcAspectRatio(base.win)

        # hide all buttons at startup
        self.hide()

    def show(self):
        self.frameMain.show()
        self.recalcAspectRatio(base.win)

    def hide(self):
        self.frameMain.hide()

    def recalcAspectRatio(self, window):
        """get the new aspect ratio to resize the mainframe"""
        screenResMultiplier = window.getXSize() / window.getYSize()
        self.frameMain["frameSize"] = (
            base.a2dLeft, base.a2dRight,
            base.a2dTop, base.a2dBottom)
        self.btnQuit["text_scale"] = (0.5*screenResMultiplier, 0.5, 0.5)
        self.btnStart["text_scale"] = (0.5*screenResMultiplier, 0.5, 0.5)


    def createButton(self, text, btnGeom, yPos, command):
        btn = DirectButton(
            scale = (0.25, 0.25, 0.25),
            # some temp text
            text = text,
            text_scale = (0.5, 0.5, 0.5),
            # set the alignment to right
            text_align = TextNode.ACenter,
            # put the text on the right side of the button
            text_pos = (0, -0.15),
            # set the text color to black
            text_fg = (1,1,0,1),
            text_shadow = (0.3, 0.3, 0.1, 1),
            text_shadowOffset = (0.05, 0.05),
            # set the buttons images
            geom = btnGeom,
            relief = 1,
            frameColor = (0,0,0,0),
            pressEffect = False,
            pos = (0, 0, yPos),
            command = command,
            rolloverSound = None,
            clickSound = None)
        btn.setTransparency(1)
        return btn

    def btnStart_Click(self):
        base.messenger.send("start")

    def btnQuit_Click(self):
        base.messenger.send("quit")
Beispiel #14
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmStats = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.55, 0.55, -0.1, 0.1),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmStats.setTransparency(0)

        self.lblName = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.3, 0, 0.05),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Name: ',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblName.setTransparency(0)

        self.lblAttack = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.3, 0, -0.01),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Attack:',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblAttack.setTransparency(0)

        self.lblDefense = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.3, 0, -0.075),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Defense:',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblDefense.setTransparency(0)

        self.imgPlayer = DirectLabel(
            frameSize=(-0.9, 0.9, -0.9, 0.9),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.445, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.imgPlayer.setTransparency(0)

        self.lblNameValue = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.075, 0, 0.05),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Player Name',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblNameValue.setTransparency(0)

        self.lblAttackValue = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.075, 0, -0.01),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='5',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblAttackValue.setTransparency(0)

        self.lblDefenseValue = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.075, 0, -0.075),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='10',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblDefenseValue.setTransparency(0)

        self.lblHealtPotions = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.12, 0, -0.075),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Potions:',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblHealtPotions.setTransparency(0)

        self.lblHealthPotionsValue = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.325, 0, -0.075),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='3',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblHealthPotionsValue.setTransparency(0)

        self.lblHit = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.125),
            scale=LVecBase3f(0.5, 0.5, 0.5),
            text='5',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmStats,
        )
        self.lblHit.setTransparency(0)

    def show(self):
        self.frmStats.show()

    def hide(self):
        self.frmStats.hide()

    def destroy(self):
        self.frmStats.destroy()
Beispiel #15
0
class GUI:
    def __init__(self, rootParent=None):

        self.lblDescription = DirectFrame(
            frameColor=(1.0, 1.0, 1.0, 0.0),
            frameSize=(-0.75, 0.75, -0.8, 0.8),
            hpr=LVecBase3f(0, 0, 0),
            image='./assets/quest/QuestBG.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(0.75, 1, 0.8),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.lblDescription.setTransparency(2)

        self.lblHeader = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.59),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Quest',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblHeader.setTransparency(1)

        self.lblQuestDesc = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, 0.525),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text='Quest description part 1',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblQuestDesc.setTransparency(1)

        self.lblControl = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, -0.25),
            scale=LVecBase3f(0.08, 0.08, 0.08),
            text='Controls',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblControl.setTransparency(1)

        self.lblControlDesc = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.6, 0, -0.315),
            scale=LVecBase3f(0.05, 0.05, 0.05),
            text="If it's your turn, click the dice button or hit D",
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
        )
        self.lblControlDesc.setTransparency(1)

        self.btnClose = DirectButton(
            frameColor=(0.8, 0.8, 0.8, 0.75),
            frameSize=(-1.288, 1.387, -0.213, 0.825),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.65),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Close',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.lblDescription,
            pressEffect=1,
        )
        self.btnClose.setTransparency(0)

    def show(self):
        self.lblDescription.show()

    def hide(self):
        self.lblDescription.hide()

    def destroy(self):
        self.lblDescription.destroy()
Beispiel #16
0
class GUI:
    def __init__(self, rootParent=None):
        self.background = loader.load_model("assets/models/highscoreBack.bam")
        self.background.reparent_to(render)

        x = -0.8
        y = 0.8

        xShift = 0.15
        yShift = -0.15

        lb = base.leaderboard.leaderboard()

        self.lbl1 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='1 - {} : {}'.format(lb[0][0], lb[0][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl1.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl2 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='2 - {} : {}'.format(lb[1][0], lb[1][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl2.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl3 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='3 - {} : {}'.format(lb[2][0], lb[2][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl3.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl4 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='4 - {} : {}'.format(lb[3][0], lb[3][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl4.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl5 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='5 - {} : {}'.format(lb[4][0], lb[4][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl5.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl6 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='6 - {} : {}'.format(lb[5][0], lb[5][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl6.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl7 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='7 - {} : {}'.format(lb[6][0], lb[6][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl7.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl8 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='8 - {} : {}'.format(lb[7][0], lb[7][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl8.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl9 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='9 - {} : {}'.format(lb[8][0], lb[8][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl9.setTransparency(0)

        x += xShift
        y += yShift

        self.lbl10 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(0.03750000149011612, 3.3125, -0.11250001192092896,
                       0.699999988079071),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(x, 0, y),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='10 - {} : {}'.format(lb[9][0], lb[9][1]),
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.lbl10.setTransparency(0)

        credits = '''
            hendrik-jan - Lead design & Audio
            tizilogic - Procedural Generation
            fireclaw - Graphics
            rdb - Fireworks
        '''
        self.credits = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text=credits,
            text_align=0,  #TextNode.A_left,
            text_scale=(0.5, 0.5),
            text_pos=(-4, 4),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.credits.reparent_to(base.a2dBottomLeft)

        self.wait = 0.3
        self.task = base.task_mgr.add(self.update)

    def update(self, task):
        if self.wait < 0:
            context = base.device_listener.read_context('player')
            if context['move'] or context['accelerate'] or context[
                    "decelerate"]:
                base.messenger.send("do_back")
        else:
            self.wait -= globalClock.get_dt()
        return task.cont

    def show(self):
        self.lbl1.show()
        self.lbl2.show()
        self.lbl3.show()
        self.lbl4.show()
        self.lbl5.show()
        self.lbl6.show()
        self.lbl7.show()
        self.lbl8.show()
        self.lbl9.show()
        self.lbl10.show()

    def hide(self):
        self.lbl1.hide()
        self.lbl2.hide()
        self.lbl3.hide()
        self.lbl4.hide()
        self.lbl5.hide()
        self.lbl6.hide()
        self.lbl7.hide()
        self.lbl8.hide()
        self.lbl9.hide()
        self.lbl10.hide()

    def destroy(self):
        self.task.remove()
        self.credits.destroy()
        self.background.detach_node()
        self.lbl1.destroy()
        self.lbl2.destroy()
        self.lbl3.destroy()
        self.lbl4.destroy()
        self.lbl5.destroy()
        self.lbl6.destroy()
        self.lbl7.destroy()
        self.lbl8.destroy()
        self.lbl9.destroy()
        self.lbl10.destroy()
Beispiel #17
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1.777778, 1.77777778, -1.1638, 1.1638),
            hpr=LVecBase3f(0, 0, 0),
            image='assets/menu/Background.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(1.77778, 1, 1.1638),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.frmRoomList = DirectScrolledFrame(
            canvasSize=(-1.0, 1.0, -2.0, 0.0),
            frameColor=(1, 1, 1, 1),
            frameSize=(-1.0, 1.08, -1.4, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.7),
            scrollBarWidth=0.08,
            state='normal',
            horizontalScroll_borderWidth=(0.01, 0.01),
            horizontalScroll_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_pos=LPoint3f(0, 0, 0),
            horizontalScroll_decButton_borderWidth=(0.01, 0.01),
            horizontalScroll_decButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_decButton_pos=LPoint3f(-0.96, 0, -1.36),
            horizontalScroll_incButton_borderWidth=(0.01, 0.01),
            horizontalScroll_incButton_frameSize=(-0.05, 0.05, -0.04, 0.04),
            horizontalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_incButton_pos=LPoint3f(0.96, 0, -1.36),
            horizontalScroll_thumb_borderWidth=(0.01, 0.01),
            horizontalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            horizontalScroll_thumb_pos=LPoint3f(0, 0, -1.36),
            verticalScroll_borderWidth=(0.01, 0.01),
            verticalScroll_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_pos=LPoint3f(0, 0, 0),
            verticalScroll_decButton_borderWidth=(0.01, 0.01),
            verticalScroll_decButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_decButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_decButton_pos=LPoint3f(1.04, 0, -0.04),
            verticalScroll_incButton_borderWidth=(0.01, 0.01),
            verticalScroll_incButton_frameSize=(-0.04, 0.04, -0.05, 0.05),
            verticalScroll_incButton_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_incButton_pos=LPoint3f(1.04, 0, -1.28),
            verticalScroll_thumb_borderWidth=(0.01, 0.01),
            verticalScroll_thumb_hpr=LVecBase3f(0, 0, 0),
            verticalScroll_thumb_pos=LPoint3f(1.04, 0, -0.4628),
            parent=self.frmMain,
        )
        self.frmRoomList.setTransparency(0)

        self.btnBack = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.96, 0, -0.825),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Back',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["roomList_back"],
        )
        self.btnBack.setTransparency(0)

        self.lblRoomName = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-1, 0, 0.725),
            scale=LVecBase3f(0.07, 0.1, 0.07),
            text='Room Name',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblRoomName.setTransparency(0)

        self.lblPlayerCount = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.15, 0, 0.725),
            scale=LVecBase3f(0.07, 0.1, 0.07),
            text='Players',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblPlayerCount.setTransparency(0)

        self.btnCreateRoom = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pad=(0.2, 0.2),
            pos=LPoint3f(-0.955, 0, -0.815),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='+',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.btnCreateRoom.setTransparency(0)

        self.btnReloadRoomList = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.025, 0, -0.825),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Reload Rooms',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["roomList_reload"],
        )
        self.btnReloadRoomList.setTransparency(0)

        self.lblGameType = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.125, 0, 0.725),
            scale=LVecBase3f(0.07, 0.1, 0.07),
            text='Type',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblGameType.setTransparency(0)

        self.lblDifficulty = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.54, 0, 0.72),
            scale=LVecBase3f(0.07, 0.1, 0.07),
            text='Difficulty',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblDifficulty.setTransparency(0)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
Beispiel #18
0
class PlayerHUD():
    def __init__(self):
        #
        # Player status section
        #
        heartscale = (0.1, 1, 0.1)
        self.heart1 = OnscreenImage(
            image = "HeartIcon.png",
            scale = heartscale,
            pos = (0.2, 0, -0.15))
        self.heart1.setTransparency(True)
        self.heart1.reparentTo(base.a2dTopLeft)
        self.heart2 = OnscreenImage(
            image = "HeartIcon.png",
            scale = heartscale,
            pos = (0.45, 0, -0.15))
        self.heart2.setTransparency(True)
        self.heart2.reparentTo(base.a2dTopLeft)
        self.heart3 = OnscreenImage(
            image = "HeartIcon.png",
            scale = heartscale,
            pos = (0.7, 0, -0.15))
        self.heart3.setTransparency(True)
        self.heart3.reparentTo(base.a2dTopLeft)

        self.keys = DirectLabel(
            text = "x0",
            frameColor = (0, 0, 0, 0),
            text_fg = (1, 1, 1, 1),
            text_scale = 1.8,
            text_pos = (1, -0.25, 0),
            text_align = TextNode.ALeft,
            image = "Keys.png",
            pos = (0.2, 0, -0.4))
        self.keys.setScale(0.085)
        self.keys.setTransparency(True)
        self.keys.reparentTo(base.a2dTopLeft)

        self.actionKey = DirectLabel(
            frameColor = (0, 0, 0, 0),
            text_fg = (1, 1, 1, 1),
            scale = 0.15,
            pos = (0, 0, 0.15),
            text = _("Action: E/Enter"))
        self.actionKey.setTransparency(True)
        self.actionKey.reparentTo(base.a2dBottomCenter)
        self.actionKey.hide()

    def show(self):
        self.keys.show()

    def hide(self):
        self.heart1.hide()
        self.heart2.hide()
        self.heart3.hide()
        self.keys.hide()
        self.hideActionKey()

    def setHealthStatus(self, value):
        """this function will set the health image in the top righthand corner
        according to the given value, where value is a integer between 0 and 100
        """
        if value >= 1: self.heart1.show()
        else: self.heart1.hide()
        if value >= 2: self.heart2.show()
        else: self.heart2.hide()
        if value >= 3: self.heart3.show()
        else: self.heart3.hide()

    def showActionKey(self):
        self.actionKey.show()

    def hideActionKey(self):
        self.actionKey.hide()

    def updateKeyCount(self, numKeys):
        self.keys["text"] = "x%d" % numKeys
Beispiel #19
0
class GUI:
    def __init__(self, rootParent=None):
        
        self.frmMain = DirectFrame(
            frameColor=(0.25, 0.25, 0.25, 1.0),
            frameSize=(0.0, 2.0, -0.1, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.btnLeave = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pad=(0.1, 0.1),
            pos=LPoint3f(0.115, 0, -0.075),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Leave',
            text_align=TextNode.A_center,
            text_scale=(0.75, 0.75),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["leaveRoom"],
        )
        self.btnLeave.setTransparency(0)

        self.lblPlayerName = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.55, 0, -0.075),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Label',
            text_align=TextNode.A_left,
            text_scale=(0.75, 0.75),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.8, 0.8, 0.8, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblPlayerName.setTransparency(0)

        self.pg1983 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.42, 0, -0.075),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Name:',
            text_align=TextNode.A_center,
            text_scale=(0.75, 0.75),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0.6, 0.6, 0.6, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.pg1983.setTransparency(0)


    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
Beispiel #20
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            frameColor=(1, 1, 1, 1),
            frameSize=(-1.777, 1.777, -1.0, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            image='assets/menu/Background.png',
            pos=LPoint3f(0, 0, 0),
            image_scale=LVecBase3f(1.77778, 0, 1.1638),
            image_pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.lblptions = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.8),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Options',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblptions.setTransparency(0)

        self.lblServer = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.75, 0, 0.175),
            scale=LVecBase3f(1, 1, 1),
            text='Game Server URL:',
            text_align=TextNode.A_left,
            text_scale=(0.05, 0.05),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblServer.setTransparency(0)

        self.btnOk = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.375, 0, -0.775),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Ok',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["options_ok"],
            pressEffect=1,
        )
        self.btnOk.setTransparency(0)

        self.btnCancel = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.275, 0, -0.775),
            relief=1,
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Cancel',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=base.messenger.send,
            extraArgs=["options_cancel"],
            pressEffect=1,
        )
        self.btnCancel.setTransparency(0)

        self.txtServer = DirectEntry(
            borderWidth=(0.01, 0.01),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.15, 0, 0.17),
            scale=LVecBase3f(1, 1, 1),
            width=25.0,
            text_align=TextNode.A_left,
            text_scale=(0.05, 0.05),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.txtServer.setTransparency(0)

        self.cbMusic = DirectCheckButton(
            frameSize=(-3.0, 2.0, -0.3, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            indicatorValue=1,
            pos=LPoint3f(0, 0, -0.21),
            scale=LVecBase3f(0.05, 0.1, 0.05),
            text='Music',
            indicator_hpr=LVecBase3f(0, 0, 0),
            indicator_pos=LPoint3f(-2.625, 0, 0.05),
            indicator_relief='sunken',
            indicator_text_align=TextNode.A_center,
            indicator_text_scale=(1, 1),
            indicator_text_pos=(0, -0.2),
            indicator_text_fg=LVecBase4f(0, 0, 0, 1),
            indicator_text_bg=LVecBase4f(0, 0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.cbMusic.setTransparency(0)

        self.cbSFX = DirectCheckButton(
            frameSize=(-3.0, 2.0, -0.3, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            indicatorValue=1,
            pos=LPoint3f(0, 0, -0.315),
            scale=LVecBase3f(0.05, 0.1, 0.05),
            text='SFX',
            indicator_hpr=LVecBase3f(0, 0, 0),
            indicator_pos=LPoint3f(-2.625, 0, 0.05),
            indicator_relief='sunken',
            indicator_text_align=TextNode.A_center,
            indicator_text_scale=(1, 1),
            indicator_text_pos=(0, -0.2),
            indicator_text_fg=LVecBase4f(0, 0, 0, 1),
            indicator_text_bg=LVecBase4f(0, 0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.cbSFX.setTransparency(0)

        self.lblAudio = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.1),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Audio',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblAudio.setTransparency(0)

        self.lblConnection = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.3),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Connection',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblConnection.setTransparency(0)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
class GUI_3:
    def __init__(self, rootParent=None):

        self.pg149 = DirectLabel(
            frameSize=(-3.15, 3.25, -0.113, 0.725),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.525),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Moderators',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.pg149.setTransparency(0)

        self.pg422 = DirectScrolledList(
            forceHeight=0.1,
            scale=LVecBase3f(10, 10, 10),
            frameSize=(-0.5, 0.5, -0.01, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            numItemsVisible=5,
            pos=LPoint3f(0, 0, -7.9),
            state='normal',
            text='',
            decButton_borderWidth=(0.005, 0.005),
            decButton_hpr=LVecBase3f(0, 0, 0),
            decButton_pos=LPoint3f(-0.45, 0, 0.03),
            decButton_state='disabled',
            decButton_text='Prev',
            decButton_text_align=TextNode.A_left,
            decButton_text_scale=(0.05, 0.05),
            decButton_text_pos=(0, 0),
            decButton_text_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text_wordwrap=None,
            incButton_borderWidth=(0.005, 0.005),
            incButton_hpr=LVecBase3f(0, 0, 0),
            incButton_pos=LPoint3f(0.45, 0, 0.03),
            incButton_state='disabled',
            incButton_text='Next',
            incButton_text_align=TextNode.A_right,
            incButton_text_scale=(0.05, 0.05),
            incButton_text_pos=(0, 0),
            incButton_text_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text_wordwrap=None,
            itemFrame_frameColor=(1, 1, 1, 1),
            itemFrame_frameSize=(-0.47, 0.47, -0.5, 0.1),
            itemFrame_hpr=LVecBase3f(0, 0, 0),
            itemFrame_pos=LPoint3f(0, 0, 0.6),
            text_align=TextNode.A_center,
            text_scale=(0.1, 0.1),
            text_pos=(0, 0.015),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg149,
        )
        self.pg422.setTransparency(0)

        self.pg1117 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317,
                       -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            state='disabled',
            text='Marcic_Admin',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg422,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1118 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317,
                       -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            state='disabled',
            text='panda3dmastercoder',
            text_align=TextNode.A_center,
            text_scale=(0.8, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg422,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1117.setTransparency(0)

        self.pg422.addItem(self.pg1117)
        self.pg422.addItem(self.pg1118)

    def show(self):
        self.pg149.show()

    def hide(self):
        self.pg149.hide()

    def destroy(self):
        self.pg149.destroy()
Beispiel #22
0
class HUD():
    def __init__(self):
        self.canPlantLabel = DirectLabel(
            frameColor=(0, 0, 0, 0.25),
            text_fg=(1, 1, 1, 1),
            scale=0.15,
            pos=(0, 0, 0.25),
            pad=(0.2,0.2),
            text=_("Plant Seed"))
        self.canPlantLabel.setTransparency(True)
        self.canPlantLabel.reparentTo(base.a2dBottomCenter)
        self.canPlantLabel.hide()

        self.speekLabel = DirectLabel(
            frameColor=(0, 0, 0, 0.25),
            text_fg=(1, 1, 1, 1),
            scale=0.15,
            pos=(0, 0, 0.5),
            pad=(0.2,0.2),
            text="...")
        self.speekLabel.reparentTo(render)
        self.speekLabel.hide()
        self.speekLabel.setTransparency(True)
        self.speekLabel.setEffect(BillboardEffect.makePointEye())
        self.speekLabel.setBin("fixed", 11)
        self.speekLabel.setDepthWrite(False)

        self.storyText = DirectLabel(
            frameColor=(0, 0, 0, 0.25),
            text_fg=(1, 1, 1, 1),
            scale=0.08,
            pos=(0, 0, 0.25),
            pad=(0.2,0.2),
            text="Story text")
        self.storyText.setTransparency(True)
        self.storyText.reparentTo(base.a2dBottomCenter)
        self.storyText.hide()

        self.points = DirectLabel(
            frameColor=(0, 0, 0, 0.25),
            text_fg=(1, 1, 1, 1),
            scale=0.075,
            pos=(0.05, 0, -0.1),
            pad=(0.2,0.2),
            text_align=TextNode.ALeft,
            text=_("Points: %d")%0)
        self.points.setTransparency(True)
        self.points.reparentTo(base.a2dTopLeft)

        self.playerWater = DirectLabel(
            frameColor=(0, 0, 0, 0.25),
            text_fg=(1, 1, 1, 1),
            scale=0.075,
            pos=(0.05, 0, -0.2),
            pad=(0.2,0.2),
            text_align=TextNode.ALeft,
            text=_("Remaining Water: %d")%100)
        self.playerWater.setTransparency(True)
        self.playerWater.reparentTo(base.a2dTopLeft)


        self.helpInfo = DirectLabel(
            frameColor=(0, 0, 0, 0.25),
            text_fg=(1, 1, 1, 1),
            scale=0.075,
            pos=(-0.05, 0, -0.1),
            pad=(0.2,0.2),
            text_align=TextNode.ARight,
            text=_("F1 - show help"))
        self.helpInfo.setTransparency(True)
        self.helpInfo.reparentTo(base.a2dTopRight)

        self.hide()

    def show(self):
        self.points.show()
        self.playerWater.show()
        self.helpInfo.show()

    def hide(self):
        self.points.hide()
        self.playerWater.hide()
        self.helpInfo.hide()

    def hideAll(self):
        self.canPlantLabel.hide()
        self.speekLabel.hide()
        self.points.hide()
        self.playerWater.hide()
        self.helpInfo.hide()

    def showStory(self):
        self.storyText.show()

    def hideStory(self):
        self.storyText.hide()

    def cleanup(self):
        self.hideAll()
        self.canPlantLabel.destroy()
        self.speekLabel.destroy()
        self.points.destroy()
        self.playerWater.destroy()
        self.helpInfo.destroy()

    def showCanPlant(self):
        self.canPlantLabel.show()

    def hideCanPlant(self):
        self.canPlantLabel.hide()

    def setPoints(self, points):
        self.points["text"] = _("Points: %d")%points
        self.points.resetFrameSize()

    def setWater(self, water):
        self.playerWater["text"] = _("Remaining Water: %d")%water
        self.playerWater.resetFrameSize()

    def setStory(self, storytext):
        self.storyText["text"] = storytext
        self.storyText.resetFrameSize()

    def showSpeekText(self, text, newPos):
        self.speekLabel.setPos(newPos)
        self.speekLabel["text"] = text
        self.speekLabel.resetFrameSize()
        self.speekLabel.show()

    def hideSpeekText(self):
        self.speekLabel.hide()
Beispiel #23
0
class GUI:
    def __init__(self, rootParent=None):

        self.frmMain = DirectFrame(
            borderWidth=(2, 2),
            frameColor=(1, 1, 1, 1),
            frameSize=(-300.0, 300.0, -250.0, 250.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            parent=rootParent,
        )
        self.frmMain.setTransparency(0)

        self.frmHeader = DirectFrame(
            borderWidth=(2, 2),
            frameColor=(0.25, 0.25, 0.25, 1.0),
            frameSize=(-300.0, 300.0, -20.0, 20.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 230),
            parent=self.frmMain,
        )
        self.frmHeader.setTransparency(0)

        self.lblHeader = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-295, 0, -5),
            scale=LVecBase3f(1, 1, 1),
            text='Settings',
            text_align=TextNode.A_left,
            text_scale=(16.0, 16.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(1, 1, 1, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmHeader,
        )
        self.lblHeader.setTransparency(0)

        self.btnOk = DirectButton(
            borderWidth=(2, 2),
            frameSize=(-45.0, 45.0, -6.0, 14.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(120, 0, -220),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='OK',
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=messenger.send,
            extraArgs=["Settings_OK"],
        )
        self.btnOk.setTransparency(0)

        self.btnCancel = DirectButton(
            borderWidth=(2, 2),
            frameSize=(-45.0, 45.0, -6.0, 14.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(230, 0, -220),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='Cancel',
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            command=messenger.send,
            extraArgs=["Settings_CANCEL"],
        )
        self.btnCancel.setTransparency(0)

        self.lblCustomWidgets = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, 5),
            scale=LVecBase3f(1, 1, 1),
            text='Custom widgets path:',
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblCustomWidgets.setTransparency(0)

        self.txtCustomWidgetsPath = DirectEntry(
            borderWidth=(0.167, 0.167),
            hpr=LVecBase3f(0, 0, 0),
            overflow=1,
            pos=LPoint3f(-50, 0, 5),
            scale=LVecBase3f(12, 1, 12),
            width=18.0,
            text_align=TextNode.A_left,
            text_scale=(1.0, 1.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.txtCustomWidgetsPath.setTransparency(0)

        self.lblAskForQuit = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, 140),
            scale=LVecBase3f(1, 1, 1),
            text='Ask before quit:',
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblAskForQuit.setTransparency(0)

        self.cbAskForQuit = DirectCheckButton(
            borderWidth=(2, 2),
            frameColor=(1.0, 1.0, 1.0, 1.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(110, 0, 145),
            scale=LVecBase3f(1, 1, 1),
            text='',
            indicator_borderWidth=(2, 2),
            indicator_hpr=LVecBase3f(0, 0, 0),
            indicator_pos=LPoint3f(-11, 0, -7.2),
            indicator_relief='sunken',
            indicator_text_align=TextNode.A_center,
            indicator_text_scale=(24, 24),
            indicator_text_pos=(0, -0.2),
            indicator_text_fg=LVecBase4f(0, 0, 0, 1),
            indicator_text_bg=LVecBase4f(0, 0, 0, 0),
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.cbAskForQuit.setTransparency(0)

        self.lblExecutableScripts = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, 95),
            scale=LVecBase3f(1, 1, 1),
            text='Create executable Scripts:',
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblExecutableScripts.setTransparency(0)

        self.cbExecutableScripts = DirectCheckButton(
            borderWidth=(2, 2),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(110, 0, 100),
            scale=LVecBase3f(1, 1, 1),
            text='',
            indicator_borderWidth=(2, 2),
            indicator_hpr=LVecBase3f(0, 0, 0),
            indicator_pos=LPoint3f(-11, 0, -7.2),
            indicator_relief='sunken',
            indicator_text_align=TextNode.A_center,
            indicator_text_scale=(24, 24),
            indicator_text_pos=(0, -0.2),
            indicator_text_fg=LVecBase4f(0, 0, 0, 1),
            indicator_text_bg=LVecBase4f(0, 0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.cbExecutableScripts.setTransparency(0)

        self.btnBrowseWidgetPath = DirectButton(
            borderWidth=(2, 2),
            frameSize=(-45.25, 45.25, -6.0, 14.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(230, 0, 5),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='Browse',
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.btnBrowseWidgetPath.setTransparency(0)

        self.lblShowToolbar = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, 50),
            scale=LVecBase3f(1, 1, 1),
            text='Show toolbar',
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblShowToolbar.setTransparency(0)

        self.cbShowToolbar = DirectCheckButton(
            borderWidth=(2, 2),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(110, 0, 55),
            scale=LVecBase3f(1, 1, 1),
            text='',
            indicator_borderWidth=(2, 2),
            indicator_hpr=LVecBase3f(0, 0, 0),
            indicator_pos=LPoint3f(-11, 0, -7.2),
            indicator_relief='sunken',
            indicator_text_align=TextNode.A_center,
            indicator_text_scale=(24, 24),
            indicator_text_pos=(0, -0.2),
            indicator_text_fg=LVecBase4f(0, 0, 0, 1),
            indicator_text_bg=LVecBase4f(0, 0, 0, 0),
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.cbShowToolbar.setTransparency(0)

        self.lblSearchPath = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, -45),
            scale=LVecBase3f(1, 1, 1),
            text='Search paths',
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblSearchPath.setTransparency(0)

        self.txtSearchPaths = DirectEntry(
            borderWidth=(0.167, 0.167),
            frameSize=(-0.167, 18.167, -0.463, 1.155),
            hpr=LVecBase3f(0, 0, 0),
            overflow=1,
            pos=LPoint3f(-50, 0, -45),
            scale=LVecBase3f(12, 1, 12),
            width=18.0,
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.txtSearchPaths.setTransparency(0)

        self.btnBrowseSearchPaths = DirectButton(
            borderWidth=(2, 2),
            frameSize=(-45.25, 45.25, -6.0, 14.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(230, 0, -45),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='Browse',
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.btnBrowseSearchPaths.setTransparency(0)

        self.lblWorkDir = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, -95),
            scale=LVecBase3f(1, 1, 1),
            text='Default work directory',
            text_align=TextNode.A_left,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.lblWorkDir.setTransparency(0)

        self.txtWorkDir = DirectEntry(
            borderWidth=(0.08333333333333333, 0.08333333333333333),
            hpr=LVecBase3f(0, 0, 0),
            overflow=1,
            pos=LPoint3f(-50, 0, -95),
            scale=LVecBase3f(12, 1, 12),
            width=18.0,
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
        )
        self.txtWorkDir.setTransparency(0)

        self.btnBrowseWorkDir = DirectButton(
            borderWidth=(2, 2),
            frameSize=(-45.25, 45.25, -6.0, 14.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(230, 0, -95),
            relief=1,
            scale=LVecBase3f(1, 1, 1),
            text='Browse',
            text_align=TextNode.A_center,
            text_scale=(12.0, 12.0),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmMain,
            pressEffect=1,
        )
        self.btnBrowseWorkDir.setTransparency(0)

        self.spinAutosaveDealy = DirectSpinBox(
            frameSize=(-2.1, 1.0, -0.742, 0.742),
            hpr=LVecBase3f(0, 0, 0),
            maxValue=3600,
            minValue=10,
            pos=LPoint3f(105, 0, -140),
            value=60,
            scale=LVecBase3f(12, 1, 12),
            decButton_hpr=LVecBase3f(0, 0, 0),
            decButton_pos=LPoint3f(0.583333, 0, -0.533333),
            decButton_text='6',
            decButton_text0_align=TextNode.A_center,
            decButton_text0_scale=(1, 1),
            decButton_text0_pos=(0, 0),
            decButton_text0_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text0_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text0_wordwrap=None,
            decButton_text1_align=TextNode.A_center,
            decButton_text1_scale=(1, 1),
            decButton_text1_pos=(0, 0),
            decButton_text1_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text1_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text1_wordwrap=None,
            decButton_text2_align=TextNode.A_center,
            decButton_text2_scale=(1, 1),
            decButton_text2_pos=(0, 0),
            decButton_text2_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text2_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text2_wordwrap=None,
            decButton_text3_align=TextNode.A_center,
            decButton_text3_scale=(1, 1),
            decButton_text3_pos=(0, 0),
            decButton_text3_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text3_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text3_wordwrap=None,
            incButton_hpr=LVecBase3f(0, 0, 0),
            incButton_pos=LPoint3f(0.583333, 0, -0.016667),
            incButton_text='5',
            incButton_text0_align=TextNode.A_center,
            incButton_text0_scale=(1, 1),
            incButton_text0_pos=(0, 0),
            incButton_text0_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text0_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text0_wordwrap=None,
            incButton_text1_align=TextNode.A_center,
            incButton_text1_scale=(1, 1),
            incButton_text1_pos=(0, 0),
            incButton_text1_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text1_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text1_wordwrap=None,
            incButton_text2_align=TextNode.A_center,
            incButton_text2_scale=(1, 1),
            incButton_text2_pos=(0, 0),
            incButton_text2_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text2_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text2_wordwrap=None,
            incButton_text3_align=TextNode.A_center,
            incButton_text3_scale=(1, 1),
            incButton_text3_pos=(0, 0),
            incButton_text3_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text3_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text3_wordwrap=None,
            valueEntry_hpr=LVecBase3f(0, 0, 0),
            valueEntry_initialText='60',
            valueEntry_pos=LPoint3f(0, 0, -0.345625),
            valueEntry_text_align=TextNode.A_right,
            valueEntry_text_scale=(1, 1),
            valueEntry_text_pos=(0, 0),
            valueEntry_text_fg=LVecBase4f(0, 0, 0, 1),
            valueEntry_text_bg=LVecBase4f(0, 0, 0, 0),
            valueEntry_text_wordwrap=None,
            parent=self.frmMain,
        )
        self.spinAutosaveDealy.setTransparency(0)

        self.lblAutosaveDelay = DirectLabel(
            borderWidth=(2, 2),
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=LVecBase4f(0.3, 84.45, -3.9, 8.7),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-260, 0, -140),
            scale=LVecBase3f(1, 1, 1),
            text='Autosave delay in seconds',
            text0_align=TextNode.A_left,
            text0_scale=(12.0, 12.0),
            text0_pos=(0, 0),
            text0_fg=LVecBase4f(0, 0, 0, 1),
            text0_bg=LVecBase4f(0, 0, 0, 0),
            text0_wordwrap=None,
            parent=self.frmMain,
        )
        self.lblAutosaveDelay.setTransparency(0)

    def show(self):
        self.frmMain.show()

    def hide(self):
        self.frmMain.hide()

    def destroy(self):
        self.frmMain.destroy()
Beispiel #24
0
class GUI:
    def __init__(self, USERNAME, rootParent=None):
        
        self.pg149 = DirectLabel(
            frameSize=(-1.149999976158142, 1.25, -0.11250001192092896, 0.7250000238418579),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.525),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Top',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.pg149.setTransparency(0)

        self.pg1336 = DirectScrolledList(
            forceHeight=0.1,
            frameSize=(-0.5, 0.5, -0.01, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            numItemsVisible=5,
            pos=LPoint3f(0.025, 0, -0.25),
            state='normal',
            text='scrolled list',
            decButton_borderWidth=(0.005, 0.005),
            decButton_hpr=LVecBase3f(0, 0, 0),
            decButton_pos=LPoint3f(-0.45, 0, 0.03),
            decButton_state='disabled',
            decButton_text='Prev',
            decButton_text_align=TextNode.A_left,
            decButton_text_scale=(0.05, 0.05),
            decButton_text_pos=(0, 0),
            decButton_text_fg=LVecBase4f(0, 0, 0, 1),
            decButton_text_bg=LVecBase4f(0, 0, 0, 0),
            decButton_text_wordwrap=None,
            incButton_borderWidth=(0.005, 0.005),
            incButton_hpr=LVecBase3f(0, 0, 0),
            incButton_pos=LPoint3f(0.45, 0, 0.03),
            incButton_state='disabled',
            incButton_text='Next',
            incButton_text_align=TextNode.A_right,
            incButton_text_scale=(0.05, 0.05),
            incButton_text_pos=(0, 0),
            incButton_text_fg=LVecBase4f(0, 0, 0, 1),
            incButton_text_bg=LVecBase4f(0, 0, 0, 0),
            incButton_text_wordwrap=None,
            itemFrame_frameColor=(1, 1, 1, 1),
            itemFrame_frameSize=(-0.47, 0.47, -0.5, 0.1),
            itemFrame_hpr=LVecBase3f(0, 0, 0),
            itemFrame_pos=LPoint3f(0, 0, 0.6),
            text_align=TextNode.A_center,
            text_scale=(0.1, 0.1),
            text_pos=(0, 0.015),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=rootParent,
        )
        self.pg1336.setTransparency(0)

        self.pg1693 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317, -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            state='disabled',
            text='Admin',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg1336,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1693.setTransparency(0)

        self.pg1715 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317, -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.1),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='NFSMW',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg1336,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1715.setTransparency(0)

        self.pg1740 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317, -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.2),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='|X_X|',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg1336,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1740.setTransparency(0)

        self.pg1768 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317, -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.3),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text=USERNAME,
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg1336,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1768.setTransparency(0)

        self.pg1799 = DirectScrolledListItem(
            frameSize=(-3.831250286102295, 3.9062500953674317, -0.21250001192092896, 0.85),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, -0.4),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='.___.',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            text_wordwrap=None,
            parent=self.pg1336,
            command=base.messenger.send,
            extraArgs=['select_list_item_changed'],
        )
        self.pg1799.setTransparency(0)

        self.pg1336.addItem(self.pg1693)
        self.pg1336.addItem(self.pg1715)
        self.pg1336.addItem(self.pg1740)
        self.pg1336.addItem(self.pg1768)
        self.pg1336.addItem(self.pg1799)

    def show(self):
        self.pg149.show()
        self.pg1336.show()

    def hide(self):
        self.pg149.hide()
        self.pg1336.hide()

    def destroy(self):
        self.pg149.destroy()
        self.pg1336.destroy()
class GUI:
    def __init__(self, rootParent=None):
        
        self.frmCreateRoom = DirectFrame(
            borderWidth=(0.01, 0.01),
            frameColor=(1, 1, 1, 1),
            frameSize=(-0.65, 0.65, -0.55, 0.55),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0),
            relief=5,
            parent=rootParent,
        )
        self.frmCreateRoom.setTransparency(0)

        self.btnOk = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.425, 0, -0.45),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='OK',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
            command=base.messenger.send,
            extraArgs=["createRoom_Ok"],
        )
        self.btnOk.setTransparency(0)

        self.btnCancel = DirectButton(
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.4, 0, -0.45),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Cancel',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
            command=base.messenger.send,
            extraArgs=["createRoom_Cancel"],
        )
        self.btnCancel.setTransparency(0)

        self.pg1640 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0, 0, 0.425),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Create New Room',
            text_align=TextNode.A_center,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.pg1640.setTransparency(0)

        self.pg2148 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.05, 0, 0.24),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Room Name',
            text_align=TextNode.A_right,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.pg2148.setTransparency(0)

        self.pg2173 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.05, 0, 0.065),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='# of Players',
            text_align=TextNode.A_right,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.pg2173.setTransparency(0)

        self.pg2201 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.05, 0, -0.115),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Game Type',
            text_align=TextNode.A_right,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.pg2201.setTransparency(0)

        self.entryRoomName = DirectEntry(
            hpr=LVecBase3f(0, 0, 0),
            overflow=1,
            pos=LPoint3f(0.08, 0, 0.25),
            scale=LVecBase3f(0.05, 0.1, 0.05),
            width=8.0,
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.entryRoomName.setTransparency(0)

        self.optionNumPlayers = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.07500000298023224, 3.012500149011612, -0.11250001192092896, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.175, 0, 0.06),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475, -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.optionNumPlayers.setTransparency(0)

        self.optionGameType = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.07500000298023224, 3.012500149011612, -0.11250001192092896, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.175, 0, -0.125),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475, -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.optionGameType.setTransparency(0)

        self.pg629 = DirectLabel(
            frameColor=(0.8, 0.8, 0.8, 0.0),
            frameSize=(-1.15, 1.25, -0.113, 0.725),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(-0.055, 0, -0.3),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='Difficulty',
            text_align=TextNode.A_right,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.pg629.setTransparency(0)

        self.optionDifficulty = DirectOptionMenu(
            items=['item1'],
            frameSize=(0.1, 3.013, -0.113, 0.75),
            hpr=LVecBase3f(0, 0, 0),
            pos=LPoint3f(0.175, 0, -0.305),
            scale=LVecBase3f(0.1, 0.1, 0.1),
            text='item1',
            cancelframe_frameSize=(-1, 1, -1, 1),
            cancelframe_hpr=LVecBase3f(0, 0, 0),
            cancelframe_pos=LPoint3f(0, 0, 0),
            cancelframe_relief=None,
            item_frameSize=(0.07500000298023224, 2.4125001430511475, -0.11250001192092896, 0.75),
            item_hpr=LVecBase3f(0, 0, 0),
            item_pos=LPoint3f(-0.075, 0, -0.75),
            item_text='item1',
            item0_text_align=TextNode.A_left,
            item0_text_scale=(1, 1),
            item0_text_pos=(0, 0),
            item0_text_fg=LVecBase4f(0, 0, 0, 1),
            item0_text_bg=LVecBase4f(0, 0, 0, 0),
            popupMarker_frameSize=(-0.5, 0.5, -0.2, 0.2),
            popupMarker_hpr=LVecBase3f(0, 0, 0),
            popupMarker_pos=LPoint3f(2.7125, 0, 0.31875),
            popupMarker_relief=2,
            popupMarker_scale=LVecBase3f(0.4, 0.4, 0.4),
            popupMenu_frameSize=(0, 2.3375001400709152, -0.862500011920929, 0),
            popupMenu_hpr=LVecBase3f(0, 0, 0),
            popupMenu_pos=LPoint3f(0, 0, 0),
            popupMenu_relief='raised',
            text_align=TextNode.A_left,
            text_scale=(1, 1),
            text_pos=(0, 0),
            text_fg=LVecBase4f(0, 0, 0, 1),
            text_bg=LVecBase4f(0, 0, 0, 0),
            parent=self.frmCreateRoom,
        )
        self.optionDifficulty.setTransparency(0)


    def show(self):
        self.frmCreateRoom.show()

    def hide(self):
        self.frmCreateRoom.hide()

    def destroy(self):
        self.frmCreateRoom.destroy()