def visit_story(story): chapter = startFlag engine.resetCurrentChapter() while(chapter is not endFlag):# loop the story line show_chapter(engine.getChapterContent(chapter)) show_options(engine.getNextChapters(chapter)) choose = inputMsgDispatch(input('So, what is your choose')) while not choose: choose = inputMsgDispatch(input('So, what is your choose')) chapter = engine.chooseChapter(choose-1) show_chapter(engine.getChapterContent(endFlag))
def inputMsgDispatch(value): if value in ['S', 's']: save() output('Save succeed!',foreGroundColor.YELLOW) elif value in ['L', 'l']: chapter = load() show_chapter(engine.getChapterContent(chapter)) show_options(engine.getNextChapters(chapter)) elif value in ['help', 'H', 'h']: output(helpinfo) else: return stools.intelligence_int(value)
def load_E(choose): global chapter_on chapter_on = engine.load(choose) show_chapter(engine.getChapterContent(chapter_on)) show_options(engine.getNextChapters(chapter_on), visit_chapter_E)
def visit_chapter(chapter): global endFlag print 'visit_chapter:'+chapter show_chapter(engine.getChapterContent(chapter)) if chapter is not endFlag: show_options(engine.getNextChapters(chapter), visit_chapter_E)