Advertisement
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;
- using System.Xml.Serialization;
- using System.IO;
- public class Lang
- {
- [XmlAttribute("id")]
- public int id;
- [XmlAttribute("txt")]
- public string txt;
- }
- public class Quip
- {
- [XmlAttribute("id")]
- public int id;
- [XmlAttribute("txt")]
- public string txt;
- [XmlAttribute("death")]
- public bool death = false;
- [XmlAttribute("wpn")]
- public int wpn = -1;
- [XmlAttribute("acc")]
- public int acc = -1;
- }
- [XmlRoot("langues")]
- public class Language
- {
- [XmlArray("Language")]
- [XmlArrayItem("lang")]
- public List<Lang> langs = new List<Lang>();
- [XmlArray("Quips")]
- [XmlArrayItem("quip")]
- public List<Quip> quips = new List<Quip>();
- public static Language Load(string path)
- {
- TextAsset _xml = Resources.Load<TextAsset>(path);
- XmlSerializer serializer = new XmlSerializer(typeof(Language));
- StringReader reader = new StringReader(_xml.text);
- Language items = serializer.Deserialize(reader) as Language;
- reader.Close();
- return items;
- }
- public static string TXT(int ID)
- {
- string path = "language";
- Language lang = Language.Load(path);
- return lang.langs[ID].txt;
- }
- public static Quip[] QUIP()
- {
- string path = "language";
- Language lang = Language.Load(path);
- return lang.quips.ToArray();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement