当前位置: 首页>>代码示例>>Python>>正文


Python Configuration.configure方法代码示例

本文整理汇总了Python中configuration.Configuration.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.configure方法的具体用法?Python Configuration.configure怎么用?Python Configuration.configure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configuration.Configuration的用法示例。


在下文中一共展示了Configuration.configure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runGP

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import configure [as 别名]
def runGP(xmlConfig=None,configClass=None):
    c = Configuration(configClass=configClass,configXml="config.xml")
    c.configure()
    p = Populator(configuration=c)
    p.populate()
    return p
开发者ID:MrJew,项目名称:darwin,代码行数:8,代码来源:runner.py

示例2: __init__

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import configure [as 别名]
class Level:
  def __init__(self, name, game, player_start, player_direction, board, enemies, powerups):
    self.stats = LevelStats()
    self.load_screen = LoadScreen(self)
    self.stats_screen = StatsScreen(self)
    self.name = name
    self.game = game

    self.player_start = player_start
    self.player_direction = player_direction
    self.board = board

    self.powerups = Group(powerups)

    self.shields = Group()

    self.powerup_particles = Group()
    self.trail_particles = Group()

    self.player_tanks = Group()
    self.player_turrets = Group()

    self.player = Tank(self.player_start, self.player_direction)
    self.player_tanks.add(self.player)
    self.player_turret = Turret(self.player)
    self.player_turrets.add(self.player_turret)
    self.player_controllers = [PlayerController(self.player, self.player_turret)]

    self.enemies = Group()
    self.enemy_turrets = Group()
    self.enemy_ai = []
    self.enemy_turret_ai = []
    for (p, d, waypoint_type, waypoints) in enemies:
      enemy = Tank(p, d, constants.ENEMY_TANK_COLOR)
      self.enemy_ai.append(TankAI(enemy, self, waypoints, waypoint_type))
      enemy_turret = Turret(enemy)
      self.enemies.add(enemy)
      self.enemy_turrets.add(enemy_turret)
      self.enemy_turret_ai.append(TurretAI(enemy_turret, self))

    self.tiles = Group()
    for tile in self.board:
      self.tiles.add(tile)
    self.solid = Group()
    self.non_solid = Group()
    for tile in self.tiles:
      if tile.solid:
        self.solid.add(tile)
      else:
        self.non_solid.add(tile)
    self.bullets = Group()
    self.shockwaves = Group()
    self.explosions = Group()
    self.mines = Group()
    self.old_status = LEVEL_ONGOING
    self.text = None

    self.timers = []

    if self.game.settings['debug']:
      self.load_time = constants.DEBUG_LEVEL_LOAD_TIME
    else:
      self.load_time = constants.LEVEL_LOAD_TIME
    self.victory = False
    self.cooldown = -1

    self.paused = False

    self.action_processor = ActionProcessor(self)
    self.update_processor = UpdateProcessor(self)
    self.collision_processor = CollisionProcessor(self)
    self.expiration_processor = ExpirationProcessor(self)
    self.action_post_processor = ActionPostProcessor(self, self.action_processor)
    self.particle_processor = ParticleProcessor(self)
    self.sound_processor = SoundProcessor(self)

    self.config = Configuration(self)
    self.config.configure()

  def play_sound(self, name, volume=1.0):
    self.game.register_event(PlaySoundEvent(self, name, volume))

  def get_part(self):
    if self.load_time > 0:
      return LEVEL_INTRO
    if self.cooldown >= 0:
      return LEVEL_OUTRO
    return LEVEL_MAIN

  def get_status(self):
    if not self.enemies:
      return LEVEL_BEATEN
    if self.player.dead:
      return LEVEL_LOST
    return LEVEL_ONGOING

  def is_finished(self):
    return self.get_part() is LEVEL_OUTRO

  def update_timers(self, delta):
#.........这里部分代码省略.........
开发者ID:jasharpe,项目名称:tanks,代码行数:103,代码来源:level.py


注:本文中的configuration.Configuration.configure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。