def cr_sysctrl_sync_timing(self): msg = AtomSysctrl.mk_sync_timing(False) self.pub_state(WORLD_STATES.TIME_CURRENT, '', msg) # 发送proto2兼容数据 msg2 = AtomSysctrl2.mk_sync_timing(False) self.pub_state(WORLD_STATES.TIME_CURRENT_PROTO2, '', msg2) return True
def cr_sysctrl_sync_timing_countdown(self, countdown_seconds=0): """ 存入倒计时 :param countdown_seconds: int 型,倒计时剩余秒数 :return: """ msg = AtomSysctrl.mk_sync_timing(True, countdown_seconds * 1000) saved_state = {"MOMENT": time.time(), "SECONDS": countdown_seconds} self.pub_state(WORLD_STATES.TIME_SECONDS_COUNTDOWN, saved_state, msg) # 发送proto2兼容数据 msg2 = AtomSysctrl2.mk_sync_timing(False) self.pub_state(WORLD_STATES.TIME_SECONDS_COUNTDOWN_PROTO2, saved_state, msg2) return True
def restore_current(self): msg = AtomSysctrl.mk_sync_timing(False) return self.pub_state(WORLD_STATES.TIME_CURRENT, '', msg)
def restore_countdown(self, saved_state): message = AtomSysctrl.mk_sync_timing(True, saved_state['SECONDS'] * 1000) self.pub_state(WORLD_STATES.TIME_SECONDS_COUNTDOWN, saved_state, message)