Esempio n. 1
0
 /*
  * public void loadDataFromPath(string path)
  * {
  *  FileStream fs = File.Open (path, FileMode.Open);
  *  StreamReader sr = null;
  *
  *  string line = null;
  *  try {
  *      sr = new StreamReader(fs);
  *      if(sr != null) {
  *          while(!string.IsNullOrEmpty(line = sr.ReadLine()) ) {
  *              if(!line.StartsWith ("#")) {
  *                  SDK.Log("==="+line);
  *                  Dictionary<string,object> t = MiniJSON.Json.Deserialize(line) as Dictionary<string,object>;
  * //                        szConfig.Add(t["ID"].ToString(),t["txt"].ToString());
  *              }
  *          }
  *      }
  *  } catch(IOException ex) {
  *      SDK.Log(line+";"+ex.ToString());
  *  } finally {
  *      if(fs != null) { fs.Close(); fs = null; }
  *      if(sr != null) { sr.Close(); sr = null; }
  *  }
  * }
  * public IEnumerator loadDataWithWWW(string path)
  * {
  *  WWW www = new WWW("file:///"+path);
  *  yield return www;
  *  StreamReader sr = null;
  *  string line = null;
  *  try {
  *      sr = new StreamReader(new MemoryStream(www.bytes));
  *      if(sr != null) {
  *          while(!string.IsNullOrEmpty(line = sr.ReadLine()) ) {
  *              if(!line.StartsWith ("#")) {
  *                  Dictionary<string,object> t = MiniJSON.Json.Deserialize(line) as Dictionary<string,object>;
  * //                        config.Add(t["ID"].ToString(),t["txt"].ToString());
  *              }
  *          }
  *      }
  *  } catch(IOException ex) {
  *      SDK.Log(line+";"+ex.ToString());
  *  } finally {
  *      if(sr != null) { sr.Close(); sr = null; }
  *  }
  * }
  */
 public static string getText(int id)
 {
     if (instance.szConfig.ContainsKey(id))
     {
         if (IOS.systemLanguage() == UnityEngine.SystemLanguage.Chinese)
         {
             return(instance.szConfig[id].txtCN);
         }
         else
         {
             return(instance.szConfig[id].txtEN);
         }
     }
     return("文字缺失:" + id);
 }