コード例 #1
0
ファイル: LoadConfig.cs プロジェクト: clime57/Stars
    void DataCallBackHandler(AssetBundleInfo info)
    {
        TextAsset textAsset = info.mainObject as TextAsset;

        if (textAsset == null)
        {
            Debug.LogError("can not found this table:" + configType);
            return;
        }
        TyLogger.Log("ConfigCollect.CONFIG_ARRAY:" + configType);
        IFormatter formatter = new BinaryFormatter();

        formatter.Binder = new UBinder();
        MemoryStream stream = new MemoryStream(textAsset.bytes);

        object[]  dataArr    = formatter.Deserialize(stream) as object[];
        IConfig[] iConfigArr = Array.ConvertAll <object, IConfig>(dataArr, delegate(object s) { return(s as IConfig); });
        ConfigDataManager.addConfigData(configType, iConfigArr);
        stream.Close();
        _loadProgress = 1.0f;
        _loadState    = 3;
    }