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


Python Clock.reset方法代码示例

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


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

示例1: __init__

# 需要导入模块: from clock import Clock [as 别名]
# 或者: from clock.Clock import reset [as 别名]
class Lane:
    def __init__(self, tree_type="sportsman", delay=0.5, start=None, lane="left",
                 computer=True, perfect=0.0, rollout=0.220, cmin=-0.009,
                 cmax=0.115, surface=None, background=None):
        self.perfect = perfect
        self.rollout = rollout
        self.cmin = cmin
        self.cmax = cmax
        self.surface = surface
        self.rect = self.surface.get_rect()
        self.dirty_rects = []
        self.dirty = False
        self.tree_type = tree_type
        if tree_type == "sportsman":
            self.multiplier = 3
        elif tree_type == "pro":
            self.multiplier = 1
        self.state = None
        self.launched_time = None
        self.start_time = None
        self.foul = threading.Event()
        self.launched = threading.Event()
        self.pre_staged = threading.Event()
        self.staged = threading.Event()
        self.flashing = threading.Event()
        self.y1 = threading.Event()
        self.y2 = threading.Event()
        self.y3 = threading.Event()
        self.g = threading.Event()
        self.reaction = None
        self.dial_in = 0.0
        self.log = []
        self.computer = computer
        self.start = start
        self.delay = delay
        self.state = 0
        self.total_delay = self.delay * self.multiplier
        self.start_time = None
        self.clock_log = []
        clock_rect = pygame.Rect(
            0, self.rect.height - self.rect.height / 7.0,
            self.rect.width, self.rect.height / 7.0)
        clock_rect.bottom = self.rect.height
        self.clock = Clock(clock_rect)
        self.background = pygame.Surface(
            (self.rect.width, self.rect.height),
            flags=pygame.SRCALPHA)
        self.background.blit(
            background,
            (0, 0),
            area=(
                self.surface.get_offset(),
                (self.rect.width, self.rect.height)))
        self.surface.blit(self.background, (0, 0))
        self.lane = lane.lower()
        light_width = (self.rect.height / 7) - (self.rect.height / 35.0)
        self.lights = [
            Light(light_width, light_type='staging'),
            Light(light_width, light_type='staging'),
            Light(light_width, light_type='yellow'),
            Light(light_width, light_type='yellow'),
            Light(light_width, light_type='yellow'),
            Light(light_width, light_type='green'),
            Light(light_width, light_type='red')
        ]
        #if self.lane == "left":
        #    self.offset = int(round(self.rect.width * 0.49, 0))
        #else:
        self.offset = int(round(self.rect.height / 16.5, 0))
        total_offset = self.rect.height / 20.575
        counter = 0
        for light in self.lights:
            if self.lane == "right":
                light.rect.left = self.offset
            else:
                light.rect.right = self.rect.right - self.offset
            light.rect.top = int(round(total_offset, 0))
            if counter == 0:
                total_offset += light_width - (light_width / 11.0)
            elif counter == 1:
                total_offset +=  light_width / 2.25
            else:
                total_offset += (light_width / 10.0) + light_width
                #total_offset += (self.rect.height / 700.0) * 1.49

            counter += 1

    def reset(self):
        self.start_time = None
        self.launched_time = None
        self.foul.clear()
        self.flashing.clear()
        self.launched.clear()
        self.pre_staged.clear()
        self.staged.clear()
        self.y1.clear()
        self.y2.clear()
        self.y3.clear()
        self.g.clear()
        self.clock.reset()
#.........这里部分代码省略.........
开发者ID:daveisadork,项目名称:Racer,代码行数:103,代码来源:lane.py

示例2: reset

# 需要导入模块: from clock import Clock [as 别名]
# 或者: from clock.Clock import reset [as 别名]
def reset():
    sky_client.reset()
    res_manager.reset()
    Clock.reset()
    return True
开发者ID:Jason918,项目名称:self-web,代码行数:7,代码来源:res_pool.py


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