代码实现
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using UnityEngine;
public class TextConfig : MonoBehaviour
{
public List<TextType> textTypes = new List<TextType>();
private void Start()
{
ReadXml();
}
public class TextType
{
string language;
public string Language
{
get { return this.language; }
protected set { this.language = value; }
}
public List<TextData> textDatas = new List<TextData>();
/// <summary>
/// 构造函数
/// </summary>
/// <param name="element">xml的第一子级</param>
public TextType(XmlElement element)
{
language = element.GetAttribute("Language");
}
}
public class TextData
{
#region 字段
string textKey;
string textValue;
int textFont