from PyQt5.QtWidgets import QMessageBox
from tool import data, mytool
from view.init_game import Init
from ctrl.mythread import LoadThread, TimeThread
# 开始游戏
def start_game(w: Init):
w.game.start_game.setEnabled(False)
LoadThread(w.game).start()
# 时间模式开始游戏
def start_time_game(w: Init):
w.time_game.start_game.setEnabled(False)
LoadThread(w.time_game).start()
TimeThread(w.time_game).start()
# 重新开始游戏
def restart_game(w: Init):
key = QMessageBox.information(w.game, "提示", "是否重新开始游戏", QMessageBox.Yes | QMessageBox.No)
if key == QMessageBox.Yes:
data.load_over = 0
w.game.restart.setEnabled(False)
# 重置
w.game.step = 30
w.game.score = 0
w.game.grade = data.grade[0]
# 初始化前台列表
mytool.init_front(w.game.front_list)
w.game.update()
# 构建后台列表
mytool.init_back(w.game.back_list)
LoadThread(w.game).start()
# 步数模式进入下一关刷新页面
def refresh(w: Init):
data.load_over = 0
w.game.restart.setEnabled(False)
# 重置
w.game.step = 30
w.game.score = 0
w.game.grade = data.grade[0]
# 初始化前台列表
mytool.init_front(w.game.front_list)
w.game.update()
# 构建后台列表
mytool.init_back(w.game.back_list)
LoadThread(w.game).start()
# 时间模式进入下一关刷新页面
def time_refresh(w: Init):
data.load_over = 0
w.time_game.restart.setEnabled(False)
data.Time = 100
w.time_game.score = 0
w.time_game.grade = data.grade[0]
# 初始化前台列表
mytool.init_front(w.time_game.front_list)
w.time_game.update()
# 构建后台列表
mytool.init_back(w.time_game.back_list)
LoadThread(w.time_game).start()
# 时间模式重新开始游戏
def time_restart_game(w: Init):
key = QMessageBox.information(w.game, "提示", "是否重新开始游戏", QMessageBox.Yes | QMessageBox.No)
if key == QMessageBox.Yes:
data.load_over = 0
w.time_game.restart.setEnabled(False)
data.Time = 100
w.time_game.score = 0
w.time_game.grade = data.grade[0]
# 初始化前台列表
mytool.init_front(w.time_game.front_list)
w.time_game.update()
# 构建后台列表
mytool.init_back(w.time_game.back_list)
LoadThread(w.time_game).start()
TimeThread(w.time_game).start()
# 步数模式退出游戏
def over_game(w: Init):
key = QMessageBox.information(w.game, "提示", "是否退出游戏", QMessageBox.Yes | QMessageBox.No)
if key == QMessageBox.Yes:
w.game.hide()
w.show()
# w.game.start_game.setEnabled(True)
# 时间模式退出游戏
def time_over_game(w: Init):
key = QMessageBox.information(w.time_game, "提示", "是否退出游戏", QMessageBox.Yes | QMessageBox.No)
if key == QMessageBox.Yes:
w.time_game.hide()
w.show()
# 操作说明
def intro_game(w: Init):
QMessageBox.information(w, "操作说明", "交换元素,若相同的元素相连且大于三个即消除")
# 关于
def about(w: Init):
QMessageBox.information(w, "关于", "此游戏由xx团队开发\n公司:xx有限公司\n版本:2.0")
# 步数模式--用户自定义
def step_defined(w: Init):
w.game.defined.show()
# 时间模式--用户自定义
def time_defined(w: Init):
w.time_game.defined.show()
# 步数模式初级模式
def step_simple(w: Init):
w.game.level = 1
data.load_over = 0
w.game.restart.setEnabled(False)
# 重置
w.game.step = 30
w.game.score = 0
w.game.goal_score = 100
w.game.grade = data.grade[0]
# 初始化前台列表
mytool.init_front(w.game.front_list)
w.game.update()
# 构建后台列表
mytool.init_back(w.game.back_list)
LoadThread(w.game).start()
# 步数模式中级模式
def step_common(w: Init):
w.game.level = 2
data.load_over = 0
w.game.restart.setEnabled(False)
# 重置
w.game.step = 25
w.game.score = 0
w.game.goal_score = 300
w.game.grade = data.grade[1]
# 初始化前台列表
mytool.init_front(w.game.front_list)
w.game.update()
# 构建后台列表
mytool.init_back(w.game.back_list)
LoadThread(w.game).start()
# 步数模式高级模式
def step_difficult(w: Init):
w.game.level = 3
data.load_over = 0
w.game.restart.setEnabled(False)
# 重置
w.game.step = 20
w.game.score = 0
w.game.goal_score = 500
w.game.grade = data.grade[2]
# 初始化前台列表
mytool.init_front(w.game.front_list)
w.game.update()
# 构建后台列表
mytool.init_back(w.game.back_list)
LoadThread(w.game).start()
# 时间模式初级模式
def time_simple(w: Init):
w.time_game.level = 1
data.load_over = 0
w.time_game.restart.setEnabled(False)
data.Time = 100
w.time_game.score = 0
w.time_game.goal_score = 100
w.time_game.grade = data.grade[0]
# 初始化前台列表
mytool.init_front(w.time_game.front_list)
w.time_game.update()
# 构建后台列表
mytool.init_back(w.time_game.back_list)
LoadThread(w.time_game).start()
TimeThread(w.time_game).start()
# 时间模式中级模式
def time_common(w: Init):
w.time_game.level = 2
data.load_over = 0
w.time_game.restart.setEnabled(False)
data.Time = 80
w.time_game.score = 0
w.time_game.goal_score = 300
w.time_game.grade = data.grade[1]
# 初始化前台列表
mytool.init_front(w.time_game.front_list)
w.time_game.update()
# 构建后台列表
mytool.init_back(w.time_game.back_list)
LoadThread(w.time_game).start()
TimeThread(w.time_game).start()
# 时间模式高级模式
def time_difficult(w: Init):
w.time_game.level = 3
data.load_over = 0
w.time_game.restart.setEnabled(False)
data.Time = 50
w.time_game.score = 0
w.time_game.goal_score = 500
w.time_game.grade = data.grade[2]
# 初始化前台列表
mytool.init_front(w.time_game.front_list)
w.time_game.update()
# 构建后台列表
mytool.init_back(w.time_game.back_list)
LoadThread(w.time_game).start()
TimeThread(w.time_game).start()
# 步数模式--自定义窗口里的确认按钮
def step_certain(w: Init):
# 获取初始步数
step_num = w.game.defined.step_line.text().strip()
# 获取目标分数
goal_score_num = w.game.defined.goal_score.text().strip()
if len(step_num) != 0 and int(step_num) <= 0:
QMessageBox.information(w.time_game.defined, "提示", "请输入正确的时间")
elif len(goal_score_num) != 0 and int(goal_score_num) <= 0:
QMessageBox.information(w.time_game.defined, "提示", "请输入正确的分数")
elif len(step_num) != 0 and len(goal_score_num) == 0:
w.game.defined.hide()
w.game.step = int(step_num)
w.game.score = 0
w.game.defined.step_line.clear()
elif len(step_num) == 0 and len(goal_score_num) != 0:
w.game.defined.hide()
w.game.goal_score = int(goal_score_num)
w.game.score = 0
w.game.defined.goal_score.clear()
elif len(step_num) == 0 and len(goal_score_num) == 0:
w.game.defined.hide()
else:
w.game.defined.hide()
w.game.step = int(step_num)
w.game.goal_score = int(goal_score_num)
w.game.score = 0
w.game.defined.step_line.clear()
w.game.defined.goal_score.clear()
# 时间模式--自定义窗口里的确定按钮
def time_certain(w: Init):
# 获取设定的时间
time_num = w.time_game.defined.time.text().strip()
# 获取目标�
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
python游戏 消消乐.zip (63个子文件)
happyremove
ctrl
__init__.py 0B
play_menu_ctrl.py 13KB
pass_all_level.py 1KB
mythread.py 4KB
__pycache__
pass_all_level.cpython-38.pyc 2KB
init_btn_ctrl.cpython-38.pyc 1KB
mythread.cpython-38.pyc 4KB
play_menu_ctrl.cpython-38.pyc 11KB
__init__.cpython-38.pyc 128B
next_level.cpython-38.pyc 2KB
init_btn_ctrl.py 830B
next_level.py 2KB
tool
__init__.py 0B
mytool.py 5KB
data.py 561B
__pycache__
data.cpython-38.pyc 466B
mytool.cpython-38.pyc 4KB
__init__.cpython-38.pyc 128B
resource
music
remove.mp3 18KB
bg_music.mp3 682KB
unbelievable.mp3 22KB
excellent.mp3 16KB
img
bg2.png 582KB
10.png 54KB
9.png 66KB
3.png 36KB
12.png 58KB
bg4.png 64KB
1.png 48KB
11.png 70KB
bg3.png 438KB
13.png 73KB
6.png 126KB
bg.png 108KB
5.png 60KB
4.png 104KB
8.png 57KB
7.png 77KB
2.png 35KB
bin
test.exe 38.53MB
view
__init__.py 0B
intro_game.py 685B
pass_all_level.py 789B
time_defined_myself.py 4KB
step_defined_myself.py 4KB
fail.py 3KB
success.py 689B
time_play_game.py 7KB
init_game.py 2KB
__pycache__
step_defined_myself.cpython-38.pyc 3KB
fail.cpython-38.pyc 2KB
time_defined_myself.cpython-38.pyc 3KB
pass_all_level.cpython-38.pyc 1KB
init_game.cpython-38.pyc 2KB
success.cpython-38.pyc 1KB
time_play_game.cpython-38.pyc 4KB
__init__.cpython-38.pyc 128B
step_play_game.cpython-38.pyc 4KB
step_play_game.py 7KB
model
__init__.py 0B
animal.py 748B
__pycache__
__init__.cpython-38.pyc 129B
animal.cpython-38.pyc 983B
共 63 条
- 1
资源评论
乐韬科技
- 粉丝: 20
- 资源: 107
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于 SpringCloud 和 Vue3 的OA系统
- 软考高级项目管理师-项目采购管理思维导图
- WordsVector (1).ipynb
- yolov7 车牌检测 车牌识别 中文车牌识别 检测 支持双层车牌 支持12种中文车牌
- 20240429_112025.m4a
- "麦嘟学编程"似乎是一个与编程学习相关的品牌或社区名称,它可能是一个在线教育平台、博客、论坛或社交媒体群组等,旨在帮助人们学习编
- OpenCV(Open Source Computer Vision Library)是一个开源的计算机视觉和机器学习软件库,由
- Redis入门基础篇+源码(springboot、maven)
- ChatGPT-4是由OpenAI开发的人工智能模型,是GPT(Generative Pre-trained Transform
- 91fdd461elb59a4ce8dfcfc46bc283a7.msi
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功