Beispiel #1
0
def order_deal(flag='order', print_order=True):
    global __skip_flag__
    __skip_flag__ = False
    while True:
        time.sleep(0.01)
        while not io._order_queue.empty():
            order = io.getorder()
            if order == '_exit_game_':
                global exit_flag
                exit_flag = True
                return
            if order == '_reset_this_game_':
                reset_func()
                return
            if print_order == True and order != '' and order != 'skip_all_wait' and order != 'skip_one_wait':
                io.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
Beispiel #2
0
def askfor_int(print_order=False):
    while True:
        order = order_deal('str', print_order)
        if order.isdigit():
            return int(order)
        else:
            io.print('\n' + "不是有效数字" + '\n')
Beispiel #3
0
def order_deal(flag='order', print_order=True):
    global __skip_flag__
    __skip_flag__ = False
    while True:
        io._get_input_event().clear()
        io._get_input_event().wait()
        order = io.getorder()
        if order == '_reset_this_game_':
            reset_func()
        if print_order == True and order != '' and order != 'skip_all_wait':
            io.print('\n' + order + '\n')
        if flag == 'order':
            if order.isdigit() and _cmd_valid(int(order)):
                _cmd_deal(int(order))
                return

        if flag == 'str':
            return io.getorder()

        if flag == 'console':
            exec(io.getorder())
Beispiel #4
0
def p(string, style=('standard', )):
    global last_char
    if len(string) > 0:
        last_char = string[-1:]
    io.print(string, style)
Beispiel #5
0
def p(string, style='standard'):
    string = str(string)
    global last_char
    if len(string) > 0:
        last_char = string[-1:]
    io.print(string, style)
Beispiel #6
0
def get_flow(flow_name):
    if flow_name in flow_map.keys():
        return flow_map[flow_name]
    else:
        io.print(flow_name + ' :没有该流程,或该流程没有被加载')