示例#1
0
	def update(self):
		player = savage.getLocalPlayer();
		team = savage.getTeamObject(player.getTeam());
		
		self.setAlpha(255);
		self.image.setAlpha(255);
		self.request.setVisible(False);
		
		if not self.objtype.isResearched():
			self.setVisible(False);
		else:
			self.setVisible(True);
			
		#self.image.setProgress(1.0);
		if self.objtype in team.getResearch():
			self.setVisible(True);
			for r in team.getResearch():
				if r == self.objtype:
					con_println("progressing \n")
					self.image.setProgress(r.getBuildProgress());
					break;
			
		if player.getGold() < self.objtype.getValue("playerCost"):
			self.request.setVisible(True);
			if self.objtype.isWeaponType():
				obj1 = player.getInventorySlot(1);
				if obj1 is not None and player.getGold() + obj1.getValue("playerCost") >= self.objtype.getValue("playerCost"):
					self.request.setVisible(False);

		self.maxDeployment.setCaption("");
		if self.objtype.getValue("maxDeployment") > 0:
			md = self.objtype.getValue("maxDeployment")-team.getDeployedCount(self.objtype.typeId);
			self.maxDeployment.setCaption(str(md).rjust(2));
示例#2
0
def rebuildUnits():
	player = savage.getLocalPlayer();
	team = savage.getTeamObject(player.getTeam());

	loadout.unitContainer.erase();

	viewers = [];
	unitNames = [];
	unitPrices = [];
	unitList = team.getUnits();

	for unit in unitList:
		
		price = str( unit.getValue("playerCost") );
		if price == "0":
			price = "FREE";

		if price == "-1":
			continue;

		modelContainer = glass.GlassContainer(); #Store the button and the viewer in a container
		modelContainer.setSizePct( 0.075, 0.15 ); 
		
		viewer = glass.GlassViewer();
		viewer.setModel(unit.getValue("model"));
		viewer.setOpaque(0);
		modelContainer.add( viewer, 0, 0 );
		viewer.rotateModel(160);
		viewer.setCameraFOV(45);
		viewer.setSizePct(1,1);
		viewer.setAnimation("idle");
		viewer.fitCameraToModel(2);
		#viewer.setCameraPosition(0,0,16);
		#viewer.setCameraDistance(40);
		
		button = glass.ImageButton("textures/econs/transparent.s2g");
		#Create clickable, invisible button over the viewer.
		button.setClickAction( "CL_RequestUnit('" + str(unit.getValue('name')) + "');" );
		modelContainer.add( button );
		button.setSizePct(1,1);
		button.setPosition(0,0);
		
		viewers.append( modelContainer );
		
		price = glass.GlassLabel("^icon ../../gui/standard/icons/gold/gold_icon^" + price);
		price.setForegroundColor( gold );
		price.setFont(fontSizeSmall);
		unitPrices.append(price);
		
		name = glass.GlassLabel(unit.getValue("description"));
		unitNames.append(name);
		
	loadout.unitContainer.addRow(*viewers);
	loadout.unitContainer.addRow(*unitNames);
	loadout.unitContainer.addRow(*unitPrices);
	
	loadout.unitContainer.adjustHeightTo(int(0.2*loadout.main.getHeight()));
	loadout.unitContainer.setX( int( 0.69*loadout.main.getWidth() - loadout.unitContainer.getWidth()/2) );
	loadout.unitContainer.adjustJustification();
示例#3
0
	def update(self):
		player = savage.getLocalPlayer();
		team = savage.getTeamObject(player.getTeam());
		
		self.kills.setCaption("^g"+("% 3d"%player.getKills()));
		self.losses.setCaption("^900"+str(player.getDeaths()));
		
		self.levelLabel.setCaption("LEVEL: "+("% 3d"%player.getLevel()));
		self.level.setProgress(player.getXp()/float(savage.getXPForLevel(team.getRace(), player.getLevel()+1)));
示例#4
0
	def onEvent(self, e):
		if e.eventType == "research_complete" or e.eventType == "inventory_changed": #\
		  #and GUI_IsScreenVisible('loadout'): TODO
			player = savage.getLocalPlayer();
			team = savage.getTeamObject(player.getTeam());

			if team.getRace() == "human":
				loadout.buildLoadout(['NULL', 'magnetic', 'electric', 'chemical']);
			elif team.getRace() == "beast":
				loadout.buildLoadout(['NULL', 'entropy', 'strata', 'fire']);
示例#5
0
    def __init__(self, what, who, where):
        self.playerId = who
        player = savage.getGameObject(who)
        team = savage.getTeamObject(player.getTeam())

        race = team.getRace() + "s"
        msg = player.getFormattedName() + " " + what + " the " + race
        CommAlert.__init__(self, self.PRIORITY, self.RATE, msg)
        self.text.setFont(fontSizeSmall)
        self.text.setX(5)

        self.pic.setVisible(False)
示例#6
0
def frame():
	player = savage.getLocalPlayer();
	team = savage.getTeamObject(player.getTeam());
	teamNum = player.getTeam();

	if loadout.lastTeamNum != teamNum and teamNum != 0:
		if team.getRace() == "human":
			loadout.buildLoadout(['NULL', 'magnetic', 'electric', 'chemical']);
		elif team.getRace() == "beast":
			loadout.buildLoadout(['NULL', 'entropy', 'strata', 'fire']);
	loadout.lastTeamNum = teamNum; 

	loadout.updateInventory();
	loadout.updateMainViewer();
	
	loadout.goldLabel.setCaption("^icon ../../gui/standard/icons/gold/gold_icon^" + str(player.getGold()) );
示例#7
0
def rebuildWeapons():
	techColumns = loadout.techColumns;
	loadout.weaponContainer.erase();
	player = savage.getLocalPlayer();
	team = savage.getTeamObject(player.getTeam());
	currentInventory = [];
	for j in range(5):
		currentInventory.append(player.getInventorySlot(j));
	
	##WEAPONS
	ycol = [10,10,10,10];
	col=0;
	for weapon in team.getWeapons():
		if weapon.getValue("playerCost") < 0:
			continue;
		for i in range(len(techColumns)):
			if weapon.getTechType() == techColumns[i]:
				col = i;
				break;

		if weapon not in currentInventory:
			name = weapon.getValue("name")
			button = glass.ImageButton();
			button.setImage(weapon.getValue("icon")+".s2g");
			button.setSize(loadout.ICON_SIZE, loadout.ICON_SIZE);
			button.setClickAction("""
CL_RequestGiveback(0);
CL_RequestGiveback(1);
CL_RequestGive('"""+name+"""')
""");
			loadout.weaponContainer.add(button, 10+(loadout.ICON_SIZE+8)*col, ycol[col]);
			
			price = str(weapon.getValue("playerCost"));
			if price == "0":
				price = "FREE";
			price = glass.GlassLabel("^icon ../../gui/standard/icons/gold/gold_icon^" + price);
			price.setAlignment(glass.Graphics.CENTER);
			price.setFont(fontSizeSmall);
			price.setForegroundColor( gold );
			price.adjustSize();
			price.setWidth( button.getWidth() );
			price.setPosition( button.getX(), button.getY() + button.getHeight() + 2 )
			loadout.weaponContainer.add(price)
		
		ycol[col] = price.getY() + price.getHeight() + 2;
示例#8
0
def frame():
	player = savage.getLocalPlayer();
	team = savage.getTeamObject(player.getTeam());
	
	if team.getRace() == "human":
		loadout.activeWindow = loadout.humanLoadout;
		loadout.beastLoadout.setVisible(False);
	else:
		loadout.activeWindow = loadout.beastLoadout;
		loadout.humanLoadout.setVisible(False);
	
	gblPresetManager.setY( loadout.activeWindow.presetsY+loadout.activeWindow.getY());
	gblPresetManager.setX( loadout.activeWindow.getX()+10);
	#gblPresetManager.requestMoveToTop();
		
	loadout.activeWindow.setVisible(True);
	loadout.activeWindow.update();
	loadout.expWindow.update();
示例#9
0
def rebuildItems():
	techColumns = loadout.techColumns
	loadout.itemContainer.erase();
	player = savage.getLocalPlayer();
	team = savage.getTeamObject(player.getTeam());
	currentInventory = [];
	for j in range(5):
		currentInventory.append(player.getInventorySlot(j));
	
	ycol = [10,10,10,10]; #FIXME: more or less columns based on techColumns?
	col=0;
	
	for item in team.getItems():
		if item.getValue("playerCost") < 0:
			continue;
		for i in range(len(techColumns)):
			if item.getTechType() == techColumns[i]:
				col = i;
				break;

		name = item.getValue("name");
		button = glass.ImageButton();
		button.setImage(item.getValue("icon")+".s2g");
		button.setSize(loadout.ICON_SIZE,loadout.ICON_SIZE)
		button.setPosition(10+(loadout.ICON_SIZE+8)*col, ycol[col]);
		button.setClickAction("""
CL_RequestGive('"""+name+"""')
""");
		price = str(item.getValue("playerCost"));
		if price == "0":
			price = "FREE";
		price = glass.GlassLabel("^icon ../../gui/standard/icons/gold/gold_icon^" + price);
		price.setAlignment(glass.Graphics.CENTER);
		price.setFont(fontSizeSmall);
		price.setForegroundColor( gold );
		price.adjustSize();
		price.setWidth( button.getWidth() );
		price.setPosition( button.getX(), button.getY() + button.getHeight() + 2 )

		if item not in currentInventory or player.getInventorySlotAmmo(currentInventory.index(item)) < item.getValue("ammoMax"):
			loadout.itemContainer.add(button);
			loadout.itemContainer.add(price)
		
		ycol[col] = price.getY() + price.getHeight() + 2;