Example #1
0
        static void SwfFileProcess(string swf_path)
        {
            var swf_hash       = SwfEditorUtils.GetFileHashWithVersion(swf_path);
            var swf_asset_path = Path.ChangeExtension(swf_path, ".asset");

            SwfEditorUtils.LoadOrCreateAsset <SwfAsset>(swf_asset_path, (swf_asset, created) => {
                if (!string.IsNullOrEmpty(swf_asset.Hash) && swf_asset.Hash == swf_hash)
                {
                    return(true);
                }
                else if (created)
                {
                    var default_settings = SwfEditorUtils.GetSettingsHolder().Settings;
                    swf_asset.Settings   = default_settings;
                    swf_asset.Overridden = default_settings;
                }
                return(SafeLoadSwfAsset(swf_path, swf_hash, swf_asset));
            });
        }
        static void ConfigureClip(SwfAsset asset, SwfAssetData data, SwfSymbolData symbol)
        {
            var asset_guid  = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset));
            var clip_assets = SwfEditorUtils.LoadAllAssetsDBByFilter <SwfClipAsset>("t:SwfClipAsset")
                              .Where(p => p.AssetGUID == asset_guid && p.Name == symbol.Name);

            if (clip_assets.Any())
            {
                foreach (var clip_asset in clip_assets)
                {
                    ConfigureClipAsset(clip_asset, asset, data, symbol);
                }
            }
            else
            {
                var asset_path      = AssetDatabase.GetAssetPath(asset);
                var clip_asset_path = Path.ChangeExtension(asset_path, symbol.Name + ".asset");
                SwfEditorUtils.LoadOrCreateAsset <SwfClipAsset>(clip_asset_path, (new_clip_asset, created) => {
                    ConfigureClipAsset(new_clip_asset, asset, data, symbol);
                    return(true);
                });
            }
        }