public static Dictionary<char, CharacterData> Parse(string filePath) { Dictionary<char, CharacterData> charDictionary = new Dictionary<char, CharacterData>(); string[] lines = File.ReadAllLines(filePath); for(int i = HeaderSize; i<lines.Length; i+=1) { string firstLine = lines[i]; string[] typesAndValues = firstLine.Split("".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); CharacterData charData = new CharacterData { Id = GetValue(typesAndValues[1]), X = GetValue(typesAndValues[2]), Y = GetValue(typesAndValues[3]), Width = GetValue(typesAndValues[4]), Height = GetValue(typesAndValues[5]), XOffset = GetValue(typesAndValues[6]), YOffset = GetValue(typesAndValues[7]), XAdvance = GetValue(typesAndValues[8]) }; charDictionary.Add((char)charData.Id, charData); } return charDictionary; }
public CharacterSprite(Sprite sprite, CharacterData data) { Data = data; Sprite = sprite; }
public CharacterSprite(sprite sprite, CharacterData data) { Data = data; Sprite = sprite; }