Advertisement
Muk99

Languages

Jan 9th, 2015
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class Language {
  6.  
  7.     private static List<string> lines = new List<string> ();
  8.  
  9.     public static int lineCount {
  10.         get {return Language.lines.Count;}
  11.     }
  12.    
  13.     public static void LoadTextFile (TextAsset file) {
  14.         int outParse = 0;
  15.  
  16.         foreach (string line in file.text.Split ('|')) {
  17.             if (!int.TryParse (line, out outParse) && !line.Equals ("\n")) {
  18.                 lines.Add (line);
  19.             }
  20.         }
  21.  
  22.         lines.RemoveAt (lines.Count - 1);
  23.     }
  24.    
  25.     public static string GetLine (int lineNumber) {
  26.         return Language.lines [lineNumber];
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement