def writeEmpireName(self): """Write the Empire Name""" text = self.game.myEmpire['player'] self.textEmpireName = textonscreen.TextOnScreen(self.path, text, scale=0.03, font=5, parent=aspect2d) self.textEmpireName.writeTextToScreen(0.6, 0, 0.95, 30) self.textEmpireName.setColor(self.color) self.myWidgets.append(self.textEmpireName) self.textRound = textonscreen.TextOnScreen(self.path, 'Round: %s' % self.game.currentRound, scale=0.03, font=5, parent=aspect2d) self.textRound.writeTextToScreen(0.60, 0, 0.89, 30) self.textRound.setColor(globals.colors['guiwhite']) self.myWidgets.append(self.textRound)
def writeCurrentOrder(self): """Write the current tech orders for this technology""" if self.currentTechOrder != 0: self.clearText(self.textOrder) self.textOrder = textonscreen.TextOnScreen(self.path, str(self.currentTechOrder), 0.4) self.textOrder.writeTextToScreen(self.x -0.65, self.y-0.1, self.z+0.2) self.textOrder.setColor(globals.colors['guiyellow'])
def writeCityNum(self): """Write City Number""" text = '%s' % self.systemDict['cities'] self.createSimCity(globals.colors[self.color1]) self.textCityNum = textonscreen.TextOnScreen(self.path, text, 10, font=1) self.textCityNum.writeTextToScreen(self.x-29, self.y, self.z+13, wordwrap=10) self.textCityNum.setColor(globals.colors[self.color1])
def writeName(self): """Write the system name""" text = funcs.getSystemName(self.systemDict) self.clearText(self.textName) self.textName = textonscreen.TextOnScreen(self.path, text, 0.25, font=1) self.textName.writeTextToScreen(self.x-0.9, self.y, self.z+1, wordwrap=14) self.textName.setColor(globals.colors[self.color1])
def createTitleCard(self): """Default Title label""" if self.title != '': self.myTitle = textonscreen.TextOnScreen(self.path, self.title, 0.025, 5, aspect2d) self.myTitle.writeTextToScreen(self.x, 0, self.y+0.04, self.titlewidth) self.myTitle.setTitleStyle() self.myWidgets.append(self.myTitle)
def writeTextTitle(self): """Write the Game Title""" text = 'C O S M I C A' self.textTitle = textonscreen.TextOnScreen(self.path, text, scale=0.03, font=5, parent=aspect2d) self.textTitle.writeTextToScreen(-1.0, 0, 0.95, 30) self.myWidgets.append(self.textTitle)
def writeWarpReq(self, x, z): """Display the warp required for this trade route""" if self.tradeRouteDict['warpReq'] > 0: text = 'WARP = %d' % self.tradeRouteDict['warpReq'] self.textWarpReq = textonscreen.TextOnScreen(self.path, text, 0.15, font=5) self.textWarpReq.writeTextToScreen(x, self.y, z, wordwrap=20) self.textWarpReq.setColor(globals.colors['guiwhite']) self.myWidgets.append(self.textWarpReq)
def writeToScreen(self, myText, x, z, scale=0.2, color='default', font=3, wordwrap=10): if color == 'default': color = Vec4(.1,.1,.8,.8) text = textonscreen.TextOnScreen(self.guiMediaPath, myText, scale,font=3) text.writeTextToScreen(x, self.depth, z, wordwrap=wordwrap) text.setColor(color) self.gui.append(text)
def createTitleCard(self): """Default Title label""" self.myTitle = textonscreen.TextOnScreen(self.path, self.title, 0.025, 5, aspect2d) self.myTitle.writeTextToScreen(self.x + 0.01, 0, self.z + self.textDelta, self.titleWidth) self.myTitle.setTitleStyle()
def writeAssault(self, message, color): """Write the assault status of assault battle""" if self.textAssault == None: self.textAssault = textonscreen.TextOnScreen(self.path, message, 0.20) self.textAssault.writeTextToScreen(self.x-0.9, self.y, self.z-1.0, wordwrap=100) self.myWidgets.append(self.textAssault) else: self.textAssault.myText.setText(message) self.textAssault.setColor(globals.colors[color])
def writeEmpireStat8(self, empireID, x, y): if self.stat8 != None: self.removeMyGui('stat8') text = self.getMyStats(empireID) self.stat8 = textonscreen.TextOnScreen(self.guiMediaPath, text, scale=0.03, font=5, parent=aspect2d) self.stat8.writeTextToScreen(x=x, y=0, z=y, wordwrap=100) self.stat8.setColor(globals.colors[self.empires[empireID].color1]) self.gui.append(self.stat8)
def writeOverValue(self): """Set the textOverValue text if currentValue > maxValue""" if self.showOverValues == 1: value = self.currentValue - self.maxValue self.clearText(self.textOverValue) if int(value) > 0: self.textOverValue = textonscreen.TextOnScreen(self.path, '+ %d' % value, self.scale/8.0, parent=aspect2d) self.textOverValue.writeTextToScreen(self.x, self.y, self.z) self.textOverValue.setColor(globals.colors['guiyellow'])
def writeTextPause(self): text = 'Simulation Paused: My Current Total Ship Radar = %d' % self.myRadar self.textPause = textonscreen.TextOnScreen(self.guiMediaPath, text, scale=0.06, font=5, parent=aspect2d) self.textPause.writeTextToScreen(x=-1, y=0, z=+0.8, wordwrap=40) color = globals.empires[int(self.game.myEmpireID)]['color1'] self.textPause.setColor(globals.colors[color]) self.gui.append(self.textPause) self.writeStats()
def writeAttribute(self, myAttribute, value, color, text, x=0): if value > 0: self.yOffset -= 0.04 myAttribute = textonscreen.TextOnScreen(self.path, text, scale=0.03, font=5, parent=aspect2d) myAttribute.writeTextToScreen(self.posInitX+x, 0, self.posInitY+self.yOffset, 40) myAttribute.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 0.2, 0.2) myAttribute.setColor(globals.colors[color]) self.myWidgets.append(myAttribute)
def writeIA(self, x, y, z, value): resource = 'IA' text = '%s = %d' % (resource, value) color = globals.resourceColors[resource] self.textIA = textonscreen.TextOnScreen(self.path, text, self.resourceSize, font=5) self.textIA.writeTextToScreen(x, y, z, wordwrap=20) self.textIA.setColor(globals.colors[color]) self.myWidgets.append(self.textIA)
def printChartXAxis(self, y, offset): """Print the X Chart Axis""" count = 0 for roundnum in self.xAxis: count += 1 if self.shouldIprint(len(self.xAxis), count): x = self.getX(roundnum, len(self.xAxis)) + offset xAxis = textonscreen.TextOnScreen(self.guiMediaPath, str(roundnum), 0.20) xAxis.writeTextToScreen(x, 20, y) xAxis.setColor(globals.colors['guiwhite']) self.gui.append(xAxis)
def createTitleAvail(self): if self.titleAvail == None: self.titleAvail = textonscreen.TextOnScreen( self.guiMediaPath, 'Available Simulation Points:', scale=0.03, font=5, parent=aspect2d) self.titleAvail.writeTextToScreen(-0.1, 0, 0.15, 10) self.titleAvail.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 0.2, 0.2) self.gui.append(self.titleAvail)
def createTitleCost(self): if self.titleCost == None: self.titleCost = textonscreen.TextOnScreen( self.guiMediaPath, 'Cost of Current Simulation:', scale=0.03, font=5, parent=aspect2d) self.titleCost.writeTextToScreen(-0.1, 0, 0.3, 10) self.titleCost.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 0.2, 0.2) self.gui.append(self.titleCost)
def writeTradeDescription(self): """Create Trade Description""" text = 'Trade From:\n\n %s \n\n\nTrade To:\n\n %s ' % (self.mySystemDict['name'], self.toSystemDict['name']) if self.textTradeDescription == None: self.textTradeDescription = textonscreen.TextOnScreen(self.path, text, scale=0.020, font=5, parent=aspect2d) self.textTradeDescription.writeTextToScreen(self.posInitX+0.25, 0, self.posInitY+0.216, 10) self.textTradeDescription.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 1, 1) self.textTradeDescription.setColor(globals.colors['guiyellow']) self.myWidgets.append(self.textTradeDescription) else: self.textTradeDescription.myText.setText(text)
def writeName(self): """Write the tech name""" if 'availWGC' in self.systemDict.keys(): availWGC = self.systemDict['availWGC'] if availWGC != 0: text = '%s -> (%d/%d)' % (self.systemDict['name'], self.systemDict['usedWGC'], availWGC) else: text = self.systemDict['name'] else: text = self.systemDict['name'] self.clearText(self.textName) self.textName = textonscreen.TextOnScreen(self.path, text, 8, font=1) self.textName.writeTextToScreen(self.x-20, self.y, self.z+20, wordwrap=14) self.textName.setColor(globals.colors[self.color1])
def writeIACost(self): value = '%d' % (self.myData.costIA) if self.textIA == None: self.textIA = textonscreen.TextOnScreen(self.path, value, scale=0.03, font=5, parent=aspect2d) self.textIA.writeTextToScreen(self.posInitX + 0.47, 0, self.posInitY + 0.2 - 0.06, 10) self.textIA.setColor(globals.colors['guired']) self.myWidgets.append(self.textIA) else: self.textIA.myText.setText(value)
def writeECCost(self): value = '%d' % (self.myData.costEC) if self.textEC == None: self.textEC = textonscreen.TextOnScreen(self.path, value, scale=0.03, font=5, parent=aspect2d) self.textEC.writeTextToScreen(self.posInitX + 0.47, 0, self.posInitY + 0.2 - 0.04, 10) self.textEC.setColor(globals.colors['guiyellow']) self.myWidgets.append(self.textEC) else: self.textEC.myText.setText(value)
def writeCRCost(self): value = '%d' % (self.myData.costCR) if self.textCR == None: self.textCR = textonscreen.TextOnScreen(self.path, value, scale=0.03, font=5, parent=aspect2d) self.textCR.writeTextToScreen(self.posInitX + 0.47, 0, self.posInitY + 0.2, 10) self.textCR.setColor(globals.colors['guigreen']) self.myWidgets.append(self.textCR) else: self.textCR.myText.setText(value)
def createTextCardAvail(self, simAvail): """Text Card For Simulation Points Available""" if self.multisimAvail == None: self.multisimAvail = textonscreen.TextOnScreen(self.guiMediaPath, str(simAvail), scale=0.09, font=5, parent=aspect2d) self.multisimAvail.writeTextToScreen(0.15, 0, 0.12, 10) self.multisimAvail.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 0.2, 0.2) self.gui.append(self.multisimAvail) funcs.setZeroToText(self.multisimAvail.myText, simAvail)
def writeCR(self): """Write the Player Information""" text = '' self.textCR = textonscreen.TextOnScreen(self.path, text, scale=0.03, font=5, parent=aspect2d) self.textCR.writeTextToScreen(0.6, 0, 0.92, 30) if self.game.myEmpire['CR'] > 100000: self.textCR.setColor(globals.colors['guigreen']) elif self.game.myEmpire['CR'] > 0: self.textCR.setColor(globals.colors['guiyellow']) else: self.textCR.setColor(globals.colors['guired']) self.updateCR() self.myWidgets.append(self.textCR)
def writeALCost(self): value = '%d' % (self.myIndustryData.costAL) if self.textAL == None: self.textAL = textonscreen.TextOnScreen(self.path, value, scale=0.03, font=5, parent=aspect2d) self.textAL.writeTextToScreen(self.posInitX + 0.40, 0, self.posInitY + 0.2 - 0.02, 10) self.textAL.setColor(globals.colors['guiblue1']) self.myWidgets.append(self.textAL) else: self.textAL.myText.setText(value)
def writeTextRoundEnds(self): """Write when the round will auto-end""" if self.textRoundEnds != None: self.removeMyWidget(self.textRoundEnds) if 'EndTurn' in self.mode.game.myEmpire['help']: text = 'PLEASE FINISH YOUR TURN\nROUND AUTO ENDS IN %d HRS' % self.game.myGalaxy['currentHoursLeft'] color = 'guiyellow' else: text = 'THANKS FOR ENDING TURN\nROUND AUTO ENDS IN %d HRS' % self.game.myGalaxy['currentHoursLeft'] color = 'guigreen' self.textRoundEnds = textonscreen.TextOnScreen(self.path, text, scale=0.03, font=5, parent=aspect2d) self.textRoundEnds.writeTextToScreen(-1.0, -0.05, 0.92, 30) self.textRoundEnds.setColor(globals.colors[color]) self.myWidgets.append(self.textRoundEnds)
def writeName(self): """Create Name""" if self.textName == None: self.textName = textonscreen.TextOnScreen(self.path, self.myData.name, scale=0.04, font=5, parent=aspect2d) self.textName.writeTextToScreen(self.posInitX + 0.36, 0, self.posInitY + 0.31, 12) self.textName.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 7, 0.2) self.myWidgets.append(self.textName) else: self.textName.myText.setText(self.myData.name)
def printChartYAxis(self, yList, yMin, yTotal, factor): """Print the Y Axis""" count = 0 lastprint = yMin - 1 for val in yList: y = self.getY(val, max(yList), yMin, yTotal) if y - lastprint <= 0.2: continue lastprint = y yAxis = textonscreen.TextOnScreen(self.guiMediaPath, str(val * factor), 0.2) yAxis.writeTextToScreen(self.xMin, 20, y) yAxis.setColor(globals.colors['guiwhite']) self.gui.append(yAxis) count += 1
def writeDescription(self): """Create Description""" if self.textDescription == None: self.textDescription = textonscreen.TextOnScreen( self.path, self.myData.description, scale=0.03, font=5, parent=aspect2d) self.textDescription.writeTextToScreen(self.posInitX + 0.36, 0, self.posInitY + 0.09, 20) self.textDescription.setCardColor(globals.colors['guiblue3'], 0.2, 0.2, 0.2, 0.2) self.myWidgets.append(self.textDescription) else: self.textDescription.myText.setText(self.myData.description)