コード例 #1
0
ファイル: MetaLoader.cs プロジェクト: boy3050/BetterFramework
    public static T LoadPBData(string name, bool useZip = false)
    {
        MLResourceManager resMgr    = MLResourceManager.Instance;
        TextAsset         textAsset = resMgr.LoadResource(name, ResourceType.RES_META_DATAS) as TextAsset;

        if (textAsset == null)
        {
            Debug.LogError("load prototype data error!!!");
            return(default(T));
        }

        T t = default(T);

        byte[] datas = textAsset.bytes;
        if (useZip)
        {
            t = DeserializePBClassWithGZip(datas);
        }
        else
        {
            t = DeserializePBClass(datas);
        }

        resMgr.UnloadResource(name);
        return(t);
    }
コード例 #2
0
    byte[] ReadDownLoadFile(string fileName)
    {
        if (!fileName.EndsWith(".lua"))
        {
            fileName = string.Format("{0}.lua", fileName);
        }

        MLResourceManager resMgr = MLResourceManager.Instance;
        TextAsset         asset  = resMgr.LoadResource(fileName, ResourceType.RES_LUA) as TextAsset;

        byte[] ret = asset.bytes;
        resMgr.UnloadResource(fileName, true);

//         byte[] ret = null;
//         resMgr.LoadResourceAsync(fileName, (_obj) =>
//         {
//             TextAsset asset = _obj as TextAsset;
//             ret = asset.bytes;
//
//         }, ResourceType.RES_LUA);
//
//         resMgr.UnloadResource(fileName, true);
        return(ret);
    }