- 修复 AI decide 方法参数类型为 Array[Card] - 添加 cards_played 和 player_passed 信号 - 出牌时在桌面中央显示排序后的卡牌 - 过牌时清除桌面牌 - 添加延迟动画效果(0.8秒显示,0.5秒清除) - 添加 TableLabel 作为出牌显示区域 - 出牌按 rank 排序显示 🤖 Generated with [Qoder][https://qoder.com]
32 lines
844 B
Python
32 lines
844 B
Python
import os
|
||
import shutil
|
||
|
||
# 花色映射
|
||
suit_map = {
|
||
"spade": "S",
|
||
"heart": "H",
|
||
"club": "C",
|
||
"diamond": "D"
|
||
}
|
||
|
||
# 创建cards文件夹,不存在就新建
|
||
target_dir = "cards"
|
||
if not os.path.exists(target_dir):
|
||
os.mkdir(target_dir)
|
||
|
||
# 遍历当前目录所有文件
|
||
for fname in os.listdir("."):
|
||
# 只处理png文件,格式:花色-数字/字母.png
|
||
if fname.endswith(".png") and "-" in fname:
|
||
name_no_ext = fname[:-4]
|
||
suit_name, rank = name_no_ext.split("-", maxsplit=1)
|
||
if suit_name not in suit_map:
|
||
continue
|
||
|
||
# 新文件名:点数+花色缩写.png
|
||
new_name = f"{rank}{suit_map[suit_name]}.png"
|
||
new_path = os.path.join(target_dir, new_name)
|
||
|
||
# 移动并重命名
|
||
shutil.move(fname, new_path)
|
||
print(f"{fname} → {new_path}") |