Files
game-cards/assets/转换.py
xiaji 8c81e0d14b feat: 添加出牌动画和牌型排序显示
- 修复 AI decide 方法参数类型为 Array[Card]
- 添加 cards_played 和 player_passed 信号
- 出牌时在桌面中央显示排序后的卡牌
- 过牌时清除桌面牌
- 添加延迟动画效果(0.8秒显示,0.5秒清除)
- 添加 TableLabel 作为出牌显示区域
- 出牌按 rank 排序显示

🤖 Generated with [Qoder][https://qoder.com]
2026-06-01 23:12:35 +08:00

32 lines
844 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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}")