本文整理汇总了Python中tutorial.doc_loader.sub_parsers._parseID函数的典型用法代码示例。如果您正苦于以下问题:Python _parseID函数的具体用法?Python _parseID怎么用?Python _parseID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_parseID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _readProgressSection
def _readProgressSection(xmlCtx, section, _):
progressID = sub_parsers._parseID(xmlCtx, section, 'Specify a progress ID')
conditions = []
for _, subSec in _xml.getChildren(xmlCtx, section, 'steps'):
condID = sub_parsers._parseID(xmlCtx, subSec, 'Specify a condition ID')
conditions.append(chapter.HasIDConditions(sub_parsers._parseID(xmlCtx, subSec, 'Specify a condition ID'), sub_parsers._readConditions(xmlCtx, subSec, [])))
return chapter.ChapterProgress(progressID, conditions)
示例2: _readSetFilterSection
def _readSetFilterSection(xmlCtx, section, _, conditions):
filterID = sub_parsers._parseID(xmlCtx, section, 'Specify a filter ID')
value = []
for name, subSec in _xml.getChildren(xmlCtx, section, 'value'):
value.append(sub_parsers._readVarValue(name, subSec))
return chapter.SetFilter(filterID, tuple(value), conditions=conditions)
示例3: __readGuiItemsSection
def __readGuiItemsSection(self, xmlCtx, section):
self.__guiItems.clear()
for _, subSection in _xml.getChildren(xmlCtx, section, 'gui-items'):
itemID = sub_parsers._parseID(xmlCtx, subSection, 'Specify a GUI item ID')
path = _xml.readString(xmlCtx, subSection, 'path')
self.__guiItems[itemID] = {'path': path,
'locked': True}
示例4: _readChapterTaskSection
def _readChapterTaskSection(xmlCtx, section, _):
taskID = sub_parsers._parseID(xmlCtx, section, 'Specify a task ID')
text = translation(_xml.readString(xmlCtx, section, 'text'))
flagID = None
if 'flag' in section.keys():
flagID = _xml.readString(xmlCtx, section, 'flag')
return chapter.ChapterTask(taskID, text, flagID=flagID)
示例5: parse
def parse(self, chapter, afterBattle = False, initial = False):
filePath = chapter.getFilePath(afterBattle=afterBattle)
section = ResMgr.openSection(filePath)
if section is None:
_xml.raiseWrongXml(None, filePath, 'can not open or read')
xmlCtx = (None, filePath)
chapter.clear()
flags = []
itemFlags = []
if 'initial-scene' in section.keys():
chapter.setInitialSceneID(_xml.readString(xmlCtx, section, 'initial-scene'))
if 'default-scene' in section.keys():
chapter.setDefaultSceneID(_xml.readString(xmlCtx, section, 'default-scene'))
for name, subSec in _xml.getChildren(xmlCtx, section, 'has-id'):
entity = sub_parsers._parseEntity(xmlCtx, name, subSec, flags)
if entity is not None:
chapter.addHasIDEntity(entity)
for _, subSec in _xml.getChildren(xmlCtx, section, 'triggers'):
trigger = sub_parsers._parseTrigger(xmlCtx, subSec, flags, chapter)
if trigger is not None:
chapter.addTrigger(trigger)
gVarIDs = []
for name, subSec in _xml.getChildren(xmlCtx, section, 'vars'):
if name == 'var-set':
chapter.addVarSet(sub_parsers._parseVarSet(xmlCtx, subSec, flags))
elif name == 'var-set-ref':
gVarIDs.append(sub_parsers._parseID(xmlCtx, subSec, 'Specify a var ID'))
else:
_xml.raiseWrongXml(xmlCtx, name, 'Unknown tag')
if len(gVarIDs):
GlobalRefParser().parse(chapter, varIDs=gVarIDs, flags=flags)
for _, sceneSec in _xml.getChildren(xmlCtx, section, 'scenes'):
sceneID = sub_parsers._parseID(xmlCtx, sceneSec, 'Specify a unique name for the scene')
scene = Scene(entityID=sceneID)
self.__parseScene(xmlCtx, sceneSec, scene, flags, itemFlags, afterBattle=afterBattle)
chapter.addScene(scene)
if initial:
scene = chapter.getInitialScene()
self.__parseSharedScene(chapter, scene, flags, itemFlags)
flags = filter(lambda flag: flag not in itemFlags, flags)
chapter.setFlags(flags)
chapter.setValid(True)
return chapter
示例6: _readGreetingSection
def _readGreetingSection(xmlCtx, section, _):
greetingID = sub_parsers._parseID(xmlCtx, section, 'Specify a greeting ID')
title = translation(_xml.readString(xmlCtx, section, 'title'))
text = translation(_xml.readString(xmlCtx, section, 'text'))
speakID = None
if 'speak' in section.keys():
speakID = _xml.readString(xmlCtx, section, 'speak')
return chapter.Greeting(greetingID, title, text, speakID=speakID)
示例7: _readMarkerSection
def _readMarkerSection(xmlCtx, section, _):
markerID = sub_parsers._parseID(xmlCtx, section, 'Specify a marker ID')
type = _xml.readString(xmlCtx, section, 'type')
marker = None
if type in _MARKER_TYPES:
parser = _MARKER_TYPES[type]
marker = parser(xmlCtx, section, markerID, _xml.readString(xmlCtx, section, 'var-ref'))
else:
LOG_ERROR('Marker is not supported:', type)
return marker
示例8: _readHintSection
def _readHintSection(xmlCtx, section, _):
hintID = sub_parsers._parseID(xmlCtx, section, 'Specify a hint ID')
text = translation(_xml.readString(xmlCtx, section, 'text'))
image = None
if 'image' in section.keys():
image = _xml.readString(xmlCtx, section, 'image')
speakID = None
if 'speak' in section.keys():
speakID = _xml.readString(xmlCtx, section, 'speak')
return chapter.SimpleHint(hintID, text, image=image, speakID=speakID)
示例9: _readImageSection
def _readImageSection(xmlCtx, section, _):
imageID = sub_parsers._parseID(xmlCtx, section, 'Specify a image ID')
imageType = _xml.readString(xmlCtx, section, 'type')
image = None
if imageType in _IMAGE_TYPES:
parser = _IMAGE_TYPES[imageType]
image = parser(xmlCtx, section, imageID)
else:
LOG_ERROR('Image is not supported:', imageType)
return image
示例10: __readCommandsSection
def __readCommandsSection(self, xmlCtx, section):
self.__commands.clear()
for _, subSection in _xml.getChildren(xmlCtx, section, 'gui-commands'):
commandID = sub_parsers._parseID(xmlCtx, subSection, 'Specify a command ID')
cmdType = _xml.readString(xmlCtx, subSection, 'type')
command = _xml.readString(xmlCtx, subSection, 'name')
argsSec = _xml.getChildren(xmlCtx, subSection, 'args')
args = []
for name, argSec in argsSec:
args.append(sub_parsers._readVarValue(name, argSec))
self.__commands[commandID] = CommandData(cmdType, command, args)
示例11: _parseHint
def _parseHint(xmlCtx, section, _):
hintID = sub_parsers._parseID(xmlCtx, section, 'Specify a hint ID')
targetID = _xml.readString(xmlCtx, section, 'gui-item-ref')
containerID = section.readString('container-ref')
if not len(containerID):
containerID = None
text = translation(_xml.readString(xmlCtx, section, 'text'))
inPin = _xml.readString(xmlCtx, section, 'inPin')
outPin = _xml.readString(xmlCtx, section, 'outPin')
line = _xml.readString(xmlCtx, section, 'line')
position = section.readVector2('position')
topmostLevel = section.readBool('topmost-level', True)
return chapter.ItemHint(hintID, targetID, containerID, position, text, inPin, outPin, line, topmostLevel)
示例12: _readExitQueueEffectSection
def _readExitQueueEffectSection(xmlCtx, section, flags, conditions):
flagID = sub_parsers._parseID(xmlCtx, section, 'Specify a flag ID')
if flagID not in flags:
flags.append(flagID)
return chapter.HasTargetEffect(flagID, chapter.Effect.EXIT_QUEUE, conditions=conditions)
示例13: _readShowMarkerSection
def _readShowMarkerSection(xmlCtx, section, _, conditions):
markerID = sub_parsers._parseID(xmlCtx, section, 'Specify a marker ID')
return chapter.HasTargetEffect(markerID, chapter.Effect.SHOW_MARKER, conditions=conditions)
示例14: _readDispatcherTriggerSection
def _readDispatcherTriggerSection(xmlCtx, section, _, triggerID):
triggerIDs = set()
for _, subSec in _xml.getChildren(xmlCtx, section, 'includes'):
triggerIDs.add(sub_parsers._parseID(xmlCtx, subSec, 'Specify a trigger ID'))
return triggers.TriggersDispatcher(triggerID, triggerIDs)
示例15: _readShowGreetingSection
def _readShowGreetingSection(xmlCtx, section, _, conditions):
greetingID = sub_parsers._parseID(xmlCtx, section, 'Specify a greeting ID')
return chapter.HasTargetEffect(greetingID, chapter.Effect.SHOW_GREETING, conditions=conditions)