NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

conversation.py (2308B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\conversations\conversation.py
      2 import localization
      3 
      4 class ConversationAgent(object):
      5 
      6     def __init__(self, agent_id, name, image_path, intro_video_path = None, loop_video_path = None, scene_path = None):
      7         self.agent_id = agent_id
      8         self.name = name
      9         self.image_path = image_path
     10         self.use_video = loop_video_path is not None
     11         self.use_intro_video = intro_video_path is not None
     12         self.intro_video_path = intro_video_path
     13         self.loop_video_path = loop_video_path
     14         self.scene_path = scene_path
     15 
     16 
     17 class LineOfDialogueHint(object):
     18 
     19     def __init__(self, text, iconID, imageSize, imageColor):
     20         self.text = text
     21         self.iconID = iconID
     22         self.image_size = imageSize
     23         self.image_color = imageColor
     24 
     25 
     26 class LineOfDialogue(object):
     27 
     28     def __init__(self, agent_id, text_message_id, sound_id, hints, music_trigger, scene_path = None, variables = None):
     29         self.agent_id = agent_id
     30         self.text_message_id = text_message_id
     31         self.sound_id = sound_id
     32         self.music_trigger = music_trigger
     33         self.scene_path = scene_path
     34         self.variables = variables or {}
     35         self.hints = [ LineOfDialogueHint(hint.text, getattr(hint, 'iconID', None), getattr(hint, 'imageSize', None), getattr(hint, 'imageColor', None)) for hint in hints ]
     36 
     37     def get_text(self):
     38         return localization.GetByMessageID(self.text_message_id, **self.variables)
     39 
     40 
     41 class Conversation(object):
     42 
     43     def __init__(self, id, name, lines, variables = None):
     44         self.id = id
     45         self.name = name
     46         self._lines = lines
     47         self._line_iterator = iter(lines)
     48         self.variables = variables
     49 
     50     def __len__(self):
     51         return len(self._lines)
     52 
     53     def reset(self):
     54         self._line_iterator = iter(self._lines)
     55 
     56     def next(self):
     57         raise NotImplementedError('Implement creating the corresponding conversation LineOfDialogue object')
     58 
     59     def __iter__(self):
     60         return self
     61 
     62 
     63 class LineHintImage(object):
     64     ALL_RACES = 0
     65 
     66     def __init__(self, line_hint_image_id, description, image_path):
     67         self.line_hint_image_id = line_hint_image_id
     68         self.name = description
     69         self.image_path = image_path