def __init__(self, inventory, name, **kw): optiondefs = (('relief', None, None), ('framSize', (0, self.width, 0, self.height), None), ('sortOrder', 20, None)) self.defineoptions(kw, optiondefs) DirectFrame.__init__(self, None, **None) self.initialiseoptions(MusicianGUI) if not MusicianGUI.CoinImage: MusicianGUI.CoinImage = loader.loadModel( 'models/gui/toplevel_gui').find('**/treasure_w_coin*') self.panel = GuiPanel.GuiPanel(name, self.width, self.height, parent=self) self.panel.closeButton['command'] = self.closePanel self.setPos(-0.59999999999999998, 0, -0.66000000000000003) self.balance = 0 self.inventory = inventory self.storeInventory = InventoryItemList.InventoryItemList( self.inventory, self.height - 0.14999999999999999, buy=PiratesGuiGlobals.InventoryAdd, listItemClass=SongItemGui) self.storeInventory.reparentTo(self.panel) self.storeInventory.setPos(0.029999999999999999, 0, 0.040000000000000001) self.cartWidth = self.columnWidth - 0.10000000000000001 self.cartHeight = self.height - 0.25 self.cartFrame = DirectFrame(parent=self.panel, relief=None, frameSize=(0, self.cartWidth, 0, self.cartHeight)) self.cartFrame.setPos(self.columnWidth + 0.025000000000000001, 0, 0.080000000000000002) self.myGoldTitle = DirectFrame( parent=self.cartFrame, relief=None, text=PLocalizer.YourMoney, text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0, 0.0), pos=(0.01, 0, 0.155)) self.myGold = DirectFrame(parent=self.cartFrame, relief=None, text=str(localAvatar.getMoney()), text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(-0.055, 0.0), textMayChange=1, image=MusicianGUI.CoinImage, image_scale=0.14999999999999999, image_pos=(-0.025000000000000001, 0, 0.025000000000000001), pos=(self.cartWidth, 0, 0.155)) self.accept(PiratesGuiGlobals.InventoryBuyEvent, self.handleBuyItem) self.acceptOnce('escape', self.closePanel)
def __init__(self, inventory, name, **kw): optiondefs = ( ('relief', None, None), ('framSize', (0, self.width, 0, self.height), None), ('sortOrder', 20, None)) self.defineoptions(kw, optiondefs) DirectFrame.__init__(self, None, **kw) self.initialiseoptions(StoreGUI) if not StoreGUI.CoinImage: StoreGUI.CoinImage = loader.loadModel('models/gui/toplevel_gui').find('**/treasure_w_coin*') if not StoreGUI.WeaponIcons: StoreGUI.WeaponIcons = loader.loadModel('models/gui/gui_icons_weapon') if not StoreGUI.SkillIcons: StoreGUI.SkillIcons = loader.loadModel('models/textureCards/skillIcons') if not StoreGUI.FishingIcons: StoreGUI.FishingIcons = loader.loadModel('models/textureCards/fishing_icons') self.backTabParent = self.attachNewNode('backTabs', sort=0) self.panel = GuiPanel.GuiPanel(name, self.width, self.height, parent=self) self.panel.closeButton['command'] = self.closePanel self.setPos(-1.1, 0, -0.66) self.balance = 0 self.inventory = inventory self.storeInventory = InventoryItemList.InventoryItemList(self.inventory, self.height - 0.15, buy=PiratesGuiGlobals.InventoryAdd) self.storeInventory.reparentTo(self.panel) self.storeInventory.setPos(0.03, 0, 0.04) self.storeInventory.sortByTypeAndLevel() self.cartWidth = self.columnWidth - 0.1 self.cartHeight = self.height - 0.25 self.cartFrame = DirectFrame(parent=self.panel, relief=None, frameSize=(0, self.cartWidth, 0, self.cartHeight)) self.cartFrame.setPos(self.columnWidth + 0.025, 0, 0.08) self.purchaseTitle = DirectFrame(parent=self.cartFrame, relief=None, text=PLocalizer.PurchaseCart, text_fg=PiratesGuiGlobals.TextFG1, text_align=TextNode.ACenter, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0, -0.03), textMayChange=0, pos=(self.cartWidth / 2, 0, self.cartHeight)) self.purchaseInventory = PurchaseList.PurchaseList([], self.cartHeight - 0.25, buy=PiratesGuiGlobals.InventoryRemove) self.purchaseInventory.reparentTo(self.cartFrame) self.purchaseInventory.setPos(0, 0, 0.2) self.frontTabParent = self.panel.attachNewNode('frontTab', sort=2) self.balanceTitle = DirectFrame(parent=self.cartFrame, relief=None, text=PLocalizer.Total, text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0, 0.0), pos=(0.01, 0, 0.225)) self.balanceValue = DirectFrame(parent=self.cartFrame, relief=None, text=str(self.balance), text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(-0.055, 0.0), textMayChange=1, image=StoreGUI.CoinImage, image_scale=0.15, image_pos=(-0.025, 0, 0.025), pos=(self.cartWidth, 0, 0.225)) self.myGoldTitle = DirectFrame(parent=self.cartFrame, relief=None, text=PLocalizer.YourMoney, text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0, 0.0), pos=(0.01, 0, 0.155)) self.myGold = DirectFrame(parent=self.cartFrame, relief=None, text=str(localAvatar.getMoney()), text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(-0.055, 0.0), textMayChange=1, image=StoreGUI.CoinImage, image_scale=0.15, image_pos=(-0.025, 0, 0.025), pos=(self.cartWidth, 0, 0.155)) self.commitButton = GuiButton.GuiButton(command=self.handleCommitPurchase, parent=self.cartFrame, text=PLocalizer.PurchaseCommit, text_fg=PiratesGuiGlobals.TextFG2, text_pos=(0, -PiratesGuiGlobals.TextScaleLarge * 0.25), text_scale=PiratesGuiGlobals.TextScaleLarge, pos=(self.width - 0.2, 0, 0.075)) self.commitButton.setPos(self.cartWidth / 2, 0, 0.05) self.initTabs() self.updateBalance() self.accept(getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.updateBalance) self.accept(PiratesGuiGlobals.InventoryBuyEvent, self.handleBuyItem) base.localAvatar.guiMgr.setIgnoreEscapeHotKey(True) self.acceptOnce('escape', self.closePanel) return
def __init__(self, inventory, name, **kw): optiondefs = (('relief', None, None), ('framSize', (0, self.width, 0, self.height), None), ('sortOrder', 20, None)) self.defineoptions(kw, optiondefs) DirectFrame.__init__(self, None, **kw) self.initialiseoptions(StowawayGUI) if not StowawayGUI.CoinImage: StowawayGUI.CoinImage = loader.loadModel( 'models/gui/toplevel_gui').find('**/treasure_w_coin*') if not StowawayGUI.CrateShutSound: StowawayGUI.CrateShutSound = loadSfx( SoundGlobals.SFX_STOWAWAY_CRATE_SHUT) self.panel = GuiPanel.GuiPanel(name, self.width, self.height, parent=self) self.panel.closeButton['command'] = self.closePanel self.setPos(-0.8, 0, -0.66) self.balance = 0 self.inventory = inventory self.storeInventory = InventoryItemList.InventoryItemList( self.inventory, self.height - 0.15, buy=PiratesGuiGlobals.InventoryAdd, listItemClass=StowawayItemGui) self.storeInventory.reparentTo(self.panel) self.storeInventory.setPos(0.03, 0, 0.04) self.myGoldTitle = DirectFrame( parent=self.panel, relief=None, text=PLocalizer.YourMoney, text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ALeft, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(0.0, 0.0), pos=(0.1, 0, 0.155)) self.myGold = DirectFrame(parent=self.myGoldTitle, relief=None, text=str(localAvatar.getMoney()), text_fg=PiratesGuiGlobals.TextFG2, text_align=TextNode.ARight, text_scale=PiratesGuiGlobals.TextScaleLarge, text_pos=(-0.055, 0.0), textMayChange=1, image=StowawayGUI.CoinImage, image_scale=0.15, image_pos=(-0.025, 0, 0.025), pos=(0.4, 0, 0)) self.accept(PiratesGuiGlobals.InventoryBuyEvent, self.handleBuyItem) self.acceptOnce('escape', self.closePanel) return