def start_input_nick_name_panel():
    """
    玩家昵称输入处理面板
    """
    era_print.line_feed_print(
        text_loading.get_text_data(constant.FilePath.MESSAGE_PATH, "5"))
    while 1:
        character_nick_name = game_init.askfor_str()
        era_print.line_feed_print(character_nick_name)
        if text_handle.get_text_index(character_nick_name) > 10:
            era_print.line_feed_print(
                text_loading.get_text_data(constant.FilePath.ERROR_PATH,
                                           "inputNickNameTooLongError"))
        else:
            cache_contorl.character_data[0].nick_name = character_nick_name
            break
Esempio n. 2
0
def wait_input(int_a: int, int_b: int) -> str:
    """
    等待玩家输入ab之间的一个数
    Keyword arguments:
    int_a -- 输入边界A
    int_b -- 输入边界B
    """
    while True:
        ans = game_init.askfor_str()
        if ans.isdecimal():
            ans = int(ans)
            if int_a <= ans <= int_b:
                break
        era_print.line_feed_print(ans)
        era_print.line_feed_print(
            text_loading.get_text_data(constant.FilePath.ERROR_PATH,
                                       "input_null_error") + "\n")
    return ans