コード例 #1
0
  @Override
  public void xmlCompleted() {
    super.xmlCompleted();
    m_Status = "";
    m_Enemies = new ArrayList();

    //        m_PauseKey =
    // KeyboardCodes.getKey(m_Data.getElementsByTagName("pause_game").item(0).getTextContent());

    String resourceName;
    String resourceType;
    String assetXMLFile;

    NodeList rootNode = m_Data.getElementsByTagName("Node");
    for (int i = 0; i < rootNode.getLength(); i++) {
      Element child = (Element) rootNode.item(i);
      resourceType = child.getElementsByTagName("Type").item(0).getTextContent();
      resourceName = child.getElementsByTagName("Name").item(0).getTextContent();
      assetXMLFile = child.getElementsByTagName("Asset").item(0).getTextContent();

      if (resourceType.compareTo("Player") == 0) {
        m_Nodes.put(resourceName, new Player(m_RefToMain, assetXMLFile));
        m_Player = resourceName;
      } else if (resourceType.compareTo("Enemy") == 0) {
        m_Nodes.put(resourceName, new Enemy(m_RefToMain, assetXMLFile));
        m_Enemies.add(resourceName);
      } else if (resourceType.compareTo("Background") == 0) {
        m_Nodes.put(resourceName, new Background(m_RefToMain, assetXMLFile));
      } else if (resourceType.compareTo("Status") == 0) {
        m_Nodes.put(resourceName, new Status(m_RefToMain, assetXMLFile));
        m_Status = resourceName;
      }
    }
  }
コード例 #2
0
 @Override
 public void reset() {
   super.reset();
 }