def createTechTotal(self): """Display tech total""" self.techTotal = valuebar.ValueBar(self.guiMediaPath, scale=0.45) self.techTotal.setMyPosition(0, 0, 0.85) self.techTotal.setColor(globals.colors['guiyellow']) self.updateTechTotal() self.gui.append(self.techTotal)
def createValueBars(self): """Create Value Bars:""" x = self.posInitX y = self.posInitY+0.350 name = self.mode.game.shipDesignObjects[self.otherDesignID].name self.createTitleCard('bvTitle1','Choose Ship Numbers for Simulation:', 30,x-0.04, y+0.042) self.myBV = valuebar.ValueBar(self.path, scale=self.scale, extraText = ' OF MY DESIGN') self.myBV.setColor(globals.colors['guiwhite']) self.myBV.setMyValues(self.myValues[0], self.maxValue) self.myBV.setMyPosition(x+0.20, 0, y-0.02) self.myWidgets.append(self.myBV) barHeight = self.myBV.myBar.getHeight()*self.scale self.otherBV = valuebar.ValueBar(self.path, scale=self.scale, extraText = ' OF OTHER DESIGN') self.otherBV.setColor(globals.colors['guigrey']) self.otherBV.setMyValues(self.myValues[0], self.maxValue) self.otherBV.setMyPosition(x+0.20, 0, y-barHeight-0.02) self.myWidgets.append(self.otherBV)
def createPriceBar(self): """Market Price from 0 to Max""" self.priceBar = valuebar.ValueBar(self.path, scale=self.scale, extraText=' CREDITS PER UNIT', showOverValues=1) self.priceBar.setMyValues(self.currentPrice, self.maxPrice) self.priceBar.setMyPosition(self.posInitX + 0.20, 0, self.posInitY + 0.31) color = globals.resourceColors['CR'] self.priceBar.setColor(globals.colors[color]) self.myWidgets.append(self.priceBar)
def createAvailMIC(self): """Display Available MI Capacity""" remaining = self.mySystemDict['availMIC'] - self.mySystemDict['usedMIC'] x = self.posInitX + 0.55 - (1 * self.xOffset) y = self.posInitY - 0.04 self.availMIC = valuebar.ValueBar(self.path, scale=self.scale, extraText='MILITARY INST CAPACITY') self.availMIC.setMyPosition(x, 0, y) self.availMIC.setColor(globals.colors['guiwhite']) self.availMIC.setMyValues(remaining, self.mySystemDict['availMIC']) self.myWidgets.append(self.availMIC)
def createAmountBar(self): """Market Amount from 0 to Max""" self.amountBar = valuebar.ValueBar(self.path, scale=self.scale, extraText=' %s' % self.resource, showOverValues=0) self.amountBar.setMyValues(self.currentAmount, self.maxAmount) barHeight = self.amountBar.myBar.getHeight() * self.scale self.amountBar.setMyPosition(self.posInitX + 0.20, 0, self.posInitY + 0.31 - barHeight) color = globals.resourceColors[self.resource] self.amountBar.setColor(globals.colors[color]) self.myWidgets.append(self.amountBar)
def createAmountBar(self): """choose amount to send""" self.amountBar = valuebar.ValueBar(self.path, scale=self.scale, extraText=' CREDITS', showOverValues=0) self.amountBar.setMyValues(100.0, self.empireDict['CR']) barHeight = self.amountBar.myBar.getHeight() * self.scale self.amountBar.setMyPosition(self.posInitX + 0.20, 0, self.posInitY + 0.31 - barHeight) color = globals.resourceColors['CR'] self.amountBar.setColor(globals.colors[color]) self.myWidgets.append(self.amountBar)
def createValueBars(self): """Create Value Bars:""" x = self.posInitX y = self.posInitY + 0.350 self.createTitleCard( 'title', 'Choose number of %s to add to Team 1 or 2:' % self.designName, 15, x - 0.04, y + 0.085) self.shipNum = valuebar.ValueBar(self.path, scale=self.scale, extraText=' SHIPS TO ADD') self.shipNum.setColor(globals.colors['guiwhite']) self.shipNum.setMyValues(1, self.maxValue) self.shipNum.setMyPosition(x + 0.20, 0, y - 0.02) self.myWidgets.append(self.shipNum)
def createCadetsAvailable(self): """Display Cadets currently ready to pilot new ships""" cadetsUsed = self.mySystemDict['armyCadets'] - self.cadetsNeeded if cadetsUsed < 0: cadetsUsed = 0 x = self.posInitX + 0.55 - (1 * self.xOffset) y = self.posInitY self.cadetsAvailable = valuebar.ValueBar(self.path, scale=self.scale, extraText='CADETS AVAILABLE') self.cadetsAvailable.setMyPosition(x, 0, y) self.cadetsAvailable.setColor(globals.colors['guiwhite']) self.cadetsAvailable.setMyValues(cadetsUsed, self.mySystemDict['armyCadets']) self.myWidgets.append(self.cadetsAvailable)
def writeChangingAttribute(self, name, currentValue, maxValue, text, x=0): """Write the changing attribute as a bar value""" if currentValue > maxValue: currentValue = maxValue if name in ['shipAccel', 'shipRotation'] or 'Lock' in name: decimal = 1 else: decimal = 0 self.yOffset -= 0.04 setattr(self, name, (valuebar.ValueBar(self.path, scale=0.25, extraText=text, decimal=decimal, showOverValues=0))) myAttr = getattr(self, name) myAttr.setMyValues(currentValue, maxValue) myAttr.setMyPosition(self.posInitX + x + 0.15, 0, self.posInitY + self.yOffset) myAttr.setColor(funcs.getDamageColor(currentValue, maxValue)) myAttr.myBar.setSx(0.23) self.myWidgets.append(myAttr)
def createInfrastructureBars(self): """These bars will show the infrastructure output of system""" wordWrap = 30 x = (self.posInitX + 0.55) - (1 * self.xOffset) y = self.posInitY + 0.15 self.createTitleCard('infrastructureBars', 'Future System Infrastructure:', wordWrap, x + self.xInit, y + 0.04) i = 0 for myList in self.infrastructureOutput: id = myList[0] text = myList[1] setattr( self, 'infrastructureBar%s' % id, valuebar.ValueBar(self.path, scale=self.scale, extraText=text)) myBar = getattr(self, 'infrastructureBar%s' % id) barHeight = myBar.myBar.getHeight() * self.scale myBar.setMyValues(myList[2], myList[3]) myBar.setMyPosition(x, 0, y - barHeight * i) myBar.setColor(globals.colors['guiwhite']) self.myWidgets.append(myBar) i += 1