feat: 新增清除数据按钮
This commit is contained in:
@@ -333,6 +333,20 @@ init python:
|
|||||||
persistent.gallery_seen = set()
|
persistent.gallery_seen = set()
|
||||||
persistent.gallery_seen.add(photo_id)
|
persistent.gallery_seen.add(photo_id)
|
||||||
|
|
||||||
|
def has_any_new_gallery_photo():
|
||||||
|
for photo in GALLERY_PHOTOS:
|
||||||
|
if is_gallery_photo_unlocked(photo) and is_photo_new(photo["id"]):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def clear_all_game_data():
|
||||||
|
"""清除所有存档和持久化数据,然后重启游戏。"""
|
||||||
|
for slot, _, _, _ in renpy.list_saved_games(regexp=r'.+'):
|
||||||
|
renpy.unlink_save(slot)
|
||||||
|
persistent._clear(progress=True)
|
||||||
|
renpy.save_persistent()
|
||||||
|
renpy.full_restart()
|
||||||
|
|
||||||
style window is default
|
style window is default
|
||||||
style say_label is default
|
style say_label is default
|
||||||
style say_dialogue is default
|
style say_dialogue is default
|
||||||
@@ -518,16 +532,36 @@ screen hud_overlay():
|
|||||||
tooltip "游戏菜单"
|
tooltip "游戏菜单"
|
||||||
|
|
||||||
## 右上角画廊/日期图标(1920 - 96 - 40 = 1784)
|
## 右上角画廊/日期图标(1920 - 96 - 40 = 1784)
|
||||||
vbox:
|
fixed:
|
||||||
xpos 1784
|
xpos 1784
|
||||||
ypos 40
|
ypos 40
|
||||||
|
xysize (96, 96)
|
||||||
|
|
||||||
imagebutton:
|
button:
|
||||||
idle create_gallery_page_idle(96)
|
xfill True
|
||||||
hover create_gallery_page_hover(96)
|
yfill True
|
||||||
|
background create_gallery_page_idle(96)
|
||||||
|
hover_background create_gallery_page_hover(96)
|
||||||
action ToggleScreen("gallery_panel")
|
action ToggleScreen("gallery_panel")
|
||||||
tooltip "画廊 / 日期"
|
tooltip "画廊 / 日期"
|
||||||
|
|
||||||
|
if has_any_new_gallery_photo():
|
||||||
|
frame:
|
||||||
|
xanchor 1.0
|
||||||
|
xpos 96
|
||||||
|
yanchor 0.0
|
||||||
|
ypos 0
|
||||||
|
xysize (36, 20)
|
||||||
|
background "#e03030"
|
||||||
|
padding (3, 2, 3, 2)
|
||||||
|
|
||||||
|
text "NEW":
|
||||||
|
xalign 0.5
|
||||||
|
yalign 0.5
|
||||||
|
color "#ffffff"
|
||||||
|
size 13
|
||||||
|
bold True
|
||||||
|
|
||||||
## 移动端 - 稍大的图标,更易点击
|
## 移动端 - 稍大的图标,更易点击
|
||||||
elif renpy.variant("touch") or renpy.variant("small"):
|
elif renpy.variant("touch") or renpy.variant("small"):
|
||||||
vbox:
|
vbox:
|
||||||
@@ -542,15 +576,34 @@ screen hud_overlay():
|
|||||||
xysize (120, 120)
|
xysize (120, 120)
|
||||||
|
|
||||||
## 移动端右上角画廊/日期图标
|
## 移动端右上角画廊/日期图标
|
||||||
vbox:
|
fixed:
|
||||||
xpos 1730
|
xpos 1730
|
||||||
ypos 30
|
ypos 30
|
||||||
|
xysize (112, 112)
|
||||||
|
|
||||||
imagebutton:
|
button:
|
||||||
idle create_gallery_page_idle(112)
|
xfill True
|
||||||
hover create_gallery_page_hover(112)
|
yfill True
|
||||||
|
background create_gallery_page_idle(112)
|
||||||
|
hover_background create_gallery_page_hover(112)
|
||||||
action ToggleScreen("gallery_panel")
|
action ToggleScreen("gallery_panel")
|
||||||
xysize (120, 120)
|
|
||||||
|
if has_any_new_gallery_photo():
|
||||||
|
frame:
|
||||||
|
xanchor 1.0
|
||||||
|
xpos 112
|
||||||
|
yanchor 0.0
|
||||||
|
ypos 0
|
||||||
|
xysize (36, 20)
|
||||||
|
background "#e03030"
|
||||||
|
padding (3, 2, 3, 2)
|
||||||
|
|
||||||
|
text "NEW":
|
||||||
|
xalign 0.5
|
||||||
|
yalign 0.5
|
||||||
|
color "#ffffff"
|
||||||
|
size 13
|
||||||
|
bold True
|
||||||
|
|
||||||
|
|
||||||
## 注册HUD overlay为持久显示的屏幕
|
## 注册HUD overlay为持久显示的屏幕
|
||||||
@@ -592,7 +645,7 @@ screen gallery_panel():
|
|||||||
xfill True
|
xfill True
|
||||||
ysize 72
|
ysize 72
|
||||||
background None
|
background None
|
||||||
padding (24, 0, 24, 0)
|
padding (24, 0, 40, 0)
|
||||||
|
|
||||||
hbox:
|
hbox:
|
||||||
xfill True
|
xfill True
|
||||||
@@ -1422,6 +1475,23 @@ screen preferences():
|
|||||||
action Preference("all mute", "toggle")
|
action Preference("all mute", "toggle")
|
||||||
style "mute_all_button"
|
style "mute_all_button"
|
||||||
|
|
||||||
|
null height (4 * gui.pref_spacing)
|
||||||
|
|
||||||
|
hbox:
|
||||||
|
style_prefix "check"
|
||||||
|
box_wrap True
|
||||||
|
|
||||||
|
vbox:
|
||||||
|
label _("危险操作")
|
||||||
|
|
||||||
|
textbutton _("清除所有数据"):
|
||||||
|
action Confirm(
|
||||||
|
_("此操作将清除所有存档和游戏进度,且无法撤销。\n确定要继续吗?"),
|
||||||
|
yes=Function(clear_all_game_data),
|
||||||
|
no=Hide("confirm")
|
||||||
|
)
|
||||||
|
style "mute_all_button"
|
||||||
|
|
||||||
|
|
||||||
style pref_label is gui_label
|
style pref_label is gui_label
|
||||||
style pref_label_text is gui_label_text
|
style pref_label_text is gui_label_text
|
||||||
|
|||||||
Reference in New Issue
Block a user