/// <summary> /// Loads the script. /// </summary> /// <returns>The script.</returns> /// <param name="fn">Fn.</param> public static byte[] LoadScript(string fn, ref string str) { fn = fn.Replace(".", "/"); #if UNITY_STANDALONE || UNITY_EDITOR XBufferAsset asset = ScriptableObject.CreateInstance <XBufferAsset>(); // find config source code string filePath = System.IO.Path.Combine(Application.dataPath, string.Format("Config/{0}.lua", fn)); if (!System.IO.File.Exists(filePath)) { // find logic script filePath = System.IO.Path.Combine(Application.dataPath, string.Format("Code/Script/{0}.lua", fn)); if (!System.IO.File.Exists(filePath)) { string bytefn = fn.Replace("/", "@").ToLower(); // find lua byte code filePath = System.IO.Path.Combine(Application.dataPath, string.Format("Bytecode/{0}/{1}.bytes", platformPath, bytefn)); } } #if !RELEASE GLog.Log(string.Format("{0}", filePath)); #endif if (System.IO.File.Exists(filePath)) { System.IO.FileStream fs = System.IO.File.OpenRead(filePath); asset.init((int)fs.Length); fs.Read(asset.bytes, 0, (int)fs.Length); fs.Close(); return(asset.bytes); } else { Debug.LogError("can't find file : " + filePath); } #else string bytefn = fn.Replace("/", "@").ToLower(); string hashfn = XUtility.Md5Sum(string.Format("{0}/{1}", platformPath, bytefn)); XBufferAsset asset = XBytecodeFilePicker.LoadBytecodeAsset(string.Format("bytecode/{0}", hashfn)); if (asset != null) { return(asset.bytes); } else { Debug.LogError("Can't load bytecode " + platformPath + " " + bytefn); } #endif return(null); }
private void Awake() { Debuger.Info(XUtility.Md5Sum(base.get_gameObject().get_name()), new object[0]); }