1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[MODCOMP] Advisor Menu

Discussion in 'Civ4Col - Mods and Files' started by Dale, Oct 24, 2008.

  1. Dale

    Dale Chieftain

    Joined:
    Mar 14, 2002
    Messages:
    6,986
    With the ability to add our own advisors via python, it is easy to see how the UI will become very cluttered in the advisor bar. With the space to only add a couple of new advisor buttons, or move into the ilogical menu buttons (menu, pedia, etc) the matter of UI clutter becomes an issue.

    If we were to add the current new advisors such as Jeckels Trade Route advisor, Melinko's Finance Advisor, Dom Pedro II's Triangle Trade Advisor, and Melinko's Tech Advisor, we would overflow the advisor area on screen by two icons.

    This mod addresses that issue and resolves it cleanly, easily and logically. :)

    The Advisor Menu is a new segment of the UI dedicated to advisor buttons. One simple button (left-hand button where domestic advisor used to be) is used to turn the Advisor Menu on or off. This allows for the retention of a clean UI and the ability to access all of a mod's advisors fast and easily in one area on the screen.

    This is a very simple ModComp to implement (only affecting one python file, plus the single new text key) and simple to add new advisors to. Once you have your advisor working, simply add your advisor in two locations and presto, all the rest is taken care of. :)

    Location 1: Define the button in the menu
    Code:
    # Advisor menu START
    		if (ADVISOR_MENU_PANEL_UP):
    			iBtnX = (xResolution / 2) + (TOP_CENTER_HUD_WIDTH / 2) - (self.ADVISOR_BUTTON_SIZE / 3)
    			iBtnY = ((TOP_CENTER_HUD_HEIGHT - self.ADVISOR_BUTTON_SIZE) / 2) + self.ADVISOR_BUTTON_SIZE
    
    			screen.setImageButton("DomesticAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_DOMESTIC_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_DOMESTIC_SCREEN).getActionInfoIndex(), -1 )
    			screen.setImageShape("DomesticAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    			screen.setHitMargins("DomesticAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
    			self.appendtoHideState(screen, "DomesticAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
    			iBtnX += self.ADVISOR_BUTTON_SPACING
    
    			screen.setImageButton("RevolutionAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_REVOLUTION_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_REVOLUTION_SCREEN).getActionInfoIndex(), -1 )
    			screen.setImageShape("RevolutionAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    			screen.setHitMargins("RevolutionAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
    			self.appendtoHideState(screen, "RevolutionAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
    			iBtnX += self.ADVISOR_BUTTON_SPACING
    
    			screen.setImageButton("ForeignAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_FOREIGN_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_FOREIGN_SCREEN).getActionInfoIndex(), -1 )
    			screen.setImageShape("ForeignAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    			screen.setHitMargins("ForeignAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
    			self.appendtoHideState(screen, "ForeignAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
    			iBtnX += self.ADVISOR_BUTTON_SPACING
    
    			screen.setImageButton("MilitaryAdvisorButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_MILITARY_ADVISOR").getPath(), iBtnX, iBtnY, self.ADVISOR_BUTTON_SIZE, self.ADVISOR_BUTTON_SIZE, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_MILITARY_SCREEN).getActionInfoIndex(), -1 )
    			screen.setImageShape("MilitaryAdvisorButton", ImageShapes.IMAGE_SHAPE_ELLIPSE, -1)
    			screen.setHitMargins("MilitaryAdvisorButton", self.ADVISOR_BUTTON_SIZE / 6, self.ADVISOR_BUTTON_SIZE / 6)
    			self.appendtoHideState(screen, "MilitaryAdvisorButton", HIDE_TYPE_MAP, HIDE_LEVEL_HIDE)
    			iBtnX += self.ADVISOR_BUTTON_SPACING
    # Advisor menu END
    
    Location 2: Show/hide the button
    Code:
    # Advisor menu START
    			elif (inputClass.getButtonType() == WidgetTypes.WIDGET_GENERAL and inputClass.getData1() == ADVISOR_MENU_PANEL):
    				screen = CyGInterfaceScreen("MainInterface", CvScreenEnums.MAIN_INTERFACE )
                                    if (ADVISOR_MENU_PANEL_UP):
    					ADVISOR_MENU_PANEL_UP = False
    					screen.hide("DomesticAdvisorButton")
    					screen.hide("RevolutionAdvisorButton")
    					screen.hide("ForeignAdvisorButton")
    					screen.hide("MilitaryAdvisorButton")
    				else:
    					ADVISOR_MENU_PANEL_UP = True
    					screen.show("DomesticAdvisorButton")
    					screen.show("RevolutionAdvisorButton")
    					screen.show("ForeignAdvisorButton")
    					screen.show("MilitaryAdvisorButton")
    # Advisor menu END
    
    The attached screenshots show the menu on and off showing the simple ease of use this ModComp brings. I have also attached the ModComp.

    I hope this is useful. :)
     
  2. Melinko

    Melinko Reverend

    Joined:
    May 11, 2006
    Messages:
    131
    Location:
    Home
    Awesome ModComp and good idea, even good placement (On the X).. Although it is down a bit far. Other then that little bit it is very cool.:thumbsup:
     
  3. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    Nice Dale, glad to see you went with the second row idea, and nice addition with button to make them go away. However I don't like how far down the second row is.

    EDIT: Removed code blocks.
     
  4. Dale

    Dale Chieftain

    Joined:
    Mar 14, 2002
    Messages:
    6,986
    Cool! Even better. :)
     
  5. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    I was talking with Melinko and he mentioned that it would look better also if the second row of Advisor Buttons was offset one button space to the right. I tryed it and it looks pretty good as the Screen Shot shows.

    EDIT: Removed Screen Shot.
     
  6. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    I concur. It looks good offset.

    Great little modcomp, Dale!
     
  7. Dale

    Dale Chieftain

    Joined:
    Mar 14, 2002
    Messages:
    6,986
    I've updated the first post with a new screenshot showing the amendments, and also updated the zip file containing the code. :)
     

Share This Page