mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 22:19:31 +07:00
Compare commits
12 Commits
versions/1
...
versions/1
| Author | SHA1 | Date | |
|---|---|---|---|
| df364244b4 | |||
| 5012b53ac1 | |||
| b7e026e8ff | |||
| 4df50242cc | |||
| 3f4fc9f8aa | |||
| 1976d315c4 | |||
| 1abb0878b9 | |||
| 294c6bba91 | |||
| df9d7ccd43 | |||
| 8981016d57 | |||
| bc8ea51463 | |||
| ce4c644ef2 |
0
.projectile
Normal file
0
.projectile
Normal file
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e3bddf96333643c8a12fd862ebc9ec7
|
||||
guid: 2d8762b6bff92457aa59aaf03193018c
|
||||
folderAsset: yes
|
||||
timeCreated: 1480709542
|
||||
timeCreated: 1487860932
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Elefun/open.fla
Normal file
BIN
Assets/DevTests/Animations/AlphaTests/Elefun/open.fla
Normal file
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffe731bf74d034b948a5ec392ba8e284
|
||||
timeCreated: 1476541234
|
||||
guid: d481c08b811dc41eda079968a32efbb9
|
||||
timeCreated: 1487860937
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/FlashTools/Docs/CHANGELOG.md
Normal file
71
Assets/FlashTools/Docs/CHANGELOG.md
Normal file
@@ -0,0 +1,71 @@
|
||||
###### Version 1.3.7
|
||||
* Fix multiple import
|
||||
* Fix single frame optimization
|
||||
|
||||
###### Version 1.3.6
|
||||
* Fix for scale very small vector items
|
||||
* Big vector item optimization
|
||||
* More yield instructions and extensions
|
||||
|
||||
###### Version 1.3.5
|
||||
* Fix sprite import problem
|
||||
|
||||
###### Version 1.3.4
|
||||
* Fix CS6 export problem
|
||||
* Fix unity postprocessor problems
|
||||
|
||||
###### Version 1.3.3
|
||||
* Fix undefined unusedItems in CS6
|
||||
|
||||
###### Version 1.3.2
|
||||
* Fix bug custom scale export with small items optimization
|
||||
|
||||
###### Version 1.3.1
|
||||
* Fix some Unity 5.5 deprecated functions
|
||||
|
||||
###### Version 1.3.0
|
||||
* ETC separated alpha support
|
||||
* Export animations with custom scale (for retina)
|
||||
* New small vector scaled items optimization
|
||||
|
||||
###### Version 1.2.0
|
||||
* Add Yield instructions for wait in coroutines(SwfWaitPlayStopped, SwfWaitRewindPlaying, SwfWaitStopPlaying)
|
||||
* Add unscaled delta time support(for separate animations, groups of animations or for all)
|
||||
* Fix guide type flash layers
|
||||
* Some fixes for reconvert asset problem
|
||||
|
||||
###### Version 1.1.1
|
||||
* Add conversion error by shape tween in CS6
|
||||
* Fix life after death (problem about destroying with big lag by frame event)
|
||||
|
||||
###### Version 1.1.0
|
||||
* Sequence separator is anchor frame label (not common frame label)
|
||||
* SwfClip access to frame labels (currentLabelCount, GetCurrentFrameLabel)
|
||||
* SwfClip events (OnChangeClipEvent, OnChangeSequenceEvent, OnChangeCurrentFrameEvent)
|
||||
|
||||
###### Version 1.0.0
|
||||
* Initial asset store version
|
||||
* Sources to dll
|
||||
* Palette bitmaps support
|
||||
|
||||
###### Version 0.5.0
|
||||
* Flash optimizer twicks
|
||||
* Blending modes (except Alpha and Erase)
|
||||
|
||||
###### Version 0.4.0
|
||||
* Clip groups
|
||||
* Fix move assets bug
|
||||
* Tint color for clips
|
||||
* Animation API improvements
|
||||
|
||||
###### Version 0.3.0
|
||||
* Preview for animation assets and clips
|
||||
* Animation API improvements
|
||||
* Memory optimizations
|
||||
|
||||
###### Version 0.2.0
|
||||
* Export optimizations
|
||||
* Export clips with export names
|
||||
|
||||
###### Version 0.1.0
|
||||
* Initial alpha version
|
||||
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfa1591b561424bf6a952fcb68bebbc0
|
||||
timeCreated: 1472651507
|
||||
guid: 309e798efeb2741c6853f2402363a067
|
||||
timeCreated: 1487174180
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,77 +0,0 @@
|
||||
-- Version 1.3.5 --
|
||||
|
||||
Fix sprite import problem
|
||||
|
||||
-- Version 1.3.4 --
|
||||
|
||||
Fix CS6 export problem
|
||||
Fix unity postprocessor problems
|
||||
|
||||
-- Version 1.3.3 --
|
||||
|
||||
Fix undefined unusedItems in CS6
|
||||
|
||||
-- Version 1.3.2 --
|
||||
|
||||
Fix bug custom scale export with small items optimization
|
||||
|
||||
-- Version 1.3.1 --
|
||||
|
||||
Fix some Unity 5.5 deprecated functions
|
||||
|
||||
-- Version 1.3.0 --
|
||||
|
||||
ETC separated alpha support
|
||||
Export animations with custom scale (for retina)
|
||||
New small vector scaled items optimization
|
||||
|
||||
-- Version 1.2.0 --
|
||||
|
||||
Add Yield instructions for wait in coroutines(SwfWaitPlayStopped, SwfWaitRewindPlaying, SwfWaitStopPlaying)
|
||||
Add unscaled delta time support(for separate animations, groups of animations or for all)
|
||||
Fix guide type flash layers
|
||||
Some fixes for reconvert asset problem
|
||||
|
||||
-- Version 1.1.1 --
|
||||
|
||||
Add conversion error by shape tween in CS6
|
||||
Fix life after death (problem about destroying with big lag by frame event)
|
||||
|
||||
-- Version 1.1.0 --
|
||||
|
||||
Sequence separator is anchor frame label (not common frame label)
|
||||
SwfClip access to frame labels (currentLabelCount, GetCurrentFrameLabel)
|
||||
SwfClip events (OnChangeClipEvent, OnChangeSequenceEvent, OnChangeCurrentFrameEvent)
|
||||
|
||||
-- Version 1.0.0 --
|
||||
|
||||
Initial asset store version
|
||||
Sources to dll
|
||||
Palette bitmaps support
|
||||
|
||||
-- Version 0.5.0 --
|
||||
|
||||
Flash optimizer twicks
|
||||
Blending modes (except Alpha and Erase)
|
||||
|
||||
-- Version 0.4.0 --
|
||||
|
||||
Clip groups
|
||||
Fix move assets bug
|
||||
Tint color for clips
|
||||
Animation API improvements
|
||||
|
||||
-- Version 0.3.0 --
|
||||
|
||||
Preview for animation assets and clips
|
||||
Animation API improvements
|
||||
Memory optimizations
|
||||
|
||||
-- Version 0.2.0 --
|
||||
|
||||
Export optimizations
|
||||
Export clips with export names
|
||||
|
||||
-- Version 0.1.0 --
|
||||
|
||||
Initial alpha version
|
||||
33
Assets/FlashTools/Docs/README.md
Normal file
33
Assets/FlashTools/Docs/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
##### Flash Animation Toolset
|
||||
|
||||
Convert your flash animation for Unity easy!
|
||||
|
||||
* [Usage video](http://www.youtube.com/watch?v=uE_XRWZ5KHA)
|
||||
|
||||
* [Blog](http://matov.me)
|
||||
* [Site](http://matov.me/flash-animation-toolset)
|
||||
* [Web demo](http://matov.me/public/blog_share/flash_tools/web_demo)
|
||||
* [User guide](http://matov.me/flash-animation-toolset-user-guide)
|
||||
|
||||
* [Trial version](https://www.assetstore.unity3d.com/#!/content/73896)
|
||||
* [Full version](https://www.assetstore.unity3d.com/#!/content/73323)
|
||||
|
||||
###### Features
|
||||
* Support all transformations like 'rotation', 'skew' and 'scale' (except 3D)
|
||||
* Support all tweens(classic, motion and etc), keyframes and layers
|
||||
* Support mask layers
|
||||
* Support bitmap and vector graphics
|
||||
* Support all clip color effects like 'brightness', 'tint', 'alpha' and etc
|
||||
* Support most blending modes (all except Alpha and Erase)
|
||||
* Simple runtime API for controlling your animations in Unity
|
||||
* Automatic packing texture atlases of animations with different settings
|
||||
* Great performance with zero allocations in update loop
|
||||
* Frame labels to separate sequences in one timeline
|
||||
* Export marked "for export" clips and main timeline
|
||||
* Live preview of animations in the Unity editor
|
||||
|
||||
Supports Unity 5.3 and newer, both Personal and Pro. Full C# source code included.
|
||||
|
||||
Leave your rating for this Asset. It is very important for me and the development of the project :) Thank you!
|
||||
|
||||
Samples use "Creative Commons CC0 1.0 Universal License" animations from [Glitch game](http://www.glitchthegame.com/public-domain-game-art)
|
||||
8
Assets/FlashTools/Docs/README.md.meta
Normal file
8
Assets/FlashTools/Docs/README.md.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67cb565c063ff409697ad8b538d2a46a
|
||||
timeCreated: 1487174181
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
-----------------------------
|
||||
-- Flash Animation Toolset --
|
||||
-----------------------------
|
||||
|
||||
Convert your flash animation for Unity easy!
|
||||
|
||||
- Usage video "http://www.youtube.com/watch?v=uE_XRWZ5KHA"
|
||||
|
||||
- Blog "http://matov.me"
|
||||
- Site "http://matov.me/flash-animation-toolset"
|
||||
- Web demo "http://matov.me/public/blog_share/flash_tools/web_demo"
|
||||
- User guide "http://matov.me/flash-animation-toolset-user-guide"
|
||||
|
||||
- Trial version https://www.assetstore.unity3d.com/#!/content/73896
|
||||
- Full version https://www.assetstore.unity3d.com/#!/content/73323
|
||||
|
||||
Features
|
||||
- Support all transformations like 'rotation', 'skew' and 'scale' (except 3D)
|
||||
- Support all tweens(classic, motion and etc), keyframes and layers
|
||||
- Support mask layers
|
||||
- Support bitmap and vector graphics
|
||||
- Support all clip color effects like 'brightness', 'tint', 'alpha' and etc
|
||||
- Support most blending modes (all except Alpha and Erase)
|
||||
- Simple runtime API for controlling your animations in Unity
|
||||
- Automatic packing texture atlases of animations with different settings
|
||||
- Great performance with zero allocations in update loop
|
||||
- Frame labels to separate sequences in one timeline
|
||||
- Export marked "for export" clips and main timeline
|
||||
- Live preview of animations in the Unity editor
|
||||
|
||||
Supports Unity 5.3 and newer, both Personal and Pro. Full C# source code included.
|
||||
|
||||
Leave your rating for this Asset. It is very important for me and the development of the project :) Thank you!
|
||||
|
||||
Samples use "Creative Commons CC0 1.0 Universal License" animations from Glitch game "http://www.glitchthegame.com/public-domain-game-art"
|
||||
@@ -18,22 +18,25 @@ namespace FlashTools.Examples {
|
||||
|
||||
IEnumerator StartCoro(SwfClipController ctrl) {
|
||||
while ( true ) {
|
||||
ctrl.Play(_fadeInSequence);
|
||||
yield return new SwfWaitStopPlaying(ctrl);
|
||||
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(_fadeInSequence);
|
||||
for ( var i = 0; i < 3; ++i ) {
|
||||
var last_seq = ctrl.clip.sequence;
|
||||
do {
|
||||
var seq_index = Random.Range(0, _idleSequences.Length);
|
||||
ctrl.Play(_idleSequences[seq_index]);
|
||||
} while ( last_seq == ctrl.clip.sequence );
|
||||
yield return new SwfWaitStopPlaying(ctrl);
|
||||
var idle_seq = GetRandomIdleSequence(ctrl);
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(idle_seq);
|
||||
}
|
||||
|
||||
ctrl.Play(_fadeOutSequence);
|
||||
yield return new SwfWaitStopPlaying(ctrl);
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(_fadeOutSequence);
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
string GetRandomIdleSequence(SwfClipController ctrl) {
|
||||
var cur_seq = ctrl.clip.sequence;
|
||||
do {
|
||||
var seq_index = Random.Range(0, _idleSequences.Length);
|
||||
var new_sequence = _idleSequences[seq_index];
|
||||
if ( new_sequence != cur_seq ) {
|
||||
return new_sequence;
|
||||
}
|
||||
} while ( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,16 @@
|
||||
var ft = {
|
||||
profile_mode : false,
|
||||
verbose_mode : false,
|
||||
|
||||
graphics_scale : 1.0,
|
||||
scale_precision : 0.01,
|
||||
|
||||
optimize_big_items : true,
|
||||
optimize_small_items : true,
|
||||
optimize_static_items : true,
|
||||
optimize_single_graphics : true
|
||||
optimize_single_graphics : true,
|
||||
|
||||
export_path_postfix : "_export"
|
||||
};
|
||||
|
||||
//
|
||||
@@ -220,6 +226,7 @@
|
||||
ft.profile_function(function() { ftdoc.remove_unused_items(doc); }, "Remove unused items");
|
||||
ft.profile_function(function() { ftdoc.prepare_all_bitmaps(doc); }, "Prepare all bitmaps");
|
||||
ft.profile_function(function() { ftdoc.unlock_all_timelines(doc); }, "Unlock all timelines");
|
||||
ft.profile_function(function() { ftdoc.calculate_item_scales(doc); }, "Calculate item scales");
|
||||
ft.profile_function(function() { ftdoc.optimize_all_timelines(doc); }, "Optimize all timelines");
|
||||
ft.profile_function(function() { ftdoc.rasterize_all_shapes(doc); }, "Rasterize all shapes");
|
||||
ft.profile_function(function() { ftdoc.export_swf(doc); }, "Export swf");
|
||||
@@ -228,8 +235,7 @@
|
||||
ftdoc.get_temp = function (doc) {
|
||||
if (!ftdoc.hasOwnProperty("temp")) {
|
||||
ftdoc["temp"] = {
|
||||
x_max_scales : {},
|
||||
y_max_scales : {}
|
||||
max_scales : {}
|
||||
}
|
||||
}
|
||||
return ftdoc["temp"];
|
||||
@@ -239,16 +245,15 @@
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ft.graphics_scale;
|
||||
if (optional_item && ft.optimize_small_items) {
|
||||
var item_name = optional_item.name;
|
||||
var x_max_scales = ftdoc.get_temp(doc).x_max_scales;
|
||||
var y_max_scales = ftdoc.get_temp(doc).y_max_scales;
|
||||
if (x_max_scales.hasOwnProperty(item_name) && y_max_scales.hasOwnProperty(item_name)) {
|
||||
var max_x_scale = x_max_scales[item_name];
|
||||
var max_y_scale = y_max_scales[item_name];
|
||||
var max_c_scale = Math.max(max_x_scale, max_y_scale);
|
||||
if (max_c_scale < 1.0) {
|
||||
final_scale *= max_c_scale;
|
||||
if (optional_item && (ft.optimize_big_items || ft.optimize_small_items)) {
|
||||
var item_name = optional_item.name;
|
||||
var max_scales = ftdoc.get_temp(doc).max_scales;
|
||||
if (max_scales.hasOwnProperty(item_name)) {
|
||||
var max_scale = max_scales[item_name];
|
||||
var big_item = ft.optimize_big_items && (max_scale - ft.scale_precision > 1.0);
|
||||
var small_item = ft.optimize_small_items && (max_scale + ft.scale_precision < 1.0);
|
||||
if (big_item || small_item) {
|
||||
final_scale *= max_scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,15 +264,25 @@
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ftdoc.calculate_item_final_scale(doc, optional_item);
|
||||
if (ft.approximately(final_scale, 1.0, 0.01)) {
|
||||
if (ft.approximately(final_scale, 1.0, ft.scale_precision)) {
|
||||
doc.convertSelectionToBitmap();
|
||||
} else {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "center");
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "top left");
|
||||
fttim.recursive_scale_filters(doc, wrapper_item.timeline, final_scale);
|
||||
var elem = doc.selection[0];
|
||||
var elem_x = elem.x;
|
||||
var elem_y = elem.y;
|
||||
var elem_w = elem.width;
|
||||
var elem_h = elem.height;
|
||||
doc.scaleSelection(final_scale, final_scale);
|
||||
doc.convertSelectionToBitmap();
|
||||
doc.scaleSelection(1.0 / final_scale, 1.0 / final_scale);
|
||||
var new_elem = doc.selection[0];
|
||||
new_elem.x = elem_x;
|
||||
new_elem.y = elem_y;
|
||||
new_elem.width = elem_w;
|
||||
new_elem.height = elem_h;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -284,7 +299,7 @@
|
||||
ft.type_assert(doc, Document);
|
||||
return ft.combine_path(
|
||||
ft.escape_path(doc.pathURI),
|
||||
"_export/");
|
||||
ft.export_path_postfix + "/");
|
||||
};
|
||||
|
||||
ftdoc.full_exit_edit_mode = function (doc) {
|
||||
@@ -313,13 +328,72 @@
|
||||
fttim.unlock(doc.getTimeline());
|
||||
};
|
||||
|
||||
ftdoc.calculate_item_scales = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
|
||||
var max_scales = ftdoc.get_temp(doc).max_scales;
|
||||
|
||||
var walk_by_timeline = function(timeline, func, acc) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
walk_by_timeline(
|
||||
elem.libraryItem.timeline,
|
||||
func,
|
||||
func(elem, acc));
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
};
|
||||
|
||||
var walk_by_library = function(lib, func, acc) {
|
||||
ft.type_assert(lib, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(lib.items, function (item) {
|
||||
walk_by_timeline(item.timeline, func, acc)
|
||||
}, ftlib.is_symbol_item);
|
||||
};
|
||||
|
||||
var x_func = function(elem, acc) {
|
||||
var elem_sx = elem.scaleX * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
max_scales[item_name] = Math.max(
|
||||
max_scales.hasOwnProperty(item_name) ? max_scales[item_name] : elem_sx,
|
||||
elem_sx);
|
||||
return elem_sx;
|
||||
};
|
||||
|
||||
var y_func = function(elem, acc) {
|
||||
var elem_sy = elem.scaleY * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
max_scales[item_name] = Math.max(
|
||||
max_scales.hasOwnProperty(item_name) ? max_scales[item_name] : elem_sy,
|
||||
elem_sy);
|
||||
return elem_sy;
|
||||
};
|
||||
|
||||
walk_by_library(doc.library, x_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), x_func, 1.0);
|
||||
|
||||
walk_by_library(doc.library, y_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), y_func, 1.0);
|
||||
|
||||
if (ft.verbose_mode) {
|
||||
for (var item_name in max_scales) {
|
||||
var max_scale = max_scales.hasOwnProperty(item_name) ? max_scales[item_name] : 1.0;
|
||||
if (max_scale - ft.scale_precision > 1.0) {
|
||||
ft.trace_fmt("Big item for optimize: {0} - {1}", item_name, max_scale);
|
||||
} else if (max_scale + ft.scale_precision < 1.0) {
|
||||
ft.trace_fmt("Small item for optimize: {0} - {1}", item_name, max_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.optimize_all_timelines = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
if (ft.optimize_small_items) {
|
||||
ft.profile_function(function () {
|
||||
ftlib.optimize_small_items(doc, doc.library);
|
||||
}, "Optimize small items");
|
||||
}
|
||||
if (ft.optimize_static_items) {
|
||||
ft.profile_function(function () {
|
||||
ftlib.optimize_static_items(doc, doc.library);
|
||||
@@ -417,72 +491,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
ftlib.optimize_small_items = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
|
||||
var x_max_scales = ftdoc.get_temp(doc).x_max_scales;
|
||||
var y_max_scales = ftdoc.get_temp(doc).y_max_scales;
|
||||
|
||||
var walk_by_timeline = function(timeline, func, acc) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
walk_by_timeline(
|
||||
elem.libraryItem.timeline,
|
||||
func,
|
||||
func(elem, acc));
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
};
|
||||
|
||||
var walk_by_library = function(lib, func, acc) {
|
||||
ft.type_assert(lib, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(lib.items, function (item) {
|
||||
walk_by_timeline(item.timeline, func, acc)
|
||||
}, ftlib.is_symbol_item);
|
||||
};
|
||||
|
||||
var x_func = function(elem, acc) {
|
||||
var elem_sx = elem.scaleX * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
x_max_scales[item_name] = Math.max(
|
||||
x_max_scales.hasOwnProperty(item_name) ? x_max_scales[item_name] : elem_sx,
|
||||
elem_sx);
|
||||
return elem_sx;
|
||||
};
|
||||
|
||||
var y_func = function(elem, acc) {
|
||||
var elem_sy = elem.scaleY * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
y_max_scales[item_name] = Math.max(
|
||||
y_max_scales.hasOwnProperty(item_name) ? y_max_scales[item_name] : elem_sy,
|
||||
elem_sy);
|
||||
return elem_sy;
|
||||
};
|
||||
|
||||
walk_by_library(library, x_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), x_func, 1.0);
|
||||
|
||||
walk_by_library(library, y_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), y_func, 1.0);
|
||||
|
||||
if (ft.verbose_mode) {
|
||||
for (var item_name in x_max_scales) {
|
||||
var max_x_scale = x_max_scales.hasOwnProperty(item_name) ? x_max_scales[item_name] : 1.0;
|
||||
var max_y_scale = y_max_scales.hasOwnProperty(item_name) ? y_max_scales[item_name] : 1.0;
|
||||
var max_c_scale = Math.max(max_x_scale, max_y_scale);
|
||||
if (max_c_scale < 1.0) {
|
||||
ft.trace_fmt("Small item for optimize: {0} - {1}", item_name, max_c_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ftlib.optimize_static_items = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
@@ -556,6 +564,7 @@
|
||||
new_item_elem.transformX = 0;
|
||||
new_item_elem.transformY = 0;
|
||||
ftdoc.convert_selection_to_bitmap(doc, item);
|
||||
doc.exitEditMode();
|
||||
return true;
|
||||
} else {
|
||||
doc.exitEditMode();
|
||||
|
||||
@@ -24,8 +24,9 @@ namespace FTEditor.Postprocessors {
|
||||
.Select(p => AssetDatabase.LoadAssetAtPath<SwfAsset>(p))
|
||||
.Where(p => !!p);
|
||||
foreach ( var asset in assets ) {
|
||||
var asset_copy = asset;
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfAssetProcess(asset);
|
||||
SwfAssetProcess(asset_copy);
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
@@ -196,7 +197,6 @@ namespace FTEditor.Postprocessors {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
static void ConfigureAtlas(SwfAsset asset) {
|
||||
var atlas_path = AssetDatabase.GetAssetPath(asset.Atlas);
|
||||
var atlas_importer = GetBitmapsAtlasImporter(asset);
|
||||
atlas_importer.textureType = TextureImporterType.Sprite;
|
||||
atlas_importer.spriteImportMode = SpriteImportMode.Single;
|
||||
@@ -208,8 +208,7 @@ namespace FTEditor.Postprocessors {
|
||||
#else
|
||||
atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
|
||||
#endif
|
||||
AssetDatabase.WriteImportSettingsIfDirty(atlas_path);
|
||||
AssetDatabase.ImportAsset(atlas_path);
|
||||
atlas_importer.SaveAndReimport();
|
||||
}
|
||||
|
||||
static TextureImporter GetBitmapsAtlasImporter(SwfAsset asset) {
|
||||
|
||||
@@ -32,8 +32,9 @@ namespace FTEditor.Postprocessors {
|
||||
EditorUtility.DisplayDialog(title, message, "Ok");
|
||||
} else {
|
||||
foreach ( var swf_path in swf_paths ) {
|
||||
var swf_path_copy = swf_path;
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfFileProcess(swf_path);
|
||||
SwfFileProcess(swf_path_copy);
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
|
||||
250
Assets/FlashTools/Scripts/FTRuntime/Yields/SwfWaitExtensions.cs
Normal file
250
Assets/FlashTools/Scripts/FTRuntime/Yields/SwfWaitExtensions.cs
Normal file
@@ -0,0 +1,250 @@
|
||||
namespace FTRuntime.Yields {
|
||||
public static class SwfWaitExtensions {
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// WaitFor[Event]
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Yield instruction for wait animation stop event</summary>
|
||||
/// <returns>Yield instruction for wait animation stop event</returns>
|
||||
/// <param name="ctrl">The controller</param>
|
||||
public static SwfWaitStopPlaying WaitForStopPlaying(
|
||||
this SwfClipController ctrl)
|
||||
{
|
||||
return new SwfWaitStopPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Yield instruction for wait animation rewind event</summary>
|
||||
/// <returns>Yield instruction for wait animation rewind event</returns>
|
||||
/// <param name="ctrl">The controller</param>
|
||||
public static SwfWaitRewindPlaying WaitForRewindPlaying(
|
||||
this SwfClipController ctrl)
|
||||
{
|
||||
return new SwfWaitRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Yield instruction for wait animation stop or rewind event</summary>
|
||||
/// <returns>Yield instruction for wait animation stop or rewind event</returns>
|
||||
/// <param name="ctrl">The controller</param>
|
||||
public static SwfWaitStopOrRewindPlaying WaitForStopOrRewindPlaying(
|
||||
this SwfClipController ctrl)
|
||||
{
|
||||
return new SwfWaitStopOrRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Yield instruction for wait animation play event</summary>
|
||||
/// <returns>Yield instruction for wait animation play event</returns>
|
||||
/// <param name="ctrl">The controller</param>
|
||||
public static SwfWaitPlayStopped WaitForPlayStopped(
|
||||
this SwfClipController ctrl)
|
||||
{
|
||||
return new SwfWaitPlayStopped(ctrl);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// PlayAndWait[Event]
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Play with specified rewind action</summary>
|
||||
/// <returns>Yield instruction for wait animation stop event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="rewind">If set to <c>true</c> rewind animation to begin frame</param>
|
||||
public static SwfWaitStopPlaying PlayAndWaitStop(
|
||||
this SwfClipController ctrl, bool rewind)
|
||||
{
|
||||
ctrl.Play(rewind);
|
||||
return WaitForStopPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and play controller with rewind</summary>
|
||||
/// <returns>Yield instruction for wait animation stop event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
public static SwfWaitStopPlaying PlayAndWaitStop(
|
||||
this SwfClipController ctrl, string sequence)
|
||||
{
|
||||
ctrl.Play(sequence);
|
||||
return WaitForStopPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Play with specified rewind action</summary>
|
||||
/// <returns>Yield instruction for wait animation rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="rewind">If set to <c>true</c> rewind animation to begin frame</param>
|
||||
public static SwfWaitRewindPlaying PlayAndWaitRewind(
|
||||
this SwfClipController ctrl, bool rewind)
|
||||
{
|
||||
ctrl.Play(rewind);
|
||||
return WaitForRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and play controller with rewind</summary>
|
||||
/// <returns>Yield instruction for wait animation rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
public static SwfWaitRewindPlaying PlayAndWaitRewind(
|
||||
this SwfClipController ctrl, string sequence)
|
||||
{
|
||||
ctrl.Play(sequence);
|
||||
return WaitForRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Play with specified rewind action</summary>
|
||||
/// <returns>Yield instruction for wait animation stop or rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="rewind">If set to <c>true</c> rewind animation to begin frame</param>
|
||||
public static SwfWaitStopOrRewindPlaying PlayAndWaitStopOrRewind(
|
||||
this SwfClipController ctrl, bool rewind)
|
||||
{
|
||||
ctrl.Play(rewind);
|
||||
return WaitForStopOrRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and play controller with rewind</summary>
|
||||
/// <returns>Yield instruction for wait animation stop or rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
public static SwfWaitStopOrRewindPlaying PlayAndWaitStopOrRewind(
|
||||
this SwfClipController ctrl, string sequence)
|
||||
{
|
||||
ctrl.Play(sequence);
|
||||
return WaitForStopOrRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// GotoAndPlayAndWait[Event]
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Changes the animation frame with plays it</summary>
|
||||
/// <returns>Yield instruction for wait animation stop event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitStopPlaying GotoAndPlayAndWaitStop(
|
||||
this SwfClipController ctrl, int frame)
|
||||
{
|
||||
ctrl.GotoAndPlay(frame);
|
||||
return WaitForStopPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and frame with plays it</summary>
|
||||
/// <returns>Yield instruction for wait animation stop event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitStopPlaying GotoAndPlayAndWaitStop(
|
||||
this SwfClipController ctrl, string sequence, int frame)
|
||||
{
|
||||
ctrl.GotoAndPlay(sequence, frame);
|
||||
return WaitForStopPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation frame with plays it</summary>
|
||||
/// <returns>Yield instruction for wait animation rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitRewindPlaying GotoAndPlayAndWaitRewind(
|
||||
this SwfClipController ctrl, int frame)
|
||||
{
|
||||
ctrl.GotoAndPlay(frame);
|
||||
return WaitForRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and frame with plays it</summary>
|
||||
/// <returns>Yield instruction for wait animation rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitRewindPlaying GotoAndPlayAndWaitRewind(
|
||||
this SwfClipController ctrl, string sequence, int frame)
|
||||
{
|
||||
ctrl.GotoAndPlay(sequence, frame);
|
||||
return WaitForRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation frame with plays it</summary>
|
||||
/// <returns>Yield instruction for wait animation stop and rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitStopOrRewindPlaying GotoAndPlayAndWaitStopOrRewind(
|
||||
this SwfClipController ctrl, int frame)
|
||||
{
|
||||
ctrl.GotoAndPlay(frame);
|
||||
return WaitForStopOrRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and frame with plays it</summary>
|
||||
/// <returns>Yield instruction for wait animation stop and rewind event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitStopOrRewindPlaying GotoAndPlayAndWaitStopOrRewind(
|
||||
this SwfClipController ctrl, string sequence, int frame)
|
||||
{
|
||||
ctrl.GotoAndPlay(sequence, frame);
|
||||
return WaitForStopOrRewindPlaying(ctrl);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// StopAndWait[Event]
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Stop with specified rewind action</summary>
|
||||
/// <returns>Yield instruction for wait animation play event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="rewind">If set to <c>true</c> rewind animation to begin frame</param>
|
||||
public static SwfWaitPlayStopped StopAndWaitPlay(
|
||||
this SwfClipController ctrl, bool rewind)
|
||||
{
|
||||
ctrl.Stop(rewind);
|
||||
return WaitForPlayStopped(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and stop controller with rewind</summary>
|
||||
/// <returns>Yield instruction for wait animation play event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
public static SwfWaitPlayStopped StopAndWaitPlay(
|
||||
this SwfClipController ctrl, string sequence)
|
||||
{
|
||||
ctrl.Stop(sequence);
|
||||
return WaitForPlayStopped(ctrl);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// GotoAndStopAndWait[Event]
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>Changes the animation frame with stops it</summary>
|
||||
/// <returns>Yield instruction for wait animation play event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitPlayStopped GotoAndStopAndWaitPlay(
|
||||
this SwfClipController ctrl, int frame)
|
||||
{
|
||||
ctrl.GotoAndStop(frame);
|
||||
return WaitForPlayStopped(ctrl);
|
||||
}
|
||||
|
||||
/// <summary>Changes the animation sequence and frame with stops it</summary>
|
||||
/// <returns>Yield instruction for wait animation play event</returns>
|
||||
/// <param name="ctrl">The clip controller</param>
|
||||
/// <param name="sequence">The new sequence</param>
|
||||
/// <param name="frame">The new current frame</param>
|
||||
public static SwfWaitPlayStopped GotoAndStopAndWaitPlay(
|
||||
this SwfClipController ctrl, string sequence, int frame)
|
||||
{
|
||||
ctrl.GotoAndStop(sequence, frame);
|
||||
return WaitForPlayStopped(ctrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da7412b1ce89b4952869f7a85515b954
|
||||
timeCreated: 1487268103
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitPlayStopped : IEnumerator {
|
||||
public class SwfWaitPlayStopped : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitPlayStopped(SwfClipController ctrl) {
|
||||
@@ -12,12 +12,20 @@ namespace FTRuntime.Yields {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Private
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitPlayStopped Subscribe(SwfClipController ctrl) {
|
||||
(this as IEnumerator).Reset();
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnPlayStoppedEvent += OnPlayStopped;
|
||||
@@ -25,27 +33,15 @@ namespace FTRuntime.Yields {
|
||||
return this;
|
||||
}
|
||||
|
||||
void OnPlayStopped(SwfClipController ctrl) {
|
||||
(this as IEnumerator).Reset();
|
||||
}
|
||||
|
||||
//
|
||||
// IEnumerator
|
||||
//
|
||||
|
||||
bool IEnumerator.MoveNext() {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
|
||||
void IEnumerator.Reset() {
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnPlayStoppedEvent -= OnPlayStopped;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current {
|
||||
get { return null; }
|
||||
void OnPlayStopped(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitRewindPlaying : IEnumerator {
|
||||
public class SwfWaitRewindPlaying : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitRewindPlaying(SwfClipController ctrl) {
|
||||
@@ -12,12 +12,20 @@ namespace FTRuntime.Yields {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Private
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitRewindPlaying Subscribe(SwfClipController ctrl) {
|
||||
(this as IEnumerator).Reset();
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnRewindPlayingEvent += OnRewindPlaying;
|
||||
@@ -25,27 +33,15 @@ namespace FTRuntime.Yields {
|
||||
return this;
|
||||
}
|
||||
|
||||
void OnRewindPlaying(SwfClipController ctrl) {
|
||||
(this as IEnumerator).Reset();
|
||||
}
|
||||
|
||||
//
|
||||
// IEnumerator
|
||||
//
|
||||
|
||||
bool IEnumerator.MoveNext() {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
|
||||
void IEnumerator.Reset() {
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnRewindPlayingEvent -= OnRewindPlaying;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current {
|
||||
get { return null; }
|
||||
void OnRewindPlaying(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitStopOrRewindPlaying : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitStopOrRewindPlaying(SwfClipController ctrl) {
|
||||
Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public SwfWaitStopOrRewindPlaying Reuse(SwfClipController ctrl) {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitStopOrRewindPlaying Subscribe(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnStopPlayingEvent += OnStopOrRewindPlaying;
|
||||
ctrl.OnRewindPlayingEvent += OnStopOrRewindPlaying;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnStopPlayingEvent -= OnStopOrRewindPlaying;
|
||||
_waitCtrl.OnRewindPlayingEvent -= OnStopOrRewindPlaying;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnStopOrRewindPlaying(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7fb55d9b749a4fae9c1598651878ea9
|
||||
timeCreated: 1487272051
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitStopPlaying : IEnumerator {
|
||||
public class SwfWaitStopPlaying : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitStopPlaying(SwfClipController ctrl) {
|
||||
@@ -12,12 +12,20 @@ namespace FTRuntime.Yields {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Private
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitStopPlaying Subscribe(SwfClipController ctrl) {
|
||||
(this as IEnumerator).Reset();
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnStopPlayingEvent += OnStopPlaying;
|
||||
@@ -25,27 +33,15 @@ namespace FTRuntime.Yields {
|
||||
return this;
|
||||
}
|
||||
|
||||
void OnStopPlaying(SwfClipController ctrl) {
|
||||
(this as IEnumerator).Reset();
|
||||
}
|
||||
|
||||
//
|
||||
// IEnumerator
|
||||
//
|
||||
|
||||
bool IEnumerator.MoveNext() {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
|
||||
void IEnumerator.Reset() {
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnStopPlayingEvent -= OnStopPlaying;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current {
|
||||
get { return null; }
|
||||
void OnStopPlaying(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<DefineConstants>FT_VERSION_DEMO</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DocumentationFile>..\..\Assets\FlashTools\Docs\FTRuntime.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_FULL|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
@@ -26,6 +27,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<DefineConstants>FT_VERSION_FULL</DefineConstants>
|
||||
<DocumentationFile>..\..\Assets\FlashTools\Docs\FTRuntime.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
@@ -78,12 +80,18 @@
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfUtils.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfUtils.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitExtensions.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitExtensions.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitPlayStopped.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitPlayStopped.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitRewindPlaying.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitRewindPlaying.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitStopOrRewindPlaying.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitStopOrRewindPlaying.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitStopPlaying.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitStopPlaying.cs.meta</Link>
|
||||
</None>
|
||||
@@ -119,12 +127,18 @@
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfUtils.cs">
|
||||
<Link>FTRuntime\Internal\SwfUtils.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitExtensions.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitPlayStopped.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitPlayStopped.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitRewindPlaying.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitRewindPlaying.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitStopOrRewindPlaying.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitStopOrRewindPlaying.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitStopPlaying.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitStopPlaying.cs</Link>
|
||||
</Compile>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Properties StartupItem="FTEditor/FTEditor.csproj">
|
||||
<MonoDevelop.Ide.Workbench />
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release_FULL" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release_DEMO" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<BreakpointStore />
|
||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
||||
@@ -6,4 +6,4 @@ EditorBuildSettings:
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/DevTests/Scenes/Scene.unity
|
||||
path: Assets/DevTests/Scene.unity
|
||||
|
||||
Reference in New Issue
Block a user