コード例 #1
0
ファイル: Entities.py プロジェクト: jgmartins/Planet5521
 def init(self, XMLRoot=None):
   """Initialisation is called before populating with XML data. The basic
   implementation simply dynamically assigns variable names and their values,
   converted to the most sane type found. Reimplement as necessary."""
   if XMLRoot != None:
     for prop in XMLRoot:
       setattr(self, prop.tag, Util.convert(prop.text))
コード例 #2
0
ファイル: HumanView.py プロジェクト: jgmartins/Planet5521
 def init(self, title, graphicsFile):
   """Given the graphics element of the configuration file, parses the
   properties therein and sets them as properties of the View class."""
   XMLroot = ElementTree.parse(graphicsFile).getroot()
   for configNode in XMLroot:
     setattr(self, configNode.tag, Util.convert(configNode.text))
   
   Input.init(self)
   TextManager.init()
   
   # Creates screen
   self._window = sfml.RenderWindow(sfml.VideoMode(self.WINDOW_WIDTH, self.WINDOW_HEIGHT), title)
   self._pane = NGUIPane(0, 0, self.WINDOW_WIDTH, self.WINDOW_HEIGHT)
   self._pane.name = "HumanView"
   self.mouseFocus = None
コード例 #3
0
ファイル: Animation.py プロジェクト: jgmartins/Planet5521
 def loadFromXML(self, XMLRoot):
   self._name = XMLRoot.attrib["name"]
   self._loop = True
   if "repeat" in XMLRoot.attrib:
     self._loop = Util.convert(XMLRoot.attrib["repeat"])
   self._texture = nEngine.graphics.ResourceManager.ResourceManager.getTexture(XMLRoot.attrib["texture"])
   hasChildren = False
   for frameRoot in XMLRoot:
     frame = Frame()
     frame.loadFromXML(frameRoot)
     self._frames.append(frame)
     hasChildren = True
   
   if not hasChildren:
     frame = Frame()
     frame._rect = Rectangle((0,0),(self._texture.size))
     self._frames.append(frame)
コード例 #4
0
ファイル: Components.py プロジェクト: jgmartins/Planet5521
 def init(self, XMLRoot):
   researchNode = XMLRoot.find("research")
   if researchNode != None:
     self._research = Util.convert(researchNode.text)
コード例 #5
0
ファイル: Components.py プロジェクト: jgmartins/Planet5521
 def init(self, XMLRoot):
   self.range = Util.convert(XMLRoot.find("range").text)
   self.rate = Util.convert(XMLRoot.find("rate").text)
   self.capacity = Util.convert(XMLRoot.find("capacity").text)
コード例 #6
0
ファイル: Components.py プロジェクト: jgmartins/Planet5521
 def init(self, XMLRoot):
   self._facingLeft = Util.convert(XMLRoot.find("facingLeft"))