コード例 #1
0
def startInputNamePanel():
    '''
    玩家姓名输入处理面板
    '''
    EraPrint.pline()
    EraPrint.pl(TextLoading.getTextData(TextLoading.messagePath, '3'))
    while 1:
        characterName = GameInit.askfor_str()
        EraPrint.pl(characterName)
        if TextHandle.getTextIndex(characterName) > 10:
            EraPrint.pl(TextLoading.getTextData(TextLoading.errorPath, 'inputNameTooLongError'))
        else:
            CacheContorl.characterData['character'][0].Name = characterName
            break
コード例 #2
0
def startInputNamePanel():
    EraPrint.pline()
    EraPrint.pl(TextLoading.getTextData(TextLoading.messagePath, '3'))
    inputState = 0
    while inputState == 0:
        characterName = GameInit.askfor_str()
        EraPrint.pl(characterName)
        if TextHandle.getTextIndex(characterName) > 10:
            EraPrint.pl(
                TextLoading.getTextData(TextLoading.errorPath,
                                        'inputNameTooLongError'))
        else:
            inputState = 1
            CacheContorl.temporaryCharacter['Name'] = characterName
コード例 #3
0
def startInputSelfName():
    '''
    玩家自称输入处理面板
    '''
    EraPrint.pline()
    EraPrint.pl(TextLoading.getTextData(TextLoading.messagePath, '15'))
    inputState = 0
    while inputState == 0:
        characterSelfName = GameInit.askfor_str()
        EraPrint.pl(characterSelfName)
        if TextHandle.getTextIndex(characterSelfName) > 10:
            EraPrint.pl(
                TextLoading.getTextData(TextLoading.errorPath,
                                        'inputSelfNameTooLongError'))
        else:
            inputState = 1
            CacheContorl.temporaryCharacter['SelfName'] = characterSelfName
    EraPrint.p('\n')
コード例 #4
0
def waitInput(intA: int, intB: int) -> GameInit.askfor_str:
    '''
    等待玩家输入ab之间的一个数
    Keyword arguments:
    intA -- 输入边界A
    intB -- 输入边界B
    '''
    while (True):
        ans = GameInit.askfor_str()
        if ans.isdecimal():
            ans = int(ans)
            if intA <= ans <= intB:
                break
        EraPrint.pl(ans)
        EraPrint.pl(
            TextLoading.getTextData(TextLoading.errorPath, 'inputNullError') +
            '\n')
    return ans