Exemplo n.º 1
0
def win2(sets):
    box.msgbox('恭喜你突破了最高纪录' + '\n你的记录:' + str(sets.step) + '\n最高纪录:' +
               str(sets.best_step_n[0]))
    f = open('best_step_n.txt', 'w')
    f.write(str(sets.step) + '\n8')
    f.close()
    sets.get_mark()
Exemplo n.º 2
0
def check_win_n(sets):
    box.msgbox('你已死亡')
    if int(float(sets.best_step_n[1])) < sets.level:
        box.msgbox('恭喜你突破了最高纪录的等级')
        if sets.xh == '正常':
            f = open('best_step_n.txt', 'w')
        else:
            f = open('best_step.txt', 'w')
        f.write(str(sets.step) + '\n' + str(sets.level))
        f.close()

        sets.get_mark()
    elif int(float(sets.best_step_n[1])) == sets.level:
        if sets.step < int(sets.best_step_n[0]):
            box.msgbox('恭喜你突破了最高纪录的步数')
            if sets.xh == '正常':
                f = open('best_step_n.txt', 'w')
            else:
                f = open('best_step.txt', 'w')
            f.write(str(sets.step) + '\n' + str(sets.level))
            f.close()

            sets.get_mark()
        else:
            box.msgbox('很遗憾,您没有突破记录')
    else:
        box.msgbox('很遗憾,您没有突破记录')
Exemplo n.º 3
0
def check_dead_dmove(player, sets):
    color1, color2, color3, color4 = check_yjh(player.x, player.y, sets.screen)

    if player.brave == 1:
        if color1[0] == 254 \
                or color2[0] == 254 \
                or color3[0] == 254 \
                or color1[0] == 254:
            box.msgbox('你已死亡\n\n原因:触摸岩浆')
            player.reset(sets)
            sets.dead_time += 1
            if sets.dead_time % 2 == 0:
                sets.reset_maze()
Exemplo n.º 4
0
def dead_action(sets, player, because):
    if player.blood > 1:
        box.msgbox('扣一滴血,继续游戏')
        print(player.blood)
        player.brave = 0
        player.blood -= 1
        player.brave_time = -1000
    else:
        box.msgbox(f'你已死亡\n\n原因:{because}')
        player.x = 30
        player.y = 30
        player.move_time -= 1
        if player.move_time <= 0:
            player.move_time = 1
        sets.dead_time += 1
        if sets.dead_time % 2 == 0:
            sets.reset_maze()
Exemplo n.º 5
0
    def __init__(self):
        self.screen = pygame.display.set_mode([1300, 690])
        pygame.display.set_caption('迷宫挑战')
        surface = pygame.image.load('image/maze.jpg').convert_alpha()
        pygame.display.set_icon(surface)

        self.maze = mazeData.Maze()

        self.text = pygame.font.SysFont("C:/Windows/Fonts/STZHONGS.TTF", 60)

        self.step = 0
        self.maze_clear = False
        self.time = 120000
        self.dead_time = 0
        self.level = 1
        self.code = "asdfghjkl;'"

        box.msgbox('↑↓←→操控\n\n碰到红色块(岩浆)死亡回到起点,每过一关都会获得技能')

        s = """请选择模式:
    正常:共7关
    无尽:无限关"""

        self.xh = box.buttonbox(s, ['正常', '无尽'])
        if self.xh is None:
            self.xh = '正常'
        self.ds = box.ynbox('是否开启调试???')

        if self.ds:
            an = box.passwordbox('请输入调式密码')
            if an == self.code:
                box.msgbox('密码正确,开启调试')
                self.ds = True
            else:
                box.msgbox('密码错误,无法调试')
                self.ds = False

        if self.xh == '正常':
            f = open('best_step_n.txt', 'r')
        else:
            f = open('best_step.txt', 'r')

        self.best_step_n = f.readlines()
        f.close()

        self.best_step_n[0] = self.best_step_n[0].strip()
Exemplo n.º 6
0
def main():
    # pass
    import ybc_box as box
    print(box.msgbox(info('1.jpg'), '1.jpg'))
Exemplo n.º 7
0
from Login import Login
from Login import JsonSetting
import ybc_box as box

js_setting = JsonSetting('user_data.json')
login = Login(js_setting)
word = '欢迎进入迷宫游戏,请选择'
while True:
    dz_choice = box.buttonbox(word + '(按❌ / Cancel退出)', ['登录(请注意大小写)', '注册(不支持重复用户名)'])
    if dz_choice is None:
        box.msgbox('您已退出,回头见……!')
        exit()
    elif dz_choice == '登录(请注意大小写)':
        accepted, name, money = login.login()
        if accepted:
            box.msgbox('欢迎您,{0},点击🆗马上开始游戏'.format(name))
            player_name = name
            player_dollar = int(money)
            break
        else:
            word = '很抱歉,登录失败,请重试'
            continue
    else:
        if login.registered():
            word = '注册成功!!请登录进入游戏'
            continue
        else:
            word = '很抱歉,注册失败(可能重名了),请重试'
            continue
Exemplo n.º 8
0
import math
import ybc_box

while True:
    choose = input('选择语言/choose language(Chinese/English)')
    if ch == '中文':
        leg1 = ybc_box.enterbox('输入腿1的长度(不加单位):')
        leg2 = ybc_box.enterbox('输入腿2的长度(不加单位):')
        leg1 = int(leg1)
        leg2 = int(leg2)
        hypotenuse = (leg1**2 + leg2**2)**(1 / 2)
        #hypotenuse = math.floor(hypotenuse)
        hypotenuse = str(hypotenuse)
        ybc_box.msgbox('这个三角形的斜边是' + hypotenuse)
    if ch == 'English':
        leg1 = ybc_box.enterbox('Enter the length of leg 1 (without units):')
        leg2 = ybc_box.enterbox('Enter the length of leg 2 (without units):')
        leg1 = int(leg1)
        leg2 = int(leg2)
        hypotenuse = (leg1**2 + leg2**2)**(1 / 2)
        #hypotenuse = math.floor(hypotenuse)
        hypotenuse = str(hypotenuse)
        ybc_box.msgbox('The hypotenuse of this triangle is ' + hypotenuse)
    if ch == '退出/Exit' or ch == None:
        break
Exemplo n.º 9
0
#主循环
while True:
    # 使用for循环遍历当前事件列表
    for event in pygame.event.get():
        # 判断【事件类型】是不是【按下键盘事件】
        if event.type == pygame.KEYDOWN:
            # 判断【事件按键】是不是【上移键】
            if event.key == pygame.K_UP:
                color = screen.get_at([x, y - 30])
                if color[0] == 255 and color[1] == 255 and color[2] == 255:
                    y = y - 30
                    step += 1
                elif brave == 1:
                    if color[0] == 254:
                        y = y - 30
                        box.msgbox('你已死亡\n\n原因:触摸岩浆')
                        x = 30
                        y = 30
                        brave = 0
                        brave_time = 1
                        dead_time += 1
                        if dead_time % 2 == 0:
                            maze = mazeData.Maze()
            # 判断【事件按键】是不是【下移键】
            elif event.key == pygame.K_DOWN:
                color = screen.get_at([x, y + 30])
                if color[0] == 255 and color[1] == 255 and color[2] == 255:
                    y = y + 30
                    step += 1
                elif brave == 1:
                    if color[0] == 254:
Exemplo n.º 10
0
def no_win(sets):
    box.msgbox('恭喜你用了' + str(sets.step) + '\n你再少走一步就可以超过最高记录了')
Exemplo n.º 11
0
def lose(sets):
    box.msgbox('恭喜你用了' + str(sets.step) + '步来通关\n距离最高纪录还差' +
               str(sets.step - int(sets.best_step_n[0])))
Exemplo n.º 12
0
def win1(sets):
    box.msgbox('恭喜你突破了最高纪录')
    f = open('best_step_n.txt', 'w')
    f.write(str(sets.step) + '\n8')
    f.close()
    sets.get_mark()
Exemplo n.º 13
0
import random as ran
import os
import requests as req

sp.speak('''
胡展铭同学 精品
胡展铭同学的作业很认真哦,讲解视频有10分钟呢~现在老师就来批改一下你的作业吧

本节课主要学习了二维码这个第三方库的使用,分为生成二维码库(qrcode)和二维码解码库(qrdecode),依赖于Image库(可以通过安装pillow库的方式)。(几乎每天都要用到的东西已经被我们的同学掌握原理了)
''')
while True:
    op = box.buttonbox('请问您需要什么操作?', ['生成官网二维码', '二维码生成', '二维码识别', '退出'])
    if op == '退出':
        break
    elif op == '生成官网二维码':
        box.msgbox('正在生成,\n进度0%')
        url = 'https:\\www.yuanfudao.com'
        obj = qr.make(url)
        obj.show()
        obj.save('1.jpg')
        box.msgbox('正在生成,\n进度80%')
        box.msgbox('生成完毕')
    elif op == '二维码生成':
        ops = box.buttonbox('选择二维码类型', ['文本类', '网址类'])
        if ops == '文本类':
            box.msgbox('正在初始化,请稍等')
    elif op == '二维码识别':
        obj = dqr.decode('1.jpg')
        box.msgbox(obj)
Exemplo n.º 14
0
 # 检查是否到达终点
 if player.x == 1140 and player.y == 630:
     if sets.xh == '正常':
         if sets.level == 7:
             if float(sets.best_step_n[1]) <= 7:
                 gf.win1(sets)
             elif sets.step < int(sets.best_step_n[0]):
                 gf.win2(sets)
             elif sets.step > int(sets.best_step_n[0]):
                 gf.lose(sets)
             elif sets.step == int(sets.best_step_n[0]):
                 gf.no_win(sets)
             sets.reset_all(sets.xh, sets, dead)
     if sets.maze.treasure_number == 1:
         player.move_time = 2
         box.msgbox('获得技能:加速')
     elif sets.maze.treasure_number == 2:
         player.blood += 2
         box.msgbox('获得技能:加血')
     elif sets.maze.treasure_number == 6:
         player.brave = 0
         box.msgbox('获得技能:天之眷顾')
     elif sets.maze.treasure_number == 4:
         if box.ynbox('是否需要清空屏幕服务???'):
             sets.maze_clear = True
             box.msgbox('获得技能:清空全幕')
     elif sets.maze.treasure_number == 5:
         if sets.level != 6:
             if sets.xh == '正常':
                 sets.level = 6
                 box.msgbox('获得技能:直到最后一关!')