本帖最后由 被诅咒的章鱼 于 2023-5-4 09:32 编辑
仅供参考:
[RenPy] 纯文本查看 复制代码 init python:
import time
class CheckinTimer:
def __init__(self, time_gap, **kwargs):
self.last_checkin_time = 0.0
self.has_checkin = False
self.time_gap = time_gap
def time_check(self):
if self.has_checkin:
current_time = time.time()
if (current_time - self.last_checkin_time) < self.time_gap:
return False
return True
def checkin_callback(self):
self.has_checkin = True
self.last_checkin_time = time.time()
renpy.notify("签到成功")
checkin_gap_time = 24 * 60 * 60
checkinInstance = CheckinTimer(checkin_gap_time)
screen checkin_screen():
frame:
textbutton "Checkin":
sensitive checkinInstance.time_check()
action Function(checkinInstance.checkin_callback)
xysize (200, 200)
at center
label main_menu:
return
label start:
call screen checkin_screen
"......"
return |