Пример #1
0
    def __init(self,
               name,
               color,
               clientid,
               difficulty_level,
               max_tier_notification,
               settlerlevel=0):
        assert isinstance(color, Color)
        assert isinstance(name, str) and name
        try:
            self.name = str(name)
        except UnicodeDecodeError:
            # WORKAROUND: this line should be the only unicode conversion here.
            # however, if unicode() gets a parameter, it will fail if the string is already unicode.
            self.name = str(name, errors='ignore')
        self.color = color
        self.clientid = clientid
        self.difficulty = DifficultySettings.get_settings(difficulty_level)
        self.max_tier_notification = max_tier_notification
        self.settler_level = settlerlevel
        self._stats = None
        assert self.color.is_default_color, "Player color has to be a default color"

        if self.regular_player:
            SettlerUpdate.subscribe(self.notify_settler_reached_level)
Пример #2
0
	def __init(self, name, color, clientid, difficulty_level, settlerlevel=0):
		assert isinstance(color, Color)
		assert isinstance(name, basestring) and name
		try:
			self.name = unicode(name)
		except UnicodeDecodeError:
			# WORKAROUND: this line should be the only unicode conversion here.
			# however, if unicode() gets a parameter, it will fail if the string is already unicode.
			self.name = unicode(name, errors='ignore')
		self.color = color
		self.clientid = clientid
		self.difficulty = DifficultySettings.get_settings(difficulty_level)
		self.settler_level = settlerlevel
		self.stats = None
		assert self.color.is_default_color, "Player color has to be a default color"

		SettlerUpdate.subscribe(self.notify_settler_reached_level)
		NewDisaster.subscribe(self.notify_new_disaster, sender=self)