2 Commits

Author SHA1 Message Date
acbce20e18 Merge remote dev: 保留本地最新版本
远程为旧版,冲突文件(script.rpy / screens.rpy / Chapter1.rpy)均以本地版本为准。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 03:47:23 +08:00
4e305599f2 Initial commit: XinLanDiary dev0.0.7
添加 HUD 画廊/日期面板:右上角页面图标按钮,点击弹出叠层显示当前游戏内日期(Day 1 = 2029年9月3日)。
修复 renpy.pygame.draw.rect 不支持 border_radius 的兼容性问题。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 03:44:59 +08:00
3 changed files with 279 additions and 2 deletions

View File

@@ -3,8 +3,11 @@
label Chapter1_Scene1:
$ game_day = 1
$ game_period = "morning"
scene bg classroom featryt with fade
system_ "【Day 1·上午·七班教室】"
me "{cps=25}九月的风还带着夏末的燥热,那道斜切过窗台的阳光,在黑板上画出一道明晃晃的线。\n就像我的人生被分成了两半——线的那头是重点班线的这头是我。"
me "这道光就这么直直地切过来,像是在提醒我,你就在这儿,也只能在这儿了。\n曾经唾手可得如今遥不可及。"
@@ -37,6 +40,7 @@ label Chapter1_Scene1:
show xingyu laughing big
xingyu "{cps=5}哈哈哈哈哈{cps=15}\n真是一对苦命鸳鸯"
$ game_period = "after_school"
stop music fadeout 1.0
play sound "audio/AfterClassRing.ogg" noloop
queue sound "audio/MainMenu.ogg" fadein 1.0
@@ -63,7 +67,10 @@ label Chapter1_Scene1:
hide ryt with dissolve
pause 0.8
# 草稿原文:「教室里人快走空时,手机震动了」——切回空教室背景
scene bg classroom wide afterschool with dissolve
lzx "画廊更新了,有惊喜。友情提示:这次可能会火。"
me "……“任懿涛观察日志?”"
@@ -85,9 +92,11 @@ label Chapter1_Scene1:
jump Chapter1_Scene2
label Chapter1_Scene2:
$ game_day = 2
$ game_period = "morning"
scene bg classroom morning featryt with fade
play music "audio/XinLanDiary-Part1.ogg" fadein 2
#system_ "【第二天早上】"
system_ "【Day 2·早自习前·七班教室】"
me "第二天早上,一切都不一样了。"
me "刚踏进七班,就感觉空气里有种微妙的兴奋。"
@@ -151,6 +160,7 @@ label Chapter1_Scene2:
label Chapter1_Scene3:
# —— 视角A苏雨桐·学生会会议室 ——
$ game_period = "afternoon"
scene bg meetingroom meeting with fade
"{cps=20}【同日下午·学生会会议室】" # system_ "【同日下午·学生会会议室】"
@@ -227,6 +237,7 @@ label Chapter1_Scene3:
jump Chapter1_Scene4
label Chapter1_Scene4:
$ game_period = "after_school"
play music "audio/MainMenu.ogg" fadein 2.0
scene bg classroom wide afterschool with fade
"{cps=20}【同日放学后·七班教室】" # system_ "【同日放学后·七班教室】"
@@ -317,6 +328,7 @@ label Chapter1_Scene4:
pause 0.5
# 便利店
$ game_period = "evening"
play music "audio/XinLanDiary-Part2.ogg" fadein 2.0
scene bg convenience store with fade
system_ "【傍晚17:25·校门外便利店】"
@@ -371,6 +383,7 @@ label Chapter1_Scene4:
pause 0.5
# 双视角结尾
$ game_period = "night"
scene bg black with fade
system_ "【同夜·城市另一头】"

View File

@@ -136,6 +136,149 @@ screen say(who, what):
init python:
config.character_id_prefixes.append('namebox')
## 齿轮图标 Displayable 类
import math
import pygame
class GearDisplayable(renpy.Displayable):
"""
创建一个现代简洁风格的齿轮图标 Displayable
参数:
- size: 图标大小(像素)
- color: 齿轮颜色(十六进制)
- alpha: 透明度 (0.0-1.0)
"""
def __init__(self, size=48, color="#FFFFFF", alpha=0.85):
super(GearDisplayable, self).__init__()
self.size = size
self.color = color
self.alpha = alpha
def render(self, width, height, st, at):
# 创建渲染对象
render = renpy.Render(self.size, self.size)
# 创建surface
surface = pygame.Surface((self.size, self.size), pygame.SRCALPHA)
# 解析颜色
color_rgb = tuple(int(self.color.lstrip('#')[i:i+2], 16) for i in (0, 2, 4))
color_with_alpha = color_rgb + (int(self.alpha * 255),)
center = self.size // 2
outer_radius = self.size // 2 - 4 # 外圈半径
inner_radius = int(outer_radius * 0.4) # 内圆半径
tooth_height = int(outer_radius * 0.25) # 齿高
num_teeth = 8 # 齿数
# 绘制齿轮路径点
points = []
for i in range(num_teeth * 2):
angle = (i * 360 / (num_teeth * 2)) * math.pi / 180
if i % 2 == 0: # 齿尖
radius = outer_radius
else: # 齿根
radius = outer_radius - tooth_height
x = center + int(radius * math.cos(angle))
y = center + int(radius * math.sin(angle))
points.append((x, y))
# 绘制齿轮外圈
pygame.draw.polygon(surface, color_with_alpha, points, 0)
# 绘制内圆(镂空效果)
pygame.draw.circle(surface, (0, 0, 0, 0), (center, center), inner_radius)
# 绘制中心圆(增强设计感)
center_circle_radius = int(inner_radius * 0.5)
pygame.draw.circle(surface, color_with_alpha, (center, center), center_circle_radius, 0)
# 将surface绘制到render
render.blit(surface, (0, 0))
return render
def create_settings_gear_hover(size=96):
"""创建hover状态的齿轮更亮"""
return GearDisplayable(size=size, color="#FFFFFF", alpha=1.0)
def create_settings_gear_idle(size=96):
"""创建idle状态的齿轮"""
return GearDisplayable(size=size, color="#FFFFFF", alpha=0.9)
## 圆形画廊/日期图标 Displayable 类
class PageDisplayable(renpy.Displayable):
"""圆形画廊图标:白圆 + 深色纸张 + 白色线条"""
def __init__(self, size=48, alpha=0.85):
super(PageDisplayable, self).__init__()
self.size = size
self.alpha = alpha
def render(self, width, height, st, at):
size = self.size
a = int(self.alpha * 255)
surface = pygame.Surface((size, size), pygame.SRCALPHA)
center = size // 2
radius = size // 2 - 4
# 白色圆形背景
pygame.draw.circle(surface, (255, 255, 255, a), (center, center), radius)
# 深色纸张(圆角矩形,手动实现以兼容 renpy.pygame
pw = int(radius * 0.78)
ph = int(radius * 1.05)
px = center - pw // 2
py = center - ph // 2
paper_color = (32, 42, 68, min(a + 30, 255))
cr = 4 # 圆角半径
pygame.draw.rect(surface, paper_color, (px + cr, py, pw - 2 * cr, ph))
pygame.draw.rect(surface, paper_color, (px, py + cr, pw, ph - 2 * cr))
pygame.draw.circle(surface, paper_color, (px + cr, py + cr), cr)
pygame.draw.circle(surface, paper_color, (px + pw - cr, py + cr), cr)
pygame.draw.circle(surface, paper_color, (px + cr, py + ph - cr), cr)
pygame.draw.circle(surface, paper_color, (px + pw - cr, py + ph - cr), cr)
# 三条白色横线
lc = (210, 225, 245, int(self.alpha * 210))
lx0 = px + int(pw * 0.16)
lx1 = px + int(pw * 0.84)
for i in range(3):
ly = py + int(ph * 0.28) + i * int(ph * 0.22)
pygame.draw.line(surface, lc, (lx0, ly), (lx1, ly), max(2, size // 48))
render = renpy.Render(size, size)
render.blit(surface, (0, 0))
return render
def visit(self):
return []
def create_gallery_page_idle(size=96):
return PageDisplayable(size=size, alpha=0.85)
def create_gallery_page_hover(size=96):
return PageDisplayable(size=size, alpha=1.0)
## 游戏内日期字符串函数
import datetime as _dt
def get_game_date_str():
"""根据 game_day 和 game_period 返回完整游戏内日期字符串"""
base = _dt.date(store.game_start_year, store.game_start_month, store.game_start_day)
current = base + _dt.timedelta(days=store.game_day - 1)
period_map = {
"morning": "上午",
"afternoon": "下午",
"after_school": "放学后",
"evening": "傍晚",
"night": "深夜",
}
period_text = period_map.get(store.game_period, "")
return "{}年{}月{}日 {}".format(current.year, current.month, current.day, period_text)
style window is default
style say_label is default
style say_dialogue is default
@@ -295,6 +438,118 @@ style quick_button_text:
properties gui.text_properties("quick_button")
################################################################################
## HUD Overlay - 游戏内浮动图标
################################################################################
## 该屏幕在游戏进行时显示在左上角,提供快速访问菜单的图标按钮
screen hud_overlay():
## 确保在所有UI之上
zorder 101
## 只在游戏进行时显示,不在主菜单显示
if not main_menu and not renpy.context()._menu:
## 桌面版 - 左上角齿轮图标
if renpy.variant("pc") or renpy.variant("web"):
vbox:
xpos 40
ypos 40
imagebutton:
idle create_settings_gear_idle(96)
hover create_settings_gear_hover(96)
action ShowMenu()
tooltip "游戏菜单"
## 右上角画廊/日期图标1920 - 96 - 40 = 1784
vbox:
xpos 1784
ypos 40
imagebutton:
idle create_gallery_page_idle(96)
hover create_gallery_page_hover(96)
action ToggleScreen("gallery_panel")
tooltip "画廊 / 日期"
## 移动端 - 稍大的图标,更易点击
elif renpy.variant("touch") or renpy.variant("small"):
vbox:
xpos 30
ypos 30
imagebutton:
idle create_settings_gear_idle(112)
hover create_settings_gear_hover(112)
action ShowMenu()
## 移动端增大点击区域
xysize (120, 120)
## 移动端右上角画廊/日期图标
vbox:
xpos 1730
ypos 30
imagebutton:
idle create_gallery_page_idle(112)
hover create_gallery_page_hover(112)
action ToggleScreen("gallery_panel")
xysize (120, 120)
## 注册HUD overlay为持久显示的屏幕
init python:
config.overlay_screens.append("hud_overlay")
################################################################################
## 画廊/日期面板
################################################################################
screen gallery_panel():
zorder 150
modal True
## 全屏半透明背景,点击关闭
button:
xfill True
yfill True
background "#00000077"
action Hide("gallery_panel")
## 主面板80% 屏幕1536×864
frame:
xalign 0.5
yalign 0.5
xysize (1536, 864)
background "#0d0f1eee"
padding (30, 20, 30, 20)
## 右上角:日期 + 关闭按钮
hbox:
xalign 1.0
yalign 0.0
spacing 24
text get_game_date_str():
color "#a8c8f0"
size 32
yalign 0.5
font "fonts/AlibabaPuHuiTi-3-55-Regular.ttf"
textbutton "×":
action Hide("gallery_panel")
text_size 36
text_color "#a8c8f0"
text_hover_color "#ffffff"
yalign 0.5
## ESC 键关闭
key "game_menu" action Hide("gallery_panel")
################################################################################
## 标题和游戏菜单屏幕
################################################################################

View File

@@ -72,6 +72,15 @@ default lzx_stats = {
"infoOpenness": 0, # 信息开放度
}
# ====== 时间系统变量 ======
default game_day = 1 # 游戏内日期(第几天)
default game_period = "morning"
# 可选值morning / afternoon / after_school / evening / night
default game_start_year = 2029
default game_start_month = 9
default game_start_day = 3 # Day 1 = 2029年9月3日开学周一
# ====== 可选:总字典管理(便于批量操作) ======
'''