示例#1
0
    public static void ParseData(string content, string fileName)
    {
        metaData = new Dictionary <int, SoundAssetsData> ();

        CSVParser parser = new CSVParser();

        if (!parser.Parse(content))
        {
            ClientLog.Instance.LogError("UIAssetsData" + ConfigLoader.Instance.csvext + "解析错误");
            return;
        }

        int             recordCounter = parser.GetRecordCounter();
        SoundAssetsData data          = null;

        for (int i = 0; i < recordCounter; ++i)
        {
            data             = new SoundAssetsData();
            data.id_         = parser.GetInt(i, "ID");
            data.assetsName_ = parser.GetString(i, "AssetName");
            if (metaData.ContainsKey(data.id_))
            {
                ClientLog.Instance.LogError("UIAssetsData" + ConfigLoader.Instance.csvext + "ID重复");
                return;
            }
            metaData[data.id_] = data;
        }
        parser.Dispose();
        parser = null;
    }
示例#2
0
    public string GetAssetsName(int AssetsID, AssetLoader.EAssetType Type)
    {
        string AssetsName = "";

        if (Type == AssetLoader.EAssetType.ASSET_EFFECT)
        {
            EffectAssetsData AssetsData = EffectAssetsData.GetData(AssetsID);
            if (null == AssetsData)
            {
                return("");
            }
            AssetsName = AssetsData.assetsName_;
        }
        else if (Type == AssetLoader.EAssetType.ASSET_PLAYER ||
                 Type == AssetLoader.EAssetType.ASSET_WEAPON)
        {
            EntityAssetsData AssetsData = EntityAssetsData.GetData(AssetsID);
            if (null == AssetsData)
            {
                return("");
            }
            AssetsName = AssetsData.assetsName_;
        }
        else if (Type == AssetLoader.EAssetType.ASSET_UI)
        {
            UIAssetsData AssetsData = UIAssetsData.GetData(AssetsID);
            if (null == AssetsData)
            {
                return("");
            }
            AssetsName = AssetsData.assetsName_;
        }
        else if (Type == AssetLoader.EAssetType.ASSET_SOUND)
        {
            SoundAssetsData AssetsData = SoundAssetsData.GetData(AssetsID);
            if (null == AssetsData)
            {
                return("");
            }
            AssetsName = AssetsData.assetsName_;
        }
        else if (Type == AssetLoader.EAssetType.ASSET_MUSIC)
        {
            MusicAssetsData AssetsData = MusicAssetsData.GetData(AssetsID);
            if (null == AssetsData)
            {
                return("");
            }
            AssetsName = AssetsData.assetsName_;
        }

        return(AssetsName);
    }