Selaa lähdekoodia

add language exporter

gsgundam 8 vuotta sitten
vanhempi
commit
aea6110ded
31 muutettua tiedostoa jossa 724 lisäystä ja 0 poistoa
  1. 9 0
      Assets/Resources/XML/lan.meta
  2. 6 0
      Assets/Resources/XML/lan/ChineseSimplified.xml
  3. 8 0
      Assets/Resources/XML/lan/ChineseSimplified.xml.meta
  4. 6 0
      Assets/Resources/XML/lan/English.xml
  5. 8 0
      Assets/Resources/XML/lan/English.xml.meta
  6. 435 0
      Assets/Script/Editor/EditorLanguageExport.cs
  7. 12 0
      Assets/Script/Editor/EditorLanguageExport.cs.meta
  8. 220 0
      Assets/Script/Tool/Language.cs
  9. 12 0
      Assets/Script/Tool/Language.cs.meta
  10. BIN
      Assets/XlsxSource/language_config.xlsx
  11. 8 0
      Assets/XlsxSource/language_config.xlsx.meta
  12. BIN
      Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
  13. BIN
      Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb
  14. BIN
      Library/ScriptAssemblies/Assembly-CSharp.dll
  15. BIN
      Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
  16. BIN
      Library/UnityAssemblies/UnityEditor.Advertisements.dll
  17. BIN
      Library/UnityAssemblies/UnityEditor.Analytics.dll
  18. BIN
      Library/UnityAssemblies/UnityEditor.Android.Extensions.dll
  19. BIN
      Library/UnityAssemblies/UnityEditor.EditorTestsRunner.dll
  20. BIN
      Library/UnityAssemblies/UnityEditor.Graphs.dll
  21. BIN
      Library/UnityAssemblies/UnityEditor.HoloLens.dll
  22. BIN
      Library/UnityAssemblies/UnityEditor.Networking.dll
  23. BIN
      Library/UnityAssemblies/UnityEditor.PlaymodeTestsRunner.dll
  24. BIN
      Library/UnityAssemblies/UnityEditor.TreeEditor.dll
  25. BIN
      Library/UnityAssemblies/UnityEditor.UI.dll
  26. BIN
      Library/UnityAssemblies/UnityEditor.VR.dll
  27. BIN
      Library/UnityAssemblies/UnityEditor.WebGL.Extensions.dll
  28. BIN
      Library/UnityAssemblies/UnityEditor.WindowsStandalone.Extensions.dll
  29. BIN
      Library/UnityAssemblies/UnityEditor.iOS.Extensions.Common.dll
  30. BIN
      Library/UnityAssemblies/UnityEditor.iOS.Extensions.Xcode.dll
  31. BIN
      Library/assetDatabase3

+ 9 - 0
Assets/Resources/XML/lan.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f2349382e91d4b048b6141207b9e2a00
+folderAsset: yes
+timeCreated: 1487576405
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 6 - 0
Assets/Resources/XML/lan/ChineseSimplified.xml

@@ -0,0 +1,6 @@
+<lan>
+  <Public>
+    <connect_server_exception desc=""><![CDATA[服务器异常,连接服务器失败!]]></connect_server_exception>
+    <current_version desc=""><![CDATA[当前版本:{0}]]></current_version>
+  </Public>
+</lan>

+ 8 - 0
Assets/Resources/XML/lan/ChineseSimplified.xml.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bb6fbcd0fca396443b2820f0a8dbbba6
+timeCreated: 1487576407
+licenseType: Pro
+TextScriptImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 6 - 0
Assets/Resources/XML/lan/English.xml

@@ -0,0 +1,6 @@
+<lan>
+  <Public>
+    <connect_server_exception desc=""><![CDATA[connect server exception]]></connect_server_exception>
+    <current_version desc=""><![CDATA[Current version {0}]]></current_version>
+  </Public>
+</lan>

+ 8 - 0
Assets/Resources/XML/lan/English.xml.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d8a0e07981e41914aa4d318c8c28ff6c
+timeCreated: 1487576405
+licenseType: Pro
+TextScriptImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 435 - 0
Assets/Script/Editor/EditorLanguageExport.cs

@@ -0,0 +1,435 @@
+using UnityEditor;
+using UnityEngine;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Excel;
+using System.Data;
+
+using System.Xml;
+using System.Threading;
+
+public class EditorLanguageExport : EditorWindow
+{
+    [MenuItem("DashGame/Design Tools/Export Language")]
+    public static void AddWindow()
+    {
+        EditorLanguageExport window = (EditorLanguageExport)EditorWindow.GetWindow(typeof(EditorLanguageExport), false, "Export Language");
+        window.Show();
+
+    }
+
+    public List<string> nameArray = new List<string>();
+
+    private string defaultPath;
+    private bool shouldDelete = true;
+    private bool isSuccess;
+    private string text;
+    private Dictionary<string, XmlNode> parentNodeDict;
+
+	private string[] avaliableLan = new string[] { "English", "ChineseSimplified", "ChineseTraditional"};
+		
+
+    void Awake()
+    {
+		defaultPath = Application.dataPath + @"/XlsxSource/language_config.xlsx";
+    }
+
+    void OnGUI()
+    {
+        GUILayout.Label(new GUIContent("导出文件到xml目录"));
+
+        shouldDelete = GUILayout.Toggle(shouldDelete, new GUIContent("覆盖已有文件"));
+
+        if (GUILayout.Button("立即导出", GUILayout.Height(30)))
+            CreateAllXml();
+    }
+
+    /// <summary>
+    /// custom split string function
+    /// </summary>
+    private class StringExtention
+    {
+
+        public static string[] SplitWithString(string sourceString, string splitString)
+        {
+           // string tempSourceString = sourceString;
+            List<string> arrayList = new List<string>();
+            string s = string.Empty;
+            while (sourceString.IndexOf(splitString) > -1)  //split
+            {
+                s = sourceString.Substring(0, sourceString.IndexOf(splitString));
+                sourceString = sourceString.Substring(sourceString.IndexOf(splitString) + splitString.Length);
+                arrayList.Add(s);
+            }
+            arrayList.Add(sourceString);
+            return arrayList.ToArray();
+        }
+    }
+
+    private void CreateAllXml()
+    {
+//        foreach (string str in nameArray)
+//        {
+//            if (!str.Contains("language"))
+//                continue;
+//
+//            CreateXml(str);
+//        }
+
+		foreach( string s in avaliableLan) {
+			CreateXml(s);
+		}
+
+        if (isSuccess)
+        {
+            ShowNotification(new GUIContent( "已成功导出!"));
+            //DirectoryInfo di = new DirectoryInfo(defaultPath);
+            //DirectoryInfo[] diArr = di.GetDirectories();
+            isSuccess = false;
+            AssetDatabase.Refresh();
+        }
+        else
+            ShowNotification(new GUIContent("文件有错误!"));
+    }
+
+	private void CreateXml(string lan)
+    {
+        parentNodeDict = new Dictionary<string, XmlNode>();
+
+        string filepath = Application.dataPath + @"/Resources/xml/lan/" + lan + ".xml";
+	    text = "";
+
+        filepath = filepath.Replace("\\", "/");
+        string[] pathArr = filepath.Split('/');
+        string tempPath = "";
+        for(int i = 0; i < pathArr.Length; i++)
+        {
+            tempPath += pathArr[i] + "/";
+            if (i > 1 && i < pathArr.Length - 1)
+            {
+                if (!Directory.Exists(tempPath))
+                {
+                    Directory.CreateDirectory(tempPath);
+                }
+            }
+        }
+
+        if ((!File.Exists(filepath) && !shouldDelete) || shouldDelete)
+        {
+            XmlDocument xmlDoc = new XmlDocument();
+
+            try
+            {
+				FileStream stream = File.Open(defaultPath, FileMode.Open, FileAccess.Read);
+                IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
+
+                text += "\nexcelReader.ResultsCount is" + excelReader.ResultsCount + "\n";
+
+                text += "start excelReader. \n";
+
+                DataSet result = excelReader.AsDataSet();
+
+                text += "get result successful? result[" + result + "]";
+
+                text += "result columns count is " + result.Tables[0].Columns.Count;
+
+                int columns = result.Tables[0].Columns.Count;
+                int rows = result.Tables[0].Rows.Count;
+
+                //start create xml
+                XmlElement root = xmlDoc.CreateElement("lan");
+                XmlNode currentChildNode = null;
+                string parentNodeName = "";
+				int parentidex = -1;
+				int nameindex = -1;
+				int contentindex = -1;
+				int descindex = -1;
+
+				// get column index
+				for (int j = 0; j < columns; ++j) {
+					string nvalue = result.Tables[0].Rows[1][j].ToString();
+					if (string.Equals(nvalue, "parent")) {
+						parentidex = j;
+					} else if (string.Equals(nvalue, "desc")) {
+						descindex = j;
+					} else if (string.Equals(nvalue, "name")) {
+						nameindex = j;
+					} else if (string.Equals(nvalue, lan)) {
+						contentindex = j;
+					}
+				}
+
+				if (contentindex < 0) {
+					throw new Exception("language " + lan + " is not exist in the excel");
+				}
+
+                for (int i = 3; i < rows; i++)
+                {
+   					// parent
+					string nvalue = result.Tables[0].Rows[i][parentidex].ToString();
+					if (!parentNodeDict.ContainsKey(nvalue))
+					{
+						XmlNode node = xmlDoc.CreateElement(nvalue);
+						parentNodeDict.Add(nvalue, node);
+					}
+					parentNodeName = nvalue;
+
+					// name
+					nvalue = result.Tables[0].Rows[i][nameindex].ToString();
+					currentChildNode = xmlDoc.CreateElement(nvalue);
+					parentNodeDict[parentNodeName].AppendChild(currentChildNode);
+
+					// content
+					nvalue = result.Tables[0].Rows[i][contentindex].ToString();
+					XmlCDataSection cData = xmlDoc.CreateCDataSection(nvalue);
+					currentChildNode.AppendChild(cData);
+
+					// desc
+					nvalue = result.Tables[0].Rows[i][descindex].ToString();
+					XmlAttribute comment = xmlDoc.CreateAttribute("desc");
+					comment.Value = nvalue;
+					currentChildNode.Attributes.Append(comment);
+
+//                    for (int j = 0; j < columns; j++)
+//                    {
+//                        string nvalue = result.Tables[0].Rows[i][j].ToString();
+//
+//                            switch (j)
+//                            {
+//                                case 0:
+//                                    if (!parentNodeDict.ContainsKey(nvalue))
+//                                    {
+//                                        XmlNode node = xmlDoc.CreateElement(nvalue);
+//                                        parentNodeDict.Add(nvalue, node);
+//                                    }
+//                                    parentNodeName = nvalue;
+//                                break;
+//                                case 1:
+//                                    currentChildNode = xmlDoc.CreateElement(nvalue);
+//                                    parentNodeDict[parentNodeName].AppendChild(currentChildNode);
+//                                break;
+//                                case 2:
+//                                    XmlCDataSection cData = xmlDoc.CreateCDataSection(nvalue);
+//                                    currentChildNode.AppendChild(cData);
+//                                    break;
+//                                case 3:
+//                                    XmlAttribute comment = xmlDoc.CreateAttribute("desc");
+//                                    comment.Value = nvalue;
+//                                    currentChildNode.Attributes.Append(comment);
+//                                    break;
+//                            }
+//
+//                            //Debug.Log("labels[j] is " + labels[j] + ", nvalue is " + nvalue);
+//                        //Debug.Log(nvalue);
+//                    }
+
+                }
+
+                foreach(KeyValuePair<string, XmlNode> keyValue in parentNodeDict)
+                    root.AppendChild(keyValue.Value);
+
+                xmlDoc.AppendChild(root);
+				xmlDoc.Save(filepath);
+				AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
+//				AssetDatabase.ImportAsset(@"Assets/Resources/XML/Config" + fileName + ".xml", ImportAssetOptions.ForceUpdate);
+                //Debug.Log(fileName + ".xml is saved to " + filepath + ", count is " + idArr.Count);
+
+                isSuccess = true;
+            }
+            catch (Exception e)
+            {
+                text += "Exception " + e.Message;
+                Debug.Log("Exception " + e.Message);
+            }
+        }
+    }
+
+    private void CreateAllPhp()
+    {
+        foreach (string str in nameArray)
+        {
+            if (!str.Contains("language"))
+                continue;
+
+            CreatePhp(str);
+        }
+
+        if (isSuccess)
+        {
+            ShowNotification(new GUIContent("已成功导出!"));
+            //DirectoryInfo di = new DirectoryInfo(defaultPath);
+            //DirectoryInfo[] diArr = di.GetDirectories();
+            isSuccess = false;
+        }
+        else
+            ShowNotification(new GUIContent("文件有错误!"));
+    }
+
+    private void CreatePhp(string fileName)
+    {
+        string realName = StringExtention.SplitWithString(fileName, "\\")[1];
+        string filepath = defaultPath + "/" + realName + ".php";
+        text = "";
+
+        filepath = filepath.Replace("\\", "/");
+        string[] pathArr = filepath.Split('/');
+        string tempPath = "";
+        for (int i = 0; i < pathArr.Length; i++)
+        {
+            tempPath += pathArr[i] + "/";
+            if (i > 1 && i < pathArr.Length - 1)
+            {
+                if (!Directory.Exists(tempPath))
+                {
+                    Directory.CreateDirectory(tempPath);
+                }
+            }
+        }
+
+        if ((!File.Exists(filepath) && !shouldDelete) || shouldDelete)
+        {
+            try
+            {
+                string fullText = "<?php\n";
+
+                FileStream stream = File.Open(Application.dataPath + @"/XlsxSource" + fileName + ".xlsx", FileMode.Open, FileAccess.Read);
+                IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
+
+                text += "\nexcelReader.ResultsCount is" + excelReader.ResultsCount + "\n";
+
+                text += "start excelReader. \n";
+
+                DataSet result = excelReader.AsDataSet();
+
+                text += "get result successful? result[" + result + "]";
+
+                text += "result columns count is " + result.Tables[0].Columns.Count;
+
+                int columns = result.Tables[0].Columns.Count;
+                int rows = result.Tables[0].Rows.Count;
+
+                //start create xml
+                for (int i = 0; i < rows; i++)
+                {
+                    if (i == 0)
+                    {
+                        continue;
+                    }
+
+                    for (int j = 0; j < columns; j++)
+                    {
+                        string nvalue = result.Tables[0].Rows[i][j].ToString();
+
+                        if (i > 2)
+                        {
+                            switch (j)
+                            {
+                                case 0:
+                                    fullText += "$LANG['" + nvalue + "|";
+                                    break;
+                                case 1:
+                                    fullText += nvalue + "'] = '";
+                                    break;
+                                case 2:
+                                    nvalue = nvalue.Replace("\'", "\\\'");
+                                    fullText += nvalue + "\';\n";
+                                    break;
+                            }
+
+                        }
+                    }
+
+                }
+
+                fullText += "?>";
+                StreamWriter sw = new StreamWriter(filepath);
+                string w = fullText;
+                sw.Write(w);
+                sw.Close();
+                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
+
+                isSuccess = true;
+            }
+            catch (Exception e)
+            {
+                text += "Exception " + e.Message;
+                Debug.Log("Exception " + e.Message);
+            }
+        }
+    }
+
+    private void HideNotification()
+    {
+        this.RemoveNotification();
+    }
+
+    void OnInspectorUpdate()
+    {
+        this.Repaint();
+    }
+
+    void OnDestory()
+    {
+        EditorUtility.UnloadUnusedAssetsImmediate();
+    }
+
+}
+
+public class LanguageUploadData
+{
+    public string sourcePath;
+    public string targetUrl;
+
+    public string GetCmd()
+    {
+        string command = "@echo off\r\n" +
+            "echo open " + targetUrl + ">ftp.up\r\n" +
+            "echo gaoyuqin>>ftp.up\r\n" +
+            "echo Gaoyuqin123654>>ftp.up\r\n" +
+            //"echo Cd .\\User >>ftp.up\r\n" +
+            "echo binary>>ftp.up\r\n" +
+            "echo lcd \"" + sourcePath + "\">>ftp.up\r\n" +
+            "echo prompt>>ftp.up\r\n" +
+            "echo mkdir qwsk/lang/>>ftp.up\r\n" +
+            "echo cd qwsk/lang/>>ftp.up\r\n" +
+            "echo mput *.php>>ftp.up\r\n" +
+            "echo bye>>ftp.up\r\n" +
+            "FTP -s:ftp.up\r\n" +
+            "del ftp.up /q\r\n" +
+            "pause\r\n";
+
+        return command;
+    }
+}
+
+public class LanguageUploadFiles
+{
+    private Dictionary<string, LanguageUploadData> data;
+
+    private Thread s;
+    public LanguageUploadFiles(Dictionary<string, LanguageUploadData> data)
+    {
+        this.data = data;
+        s = new Thread(Run);
+        s.Start();
+    }
+
+    private void Run()
+    {
+        foreach (string key in data.Keys)
+        {
+            LanguageUploadData uploadData = data[key];
+            RunCmd(key, uploadData.GetCmd());
+            Debug.Log("【RunCmd】" + uploadData.sourcePath + " upload to----  【  " + uploadData.targetUrl + " 】");
+        }
+        s.Abort();
+    }
+
+    private void RunCmd(string key, string command)
+    {
+        Debug.Log(command);
+        File.WriteAllText(key + "-upload-language.bat", command, System.Text.Encoding.GetEncoding(936));
+        System.Diagnostics.Process.Start(key + "-upload-language.bat");
+    }
+}

+ 12 - 0
Assets/Script/Editor/EditorLanguageExport.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1a630e1c76824cf48b4a8a2d2715721d
+timeCreated: 1487575251
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 220 - 0
Assets/Script/Tool/Language.cs

@@ -0,0 +1,220 @@
+using UnityEngine;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Xml;
+
+public class Language
+{
+	public enum Enabled:int
+    {
+		ChineseSimplified = 0,
+		English = 1,
+		ChineseTraditional = 2,
+    }
+
+	public enum LangType
+	{
+		Public
+	}
+
+	public static string[] availableArr = new string[]{Enabled.ChineseSimplified.ToString(), Enabled.English.ToString(), Enabled.ChineseTraditional.ToString() };
+
+	private static SystemLanguage defaultLan = SystemLanguage.English;
+	private static XmlDocument xml;
+
+	public static string lan = SystemLanguage.English.ToString();
+    public static string lanForUI = SystemLanguage.English.ToString();
+
+    //	public static void Init (string lan)
+    //	{
+    //		Debug.Log("Init Language "+lan);
+    //
+    //        Language.lan = lan;
+    //
+    //		string path = "XML/Language/";
+    //        TextAsset textAsset = ResourcesUtil.GetInstance().GetTextAsset("XML/Language/" + lan);
+    //		if(textAsset == null)
+    //		{
+    //			Debug.LogError("Can not find language use default "+defaultLan);
+    //			textAsset = ResourcesUtil.GetInstance().GetTextAsset("XML/Language/"+defaultLan.ToString());
+    //			Language.lan = defaultLan.ToString();
+    //		}
+    //
+    //		if(xml == null)
+    //			xml = new XmlDocument();
+    //		xml.LoadXml(text);
+    //	}
+
+    public static bool initialized
+	{
+		get{
+			return xml != null;
+		}
+	}
+
+	public static void LoadFromResource()
+	{
+		//TextAsset textasset = ResourcesManager.Instance.LoadConfig("xml/lan", lan);
+		xml = new XmlDocument ();
+		//xml.LoadXml (textasset.text);
+	}
+
+	public static void Load(System.Action callBack)
+	{
+		//Language.lan = GetSpecifiedLang();
+//		ResourcesManager.Instance.LoadAsset<TextAsset> ("xml/lan", lan, (objs) => {
+//			if (objs != null && objs.Length > 0 && objs[0] != null) {
+//				xml = new XmlDocument ();
+//				xml.LoadXml ((objs[0] as TextAsset).text);
+////				Debug.LogError("bundleLoad-->"+(objs[0] as TextAsset).text);
+//			} else {
+//				TextAsset textasset = ResourcesManager.Instance.LoadConfig("xml/lan", lan);
+//				xml = new XmlDocument ();
+//				xml.LoadXml (textasset.text);
+////				Debug.LogError("resourceLoad-->"+(textasset.text));
+//			} 
+//			callBack();
+//		});
+
+
+//		AssetBundleLoader.Load(path, lan.ToString(), typeof(TextAsset), (object asset)=>{
+//			xml = new XmlDocument();
+//			xml.LoadXml((asset as TextAsset).text);
+////			AssetBundleUtil.GetInstance().GetFont(AssetBundleUtil.Url.Font, lan.ToString(), (Font assetFont)=>{
+////				font = assetFont;
+////			});
+//			font = ResourcesUtil.GetInstance().GetFont(ResourcesUtil.Url.Font, lan);
+////			font = ResourcesUtil.GetInstance().GetFont(ResourcesUtil.Url.Font, Enabled.Chinese.ToString());
+//			callBack();
+//		}, true);
+	}
+	/// <summary>
+	/// 替换字符获取新的字符串
+	/// </summary>
+	/// <param name="old">需要替换的字符串</param>
+	/// <param name="_replace">替换的数组</param>
+	/// <returns></returns>
+	public static string GetReplacedText(string old, params System.Object[] _replace)
+	{
+		if (old == "" || old == null) return "";
+		string replaceStr = old;
+		int length = _replace.Length;
+		for (int i = 0; i < length; i++)
+		{
+			replaceStr = replaceStr.Replace("_$" + i + "_", _replace[i].ToString());
+		}
+		return replaceStr;
+	}
+
+	public static string GetStr(string id,LangType type = LangType.Public)
+	{
+		return GetStr (type.ToString(),id);
+	}
+	
+	public static string GetStr(string page, string id)
+	{
+		if(xml == null) 
+		{
+			Debug.LogError("Language not init");
+			return "Language not init";
+        }
+
+        try
+		{
+			XmlNode pageNode = xml.SelectSingleNode("lan/"+page);
+			XmlNode node = pageNode.SelectSingleNode(id);
+			if(node != null)
+				return node.InnerText.Replace("\\n", "\n");
+		}
+		catch(Exception e)
+		{
+			Debug.LogException(e);
+		}
+
+		string error = "Topic missing page["+page+"] id["+id+"]";
+		Debug.LogError(error);
+		return error;
+	}
+
+	private static Font defaultFont;
+	private static Font font;
+
+    public static Font GetFont()
+    {
+		if (xml == null || font == null)
+        {
+			if(defaultFont == null)
+			{
+				Debug.LogError("Language not init");
+                defaultFont = Font.CreateDynamicFontFromOSFont("Arial", 20);
+            }
+            return defaultFont;
+        }
+		return font;
+        //return "Fonts/" + SystemLanguage.ChineseTraditional.ToString();
+        //return "Fonts/" + SystemLanguage.Chinese.ToString();
+    }
+
+    public static Font GetFont(Enabled font)
+    {
+		return null;
+        //return ResourcesUtil.GetInstance().GetFont(ResourcesUtil.Url.Font, font.ToString());
+    }
+
+    public static Font GetSystemFont()
+    {
+        return Font.CreateDynamicFontFromOSFont("Arial", 20);
+    }
+
+    public static Font GetNumberFont()
+    {
+		return null;
+        //return ResourcesUtil.GetInstance().GetFont(ResourcesUtil.Url.Font, "Number");
+    }
+
+	public static string GetSpecifiedLang1()
+    {
+        string language = "";
+        if (Application.systemLanguage.ToString() == SystemLanguage.ChineseSimplified.ToString())
+            language = SystemLanguage.Chinese.ToString();
+        else
+            language = Application.systemLanguage.ToString();
+
+        if (!isInEnabled(language))
+            language = defaultLan.ToString();
+
+#if UNITY_EDITOR || UNITY_STANDALONE
+        language = SystemLanguage.English.ToString();
+#endif
+
+//		language = SystemLanguage.Chinese.ToString();
+		language = SystemLanguage.English.ToString();
+
+        return language;
+
+    }
+
+    private static bool isInEnabled(string value)
+    {
+        bool isIn = false;
+        foreach (string name in Enum.GetNames(typeof(Enabled)))
+        {
+            if (value == name)
+                return true;
+        }
+        return isIn;
+    }
+
+    public static bool IsLanguageInit()
+    {
+        return (xml == null) ? false : true;
+    }
+
+    public static string GetLanguagePath()
+    {
+        return "XML/lan/" + lan;
+    }
+
+}
+

+ 12 - 0
Assets/Script/Tool/Language.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: fb1b44a74d6a069489693f106621f458
+timeCreated: 1487576539
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/XlsxSource/language_config.xlsx


+ 8 - 0
Assets/XlsxSource/language_config.xlsx.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2ccfb608b4fbf4048b0b7d51f4e9901f
+timeCreated: 1487576148
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Library/ScriptAssemblies/Assembly-CSharp-Editor.dll


BIN
Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb


BIN
Library/ScriptAssemblies/Assembly-CSharp.dll


BIN
Library/ScriptAssemblies/Assembly-CSharp.dll.mdb


BIN
Library/UnityAssemblies/UnityEditor.Advertisements.dll


BIN
Library/UnityAssemblies/UnityEditor.Analytics.dll


BIN
Library/UnityAssemblies/UnityEditor.Android.Extensions.dll


BIN
Library/UnityAssemblies/UnityEditor.EditorTestsRunner.dll


BIN
Library/UnityAssemblies/UnityEditor.Graphs.dll


BIN
Library/UnityAssemblies/UnityEditor.HoloLens.dll


BIN
Library/UnityAssemblies/UnityEditor.Networking.dll


BIN
Library/UnityAssemblies/UnityEditor.PlaymodeTestsRunner.dll


BIN
Library/UnityAssemblies/UnityEditor.TreeEditor.dll


BIN
Library/UnityAssemblies/UnityEditor.UI.dll


BIN
Library/UnityAssemblies/UnityEditor.VR.dll


BIN
Library/UnityAssemblies/UnityEditor.WebGL.Extensions.dll


BIN
Library/UnityAssemblies/UnityEditor.WindowsStandalone.Extensions.dll


BIN
Library/UnityAssemblies/UnityEditor.iOS.Extensions.Common.dll


BIN
Library/UnityAssemblies/UnityEditor.iOS.Extensions.Xcode.dll


BIN
Library/assetDatabase3