示例#1
0
def order_deal(flag='order', print_order=True):
    global __skip_flag__
    __skip_flag__ = False
    while True:
        time.sleep(0.01)
        while not IoInit._order_queue.empty():
            order = IoInit.getorder()
            if CacheContorl.flowContorl['quitGame']:
                os._exit(0)
                return
            if CacheContorl.flowContorl['restartGame'] == 1:
                CacheContorl.flowContorl['restartGame'] = 0
                reset_func()
                return
            if print_order == True and order != '':
                IoInit.print('\n' + order + '\n')

            if flag == 'str':
                return order

            if flag == 'console':
                # TODO add_console_method
                exec(order)

            if flag == 'order' and order.isdigit():
                if _cmd_valid(int(order)):
                    _cmd_deal(int(order))
                    return
                else:
                    global tail_deal_cmd_func
                    tail_deal_cmd_func(int(order))
                    return
示例#2
0
文件: EraPrint.py 项目: watry/dieloli
def p(string, style='standard'):
    barlist = TextLoading.getTextData(TextLoading.barConfigPath, 'barlist')
    styleList = RichText.setRichTextPrint(string, style)
    global last_char
    if len(string) > 0:
        last_char = string[-1:]
    string = RichText.removeRichCache(string)
    for i in range(0, len(string)):
        if styleList[i] in barlist:
            styledata = TextLoading.getTextData(TextLoading.barConfigPath,
                                                styleList[i])
            truebar = styledata['truebar']
            nullbar = styledata['nullbar']
            if string[i] == '0':
                pimage(nullbar, 'bar')
            elif string[i] == '1':
                pimage(truebar, 'bar')
            else:
                IoInit.print(string[i], styleList[i])
        else:
            IoInit.print(string[i], styleList[i])
示例#3
0
def askfor_All(list, print_order=False):
    while True:
        order = order_deal('str', print_order)
        if order in list:
            IoInit.print(order + '\n')
            return order
        elif order == '':
            continue
        else:
            IoInit.print(order + '\n')
            IoInit.print(
                TextLoading.getTextData(TextLoading.errorPath,
                                        'noInputListError') + '\n')
            continue