Beispiel #1
0
def app():

    g.clear()

    signal.signal(signal.SIGINT, signal_handler)

    color.tilte(f'~~ 欢迎来到{u.name} ~~', header=False, time=0.1)

    # 读取角色
    loading()
    g.player = Character()
    start()
Beispiel #2
0
def sendkey(message='请输入:'):
    while True:
        g.clear()
        current()
        print()
        text = input(color.sendkey(message)).strip()
        if text:
            if text.lower() == 'where':
                print()
                current(_map=False)
                color.next('\n按回车继续')
            elif text.lower() == 'status':
                color.info('\n# 角色当前状态如下:\n')
                g.player.show(_map=False)
                color.next('\n按回车继续')
            elif text.lower() == 'help':
                print()
                for msg in u.help:
                    color.info(msg)
                color.next('\n按回车继续')
            elif text.lower() == 'exit':
                y = confirm()
                if y:
                    g.player.exit()
            elif text.lower() == 'author':
                color.caption('\n' + u.author)
                color.next(' ')
            elif text.lower() == 'version':
                color.caption('\n' + u.version)
                color.next(' ')
            elif text.lower() == 'name':
                color.caption('\n' + g.player.data['name'])
                color.next(' ')
            elif text.lower() == 'rename':
                y = confirm()
                if y:
                    print()
                    name = input(color.rename('请输入新的用户名: '))
                    g.player.rename(name)

                color.info('\n当前用户名: ', end=False)
                color.caption(f' {g.player.data["name"]}')
                color.next(' ')
            elif text.lower() == 'delete':
                y = confirm()
                if y:
                    g.player.delete()
                else:
                    print()
            else:
                break
    return text
Beispiel #3
0
    def exit(self):
        g.clear()
        self.show(_map=False)

        color.tilte('~~ 即将退出游戏,欢迎下次光临 ~~', time=0.1)
        exit(0)