Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Xml;
- public class readXml : MonoBehaviour {
- public static string getLanguage(){
- return PlayerPrefs.GetString ("language");
- }
- public static void setLanguage(string s){
- PlayerPrefs.SetString ("language", s);
- }
- public static string getFieldLanguage(string s){
- TextAsset txtA = Resources.Load ("language") as TextAsset;
- XmlDocument doc = new XmlDocument();
- XmlNode root;
- XmlNodeList node;
- doc.LoadXml (txtA.text);
- root = doc.DocumentElement;
- node = root.SelectNodes (getLanguage());
- return node[0].SelectSingleNode(s).InnerText;
- }
- public static List<string> getLanguageList(){
- TextAsset txtA = Resources.Load ("language") as TextAsset;
- List<string> tmp = new List<string> ();
- XmlDocument doc = new XmlDocument();
- XmlNode root;
- doc.LoadXml (@txtA.text);
- root = doc.DocumentElement;
- foreach(XmlNode XN in root)
- tmp.Add (XN.Name);
- return tmp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment