Advertisement
lButcherl

Languages Unity

May 10th, 2015
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. Documento XML
  2.  
  3. <?xml version="1.0" encoding="utf-8"?>
  4. <languages>
  5.     <English>
  6.     <iniciar>Start</iniciar>
  7.     <app_name>Game Dogs</app_name>
  8.         <Descricao>Testing</Descricao>
  9.     <Teste>Teste1</Teste>
  10.     </English>
  11.  
  12.     <Portugues>
  13.     <iniciar>Iniciar</iniciar>
  14.         <app_name>Jogo Cachorros</app_name>
  15.         <Descricao>Teste</Descricao>
  16.     <Teste>Teste2</Teste>
  17.     </Portugues>
  18.  
  19.     <Espanhol>
  20.     <iniciar>Arriba</iniciar>
  21.         <app_name>EL doguitos</app_name>
  22.         <Descricao>El joguito mucho loko</Descricao>
  23.     <Teste>Teste3</Teste>
  24.     </Espanhol>
  25. </languages>
  26.  
  27. ---------------------------------------------------------------------------------------------
  28.  
  29. using UnityEngine;
  30. using System.Collections;
  31. using System.Collections.Generic;
  32. using System.Xml;
  33.  
  34. public class Languages : MonoBehaviour {
  35.  
  36.     public static XmlNodeList Linguagens;
  37.     void Awake()
  38.     {
  39.         //Carrega o arquivo .Xml contendo as linguagens
  40.         TextAsset xmlFile = (TextAsset)Resources.Load("linguagens");
  41.         //Instancia um novo documento para guardar os dados do .Xml
  42.         XmlDocument xmlDocument = new XmlDocument();
  43.         //Preenche o novo com os dados armazenados no .Xml carregado
  44.         xmlDocument.LoadXml(xmlFile.text);
  45.         Linguagens = xmlDocument.GetElementsByTagName("Espanhol");
  46.         print(Linguagens[0].SelectSingleNode("Descricao").InnerXml);
  47.        
  48.  
  49.     }
  50.  
  51.     // Use this for initialization
  52.     void Start () {
  53.  
  54.  
  55.        
  56.     }
  57.    
  58.     // Update is called once per frame
  59.     void Update () {
  60.    
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement