def createSpecialBox( self, xPos, zPos, ): """ create the special Box """ geomColor = (1, 1, 1, 1) if not self.specialBoxActive: geomColor = (0.5, 0.5, 0.5, 1) geomScaleX = 0.2 geomScaleZ = 0.2 self.specialButtonFrame = DirectFrame( parent=self, pos=(xPos, 0, zPos), geom=DGG.getDefaultDialogGeom(), geom_scale=(geomScaleX, 1.0, geomScaleZ), geom_color=geomColor, relief=None, ) items = [] if self.specialBoxActive: #TODO fill items with the images of the special items he can plant gardenSpecials = base.localAvatar.getGardenSpecials() tempItem = BoxItem(self.attachNewNode('blankSpecial')) items.append(tempItem) self.specialPhotoList = [] for item in gardenSpecials: tempItem = BoxItem( self.specialButtonFrame.attachNewNode('temp1')) specialsPhoto = SpecialsPhoto.SpecialsPhoto(item[0], parent=tempItem) #self.specialsPhoto.setBackBounds(-0.3, 0.3, -0.235, 0.25) #self.specialsPhoto.setBackBounds(-0.3, 0.3, -0.235, 0.25) specialsPhoto.setBackBounds(-geomScaleX / 2.0, geomScaleX / 2.0, -geomScaleZ / 2.0, geomScaleZ / 2.0) # Parchment paper background: specialsPhoto.setBackColor(1.0, 1.0, 1.0, 1.0) items.append(tempItem) self.specialPhotoList.append(specialsPhoto) self.specialButton = GenericBoxScrollList( self.specialButtonFrame, items, incButton_pos=(0, 0, -0.135), incButton_scale=(0.75, 1.0, -1.0), decButton_pos=(0, 0, 0.135), decButton_scale=(0.75, 1.0, 1.0), command=self.photoSpecialChanged)
def createSpecialBox(self, xPos, zPos): geomColor = (1, 1, 1, 1) if not self.specialBoxActive: geomColor = (0.5, 0.5, 0.5, 1) geomScaleX = 0.20000000000000001 geomScaleZ = 0.20000000000000001 self.specialButtonFrame = DirectFrame(parent=self, pos=(xPos, 0, zPos), geom=DGG.getDefaultDialogGeom(), geom_scale=(geomScaleX, 1.0, geomScaleZ), geom_color=geomColor, relief=None) items = [] if self.specialBoxActive: gardenSpecials = base.localAvatar.getGardenSpecials() tempItem = BoxItem(self.attachNewNode('blankSpecial')) items.append(tempItem) self.specialPhotoList = [] for item in gardenSpecials: tempItem = BoxItem( self.specialButtonFrame.attachNewNode('temp1')) specialsPhoto = SpecialsPhoto.SpecialsPhoto(item[0], parent=tempItem) specialsPhoto.setBackBounds(-geomScaleX / 2.0, geomScaleX / 2.0, -geomScaleZ / 2.0, geomScaleZ / 2.0) specialsPhoto.setBackColor(1.0, 1.0, 1.0, 1.0) items.append(tempItem) self.specialPhotoList.append(specialsPhoto) self.specialButton = GenericBoxScrollList( self.specialButtonFrame, items, incButton_pos=(0, 0, -0.13500000000000001), incButton_scale=(0.75, 1.0, -1.0), decButton_pos=(0, 0, 0.13500000000000001), decButton_scale=(0.75, 1.0, 1.0), command=self.photoSpecialChanged)
def load(self): self.notify.debug('load') ShtikerPage.ShtikerPage.load(self) gui = loader.loadModel('phase_3.5/models/gui/fishingBook') trophyCase = gui.find('**/trophyCase1') trophyCase.find('glass1').reparentTo(trophyCase, -1) trophyCase.find('shelf').reparentTo(trophyCase, -1) self.trophyCase = trophyCase self.title = DirectLabel(parent=self, relief=None, text='', text_scale=0.1, pos=(0, 0, 0.65)) normalColor = (1, 1, 1, 1) clickColor = (0.8, 0.8, 0, 1) rolloverColor = (0.15, 0.82, 1.0, 1) diabledColor = (1.0, 0.98, 0.15, 1) self.basketTab = DirectButton(parent=self, relief=None, text=TTLocalizer.GardenPageBasketTab, text_scale=TTLocalizer.GPbasketTab, text_align=TextNode.ALeft, image=gui.find('**/tabs/polySurface1'), image_pos=(0.55, 1, -0.91), image_hpr=(0, 0, -90), image_scale=(0.033, 0.033, 0.035), image_color=normalColor, image1_color=clickColor, image2_color=rolloverColor, image3_color=diabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, extraArgs=[GardenPage_Basket], pos=(0.92, 0, 0.55)) self.collectionTab = DirectButton(parent=self, relief=None, text=TTLocalizer.GardenPageCollectionTab, text_scale=TTLocalizer.GPcollectionTab, text_align=TextNode.ALeft, image=gui.find('**/tabs/polySurface2'), image_pos=(0.12, 1, -0.91), image_hpr=(0, 0, -90), image_scale=(0.033, 0.033, 0.035), image_color=normalColor, image1_color=clickColor, image2_color=rolloverColor, image3_color=diabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, extraArgs=[GardenPage_Collection], pos=(0.92, 0, 0.1)) self.trophyTab = DirectButton(parent=self, relief=None, text=TTLocalizer.GardenPageTrophyTab, text_scale=TTLocalizer.GPtrophyTab, text_align=TextNode.ALeft, image=gui.find('**/tabs/polySurface3'), image_pos=(-0.28, 1, -0.91), image_hpr=(0, 0, -90), image_scale=(0.033, 0.033, 0.035), image_color=normalColor, image1_color=clickColor, image2_color=rolloverColor, image3_color=diabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, extraArgs=[GardenPage_Trophy], pos=(0.92, 0, -0.3)) self.specialsTab = DirectButton(parent=self, relief=None, text=TTLocalizer.GardenPageSpecialsTab, text_scale=TTLocalizer.GPspecialsTab, text_align=TextNode.ALeft, image=gui.find('**/tabs/polySurface3'), image_pos=(-0.28, 1, -0.91), image_hpr=(0, 0, -90), image_scale=(0.033, 0.033, 0.035), image_color=normalColor, image1_color=clickColor, image2_color=rolloverColor, image3_color=diabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.setMode, extraArgs=[GardenPage_Specials], pos=(0.92, 0, -0.3)) self.basketTab.setPos(-0.75, 0, 0.775) self.collectionTab.setPos(-0.33, 0, 0.775) self.trophyTab.setPos(0.09, 0, 0.775) self.specialsTab.setPos(0.51, 0, 0.775) gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') self.gardenSpecialsList = DirectScrolledList(parent=self, relief=None, incButton_image=(gui.find('**/FndsLst_ScrollUp'), gui.find('**/FndsLst_ScrollDN'), gui.find('**/FndsLst_ScrollUp_Rllvr'), gui.find('**/FndsLst_ScrollUp')), incButton_relief=None, incButton_pos=(0.0, 0.0, -1.1), incButton_image1_color=Vec4(1.0, 0.9, 0.4, 1.0), incButton_image3_color=Vec4(1.0, 1.0, 0.6, 0.5), incButton_scale=(1.0, 1.0, -1.0), decButton_image=(gui.find('**/FndsLst_ScrollUp'), gui.find('**/FndsLst_ScrollDN'), gui.find('**/FndsLst_ScrollUp_Rllvr'), gui.find('**/FndsLst_ScrollUp')), decButton_relief=None, decButton_pos=(0.0, 0.0, 0.117), decButton_image1_color=Vec4(1.0, 1.0, 0.6, 1.0), decButton_image3_color=Vec4(1.0, 1.0, 0.6, 0.6), itemFrame_pos=(-0.2, 0.0, 0.05), itemFrame_relief=None, numItemsVisible=18, items=[], pos=(-0.6, 0, 0.45)) self.gardenSpecialsList.hide() self.specialsFrame = DirectFrame(parent=self, relief=None, pos=(0.45, 0.0, 0.25), text='', text_wordwrap=14.4, text_pos=(0, -0.46), text_scale=0.06) self.specialsInfo = DirectLabel(parent=self.specialsFrame, relief=None, pos=(0.0, 0.0, -0.0), text=' ', text_wordwrap=12.4, text_pos=(0, -0.46), text_scale=0.06) self.specialsPhoto = SpecialsPhoto.SpecialsPhoto(-1, parent=self.specialsFrame) self.specialsPhoto.setBackBounds(-0.3, 0.3, -0.235, 0.25) self.specialsPhoto.setBackColor(1.0, 1.0, 0.74901, 1.0) buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') okImageList = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')) self.useSpecialButton = DirectButton(parent=self, relief=None, image=okImageList, pos=(0.45, 0, -0.5), text=TTLocalizer.UseSpecial, text_scale=0.06, text_pos=(0, -0.1), command=self.__useSpecial) buttons.removeNode() return
def load(self): self.notify.debug('load') assert self.notify.debugStateCall(self) ShtikerPage.ShtikerPage.load(self) gui = loader.loadModel("phase_3.5/models/gui/fishingBook") """ rodFrame = gui.find("**/bucket/fram1") rodFrame.removeNode() """ trophyCase = gui.find("**/trophyCase1") trophyCase.find("glass1").reparentTo(trophyCase,-1) trophyCase.find("shelf").reparentTo(trophyCase,-1) self.trophyCase=trophyCase # page title self.title = DirectLabel( parent = self, relief = None, text = "", text_scale = 0.1, pos = (0,0,0.65), ) # The blue and yellow colors are trying to match the # rollover and select colors on the options page: normalColor = (1, 1, 1, 1) clickColor = (.8, .8, 0, 1) rolloverColor = (0.15, 0.82, 1.0, 1) diabledColor = (1.0, 0.98, 0.15, 1) self.basketTab = DirectButton( parent = self, relief = None, text = TTLocalizer.GardenPageBasketTab, text_scale = TTLocalizer.GPbasketTab, text_align = TextNode.ALeft, image = gui.find("**/tabs/polySurface1"), image_pos = (0.55,1,-0.91), image_hpr = (0,0,-90), image_scale = (0.033,0.033,0.035), image_color = normalColor, image1_color = clickColor, image2_color = rolloverColor, image3_color = diabledColor, text_fg = Vec4(0.2,0.1,0,1), command = self.setMode, extraArgs = [GardenPage_Basket], pos = (0.92, 0, 0.55), ) self.collectionTab = DirectButton( parent = self, relief = None, text = TTLocalizer.GardenPageCollectionTab, text_scale = TTLocalizer.GPcollectionTab, text_align = TextNode.ALeft, image = gui.find("**/tabs/polySurface2"), image_pos = (0.12,1,-0.91), image_hpr = (0,0,-90), image_scale = (0.033,0.033,0.035), image_color = normalColor, image1_color = clickColor, image2_color = rolloverColor, image3_color = diabledColor, text_fg = Vec4(0.2,0.1,0,1), command = self.setMode, extraArgs = [GardenPage_Collection], pos = (0.92, 0, 0.1), ) self.trophyTab = DirectButton( parent = self, relief = None, text = TTLocalizer.GardenPageTrophyTab, text_scale = TTLocalizer.GPtrophyTab, text_align = TextNode.ALeft, image = gui.find("**/tabs/polySurface3"), image_pos = (-0.28,1,-0.91), image_hpr = (0,0,-90), image_scale = (0.033,0.033,0.035), image_color = normalColor, image1_color = clickColor, image2_color = rolloverColor, image3_color = diabledColor, text_fg = Vec4(0.2,0.1,0,1), command = self.setMode, extraArgs = [GardenPage_Trophy], pos = (0.92, 0, -0.3), ) self.specialsTab = DirectButton( parent = self, relief = None, text = TTLocalizer.GardenPageSpecialsTab, text_scale = TTLocalizer.GPspecialsTab, text_align = TextNode.ALeft, image = gui.find("**/tabs/polySurface3"), image_pos = (-0.28,1,-0.91), image_hpr = (0,0,-90), image_scale = (0.033,0.033,0.035), image_color = normalColor, image1_color = clickColor, image2_color = rolloverColor, image3_color = diabledColor, text_fg = Vec4(0.2,0.1,0,1), command = self.setMode, extraArgs = [GardenPage_Specials], pos = (0.92, 0, -0.3), ) self.basketTab.setPos(-0.75,0,0.775) self.collectionTab.setPos(-0.33,0,0.775) self.trophyTab.setPos(0.09,0,0.775) self.specialsTab.setPos(0.51,0,0.775) gui = loader.loadModel("phase_3.5/models/gui/friendslist_gui") self.gardenSpecialsList = DirectScrolledList( parent = self, relief = None, # inc and dec are DirectButtons incButton_image = (gui.find("**/FndsLst_ScrollUp"), gui.find("**/FndsLst_ScrollDN"), gui.find("**/FndsLst_ScrollUp_Rllvr"), gui.find("**/FndsLst_ScrollUp"), ), incButton_relief = None, incButton_pos = (0.0, 0.0, -1.1), # Make the disabled button darker incButton_image1_color = Vec4(1.0, 0.9, 0.4, 1.0), incButton_image3_color = Vec4(1.0, 1.0, 0.6, 0.5), incButton_scale = (1.0, 1.0, -1.0), decButton_image = (gui.find("**/FndsLst_ScrollUp"), gui.find("**/FndsLst_ScrollDN"), gui.find("**/FndsLst_ScrollUp_Rllvr"), gui.find("**/FndsLst_ScrollUp"), ), decButton_relief = None, decButton_pos = (0.0, 0.0, 0.117), # Make the disabled button darker decButton_image1_color = Vec4(1.0, 1.0, 0.6, 1.0), decButton_image3_color = Vec4(1.0, 1.0, 0.6, 0.6), # itemFrame is a DirectFrame itemFrame_pos = (-0.2, 0.0, 0.05), itemFrame_relief = None, #itemFrame_frameSize= (-0.05,0.75,-0.75,0.05), # each item is a button with text on it numItemsVisible = 18, items = [], pos = (-0.60, 0, 0.45), ) self.gardenSpecialsList.hide() self.specialsFrame = DirectFrame( parent = self, relief = None, pos = (0.45, 0.0, 0.25), text = "", text_wordwrap = 14.4, text_pos = (0, -0.46), text_scale = 0.06, ) self.specialsInfo = DirectLabel( parent = self.specialsFrame, relief = None, pos = (0.0, 0.0, -0.0), text = " ", text_wordwrap = 12.4, text_pos = (0, -0.46), text_scale = 0.06, ) self.specialsPhoto = SpecialsPhoto.SpecialsPhoto(-1, parent = self.specialsFrame) self.specialsPhoto.setBackBounds(-0.3, 0.3, -0.235, 0.25) # Parchment paper background: self.specialsPhoto.setBackColor(1.0, 1.0, 0.74901, 1.0) #self.specialsPhoto.setPos(0.45, 0.0, 0.25) # Init buttons buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') okImageList = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')) self.useSpecialButton = DirectButton( parent = self, relief = None, image = okImageList, #pos = (0.6, 0, -0.58), pos = (0.45, 0, -0.5), text = TTLocalizer.UseSpecial, text_scale = 0.06, text_pos = (0,-0.1), command = self.__useSpecial, ) buttons.removeNode()