Пример #1
0
	def __init__(self):
		super(DotMapLayer, self).__init__(DOTMAP_LAYER)
		global g_DotMap
		g_DotMap = self
		# constants
		self.CITY_SAVE_ID = "CityDataDict"
		self.HIGHLIGHT_CROSS_LAYER = 8
		self.FIRST_CROSS_LAYER = 9
		self.NUM_CROSS_LAYERS = len(ColorUtil.getColorKeys())
		self.DOT_LAYER = PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_NUMPAD_HELP
		self.NO_DOT_STYLE = PlotStyles.PLOT_STYLE_NONE
		self.MAX_DOT_STYLE = PlotStyles.PLOT_STYLE_WAVES
		self.BFC_OFFSETS = []
		for x in range(-2, 3):
			for y in range(-2, 3):
				if abs(x) != 2 or abs(y) != 2:
					self.BFC_OFFSETS.append((x, y))
		# default options
		self.CROSS_ALPHA = 50.0
		self.DOT_ALPHA = 50.0
		self.HIGHLIGHT_CROSS_ALPHA = 100.0
		self.HIGHLIGHT_DOT_ALPHA = 100.0
		self.DRAW_DOTS = True
		self.DOT_STYLE = PlotStyles.PLOT_STYLE_DOT_TARGET
		self.readOptions()
		# state
		self.highlightedCity = None
Пример #2
0
	def __init__(self, screenID):
		self.screenID = screenID
		self.SCREEN_NAME = "DotMapOverlayScreen"
		#---------------------------------------------------------------------------
		# Panel IDS
		#---------------------------------------------------------------------------
		self.PREFIX = "DotMapOverlay"
		self.COLOR_PANEL_ID = self.PREFIX + "ColorPanel"
		#---------------------------------------------------------------------------
		# Main Panel Coordinates
		#---------------------------------------------------------------------------
		self.PANEL_MARGIN = 15
		self.TITLE_HEIGHT = 16
		self.TEXT_HEIGHT = 16
		self.TEXT_SPACING = 5
		self.PANEL_SPACING = 5
		self.Z_TEXT = -0.3
		self.Z_CONTROL = -0.3
		#---------------------------------------------------------------------------
		# Color Values
		#---------------------------------------------------------------------------
		self.COLOR_KEYS = ColorUtil.getColorKeys()
		self.COLOR_TEXT = ColorUtil.getColorDisplayNames()
		#---------------------------------------------------------------------------
		# Color Panel Widgets
		#---------------------------------------------------------------------------
		self.COLOR_WIDGET_PREFIX = self.COLOR_PANEL_ID + "Widget"
		self.COLOR_WIDGET_IDS = []
		#---------------------------------------------------------------------------
		# Color Panel Coordinates
		#---------------------------------------------------------------------------
		self.COLOR_PANEL_HEADER_H = 15
		self.COLOR_PANEL_X = 10
		self.COLOR_PANEL_Y = 75 + self.PANEL_MARGIN * 2 + self.TITLE_HEIGHT * 2 + 2 * self.TEXT_HEIGHT + 3 * self.TEXT_SPACING + self.PANEL_SPACING
		self.COLOR_PANEL_TEXT_X = self.COLOR_PANEL_X + self.PANEL_MARGIN
		self.COLOR_PANEL_TEXT_Y = self.COLOR_PANEL_Y + self.PANEL_MARGIN
		self.COLOR_PANEL_W = 0
		self.COLOR_PANEL_H = len(self.COLOR_KEYS) * (self.TEXT_HEIGHT + self.TEXT_SPACING) + self.PANEL_MARGIN * 2
		#-------------------------------------------------------------------------------
		# Constants
		#-------------------------------------------------------------------------------
		self.HIGHLIGHT_CROSS_LAYER = 8
		self.FIRST_CROSS_LAYER = 9
		self.NUM_CROSS_LAYERS = len(self.COLOR_KEYS)
		self.PLOT_LAYER = PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_NUMPAD_HELP
		self.DOT_STYLE = PlotStyles.PLOT_STYLE_DOT_TARGET
		self.NO_DOT_STYLE = PlotStyles.PLOT_STYLE_NONE
		self.BFC_OFFSETS = []
		for x in range(-2, 3):
			for y in range(-2, 3):
				if abs(x) != 2 or abs(y) != 2:
					self.BFC_OFFSETS.append((x, y))
		#---------------------------------------------------------------------------
		# State variables
		#---------------------------------------------------------------------------
		self.currentColor = 0
		self.bLeftMouseDown = False
		self.bRightMouseDown = False
		self.bInitPos = False
		self.currentLayer = self.FIRST_CROSS_LAYER
		self.currentPoint = None
		#-------------------------------------------------------------------------------
		# Widget Input Mapping
		#-------------------------------------------------------------------------------
		self.inputMap = {
			self.COLOR_WIDGET_PREFIX : self.onColorButton,
		}