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 __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