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()
class GUI: def __init__(self, rootParent=None): self.frmChat = DirectFrame( frameColor=(0.25, 0.25, 0.25, 1.0), frameSize=(-0.4, 0.4, -1.25, 0.0), hpr=LVecBase3f(0, 0, 0), pos=LPoint3f(0, 0, 0), parent=rootParent, ) self.frmChat.setTransparency(0) self.frmMessages = DirectScrolledFrame( borderWidth=(0.005, 0.005), canvasSize=(-0.38, 0.34, -1.2, 0.0), frameColor=(1, 1, 1, 1), frameSize=(-0.38, 0.38, -1.0, 0.0), hpr=LVecBase3f(0, 0, 0), pos=LPoint3f(0, 0, -0.1), relief=3, scrollBarWidth=0.03, state='normal', horizontalScroll_borderWidth=(0.01, 0.01), horizontalScroll_frameSize=(-0.05, 0.05, -0.015, 0.015), 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.015, 0.015, -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.36, 0, -0.02), 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.36, 0, -0.98), verticalScroll_thumb_borderWidth=(0.01, 0.01), verticalScroll_thumb_hpr=LVecBase3f(0, 0, 0), verticalScroll_thumb_pos=LPoint3f(0.36, 0, -0.418625), parent=self.frmChat, ) self.frmMessages.setTransparency(0) self.txtMessage = DirectEntry( borderWidth=(0.005, 0.005), frameColor=(1.0, 1.0, 1.0, 1.0), hpr=LVecBase3f(0, 0, 0), overflow=1, pos=LPoint3f(-0.375, 0, -1.195), relief=3, scale=LVecBase3f(0.045, 0.045, 0.045), width=14.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.frmChat, ) self.txtMessage.setTransparency(0) self.btnSend = DirectButton( frameColor=(0.0, 0.0, 0.0, 0.0), frameSize=(-0.4, 0.4, -0.4, 0.4), hpr=LVecBase3f(0, 0, 0), image='assets/chat/ChatSend.png', pos=LPoint3f(0.33, 0, -1.18), relief=1, scale=LVecBase3f(0.1, 0.1, 0.1), text='', image_scale=LVecBase3f(0.4, 1, 0.4), 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.frmChat, command=base.messenger.send, extraArgs=["sendMessage"], ) self.btnSend.setTransparency(1) self.btnToggleChat = DirectButton( frameColor=(0.15, 0.15, 0.15, 1.0), frameSize=(-0.4, 0.4, -0.02, 0.05), hpr=LVecBase3f(0, 0, 0), pos=LPoint3f(0, 0, -0.05), relief=1, scale=LVecBase3f(1, 1, 1), text='Toggle Chat', text_align=TextNode.A_center, text_scale=(0.05, 0.05), text_pos=(0, 0), text_fg=LVecBase4f(0.8, 0.8, 0.8, 1), text_bg=LVecBase4f(0, 0, 0, 0), parent=rootParent, command=base.messenger.send, extraArgs=["toggleChat"], ) self.btnToggleChat.setTransparency(0) def show(self): self.frmChat.show() self.btnToggleChat.show() def hide(self): self.frmChat.hide() self.btnToggleChat.hide() def destroy(self): self.frmChat.destroy() self.btnToggleChat.destroy()
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()