Esempio n. 1
0
def arrange():
	#1. work out how many teams we have
        
	sv_numteams = cvar_getvalue("sv_numteams");
        
	#.2 for eact team, set their UI visible and color the background
	for i in range( 1, sv_numteams):  
		button = lobby.buttons[i];
		scroll = lobby.scrolls[i];
		background = lobby.backgrounds[i];
		
		button.setVisible(True);
		scroll.setVisible(True);
		background.setVisible(True);		
		
		team = savage.Team(i);		
		race = team.getRace();
		
		if race == "human":    
			#scroll.setBackgroundColor(tangoBlueLight);
			background.setImage("/gui/standard/human_playerlist_background.s2g");			
		elif race == "beast":
			#scroll.setBackgroundColor(tangoRedLight);
			background.setImage("/gui/standard/beast_playerlist_background.s2g");
			
		background.setSizePct(boxWidth,boxHeight);
        
	#3. set the UI for other teams invisible
	for i in range( sv_numteams, 5):
			lobby.buttons[i].setVisible(False);
			lobby.scrolls[i].setVisible(False);
			lobby.backgrounds[i].setVisible(False);
Esempio n. 2
0
    def newPreset(self, name):
        filteredname = ""
        for char in name:
            filteredname += char if Preset.PRESET_NAME_FILTER.match(
                char) else "_"
        name = filteredname
        file = File_Open("/presets/" + name + ".prs", "w")
        File_Write(file, "name:" + name + "\r\n")

        player = savage.getLocalPlayer()
        unit = player.getType().getName()
        race = savage.Team(player.getTeam()).getRace()

        File_Write(file, "race:" + race + "\r\n")
        File_Write(file, "unit:" + unit + "\r\n")

        for i in range(5):  #well, modders won't like this
            slot_objType = player.getInventorySlot(i)
            ammo = player.getAmmoSlot(i)
            name = slot_objType.getName() if slot_objType != None else ""
            File_Write(file,
                       str(i) + ":" + name)
            if ammo != None:
                quantity = int(
                    math.ceil(ammo / slot_objType.getValue("ammoStart")))
            else:
                quantity = 1
            File_Write(file, ":" + str(quantity) + "\r\n")

        File_Close(file)

        self.reloadPresets()
Esempio n. 3
0
    def onEvent(self, e):
        if isinstance(e, NotifyEvent):
            con_println("notice! " + str(e) + "\n")

        elif e.eventType == "research_complete":
            objtype = savage.ObjectType(e.objtype)
            obj = savage.getGameObject(e.sourceId)
            team = savage.Team(obj.getTeam())
            if objtype.isBuildingType():
                if objtype.getName() == "beast_sublair":
                    Sound_PlaySound(
                        savage.getSound("beast_sublair_constructed"))
                elif objtype.getName() == "human_garrison":
                    Sound_PlaySound(
                        savage.getSound("human_garrison_constructed"))
                else:
                    Sound_PlaySound(
                        savage.getSound(team.getRace() + "_new_building"))

            elif objtype.isWeaponType():
                Sound_PlaySound(savage.getSound(team.getRace() +
                                                "_new_weapon"))
            elif objtype.isItemType():
                Sound_PlaySound(savage.getSound(team.getRace() + "_new_item"))
            elif objtype.isUnitType() and not objtype.isWorkerType():
                Sound_PlaySound(savage.getSound(team.getRace() + "_new_unit"))
Esempio n. 4
0
def updateWinData(team_wins):
	#team_wins: a list of integers. The ith entry is the number of times team i has won this map. For example: [0, 100, 100];
	caption = "";
	for i in (1,2):
		team = savage.Team(i);
		caption += team.getNameColorCode() + team.getRace() + ": " + team_wins[i] + "\n";
	caption += "Total: " + str(sum(team_wins));
	endgame.windata.setCaption(caption);
Esempio n. 5
0
	def areTechRequirementsMet(self):
		#so here is the hard part!
		team = savage.Team(savage.getLocalPlayer().getTeam());
		
		builderAvailable = False;
		
		value = self.objtype.getValue("builder1");
		if value != "":
			reqtype = savage.getObjectType(value);
			for builder in team.getBuildings():
				if builder.getType() == reqtype and not builder.isBeingBuilt():
					builderAvailable = True;
					break;
				elif builder.getType() == self.objtype or self.objtype.getValue("selfBuild") == 1:
					builderAvailable = True;
					break;
		if self.objtype.getValue("selfBuild") == 1:
			builderAvailable = True;
					
		if value == "human_worker" or value == "beast_worker":
			builderAvailable = True;
		
		if builderAvailable == False:
			value = self.objtype.getValue("builder2");
			if value != "":
				reqtype = savage.getObjectType(value);
				for builder in team.getBuildings():
					if builder.getType() == reqtype and not builder.isBeingBuilt():
						builderAvailable = True;
						break;
						
		reqbasepoints = self.objtype.getValue("needBasePoints");		
		basepoints = team.getCommandCenter().getType().getValue("basePointValue");		

		if basepoints < reqbasepoints:
			builderAvailable = False;
					
		if builderAvailable == False:
			return False;	
		
		teamObjects = team.getAvailableTech();
		for b in ("requirement1","requirement2"):
			value = self.objtype.getValue(b);
			if value != "":
				reqtype = savage.getObjectType(value);
				if reqtype not in teamObjects:
					return False;
				else:
					if reqtype.isBuildingType():
						builderAvailable = False;
						for builder in team.getBuildings():
							if builder.getType() == reqtype and not builder.isBeingBuilt():
								builderAvailable = True;
								break;
		
		#does this cover everything?
		return builderAvailable;
Esempio n. 6
0
	def areResourceRequirementsMet(self):	
		team = savage.Team(savage.getLocalPlayer().getTeam());
		teamRes = team.getResources(); #a dictionary of integers
		
		#yarr be entering stubby code now laddie! only for the brave! acch! Get me some haggis!
		for key, value in teamRes.items():
			cost = self.objtype.getCost(key);
			if cost > value and value != -1:
				#for a human team, entropy is -1
				#which is probably a silly idea, in hindsight should be 0 :P
				return False;	
		return True;
Esempio n. 7
0
def onShow():
	commcontexts.buildContextsIfNeeded();
	commhud.contextmenu.setVisible(False);
	commhud.contextmenu.close();
	
	commhud.resourcesPanel.resetDiffCounters();
	commhud.resourcesPanel.update();
	commhud.chatBox.deactivate();
	commhud.minimap.setMap(cvar_get("world_overhead"));
	commhud.unitinfowindow.buildUnitInfo(savage.Team( savage.getLocalPlayer().getTeam() ));	
	commhud.researchWindow.onTeamChange();
	commhud.scoreboard.arrange();
	commhud.scoreboard.update(); #remove the placeholders in scoreboard
Esempio n. 8
0
    def __init__(self, who, what, p):

        self.playerId = who
        self.parameter = p
        self.reqtype = what

        self.player = savage.getGameObject(who)
        team = savage.Team(self.player.getTeam())
        objtype = savage.getObjectType(p)

        prio = self.PRIORITY if not self.player.isOfficer(
        ) else self.PRIORITY + 10
        CommAlert.__init__(self, prio, self.RATE, "")

        self.text.setX(self.pic.getWidth() + 2)

        self.pos = self.player.getPosition()

        self.approvebtn = DefaultImageButton()
        self.approvebtn.setImage("yestr.s2g")
        self.approvebtn.setId("approve")
        self.approvebtn.setSize(32, 32)
        self.approvebtn.addActionListener(self)
        self.content.add(self.approvebtn,
                         self.content.getWidth() - 70, "center")

        self.denybtn = DefaultImageButton()
        self.denybtn.setImage("canceltr.s2g")
        self.denybtn.setId("deny")
        self.denybtn.setSize(32, 32)
        self.denybtn.addActionListener(self)
        self.content.add(self.denybtn,
                         self.content.getWidth() - 35, "center")

        self.btn.setSize(
            self.content.getWidth() -
            (self.content.getWidth() - self.approvebtn.getX()),
            self.content.getHeight())

        self.text.setCaption(self.player.getName())

        if what == "request_powerup":
            self.pic.setImage(objtype.getValue("icon") + ".s2g")
        elif what == "request_gold":
            self.pic.setImage("/gui/game/images/gold_icon.s2g")
        elif what == "request_promote":
            self.pic.setImage("/models/" + team.getRace() +
                              "/items/icons/officer1.tga")
        self.pic.setSize(self.content.getHeight(), self.content.getHeight())
Esempio n. 9
0
def ResearchSimple(typename):
	objtype = savage.getObjectType(typename);

	team = savage.Team(savage.getLocalPlayer().getTeam());

	value = objtype.getValue("builder1");
	if value != "":
		candidates = team.getObjectsByType(value);
		con_println("candidates:"+str(len(candidates))+"\n");
		if len(candidates) == 0:
			return False;
		else:
			#TODO: base this on which building will be available first
			builder = candidates[int(M_Randnum(0, len(candidates)))];
			gblQueue.addResearch(savage.ResearchItem(objtype.typeId, builder.objectId, 0,0));
Esempio n. 10
0
    def __init__(self):
        glass.GlassWindow.__init__(self, "Units")
        self.setMovable(False)
        self.setFocusable(False)
        self.setTitleVisible(False)
        self.setTitleBarHeight(0)
        self.setBackgroundColor(transparency)
        self.widgets = []

        self.table = DefaultTable()
        self.add(self.table)
        self.table.setPosition(0, 0)
        self.table.makeBlank()
        self.table.autoAdjust = False

        self.team = savage.Team(0)
Esempio n. 11
0
    def getTooltipFor(self, objtype):
        #TODO this generates the tooltips, but when do we need to set them? In frame?
        """General format
		
		<icon> <name> (possible coloured by tech type)
		<gold> <gold cost> <stone> <stone cost>
		<one line description>
		Requires:
			- <Requisite 1>
			- <Requisite 2>
		Colour them green if they're met, red if they're not met and yellow if they're being researched/will be met soon
		"""

        team = savage.Team(savage.getLocalPlayer().getTeam())

        tooltip = "^icon " + objtype.getValue(
            "icon") + "^ " + objtype.getValue("description") + "\n"
        tooltip += "^w^icon ../../gui/standard/icons/gold/gold_icon^^y" + str(
            objtype.getValue("goldCost"))
        tooltip += " ^w^icon ../../gui/standard/icons/redstone^^900" + str(
            objtype.getValue("stoneCost")) + "\n"
        tooltip += "^w" + objtype.getValue("tooltip") + "\n"
        tooltip += "Requires:\n"

        for requirement in ("builder1", "builder2", "requirement1",
                            "requirement2"):
            value = objtype.getValue(requirement)
            if value == "":
                continue

            notMet = True
            inProgress = False

            if requirement.startwith("builder"):
                notMet = not team.hasBuilding(value)
                #TODO
                inProgress = notMet and team.isBuilding(value)
                #TODO
            elif requirement.startswith("requirement"):
                currentResearch = [ot.getName() for ot in team.getResearch()]
                inProgress = value in currentResearch
                notMet = not team.isResearched(value)

            color = "^y" if inProgress else "^r" if notMet else "^g"
            tooltip += color + " - " + value + "\n"
        return tooltip
Esempio n. 12
0
    def build(self):
        for teamList in self.teamContainerList:
            teamList.build()
            if len(self.teamContainerList) < 3:
                teamList.scrollTeamsArrow.setVisible(False)

        self.specList.erase()
        for player in savage.Team(0).getPlayers():
            self.specList.nextRow(player.getFormattedName())
        try:
            self.specList.setColumnWidth(0,
                                         self.specWindow.getWidth() - 10)
            self.specList.adjustWidthTo(self.specWindow.getWidth() - 10)
        except ZeroDivisionError:
            con_println(
                "ZeroDivisionError: Trying to call adjustWidthTo() on an empty table!\n"
            )
Esempio n. 13
0
    def update(self, mgr, loc):
        w, h = self.status_icon.getWidth(), self.status_icon.getHeight()

        self.status_icon.setImage("/gui/standard/icons/timer.s2g")
        if self.action is None or self.action.is_done():  #researching
            research = savage.Team(
                savage.getLocalPlayer().getTeam()).getResearch()
            matchitems = [i for i in research if i == self.item]
            del research[:]
            first = mgr.findResearchPosition(self.item)
            if len(matchitems) == 1 and first >= loc:
                self.bar.setBackgroundColor(transparency)
                self.bar.setForegroundColor(tangoGreen)
                self.bar.setProgress(matchitems[0].percentComplete)
                self.item.percentComplete = matchitems[0].percentComplete
                self.status_icon.setImage("/gui/standard/comm/build_order.png")
            elif len(matchitems) > 1:
                raise Exception("Failure of Space-Time!")
                #throw an exception this should never happen...

        elif self.item.areTechRequirementsMet() == False:
            self.bar.setBackgroundColor(tangoRed)
            self.bar.setBaseColor(tangoRedDark)
            self.status_icon.setTooltip("Tech")
            self.status_icon.setImage("/gui/standard/icons/alert_warning.png")

        elif self.item.areResourceRequirementsMet() == False:  #still in queue
            self.bar.setBackgroundColor(tangoRed)
            self.bar.setBaseColor(tangoRedDark)
            self.status_icon.setTooltip("Resources")
            self.status_icon.setImage("/gui/standard/icons/redstone.png")

        #elif status == "resource":
        #	self.bar.setAlignment(glass.Graphics.CENTER);
        #	self.bar.setBackgroundColor(tangoGrey3);
        #	self.bar.setBaseColor(tangoGrey4);
        #	self.status.setImage( "Pile of gold and redstone here.s2g" );

        elif self.action is not None:  #still in queue
            self.bar.setBackgroundColor(transparency)
            self.bar.setBaseColor(transparency)
            self.status_icon.setImage("/gui/standard/icons/alert_timer.s2g")

        self.status_icon.setSize(w, h)
Esempio n. 14
0
	def update(self):
		w,h = self.status_icon.getWidth(), self.status_icon.getHeight();
		
		if self.action == None or self.action.areReqsMet(): #researching
			research=savage.Team(savage.getLocalPlayer().getTeam()).getResearch();
			matchitems = [i for i in research if i == self.item];
			del research[:];
			if len(matchitems) == 1:
				self.bar.setBackgroundColor(transparency);
				self.bar.setForegroundColor(tangoGreen);
				self.bar.setProgress(matchitems[0].percentComplete);
				self.item.percentComplete = matchitems[0].percentComplete;
			elif len(matchitems) > 1:
				raise Exception("Failure of Space-Time!"); #throw an exception this should never happen...
			
			self.status_icon.setImage("/gui/standard/icons/alert_gear.png");

		elif self.item.areTechRequirementsMet() == False:
			self.bar.setBackgroundColor(tangoRed);
			self.bar.setBaseColor(tangoRedDark);
			self.status_icon.setTooltip("Tech");
			self.status_icon.setImage( "/gui/standard/icons/alert_warning.png" );
			
		elif self.item.areResourceRequirementsMet() == False: #still in queue
			self.bar.setBackgroundColor(tangoRed);
			self.bar.setBaseColor(tangoRedDark);
			self.status_icon.setTooltip("Resources");
			self.status_icon.setImage( "/gui/standard/icons/alert_warning.png" );

		#elif status == "resource":
		#	self.bar.setAlignment(glass.Graphics.CENTER);
		#	self.bar.setBackgroundColor(tangoGrey3);
		#	self.bar.setBaseColor(tangoGrey4);
		#	self.status.setImage( "Pile of gold and redstone here.s2g" );

		elif self.action != None: #still in queue
			self.bar.setBackgroundColor(transparency);
			self.bar.setBaseColor(transparency);
			self.status_icon.setImage("/gui/standard/icons/alert_timer.s2g");

		self.status_icon.setSize( w,h );
Esempio n. 15
0
    def reloadPresets(self):
        self.dict = OrderedDict()
        paths = File_ListFiles("/presets", "*.prs", 0)
        for path in paths:
            preset = Preset(path)
            self.dict[preset.name] = preset

        #POSSIBLY NEEDED sort the ordered dictionary by key alphabetically

        self.dropdown.clear()
        teamNo = savage.getLocalPlayer().getTeam()
        raceName = savage.Team(teamNo).getRace()
        availablePresets = [
            preset for preset in self.dict.values() if preset.race == raceName
        ]
        self.dropdown.addOption("None", self.EMPTY_PRESET_NAME)
        self.dropdown.setSelectedValue("None")
        #select the EMPTY_PRESET option for consistency
        for preset in availablePresets:
            self.dropdown.addOption(preset.name, preset.name)
            self.window.dropdown.addOption(preset.name, preset.name)
Esempio n. 16
0
    def update(self):
        # Update the resources
        player = savage.getLocalPlayer()
        if player.isCommander() or cvar_getvalue("gui_showTeamStatus") == 1:
            self.setVisible(True)
        else:
            self.setVisible(False)
            return

        myteam = savage.getLocalPlayer().getTeam()
        team = savage.Team(myteam)
        resources = team.getResources()
        race = team.getRace()

        working, total, max = team.getWorkerInfo()
        workerinfo = str(working) + "/" + str(total)
        self.teamGold.setCaption(
            "^icon ../../gui/standard/icons/gold/gold_icon^ " +
            str(resources["gold"]))
        self.stoneCounter.setCaption(
            "^icon ../../gui/standard/icons/redstone^ " +
            str(resources["stone"]))
        self.workerCounter.setCaption(
            "^icon ../../gui/standard/comm/build_order^ " + str(workerinfo))

        if race == "beast":
            self.res1Counter.setCaption(
                "^icon ../../gui/standard/icons/entropy^ " +
                str(resources["entropy"]))
            self.res1Counter.setForegroundColor(tangoGreenLight)
            self.res2Counter.setCaption(
                "^icon ../../gui/standard/icons/strata^ " +
                str(resources["strata"]))
            self.res2Counter.setForegroundColor(tangoBlueLight)
            self.res3Counter.setCaption(
                "^icon ../../gui/standard/icons/fire^ " +
                str(resources["fire"]))
            self.res3Counter.setForegroundColor(tangoRedLight)
        elif race == "human":
            self.res1Counter.setCaption(
                "^icon ../../gui/standard/icons/magnetic^ " +
                str(resources["magnetic"]))
            self.res1Counter.setForegroundColor(tangoRedLight)
            self.res2Counter.setCaption(
                "^icon ../../gui/standard/icons/electric^ " +
                str(resources["electric"]))
            self.res2Counter.setForegroundColor(tangoBlueLight)
            self.res3Counter.setCaption(
                "^icon ../../gui/standard/icons/chemical^ " +
                str(resources["chemical"]))
            self.res3Counter.setForegroundColor(tangoGreenLight)

        currentTime = Host_Milliseconds()

        if currentTime > (self.lastTime + 10000):
            self.lastTime = currentTime
            self.resetDiffCounters()
            dGold = sum(self.trackGold)
            dStone = sum(self.trackStone)
            dlen = len(self.trackGold)
            self.goldIncome.setCaption(("%.2f" % (dGold / dlen)) + "/m")
            self.stoneIncome.setCaption(("%.2f" % (dStone / dlen)) + "/m")

        cc = team.getCommandCenter()
        k = cc.getHealthPct()

        hue = (k - 0.1) / 2.7 if k > 0.1 else 0

        self.healthForeground.setWidth(
            int(k * self.healthBackground.getWidth()))
        self.healthForeground.setBackgroundColor(tools.HSLColor(
            hue, 0.8, 0.66))
        w, h = self.cc.getWidth(), self.cc.getHeight()
        self.cc.setImage(cc.getType().getValue("mapIcon"))
        self.cc.setSize(w, h)
Esempio n. 17
0
    spechud.scoreboard.update()
    #remove the placeholders in scoreboard
    spechud.crosshair.reset()
    spechud.researchinfowindow1.rebuildResearchable(spechud.team1)
    spechud.researchinfowindow2.rebuildResearchable(spechud.team2)
    spechud.unitinfowindow1.buildUnitInfo(spechud.team1)
    spechud.unitinfowindow2.buildUnitInfo(spechud.team2)

    spechud.frame()
    #remove any other placeholders


glass.GUI_CreateScreen('spechud')

## Defining both teams here as they should not change
team1 = savage.Team(1)
team2 = savage.Team(2)

#starting from the gold to the right of the minimap and proceeding anti clockwise

## MAP and surrounding things ##

minimap = glass.GlassMiniMap()
minimap.setPositionPct(0, 0.025)
minimap.setX(10)
minimap.setSize(int(0.208 * screenHeight), int(0.208 * screenHeight))
#same number of pixels so it's square
#well assuming the pixel aspect ratio is 1:1
glass.GUI_ScreenAddWidget("spechud", minimap)

player_money = glass.GlassLabel("_ABCDE ")
Esempio n. 18
0
    def __init__(self):
        DefaultWindow.__init__(self)

        self.setSize(1000, 700)
        self.setPosition(screenWidthPct(.5) - 500,
                         screenHeightPct(.5) - 350)
        self.setFrameStyle("TrimmedEight")
        self.setBackgroundColor(glass.Color(40, 20, 20))

        # todo: check how many teams the map/server supports!
        totalTeamList = [savage.Team(1), savage.Team(2)]

        self.teamContainerList = []

        self.currentTeam = 1
        #0,1,2,3,4 ...

        dotString = ""
        for team in totalTeamList:
            teamList = TeamList(team, "left", int(self.getWidth() * 0.45),
                                int(self.getHeight() * 0.7))
            self.add(teamList)
            teamList.setY(int(self.getHeight() * 0.0714))
            self.teamContainerList.append(teamList)
            dotString += " 0 "

        # TODO: Use images and a container!
        self.dots = DefaultLabel(dotString)
        self.add(self.dots,
                 self.getWidth() // 2 - self.dots.getWidth() // 2,
                 int(self.getHeight() * 0.73))

        self.switchTeams("left")

        # Spec button
        self.specButton = DefaultButton("Spectators")
        self.add(self.specButton,
                 self.getWidth() // 2 - self.specButton.getWidth() // 2, 10)
        self.specButton.addActionListener(self)

        # Spec Window:
        self.specWindow = DefaultWindow()
        self.specWindow.setBackgroundColor(glass.Color(70, 20, 20))
        self.add(self.specWindow)
        self.specWindow.setSizePct(0.15, 0.4)
        self.specWindow.setPosition(
            self.getWidth() // 2 - self.specWindow.getWidth() // 2,
            self.specButton.getY() + self.specButton.getHeight() + 10)
        self.specWindow.setVisible(False)

        joinSpec = DefaultButton("Enlist now")
        joinSpec.setWidth(self.specWindow.getWidth())
        joinSpec.setClickAction(
            "CL_RequestTeam(0);spechud.setMode('hud');setMouseMode(MOUSE_RECENTER)"
        )
        self.specWindow.add(
            joinSpec,
            self.specWindow.getWidth() // 2 - joinSpec.getWidth() // 2, 0)

        #F**k lists, they're buggy if you don't put them in their own container:

        specListContainer = DefaultContainer()
        specListContainer.setSize(
            self.specWindow.getWidth(),
            self.specWindow.getHeight() - joinSpec.getHeight() - 5)
        self.specWindow.add(specListContainer, 0,
                            joinSpec.getHeight() + 5)

        self.specList = DefaultTableList()
        self.specList.setSelectionColor(glass.Color(70, 40, 40, 180))
        specListContainer.add(self.specList)

        specScroll = glass.GlassScrollArea(self.specList)
        specScroll.setBackgroundColor(transparency)
        specScroll.setHorizontalScrollPolicy(glass.GlassScrollArea.SHOW_NEVER)
        specListContainer.add(specScroll, 0, 0)
        specScroll.setSize(specListContainer.getWidth(),
                           specListContainer.getHeight())

        # Move in/out animation?

        # Chatbox

        chatContainer = DefaultContainer()
        self.add(chatContainer)
        chatContainer.setPositionPct(0.25, 0.78)
        chatContainer.setSizePct(0.5, 0.2)
        chatContainer.setBackgroundColor(glass.Color(0, 0, 0, 128))

        self.chatBox = HUDChatBox()
        chatContainer.add(self.chatBox)
        self.chatBox.setSizePct(1, 1)
        self.chatBox.resize()
        self.chatBox.alwaysShowInput(True)
        self.chatBox.inputType.setVisible(False)
        self.chatBox.buffer.setVisible(False)
        self.chatBox.historyBuffer.parentScroll.setVisible(True)
        self.chatBox.historyBuffer.parentScroll.setAutoscroll(True)
        # TODO: Fix auto scroll

        # Leave button
        leave = DefaultButton("<< Menu")
        leave.setClickAction("GUI_ShowScreen('mainmenu')")
        self.add(leave)
        leave.setPositionPct(0.1, 0.9)

        # Play button, only shown if you're on a team
        self.play = DefaultButton("Play >>")
        self.play.addActionListener(self)
        self.add(self.play)
        self.play.setPosition(
            int(self.getWidth() * 0.9) - self.play.getWidth(),
            int(self.getHeight() * 0.9))
Esempio n. 19
0
 def onTeamChange(self):
     #TODO call this on show, or on some team-changing game event
     self.teamObj = savage.Team(savage.getLocalPlayer().getTeam())
     self.rebuild()
Esempio n. 20
0
from silverback import *
import glass
import savage
import commcontexts

glass.GUI_CreateScreen('commhud')

# windows and widgets are essentially the same but will seperate just incase we need them seperate in the future
windowStack = {}
widgetStack = {}
selection = CommSelection()
gblEventHandler.addGameListener(selection)

team = savage.Team(1)

initialized = False


def onShow():
    GUI_ShowCursor("crosshair")
    commcontexts.buildContextsIfNeeded()
    commhud.toolBox.onShow()
    commhud.contextmenu.setVisible(False)
    commhud.contextmenu.close()

    commhud.resourcesPanel.onShow()
    commhud.resourcesPanel.update()
    commhud.buffPool.rebuild()

    commhud.miniMap.rebuild()