Exemple #1
0
 def __init__(self, table, numDice = 12, public_roll = 1, name = 'Dice Game'):
     DirectFrame.__init__(self, relief = None)
     self.numDice = numDice
     self.initialiseoptions(DiceGameGUI)
     self.hasRolled = False
     self.public = public_roll
     self.table = table
     self.arrow = loader.loadModel('models/gui/arrow')
     self.arrow.reparentTo(self)
     self.arrow.setScale(0.14999999999999999)
     self.arrow.hide()
     self.menu = GuiTray.GuiTray(0.75, 0.20000000000000001)
     self.menu.setPos(-0.40000000000000002, 0, -1)
     self.dice = { }
     self.diceval = []
     self.finalPos = []
     self.lerpList = []
     self.gameLabel = DirectLabel(parent = self, relief = None, text = name, text_align = TextNode.ACenter, text_scale = 0.14999999999999999, pos = (-0.80000000000000004, 0, 0.69999999999999996), text_fg = (1, 1.0, 1.0, 1), text_shadow = (0, 0, 1.0, 1))
     self.gameLabel.show()
     self.turnStatus = DirectLabel(parent = self, relief = None, text = PLocalizer.DiceText_Wait, text_align = TextNode.ALeft, text_scale = 0.059999999999999998, pos = (0.28000000000000003, 0, 0.77000000000000002), text_fg = (1, 0.90000000000000002, 0.59999999999999998, 1), text_shadow = (1.0, 0, 1.0, 1))
     self.turnStatus.show()
     self.gameStatus = DirectLabel(parent = self, relief = None, text = '', text_align = TextNode.ALeft, text_scale = 0.059999999999999998, pos = (0.28000000000000003, 0, 0.68999999999999995), text_fg = (1, 0.90000000000000002, 0.59999999999999998, 1), text_shadow = (1.0, 0, 1.0, 1))
     self.gameStatus.show()
     self.mainButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = '%s %d' % (PLocalizer.DiceText_Ante, self.table.ante), text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = (0.0, 0.80000000000000004, 0.10000000000000001, 1), frameSize = (0, 0.29999999999999999, 0, 0.12), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.10000000000000001, 0.029999999999999999), textMayChange = 1, pos = (0.17999999999999999, 0, 0.050000000000000003), command = self.table.playerIsReady, extraArgs = [])
     self.exitButton = DirectButton(parent = self.menu, relief = DGG.RAISED, text = 'X', text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_pos = (0.02, 0.01), text_fg = (0.75, 0.75, 0.75, 1), text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, frameColor = PiratesGuiGlobals.ButtonColor1, borderWidth = PiratesGuiGlobals.BorderWidthSmall, frameSize = (0, 0.040000000000000001, 0, 0.040000000000000001), pos = (0.75 - 0.01 - 0.040000000000000001, 0, 0.01), command = self.table.guiCallback, extraArgs = [
         -1])
Exemple #2
0
 def __init__(self, gameCallback, seatPos):
     DirectFrame.__init__(self, relief = None)
     FSM.FSM.__init__(self, 'BishopsHandGameFSM')
     self.initialiseoptions(BishopsHandGame)
     self.reparentTo(self.getParent(), sort = -100)
     self.gameCallback = gameCallback
     self.seatPos = seatPos
     self.round = None
     self.gameInterface = DirectFrame(parent = self, relief = None)
     self.gameInterface.hide()
     model = loader.loadModel('models/props/BH_images')
     self.bgImage = DirectFrame(parent = self.gameInterface, relief = None, geom = model.find('**/*table'), scale = (8.0 / 3.0, 2, 2))
     continue
     self.faces = [ FaceSpot(0, parent = self.gameInterface, relief = None, pos = BishopsHandGlobals.FACE_SPOT_POS[p], scale = 0.33300000000000002) for p in BishopsHandGlobals.FACE_SPOT_POS.keys()[1:] ]
     base.faces = self.faces
     for f in self.faces:
         f.enable()
     
     self.dealerFace = FaceSpot(0, parent = self.gameInterface, relief = None, pos = (), scale = 0.33300000000000002)
     self.burns = Burns(parent = self.gameInterface, relief = None)
     self.hand = DirectFrame(parent = self.gameInterface, relief = None, geom = Hand('Hand'), scale = 2.0)
     self.knife = Knife(parent = self.gameInterface, relief = None, pos = (0.070000000000000007, 0.0, -0.16))
     self.menu = GuiTray.GuiTray(0.75, 0.20000000000000001)
     self.menu.setPos(-0.40000000000000002, 0, -1)
     self.menu.hide()
     self.joinButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = 'Join: 2 Gold', text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = PiratesGuiGlobals.ButtonColor1, frameSize = (0, 0.40000000000000002, 0, 0.080000000000000002), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.20000000000000001, 0.029999999999999999), textMayChange = 1, pos = (0.050000000000000003, 0, 0.10000000000000001), command = self.gameCallback, extraArgs = [
         BishopsHandGlobals.PLAYER_ACTIONS.JoinGame])
     self.joinButton.hide()
     self.unjoinButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = 'Unjoin', text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = PiratesGuiGlobals.ButtonColor1, frameSize = (0, 0.40000000000000002, 0, 0.080000000000000002), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.20000000000000001, 0.029999999999999999), textMayChange = 1, pos = (0.050000000000000003, 0, 0.10000000000000001), command = self.gameCallback, extraArgs = [
         BishopsHandGlobals.PLAYER_ACTIONS.UnjoinGame])
     self.unjoinButton.hide()
     self.rejoinButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = 'Rejoin: 2 Gold', text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = PiratesGuiGlobals.ButtonColor1, frameSize = (0, 0.40000000000000002, 0, 0.080000000000000002), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.20000000000000001, 0.029999999999999999), textMayChange = 1, pos = (0.050000000000000003, 0, 0.10000000000000001), command = self.gameCallback, extraArgs = [
         BishopsHandGlobals.PLAYER_ACTIONS.RejoinGame])
     self.rejoinButton.hide()
     self.continueButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = 'Practice', text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = PiratesGuiGlobals.ButtonColor1, frameSize = (0, 0.40000000000000002, 0, 0.080000000000000002), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.20000000000000001, 0.029999999999999999), textMayChange = 1, pos = (0.050000000000000003, 0, 0.0), command = self.gameCallback, extraArgs = [
         BishopsHandGlobals.PLAYER_ACTIONS.Continue])
     self.continueButton.hide()
     self.resignButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = 'Resign Game', text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = PiratesGuiGlobals.ButtonColor1, frameSize = (0, 0.27000000000000002, 0, 0.080000000000000002), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.13, 0.029999999999999999), textMayChange = 1, pos = (0.46000000000000002, 0, 0.10000000000000001), command = self.gameCallback, extraArgs = [
         BishopsHandGlobals.PLAYER_ACTIONS.Resign])
     self.resignButton.hide()
     self.leaveButton = DirectButton(parent = self.menu, relief = DGG.RAISED, state = DGG.NORMAL, text = 'Leave with winnings', text_align = TextNode.ACenter, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, frameColor = PiratesGuiGlobals.ButtonColor1, frameSize = (0, 0.27000000000000002, 0, 0.080000000000000002), borderWidth = PiratesGuiGlobals.BorderWidth, text_pos = (0.13, 0.029999999999999999), textMayChange = 1, pos = (0.46000000000000002, 0, 0.10000000000000001), command = self.gameCallback, extraArgs = [
         BishopsHandGlobals.PLAYER_ACTIONS.Resign])
     self.leaveButton.hide()
     self.exitButton = DirectButton(parent = self.menu, relief = DGG.RAISED, text = 'X', text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_pos = (0.02, 0.01), text_fg = (0.75, 0.75, 0.75, 1), text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, frameColor = PiratesGuiGlobals.ButtonColor1, borderWidth = PiratesGuiGlobals.BorderWidthSmall, frameSize = (0, 0.040000000000000001, 0, 0.040000000000000001), pos = (0.75 - 0.01 - 0.040000000000000001, 0, 0.01), command = self.gameCallback, extraArgs = [
         -1])
     self.roundLabel = DirectLabel(parent = self, relief = None, text = '', text_align = TextNode.ALeft, text_scale = 0.059999999999999998, pos = (-0.10000000000000001, 0, 0.45000000000000001), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getPirateOutlineFont())
     self.potSizeLabel = DirectLabel(parent = self, relief = None, text_align = TextNode.ALeft, text_scale = 0.080000000000000002, pos = (-0.10000000000000001, 0, 0.5), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getPirateOutlineFont())
     self.tableStateLabel = DirectLabel(parent = self, relief = None, text = '', text_align = TextNode.ACenter, text_scale = 0.080000000000000002, pos = (0, 0, 0), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getPirateOutlineFont())
     self.timerLabel = DirectLabel(parent = self, relief = None, text = '', pos = (1, 0, 0.55000000000000004), scale = 0.10000000000000001, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getPirateOutlineFont())
     self.mouseNode = base.mouseWatcherNode
     t = taskMgr.add(self.mouseWatcherTask, 'mouse')
     t.run = True
     self.text = OnscreenText(pos = (-0.75, 0.75), mayChange = True)
     self.text.reparentTo(self)
     localAvatar.guiMgr.hideTrays()
     buttons = [
         'normalButton',
         'scButton',
         'whisperButton',
         'whisperCancelButton',
         'whisperScButton']
     for b in buttons:
         button = getattr(localAvatar.chatMgr, b)
         button.reparentTo(button.getParent())
     
     self.request('WaitingForPlayers')