4ad62c3193
Signed-off-by: 楼湘缘 <2216918339@qq.com>
62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
# coding==utf-8
|
|
|
|
|
|
from rich.live import Live
|
|
from rich.text import Text
|
|
import time
|
|
import random
|
|
|
|
def get_vibrant_color():
|
|
"""
|
|
返回一个鲜艳、高对比度的 RGB 颜色 (r, g, b)
|
|
策略:每次随机选一个主色通道拉满(255),其他两个随机但不低于 80
|
|
"""
|
|
r = g = b = 0
|
|
# 随机选择哪个通道是主色(红/绿/蓝/黄/品红/青)
|
|
choice = random.randint(0, 5)
|
|
if choice == 0: # 红为主
|
|
r, g, b = 255, random.randint(80, 200), random.randint(80, 200)
|
|
elif choice == 1: # 绿为主
|
|
r, g, b = random.randint(80, 200), 255, random.randint(80, 200)
|
|
elif choice == 2: # 蓝为主
|
|
r, g, b = random.randint(80, 200), random.randint(80, 200), 255
|
|
elif choice == 3: # 黄(红+绿)
|
|
r, g, b = 255, 255, random.randint(0, 100)
|
|
elif choice == 4: # 品红(红+蓝)
|
|
r, g, b = 255, random.randint(0, 100), 255
|
|
else: # 青(绿+蓝)
|
|
r, g, b = random.randint(0, 100), 255, 255
|
|
return f"rgb({r},{g},{b})"
|
|
|
|
# ===== 配置参数 =====
|
|
ROUNDS = 5 # 总共跑 5 轮(可改)
|
|
STEPS = 60 # 每轮 60 步(避免太长)
|
|
SLEEP_STEP = 0.15 # 每步停 0.15 秒(慢速加载)
|
|
SLEEP_FULL = 0.6 # 满格后停顿 0.6 秒(强调完成)
|
|
|
|
spinner = ["|", "/", "-", "\\"]
|
|
|
|
with Live(refresh_per_second=10) as live:
|
|
for round_num in range(1, ROUNDS + 1):
|
|
# 正常加载过程
|
|
for i in range(STEPS + 1):
|
|
spin = spinner[i % 4]
|
|
bar = "█" * i
|
|
style = f"bold {get_vibrant_color()}"
|
|
text = Text(f"{spin} INTP 加载中... [ {bar.ljust(STEPS)} ] (第 {round_num}/{ROUNDS} 轮)", style=style)
|
|
live.update(text)
|
|
time.sleep(SLEEP_STEP)
|
|
|
|
# === 满格后爆闪一次 ===
|
|
flash_style = "bold rgb(255,255,255) on rgb(255,0,100)" # 白字 + 粉红背景(强烈闪光)
|
|
flash_text = Text(f"✓ 第 {round_num} 轮加载完成!".center(50), style=flash_style)
|
|
live.update(flash_text)
|
|
time.sleep(SLEEP_FULL)
|
|
|
|
print("\n🎉 所有轮次加载完毕!")
|
|
input("按回车退出...")
|
|
|
|
# 只有直接运行 main.py 时才启动 GUI
|
|
if __name__ == "__main__":
|
|
run_gui()
|