示例#1
0
 def showCycleCompleteMessage(self):
     if self.repairGame.location == ON_LAND:
         tpMgr = TextPropertiesManager.getGlobalPtr()
         tpGold = TextProperties()
         tpGold.setTextColor(0.97999999999999998, 0.76000000000000001, 0, 1)
         tpMgr.setProperties('gold', tpGold)
         completionTime = self.repairGame.getCycleCompleteTime()
         seconds = completionTime % 60
         minutes = int(completionTime / 60.0)
         if minutes == 0:
             time = '\x1gold\x1%i %s\x2' % (
                 seconds, PLocalizer.Minigame_Repair_Seconds)
         elif seconds < 10:
             time = '\x1gold\x1%i:0%i %s\x2' % (
                 minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
         else:
             time = '\x1gold\x1%i:%i %s\x2' % (
                 minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
         goldAmount = self.repairGame.getReward(localAvatar.doId)
         goldBonus = self.repairGame.getGoldBonus()
         if goldBonus:
             reward = PLocalizer.Minigame_Repair_GoldBonus % (
                 str(goldAmount), str(goldBonus))
         else:
             reward = PLocalizer.Minigame_Repair_Gold % str(goldAmount)
         text = PLocalizer.Minigame_Repair_BenchOutro % (time, reward)
         self.textElements['cycleCompleteMessage'].setPos(
             0.0, 0.0, 0.34999999999999998)
     else:
         text = PLocalizer.Minigame_Repair_ShipOutro
         self.textElements['cycleCompleteMessage'].setPos(
             0.0, 0.0, 0.14999999999999999)
     self.textElements['cycleCompleteMessage']['text'] = text
     self.textElements['cycleCompleteMessage'].setText()
 def showCycleCompleteMessage(self):
     if self.repairGame.location == ON_LAND:
         tpMgr = TextPropertiesManager.getGlobalPtr()
         tpGold = TextProperties()
         tpGold.setTextColor(0.97999999999999998, 0.76000000000000001, 0, 1)
         tpMgr.setProperties('gold', tpGold)
         completionTime = self.repairGame.getCycleCompleteTime()
         seconds = completionTime % 60
         minutes = int(completionTime / 60.0)
         if minutes == 0:
             time = 'gold %i %s' % (seconds, PLocalizer.Minigame_Repair_Seconds)
         elif seconds < 10:
             time = 'gold %i:0%i %s' % (minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
         else:
             time = 'gold %i:%i %s' % (minutes, seconds, PLocalizer.Minigame_Repair_Minutes)
         goldAmount = self.repairGame.getReward(localAvatar.doId)
         goldBonus = self.repairGame.getGoldBonus()
         if goldBonus:
             reward = PLocalizer.Minigame_Repair_GoldBonus % (str(goldAmount), str(goldBonus))
         else:
             reward = PLocalizer.Minigame_Repair_Gold % str(goldAmount)
         text = PLocalizer.Minigame_Repair_BenchOutro % (time, reward)
         self.textElements['cycleCompleteMessage'].setPos(0.0, 0.0, 0.34999999999999998)
     else:
         text = PLocalizer.Minigame_Repair_ShipOutro
         self.textElements['cycleCompleteMessage'].setPos(0.0, 0.0, 0.14999999999999999)
     self.textElements['cycleCompleteMessage']['text'] = text
     self.textElements['cycleCompleteMessage'].setText()
示例#3
0
 def __init__(self):
   sys.stdout = PseudoFile(self.writeOut)
   sys.stderr = PseudoFile(self.writeErr)
   tpErr = TextProperties()
   tpErr.setTextColor(1, 0.5, 0.5, 1)
   TextPropertiesManager.getGlobalPtr().setProperties("err", tpErr)
   #font = loader.loadFont("cmss12")
   self.frame = DirectFrame(parent = base.a2dTopCenter, text_align = TextNode.ALeft, text_pos = (-base.getAspectRatio() + TEXT_MARGIN[0], TEXT_MARGIN[1]), text_scale = 0.05, text_fg = (1, 1, 1, 1), frameSize = (-2.0, 2.0, -0.5, 0.0), frameColor = (0, 0, 0, 0.5), text = '')#, text_font = font)
   self.entry = DirectEntry(parent = base.a2dTopLeft, command = self.command, scale = 0.05, width = 1000.0, pos = (-0.02, 0, -0.48), relief = None, text_pos = (1.5, 0, 0), text_fg = (1, 1, 0.5, 1), rolloverSound = None, clickSound = None)#, text_font = font)
   self.otext = OnscreenText(parent = self.entry, scale = 1, align = TextNode.ALeft, pos = (1, 0, 0), fg = (1, 1, 0.5, 1), text = ':')#, font = font)
   self.lines = [''] * 9
   self.commands = []  # All previously sent commands
   self.cscroll = None # Index of currently navigated command, None if current
   self.command = ''   # Currently entered command
   self.block = ''     # Temporarily stores a block of commands
   self.hide()
   self.initialized = False
示例#4
0
    def __init__(self, manager, xml):
        sys.stdout = PseudoFile(self.writeOut)
        sys.stderr = PseudoFile(self.writeErr)
        tpErr = TextProperties()
        tpErr.setTextColor(1, 0.5, 0.5, 1)
        TextPropertiesManager.getGlobalPtr().setProperties("err", tpErr)
        self.manager = manager
        font = loader.loadFont("cmss12")
        self.frame = DirectFrame(parent=base.a2dTopCenter,
                                 text_align=TextNode.ALeft,
                                 text_pos=(-base.getAspectRatio() +
                                           TEXT_MARGIN[0], TEXT_MARGIN[1]),
                                 text_scale=0.05,
                                 text_fg=(1, 1, 1, 1),
                                 frameSize=(-2.0, 2.0, -0.5, 0.0),
                                 frameColor=(0, 0, 0, 0.5),
                                 text='',
                                 text_font=font)

        self.entry = DirectEntry(parent=base.a2dTopLeft,
                                 command=self.command,
                                 scale=0.05,
                                 width=1000.0,
                                 pos=(-0.02, 0, -0.48),
                                 relief=None,
                                 text_pos=(1.5, 0, 0),
                                 text_fg=(1, 1, 0.5, 1),
                                 rolloverSound=None,
                                 clickSound=None,
                                 text_font=font)

        self.otext = OnscreenText(parent=self.entry,
                                  scale=1,
                                  align=TextNode.ALeft,
                                  pos=(1, 0, 0),
                                  fg=(1, 1, 0.5, 1),
                                  text=':',
                                  font=font)
        self.lines = [''] * 9
        self.commands = []  # All previously sent commands
        self.cscroll = None  # Index of currently navigated command, None if current
        self.command = ''  # Currently entered command
        self.block = ''  # Temporarily stores a block of commands
        self.hide()
        self.initialized = False
示例#5
0
    def __init__(self):
        self.points = 0
        self.timersecs = 60
        self.duration = 0
        self.ncandy = 0
        self.runralph = 0
        self.gamepause = 0
        self.picked = 0

        self.bg = loader.loadSfx("./sounds/faster_than_all.ogg")
        self.bg.setLoop(True)
        self.bg.setVolume(0.3)
        self.bgcount = loader.loadSfx("./sounds/panic.ogg")
        self.bgcount.setLoop(False)
        self.bgcount.setVolume(1)

        self.playBG()

        butaicon = OnscreenImage(image = './GUI/smiley1.png', pos = (0.66, 0, 0.85))
        butaicon.setScale(0.12,0,0.11)
        butaicon.setTransparency(TransparencyAttrib.MAlpha)

        tpButa = TextProperties()
        tpButa.setTextColor(1,1,1,1)
        butafont = loader.loadFont('./GUI/fonts/butafont.ttf')
        tpButa.setFont(butafont)
        tpButa.setShadow(0.05, 0.05)
        tpButa.setShadowColor(0,0,0,1)
        tpMgr = TextPropertiesManager.getGlobalPtr()
        tpMgr.setProperties("buta", tpButa)
        tpMenu = TextProperties()
        tpMenu.setTextColor(1,0.6,0.75,1)
        tpMenu.setFont(butafont)
        tpMenu.setShadow(0.05, 0.05)
        tpMenu.setShadowColor(1,0.8,0.9,1)
        tpMgr.setProperties("menu", tpMenu)

        #Add candy number
        self.candy = TextNode('Candy Number')
        self.candy.setText("\1buta\1x "+str(self.ncandy)+" \2")
        self.candynumNP = aspect2d.attachNewNode(self.candy)
        self.candynumNP.setScale(0.18)
        self.candynumNP.setPos(0.79, 0, 0.8)

         #Add points number
        self.ptnum = TextNode('Pt Number')
        self.ptnum.setText("\1buta\1Pt. "+str(self.points)+" \2")
        self.ptnumNP = aspect2d.attachNewNode(self.ptnum)
        self.ptnumNP.setScale(0.18)
        self.ptnumNP.setPos(-1.31, 0, 0.8)

         #Add record number
        
        recordfile = open("candyrecord.dat","r")
        self.record = int(recordfile.read())
        recordfile.close()
        self.rcnum = TextNode('Record Number')
        self.rcnum.setText("\1buta\1Record \n"+str(self.record)+" \2")
        self.rcnumNP = aspect2d.attachNewNode(self.rcnum)
        self.rcnumNP.setScale(0.11)
        self.rcnumNP.setPos(-1.38, 0, 0.65)
        self.rcnum.setWordwrap(4.5)

        #Add timer
        self.timer = TextNode('Timer')
        self.timer.setText("\1buta\1 "+str(self.timersecs/60)+":00 \2")
        self.timerNP = aspect2d.attachNewNode(self.timer)
        self.timerNP.setScale(0.18)
        self.timerNP.setPos(0.9,0,-0.93)

        
        self.itemset = {"musicon":loader.loadTexture('./GUI/soundon.png'),"musicoff":loader.loadTexture('./GUI/soundoff.png'),}
        self.itembox = DirectButton(image=self.itemset["musicon"], scale=.10, pos=(-1.19,0,-0.82), relief=None, state=DGG.NORMAL, command=self.changemusic, clickSound=None)
        self.itembox.setScale(0.15)
        self.itembox.setTransparency(TransparencyAttrib.MAlpha)
示例#6
0
import string
from pandac.PandaModules import TextProperties
from pandac.PandaModules import TextPropertiesManager

shadow = TextProperties()
shadow.setShadow(-0.025, -0.025)
shadow.setShadowColor(0, 0, 0, 1)
TextPropertiesManager.getGlobalPtr().setProperties('shadow', shadow)

red = TextProperties()
red.setTextColor(1, 0, 0, 1)
TextPropertiesManager.getGlobalPtr().setProperties('red', red)

green = TextProperties()
green.setTextColor(0, 1, 0, 1)
TextPropertiesManager.getGlobalPtr().setProperties('green', green)

yellow = TextProperties()
yellow.setTextColor(1, 1, 0, 1)
TextPropertiesManager.getGlobalPtr().setProperties('yellow', yellow)

midgreen = TextProperties()
midgreen.setTextColor(0.2, 1, 0.2, 1)
TextPropertiesManager.getGlobalPtr().setProperties('midgreen', midgreen)

blue = TextProperties()
blue.setTextColor(0, 0, 1, 1)
TextPropertiesManager.getGlobalPtr().setProperties('blue', blue)

white = TextProperties()
white.setTextColor(1, 1, 1, 1)