Beispiel #1
0
    private byte[] StreamingLoader(ref string szFileName)
    {
        string szFilePath = "";

#if (UNITY_EDITOR && DEVELOP_VERSION) || UNITY_WEBGL
        szFilePath = Globals.streamingPath + "/Lua/" + szFileName;
#else
        szFilePath = Globals.persistenPath + "/Lua/" + szFileName;
#endif

        string ext = System.IO.Path.GetExtension(szFilePath).ToLower();
        if (!ext.Equals("lua"))
        {
            szFilePath += ".lua";
        }

        if (!System.IO.File.Exists(szFilePath))
        {
            SampleDebuger.LogColorAquamarine("can't find file " + szFilePath);
            return(null);
        }

        SampleDebuger.LogColorAquamarine(szFilePath);

        return(System.IO.File.ReadAllBytes(szFilePath));
        //return System.Text.ASCIIEncoding.UTF8.GetBytes(System.IO.File.ReadAllText(szFilePath));
    }