mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2026-01-04 15:36:54 +07:00
Compare commits
50 Commits
versions/1
...
versions/1
| Author | SHA1 | Date | |
|---|---|---|---|
| 4df50242cc | |||
| 3f4fc9f8aa | |||
| 1976d315c4 | |||
| 1abb0878b9 | |||
| 294c6bba91 | |||
| df9d7ccd43 | |||
| 8981016d57 | |||
| bc8ea51463 | |||
| ce4c644ef2 | |||
| dc77088885 | |||
| ae5cc6de9f | |||
| a351e7352d | |||
| c607777454 | |||
| ce269317fc | |||
| 7e95d6b49a | |||
| f098bfc9bc | |||
| bee56e75a9 | |||
| 7ba00a7e9a | |||
| 545eacdaf8 | |||
| ad0e6251e8 | |||
| 6f4f11cc9d | |||
| 7e4bd5b159 | |||
| 2d8bd13384 | |||
| fa8a636d2e | |||
| 27bb4ef58d | |||
| ece15d9ada | |||
| bc8d6c890a | |||
| f12f2f9012 | |||
| c6f86098e2 | |||
| cc8677e61f | |||
| 0386992965 | |||
| a19ca2499f | |||
| ce4611e23b | |||
| 99d4236e13 | |||
| 04ddf0d08e | |||
| 77287a9b4a | |||
| 5b26becc27 | |||
| 1084c839a1 | |||
| 7042caf82a | |||
| 21fe31585f | |||
| 290fd066b5 | |||
| 16ee7896bf | |||
| a0a223b4bb | |||
| 5a04b6b314 | |||
| dfcac503df | |||
| a3e9da5c73 | |||
| eed1253aeb | |||
| 97a4f98310 | |||
| ca69c71fe6 | |||
| 9bd17c23c5 |
@@ -2,6 +2,9 @@ glob:obj/*
|
||||
glob:Temp/*
|
||||
glob:Library/*
|
||||
|
||||
glob:AssetStoreTools/*
|
||||
glob:AssetStoreTools.meta
|
||||
|
||||
glob:.DS_Store
|
||||
glob:unityflash.sln
|
||||
glob:unityflash.userprefs
|
||||
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Ducat/Shield.fla
Normal file
BIN
Assets/DevTests/Animations/AlphaTests/Ducat/Shield.fla
Normal file
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffe731bf74d034b948a5ec392ba8e284
|
||||
timeCreated: 1476541234
|
||||
guid: 936cd155c254c405cbfaa7caf5447e69
|
||||
timeCreated: 1486882364
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/Bear.fla
Normal file
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/Bear.fla
Normal file
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfa1591b561424bf6a952fcb68bebbc0
|
||||
timeCreated: 1472651507
|
||||
guid: 29c7aa624b715495da989e094be3d74a
|
||||
timeCreated: 1480925289
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/hero_pirate.fla
Normal file
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/hero_pirate.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55c438c941e894f25bb2b0527ee72f7c
|
||||
timeCreated: 1486989506
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/soulreaper.fla
Normal file
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/soulreaper.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 672cf0095a3044ff298e605979974aa6
|
||||
timeCreated: 1486823787
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/8_labels.fla
Normal file
BIN
Assets/DevTests/Animations/FeatureTests/8_labels.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a5952dba743d4595a83376fa4484f59
|
||||
timeCreated: 1480710495
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
174
Assets/DevTests/Scene.unity
Normal file
174
Assets/DevTests/Scene.unity
Normal file
@@ -0,0 +1,174 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
SceneSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PVSData:
|
||||
m_PVSObjectsArray: []
|
||||
m_PVSPortalsArray: []
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 6
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 6
|
||||
m_GIWorkflowMode: 1
|
||||
m_LightmapsMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 0
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 3
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_TextureWidth: 1024
|
||||
m_TextureHeight: 1024
|
||||
m_AOMaxDistance: 1
|
||||
m_Padding: 2
|
||||
m_CompAOExponent: 0
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_ReflectionCompression: 2
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_RuntimeCPUUsage: 25
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
accuratePlacement: 0
|
||||
minRegionArea: 2
|
||||
cellSize: 0.16666667
|
||||
manualCellSize: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &1173114888
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 4: {fileID: 1173114893}
|
||||
- 20: {fileID: 1173114892}
|
||||
- 92: {fileID: 1173114891}
|
||||
- 124: {fileID: 1173114890}
|
||||
- 81: {fileID: 1173114889}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1173114889
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1173114888}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &1173114890
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1173114888}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &1173114891
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1173114888}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1173114892
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1173114888}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 3
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!4 &1173114893
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1173114888}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
8
Assets/DevTests/Scene.unity.meta
Normal file
8
Assets/DevTests/Scene.unity.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ce0e3cb67ade4279a5eedf786d19ca7
|
||||
timeCreated: 1480709959
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/DevTests/Scripts/DeleteOnEnd.cs
Normal file
31
Assets/DevTests/Scripts/DeleteOnEnd.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
using FTRuntime;
|
||||
|
||||
namespace FTDevTests {
|
||||
public class DeleteOnEnd : MonoBehaviour {
|
||||
void Start () {
|
||||
var clip = GetComponent<SwfClip>();
|
||||
if ( clip ) {
|
||||
clip.OnChangeCurrentFrameEvent += OnChangeCurrentFrameEvent;
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy() {
|
||||
Debug.Log("DeleteOnEnd::OnDestroy");
|
||||
var clip = GetComponent<SwfClip>();
|
||||
if ( clip ) {
|
||||
clip.OnChangeCurrentFrameEvent -= OnChangeCurrentFrameEvent;
|
||||
}
|
||||
}
|
||||
|
||||
void OnChangeCurrentFrameEvent(SwfClip clip) {
|
||||
Debug.LogFormat("OnChangeCurrentFrameEvent: {0}", clip.currentFrame);
|
||||
if ( clip.currentFrame == clip.frameCount - 1 ) {
|
||||
Debug.Log("Delete");
|
||||
Destroy(gameObject);
|
||||
Debug.Log("After Delete");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/DevTests/Scripts/DeleteOnEnd.cs.meta
Normal file
12
Assets/DevTests/Scripts/DeleteOnEnd.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4482cb82b8422471cb0caf2735d7acbb
|
||||
timeCreated: 1480952822
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/DevTests/Scripts/EchoEventListener.cs
Normal file
46
Assets/DevTests/Scripts/EchoEventListener.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
|
||||
using FTRuntime;
|
||||
|
||||
namespace FTDevTests {
|
||||
public class EchoEventListener : MonoBehaviour {
|
||||
void Start () {
|
||||
var clip = GetComponent<SwfClip>();
|
||||
if ( clip ) {
|
||||
clip.OnChangeClipEvent += OnChangeClipEvent;
|
||||
clip.OnChangeSequenceEvent += OnChangeSequenceEvent;
|
||||
clip.OnChangeCurrentFrameEvent += OnChangeCurrentFrameEvent;
|
||||
}
|
||||
var ctrl = GetComponent<SwfClipController>();
|
||||
if ( ctrl ) {
|
||||
ctrl.OnPlayStoppedEvent += OnPlayStoppedEvent;
|
||||
ctrl.OnRewindPlayingEvent += OnRewindPlayingEvent;
|
||||
ctrl.OnStopPlayingEvent += OnStopPlayingEvent;
|
||||
}
|
||||
}
|
||||
|
||||
void OnChangeClipEvent(SwfClip clip) {
|
||||
Debug.LogFormat(this, "OnChangeClipEvent: {0}", clip.clip);
|
||||
}
|
||||
|
||||
void OnChangeSequenceEvent(SwfClip clip) {
|
||||
Debug.LogFormat(this, "OnChangeSequenceEvent: {0}", clip.sequence);
|
||||
}
|
||||
|
||||
void OnChangeCurrentFrameEvent(SwfClip clip) {
|
||||
Debug.LogFormat(this, "OnChangeCurrentFrameEvent: {0}", clip.currentFrame);
|
||||
}
|
||||
|
||||
void OnPlayStoppedEvent(SwfClipController ctrl) {
|
||||
Debug.LogFormat(this, "OnPlayStoppedEvent: {0}", ctrl.clip);
|
||||
}
|
||||
|
||||
void OnRewindPlayingEvent(SwfClipController ctrl) {
|
||||
Debug.LogFormat(this, "OnRewindPlayingEvent: {0}", ctrl.clip);
|
||||
}
|
||||
|
||||
void OnStopPlayingEvent(SwfClipController ctrl) {
|
||||
Debug.LogFormat(this, "OnStopPlayingEvent: {0}", ctrl.clip);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/DevTests/Scripts/EchoEventListener.cs.meta
Normal file
12
Assets/DevTests/Scripts/EchoEventListener.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38f0f7dc068694fccbf1740118107b65
|
||||
timeCreated: 1480885888
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Assets/FlashTools/Docs/CHANGELOG.md
Normal file
67
Assets/FlashTools/Docs/CHANGELOG.md
Normal file
@@ -0,0 +1,67 @@
|
||||
###### 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
|
||||
8
Assets/FlashTools/Docs/CHANGELOG.md.meta
Normal file
8
Assets/FlashTools/Docs/CHANGELOG.md.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 309e798efeb2741c6853f2402363a067
|
||||
timeCreated: 1487174180
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,59 +0,0 @@
|
||||
-------------------
|
||||
-- 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 --
|
||||
-----------------
|
||||
|
||||
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 --
|
||||
-----------------
|
||||
|
||||
Initial asset store version
|
||||
Sources to dll
|
||||
Palette bitmaps support
|
||||
|
||||
-----------------
|
||||
-- Version 0.5 --
|
||||
-----------------
|
||||
|
||||
Flash optimizer twicks
|
||||
Blending modes (except Alpha and Erase)
|
||||
|
||||
-----------------
|
||||
-- Version 0.4 --
|
||||
-----------------
|
||||
|
||||
Clip groups
|
||||
Fix move assets bug
|
||||
Tint color for clips
|
||||
Animation API improvements
|
||||
|
||||
-----------------
|
||||
-- Version 0.3 --
|
||||
-----------------
|
||||
|
||||
Preview for animation assets and clips
|
||||
Animation API improvements
|
||||
Memory optimizations
|
||||
|
||||
-----------------
|
||||
-- Version 0.2 --
|
||||
-----------------
|
||||
|
||||
Export optimizations
|
||||
Export clips with export names
|
||||
|
||||
-----------------
|
||||
-- Version 0.1 --
|
||||
-----------------
|
||||
|
||||
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"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e336e165518cf4d8680e2fff9c6b59ba
|
||||
timeCreated: 1476531185
|
||||
timeCreated: 1486894953
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -37,8 +37,7 @@ TextureImporter:
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 2
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
|
||||
@@ -12,12 +12,14 @@ MonoBehaviour:
|
||||
m_Name: npc_bureaucrat.fla._Stage_
|
||||
m_EditorClassIdentifier:
|
||||
Name: _Stage_
|
||||
Atlas: {fileID: 2800000, guid: e336e165518cf4d8680e2fff9c6b59ba, type: 3}
|
||||
Sprite: {fileID: 21300000, guid: e336e165518cf4d8680e2fff9c6b59ba, type: 3}
|
||||
FrameRate: 24
|
||||
AssetGUID: a25723a1cd8b141a6b489606584a6f65
|
||||
Sequences:
|
||||
- Name: Default
|
||||
Frames:
|
||||
- MeshData:
|
||||
- Labels: []
|
||||
MeshData:
|
||||
SubMeshes:
|
||||
- StartVertex: 0
|
||||
IndexCount: 6
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1278c7f98af44db8a86e620305eb32b
|
||||
timeCreated: 1476531185
|
||||
timeCreated: 1486894967
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -37,8 +37,7 @@ TextureImporter:
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 2
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
|
||||
@@ -12,12 +12,14 @@ MonoBehaviour:
|
||||
m_Name: npc_smuggler.fla._Stage_
|
||||
m_EditorClassIdentifier:
|
||||
Name: _Stage_
|
||||
Atlas: {fileID: 2800000, guid: c1278c7f98af44db8a86e620305eb32b, type: 3}
|
||||
Sprite: {fileID: 21300000, guid: c1278c7f98af44db8a86e620305eb32b, type: 3}
|
||||
FrameRate: 30
|
||||
AssetGUID: 91fc9b6bb83c645678686dbc06141d03
|
||||
Sequences:
|
||||
- Name: Default
|
||||
Frames:
|
||||
- MeshData:
|
||||
- Labels: []
|
||||
MeshData:
|
||||
SubMeshes:
|
||||
- StartVertex: 0
|
||||
IndexCount: 156
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a799322aa44e44b38980bc9d307f0c38
|
||||
timeCreated: 1476531185
|
||||
timeCreated: 1486894960
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -37,8 +37,7 @@ TextureImporter:
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 2
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
|
||||
@@ -12,12 +12,14 @@ MonoBehaviour:
|
||||
m_Name: purple_apparition.fla._Stage_
|
||||
m_EditorClassIdentifier:
|
||||
Name: _Stage_
|
||||
Atlas: {fileID: 2800000, guid: a799322aa44e44b38980bc9d307f0c38, type: 3}
|
||||
Sprite: {fileID: 21300000, guid: a799322aa44e44b38980bc9d307f0c38, type: 3}
|
||||
FrameRate: 24
|
||||
AssetGUID: 0f54ba869440c48cd8d6c64e70c09b87
|
||||
Sequences:
|
||||
- Name: Default
|
||||
Frames:
|
||||
- MeshData:
|
||||
- Labels: []
|
||||
MeshData:
|
||||
SubMeshes:
|
||||
- StartVertex: 0
|
||||
IndexCount: 18
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47e46d443fd064d78ae33281e2840297
|
||||
timeCreated: 1476531184
|
||||
timeCreated: 1486894975
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -37,8 +37,7 @@ TextureImporter:
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 2
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,7 +1,8 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
using FTRuntime;
|
||||
using FTRuntime.Yields;
|
||||
|
||||
namespace FlashTools.Examples {
|
||||
[RequireComponent(typeof(SwfClipController))]
|
||||
@@ -10,49 +11,32 @@ namespace FlashTools.Examples {
|
||||
static string _fadeInSequence = "fadeIn";
|
||||
static string _fadeOutSequence = "fadeOut";
|
||||
|
||||
enum States {
|
||||
FadeIn,
|
||||
Idle,
|
||||
FadeOut
|
||||
}
|
||||
|
||||
float _idleTimer = 0.0f;
|
||||
States _currentState = States.FadeIn;
|
||||
|
||||
void Start() {
|
||||
var ctrl = GetComponent<SwfClipController>();
|
||||
ctrl.OnStopPlayingEvent += OnStopPlayingEvent;
|
||||
ctrl.loopMode = SwfClipController.LoopModes.Once;
|
||||
|
||||
_currentState = States.FadeIn;
|
||||
ctrl.Play(_fadeInSequence);
|
||||
StartCoroutine(StartCoro(ctrl));
|
||||
}
|
||||
|
||||
void OnStopPlayingEvent(SwfClipController ctrl) {
|
||||
switch ( _currentState ) {
|
||||
case States.FadeIn:
|
||||
_idleTimer = Time.time;
|
||||
_currentState = States.Idle;
|
||||
ctrl.Play(_idleSequences[Random.Range(0, _idleSequences.Length)]);
|
||||
break;
|
||||
case States.Idle: {
|
||||
if ( Time.time - _idleTimer > 5.0f ) {
|
||||
_currentState = States.FadeOut;
|
||||
ctrl.Play(_fadeOutSequence);
|
||||
} else {
|
||||
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 );
|
||||
}
|
||||
IEnumerator StartCoro(SwfClipController ctrl) {
|
||||
while ( true ) {
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(_fadeInSequence);
|
||||
for ( var i = 0; i < 3; ++i ) {
|
||||
var idle_seq = GetRandomIdleSequence(ctrl);
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(idle_seq);
|
||||
}
|
||||
break;
|
||||
case States.FadeOut:
|
||||
_currentState = States.FadeIn;
|
||||
ctrl.Play(_fadeInSequence);
|
||||
break;
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,37 +7,31 @@
|
||||
};
|
||||
}
|
||||
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
if (typeof this !== 'function') {
|
||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
||||
}
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1);
|
||||
var fToBind = this;
|
||||
var fNOP = function () {};
|
||||
var fBound = function () {
|
||||
return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
fNOP.prototype = this.prototype;
|
||||
fBound.prototype = new fNOP();
|
||||
return fBound;
|
||||
};
|
||||
}
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
//
|
||||
// ft
|
||||
// ft config
|
||||
//
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
//
|
||||
// ft base functions
|
||||
//
|
||||
|
||||
ft.trace = function () {
|
||||
fl.outputPanel.trace(
|
||||
@@ -75,7 +69,7 @@ if (!Function.prototype.bind) {
|
||||
};
|
||||
|
||||
ft.type_assert_if_defined = function (item, type) {
|
||||
if (item !== undefined) {
|
||||
if (item && item !== undefined) {
|
||||
ft.type_assert(item, type);
|
||||
}
|
||||
};
|
||||
@@ -203,6 +197,13 @@ if (!Function.prototype.bind) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.approximately = function(a, b, precision) {
|
||||
ft.type_assert(a, 'number');
|
||||
ft.type_assert(b, 'number');
|
||||
ft.type_assert(precision, 'number');
|
||||
return Math.abs(b - a) < Math.abs(precision);
|
||||
};
|
||||
|
||||
ft.gen_unique_name = function () {
|
||||
if (!ft.gen_unique_name_index) {
|
||||
@@ -222,12 +223,68 @@ if (!Function.prototype.bind) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.profile_function(function() { ftdoc.prepare_folders(doc); }, "Prepare folders");
|
||||
ft.profile_function(function() { ftdoc.full_exit_edit_mode(doc); }, "Full exit edit mode");
|
||||
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");
|
||||
};
|
||||
|
||||
ftdoc.get_temp = function (doc) {
|
||||
if (!ftdoc.hasOwnProperty("temp")) {
|
||||
ftdoc["temp"] = {
|
||||
max_scales : {}
|
||||
}
|
||||
}
|
||||
return ftdoc["temp"];
|
||||
};
|
||||
|
||||
ftdoc.calculate_item_final_scale = function (doc, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ft.graphics_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return final_scale;
|
||||
};
|
||||
|
||||
ftdoc.convert_selection_to_bitmap = function (doc, optional_item) {
|
||||
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, ft.scale_precision)) {
|
||||
doc.convertSelectionToBitmap();
|
||||
} else {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.prepare_folders = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
@@ -242,7 +299,7 @@ if (!Function.prototype.bind) {
|
||||
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) {
|
||||
@@ -251,12 +308,89 @@ if (!Function.prototype.bind) {
|
||||
doc.exitEditMode();
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.remove_unused_items = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
var unused_items = doc.library.unusedItems;
|
||||
if (unused_items && unused_items !== undefined) {
|
||||
ft.array_reverse_foreach(unused_items, function(item) {
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt("Remove unused item: {0}", item.name);
|
||||
}
|
||||
doc.library.deleteItem(item.name);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.unlock_all_timelines = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.unlock_all_timelines(doc, doc.library);
|
||||
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);
|
||||
@@ -429,7 +563,7 @@ if (!Function.prototype.bind) {
|
||||
new_item_elem.setTransformationPoint({x: 0, y: 0});
|
||||
new_item_elem.transformX = 0;
|
||||
new_item_elem.transformY = 0;
|
||||
doc.convertSelectionToBitmap();
|
||||
ftdoc.convert_selection_to_bitmap(doc, item);
|
||||
return true;
|
||||
} else {
|
||||
doc.exitEditMode();
|
||||
@@ -441,7 +575,6 @@ if (!Function.prototype.bind) {
|
||||
ftlib.optimize_single_graphics = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
|
||||
ft.array_reverse_foreach(library.items, function (item) {
|
||||
fttim.optimize_single_graphics(doc, item.timeline, item);
|
||||
}, ftlib.is_symbol_item);
|
||||
@@ -500,6 +633,11 @@ if (!Function.prototype.bind) {
|
||||
return frame.startFrame == frame_index;
|
||||
};
|
||||
|
||||
fttim.is_not_guide_layer = function(layer) {
|
||||
ft.type_assert(layer, Layer);
|
||||
return layer.layerType != "guide";
|
||||
};
|
||||
|
||||
fttim.unlock = function (timeline) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
@@ -547,6 +685,26 @@ if (!Function.prototype.bind) {
|
||||
var frame_height = Math.max(0, bounds.bottom - bounds.top);
|
||||
return Math.round(frame_width) * Math.round(frame_height);
|
||||
}
|
||||
|
||||
fttim.recursive_scale_filters = function (doc, timeline, scale) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
var elem_filters = elem.filters;
|
||||
if (elem_filters && elem_filters !== undefined) {
|
||||
ft.array_foreach(elem_filters, function (elem_filter, filter_index) {
|
||||
elem_filter.blurX *= scale;
|
||||
elem_filter.blurY *= scale;
|
||||
});
|
||||
elem.filters = elem_filters;
|
||||
}
|
||||
fttim.recursive_scale_filters(doc, elem.libraryItem.timeline, scale);
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.replace_baked_symbols = function (doc, timeline, replaces) {
|
||||
ft.type_assert(doc, Document);
|
||||
@@ -564,7 +722,7 @@ if (!Function.prototype.bind) {
|
||||
}
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.optimize_single_graphics = function (doc, timeline, opt_item) {
|
||||
@@ -600,7 +758,7 @@ if (!Function.prototype.bind) {
|
||||
return fttim.is_symbol_graphic_single_frame_instance(elem) && !fttim.is_static(elem.libraryItem.timeline);
|
||||
});
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.is_static = function (timeline) {
|
||||
@@ -632,7 +790,7 @@ if (!Function.prototype.bind) {
|
||||
}, function (frame, frame_index) {
|
||||
return fttim.is_keyframe(frame, frame_index) && fttim.is_shape_frame(frame);
|
||||
});
|
||||
});
|
||||
}, fttim.is_not_guide_layer);
|
||||
|
||||
var any_rasterize = false;
|
||||
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
|
||||
@@ -643,12 +801,12 @@ if (!Function.prototype.bind) {
|
||||
doc.selectNone();
|
||||
doc.selection = ft.array_filter(frame.elements, fttim.is_shape_instance);
|
||||
if (doc.selection.length > 0) {
|
||||
doc.convertSelectionToBitmap();
|
||||
ftdoc.convert_selection_to_bitmap(doc, timeline.libraryItem);
|
||||
doc.arrange("back");
|
||||
any_rasterize = true;
|
||||
}
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
}, fttim.is_not_guide_layer);
|
||||
if (any_rasterize && ft.verbose_mode) {
|
||||
ft.trace_fmt("Rasterize vector shapes in '{0}'", timeline.name);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ inline swf_mask_v2f_t swf_mask_vert(swf_mask_appdata_t IN) {
|
||||
|
||||
inline fixed4 swf_frag(swf_v2f_t IN) : SV_Target {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv);
|
||||
if ( _ExternalAlpha ) {
|
||||
c.a *= tex2D(_AlphaTex, IN.uv).r;
|
||||
}
|
||||
if ( c.a > 0.01 ) {
|
||||
c = c * IN.mulcolor + IN.addcolor;
|
||||
}
|
||||
@@ -144,6 +147,9 @@ inline fixed4 swf_frag(swf_v2f_t IN) : SV_Target {
|
||||
|
||||
inline fixed4 swf_grab_frag(swf_grab_v2f_t IN) : SV_Target {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv);
|
||||
if ( _ExternalAlpha ) {
|
||||
c.a *= tex2D(_AlphaTex, IN.uv).r;
|
||||
}
|
||||
if ( c.a > 0.01 ) {
|
||||
c = c * IN.mulcolor + IN.addcolor;
|
||||
c = grab_blend(_GrabTexture, IN.screenpos, c);
|
||||
@@ -154,6 +160,9 @@ inline fixed4 swf_grab_frag(swf_grab_v2f_t IN) : SV_Target {
|
||||
|
||||
inline fixed4 swf_mask_frag(swf_mask_v2f_t IN) : SV_Target {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv);
|
||||
if ( _ExternalAlpha ) {
|
||||
c.a *= tex2D(_AlphaTex, IN.uv).r;
|
||||
}
|
||||
if ( c.a < 0.01 ) {
|
||||
discard;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Shader "FlashTools/SwfDecrMask" {
|
||||
Properties {
|
||||
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
|
||||
[PerRendererData] _MainTex ("Main Texture" , 2D) = "white" {}
|
||||
[PerRendererData] _AlphaTex ("Alpha Texture" , 2D) = "white" {}
|
||||
[PerRendererData] _ExternalAlpha ("External Alpha", Float) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
@@ -28,7 +30,9 @@ Shader "FlashTools/SwfDecrMask" {
|
||||
CGPROGRAM
|
||||
fixed4 _Tint;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _AlphaTex;
|
||||
sampler2D _GrabTexture;
|
||||
float _ExternalAlpha;
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "SwfBaseCG.cginc"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Shader "FlashTools/SwfIncrMask" {
|
||||
Properties {
|
||||
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
|
||||
[PerRendererData] _MainTex ("Main Texture" , 2D) = "white" {}
|
||||
[PerRendererData] _AlphaTex ("Alpha Texture" , 2D) = "white" {}
|
||||
[PerRendererData] _ExternalAlpha ("External Alpha", Float) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
@@ -28,7 +30,9 @@ Shader "FlashTools/SwfIncrMask" {
|
||||
CGPROGRAM
|
||||
fixed4 _Tint;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _AlphaTex;
|
||||
sampler2D _GrabTexture;
|
||||
float _ExternalAlpha;
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "SwfBaseCG.cginc"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
Shader "FlashTools/SwfMaskedGrab" {
|
||||
Properties {
|
||||
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
[PerRendererData] _MainTex ("Main Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _AlphaTex ("Alpha Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _ExternalAlpha ("External Alpha", Float) = 0
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
|
||||
_StencilID ("Stencil ID", Int) = 0
|
||||
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
|
||||
@@ -35,7 +37,9 @@ Shader "FlashTools/SwfMaskedGrab" {
|
||||
CGPROGRAM
|
||||
fixed4 _Tint;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _AlphaTex;
|
||||
sampler2D _GrabTexture;
|
||||
float _ExternalAlpha;
|
||||
|
||||
#pragma multi_compile SWF_DARKEN_BLEND SWF_DIFFERENCE_BLEND SWF_INVERT_BLEND SWF_OVERLAY_BLEND SWF_HARDLIGHT_BLEND
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
Shader "FlashTools/SwfMasked" {
|
||||
Properties {
|
||||
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
[PerRendererData] _MainTex ("Main Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _AlphaTex ("Alpha Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _ExternalAlpha ("External Alpha", Float) = 0
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
|
||||
_StencilID ("Stencil ID", Int) = 0
|
||||
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
|
||||
@@ -33,7 +35,9 @@ Shader "FlashTools/SwfMasked" {
|
||||
CGPROGRAM
|
||||
fixed4 _Tint;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _AlphaTex;
|
||||
sampler2D _GrabTexture;
|
||||
float _ExternalAlpha;
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "SwfBaseCG.cginc"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
Shader "FlashTools/SwfSimpleGrab" {
|
||||
Properties {
|
||||
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
[PerRendererData] _MainTex ("Main Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _AlphaTex ("Alpha Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _ExternalAlpha ("External Alpha", Float) = 0
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
|
||||
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("SrcBlend", Int) = 1
|
||||
@@ -30,7 +32,9 @@ Shader "FlashTools/SwfSimpleGrab" {
|
||||
CGPROGRAM
|
||||
fixed4 _Tint;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _AlphaTex;
|
||||
sampler2D _GrabTexture;
|
||||
float _ExternalAlpha;
|
||||
|
||||
#pragma multi_compile SWF_DARKEN_BLEND SWF_DIFFERENCE_BLEND SWF_INVERT_BLEND SWF_OVERLAY_BLEND SWF_HARDLIGHT_BLEND
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
Shader "FlashTools/SwfSimple" {
|
||||
Properties {
|
||||
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
[PerRendererData] _MainTex ("Main Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _AlphaTex ("Alpha Texture" , 2D ) = "white" {}
|
||||
[PerRendererData] _ExternalAlpha ("External Alpha", Float) = 0
|
||||
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
|
||||
|
||||
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("SrcBlend", Int) = 1
|
||||
@@ -28,7 +30,9 @@ Shader "FlashTools/SwfSimple" {
|
||||
CGPROGRAM
|
||||
fixed4 _Tint;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _AlphaTex;
|
||||
sampler2D _GrabTexture;
|
||||
float _ExternalAlpha;
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "SwfBaseCG.cginc"
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace FTEditor.Editors {
|
||||
}
|
||||
|
||||
static void ReconvertAsset(SwfAsset asset) {
|
||||
asset.Converting = new SwfAsset.ConvertingState();
|
||||
AssetDatabase.ImportAsset(
|
||||
AssetDatabase.GetAssetPath(asset));
|
||||
asset.Atlas = null;
|
||||
EditorUtility.SetDirty(asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -80,17 +80,25 @@ namespace FTEditor.Editors {
|
||||
//
|
||||
|
||||
void CreateAllClipsPrefabs() {
|
||||
Selection.objects = _clips
|
||||
var objects = _clips
|
||||
.Select (p => CreateClipPrefab(p))
|
||||
.Where (p => !!p)
|
||||
.ToArray();
|
||||
Selection.objects = objects;
|
||||
foreach ( var obj in objects ) {
|
||||
EditorGUIUtility.PingObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateAllClipsOnScene() {
|
||||
Selection.objects = _clips
|
||||
var objects = _clips
|
||||
.Select (p => CreateClipOnScene(p))
|
||||
.Where (p => !!p)
|
||||
.ToArray();
|
||||
Selection.objects = objects;
|
||||
foreach ( var obj in objects ) {
|
||||
EditorGUIUtility.PingObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -121,6 +129,20 @@ namespace FTEditor.Editors {
|
||||
});
|
||||
}
|
||||
|
||||
void DrawGUISourceAsset() {
|
||||
var asset_guids = _clips.Select(p => p.AssetGUID);
|
||||
var mixed_value = asset_guids.GroupBy(p => p).Count() > 1;
|
||||
SwfEditorUtils.DoWithEnabledGUI(false, () => {
|
||||
SwfEditorUtils.DoWithMixedValue(
|
||||
mixed_value, () => {
|
||||
var source_asset = AssetDatabase.LoadAssetAtPath<SwfAsset>(
|
||||
AssetDatabase.GUIDToAssetPath(asset_guids.First()));
|
||||
EditorGUILayout.ObjectField(
|
||||
"Source Asset", source_asset, typeof(SwfAsset), false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void DrawGUIControls() {
|
||||
SwfEditorUtils.DoHorizontalGUI(() => {
|
||||
if ( GUILayout.Button("Create prefab") ) {
|
||||
@@ -132,6 +154,14 @@ namespace FTEditor.Editors {
|
||||
});
|
||||
}
|
||||
|
||||
void DrawGUINotes() {
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.HelpBox(
|
||||
"Masks and blends of animation may not be displayed correctly in preview window. " +
|
||||
"Instance animation to the scene, to see how it will look like the animation in the game.",
|
||||
MessageType.Info);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Messages
|
||||
@@ -147,7 +177,9 @@ namespace FTEditor.Editors {
|
||||
DrawDefaultInspector();
|
||||
DrawGUIFrameCount();
|
||||
DrawGUISequences();
|
||||
DrawGUISourceAsset();
|
||||
DrawGUIControls();
|
||||
DrawGUINotes();
|
||||
if ( GUI.changed ) {
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
@@ -12,10 +12,24 @@ namespace FTEditor.Editors {
|
||||
static MaterialPropertyBlock _matPropBlock = null;
|
||||
static PreviewRenderUtility _previewUtils = null;
|
||||
|
||||
Texture2D targetAtlas {
|
||||
Sprite targetSprite {
|
||||
get {
|
||||
var clip = target as SwfClipAsset;
|
||||
return clip.Atlas;
|
||||
return clip ? clip.Sprite : null;
|
||||
}
|
||||
}
|
||||
|
||||
Texture2D targetAtlas {
|
||||
get {
|
||||
var sprite = targetSprite;
|
||||
return sprite ? sprite.texture : null;
|
||||
}
|
||||
}
|
||||
|
||||
Texture2D targetAtlasA {
|
||||
get {
|
||||
var sprite = targetSprite;
|
||||
return sprite ? sprite.associatedAlphaSplitTexture : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +174,15 @@ namespace FTEditor.Editors {
|
||||
if ( isTargetValidForPreview ) {
|
||||
_previewUtils.BeginPreview(r, background);
|
||||
{
|
||||
_matPropBlock.SetTexture("_MainTex", targetAtlas);
|
||||
if ( targetAtlas ) {
|
||||
_matPropBlock.SetTexture("_MainTex", targetAtlas);
|
||||
}
|
||||
if ( targetAtlasA ) {
|
||||
_matPropBlock.SetTexture("_AlphaTex", targetAtlasA);
|
||||
_matPropBlock.SetFloat("_ExternalAlpha", 1.0f);
|
||||
} else {
|
||||
_matPropBlock.SetFloat("_ExternalAlpha", 0.0f);
|
||||
}
|
||||
ConfigureCameraForSequence(_previewUtils.m_Camera, targetSequence);
|
||||
var frame = targetFrame;
|
||||
for ( var i = 0; i < frame.Materials.Length; ++i ) {
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace FTEditor.Editors {
|
||||
|
||||
void DrawControls() {
|
||||
SwfEditorUtils.DoRightHorizontalGUI(() => {
|
||||
if ( _manager.useUnscaledDt && GUILayout.Button("Use Scaled Dt") ) {
|
||||
_manager.useUnscaledDt = false;
|
||||
}
|
||||
if ( !_manager.useUnscaledDt && GUILayout.Button("Use Unscaled Dt") ) {
|
||||
_manager.useUnscaledDt = true;
|
||||
}
|
||||
if ( _manager.isPaused && GUILayout.Button("Resume") ) {
|
||||
_manager.Resume();
|
||||
}
|
||||
@@ -44,11 +50,21 @@ namespace FTEditor.Editors {
|
||||
SwfEditorUtils.DoWithEnabledGUI(false, () => {
|
||||
EditorGUILayout.TextField("Name", group_name);
|
||||
});
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var new_rate_scale = EditorGUILayout.FloatField(
|
||||
"Rate Scale", _manager.GetGroupRateScale(group_name));
|
||||
if ( EditorGUI.EndChangeCheck() ) {
|
||||
_manager.SetGroupRateScale(group_name, new_rate_scale);
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var new_rate_scale = EditorGUILayout.FloatField(
|
||||
"Rate Scale", _manager.GetGroupRateScale(group_name));
|
||||
if ( EditorGUI.EndChangeCheck() ) {
|
||||
_manager.SetGroupRateScale(group_name, new_rate_scale);
|
||||
}
|
||||
}
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var new_user_unscaled_dt = EditorGUILayout.Toggle(
|
||||
"Use Unscaled Dt", _manager.IsGroupUseUnscaledDt(group_name));
|
||||
if ( EditorGUI.EndChangeCheck() ) {
|
||||
_manager.SetGroupUseUnscaledDt(group_name, new_user_unscaled_dt);
|
||||
}
|
||||
}
|
||||
SwfEditorUtils.DoRightHorizontalGUI(() => {
|
||||
if ( _manager.IsGroupPaused(group_name) && GUILayout.Button("Resume") ) {
|
||||
|
||||
@@ -10,6 +10,8 @@ using FTRuntime;
|
||||
|
||||
namespace FTEditor.Postprocessors {
|
||||
class SwfAssetPostprocessor : AssetPostprocessor {
|
||||
static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar();
|
||||
|
||||
static void OnPostprocessAllAssets(
|
||||
string[] imported_assets,
|
||||
string[] deleted_assets,
|
||||
@@ -18,35 +20,31 @@ namespace FTEditor.Postprocessors {
|
||||
{
|
||||
var asset_paths = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".asset"));
|
||||
foreach ( var asset_path in asset_paths ) {
|
||||
var asset = AssetDatabase.LoadAssetAtPath<SwfAsset>(asset_path);
|
||||
if ( asset ) {
|
||||
var assets = asset_paths
|
||||
.Select(p => AssetDatabase.LoadAssetAtPath<SwfAsset>(p))
|
||||
.Where(p => !!p);
|
||||
foreach ( var asset in assets ) {
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfAssetProcess(asset);
|
||||
}
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static void SwfAssetProcess(SwfAsset asset) {
|
||||
try {
|
||||
if ( asset.Converting.Stage == 0 ) {
|
||||
if ( !asset.Atlas ) {
|
||||
_progressBar.UpdateTitle(asset.name);
|
||||
var new_data = ConfigureBitmaps(
|
||||
asset,
|
||||
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
|
||||
asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
++asset.Converting.Stage;
|
||||
EditorUtility.SetDirty(asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
|
||||
} else if ( asset.Converting.Stage == 1 ) {
|
||||
asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
asset.Atlas = LoadAssetAtlas(asset);
|
||||
if ( asset.Atlas ) {
|
||||
ConfigureAtlas(asset);
|
||||
ConfigureClips(
|
||||
asset,
|
||||
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
|
||||
ConfigureClips(asset, new_data);
|
||||
}
|
||||
++asset.Converting.Stage;
|
||||
EditorUtility.SetDirty(asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Debug.LogErrorFormat(
|
||||
@@ -57,6 +55,7 @@ namespace FTEditor.Postprocessors {
|
||||
if ( asset ) {
|
||||
UpdateAssetClips(asset);
|
||||
}
|
||||
_progressBar.HideProgress();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,12 +80,18 @@ namespace FTEditor.Postprocessors {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
static SwfAssetData ConfigureBitmaps(SwfAsset asset, SwfAssetData data) {
|
||||
var textures = data.Bitmaps
|
||||
.Where (p => p.Redirect == 0)
|
||||
.Select (p => new KeyValuePair<ushort, Texture2D>(
|
||||
p.Id,
|
||||
LoadTextureFromData(p)))
|
||||
.ToList();
|
||||
var textures = new List<KeyValuePair<ushort, Texture2D>>(data.Bitmaps.Count);
|
||||
for ( var i = 0; i < data.Bitmaps.Count; ++i ) {
|
||||
_progressBar.UpdateProgress(
|
||||
"configure bitmaps",
|
||||
(float)(i + 1) / data.Bitmaps.Count);
|
||||
var bitmap = data.Bitmaps[i];
|
||||
if ( bitmap.Redirect == 0 ) {
|
||||
textures.Add(new KeyValuePair<ushort, Texture2D>(
|
||||
bitmap.Id,
|
||||
LoadTextureFromData(bitmap)));
|
||||
}
|
||||
}
|
||||
var rects = PackAndSaveBitmapsAtlas(
|
||||
GetAtlasPath(asset),
|
||||
textures.Select(p => p.Value).ToArray(),
|
||||
@@ -116,10 +121,13 @@ namespace FTEditor.Postprocessors {
|
||||
static Rect[] PackAndSaveBitmapsAtlas(
|
||||
string atlas_path, Texture2D[] textures, SwfSettingsData settings)
|
||||
{
|
||||
_progressBar.UpdateProgress("pack bitmaps", 0.25f);
|
||||
var atlas_info = PackBitmapsAtlas(textures, settings);
|
||||
RevertTexturePremultipliedAlpha(atlas_info.Atlas);
|
||||
_progressBar.UpdateProgress("save atlas", 0.5f);
|
||||
File.WriteAllBytes(atlas_path, atlas_info.Atlas.EncodeToPNG());
|
||||
GameObject.DestroyImmediate(atlas_info.Atlas, true);
|
||||
_progressBar.UpdateProgress("import atlas", 0.75f);
|
||||
AssetDatabase.ImportAsset(atlas_path);
|
||||
return atlas_info.Rects;
|
||||
}
|
||||
@@ -188,17 +196,18 @@ namespace FTEditor.Postprocessors {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
static void ConfigureAtlas(SwfAsset asset) {
|
||||
var atlas_path = AssetDatabase.GetAssetPath(asset.Atlas);
|
||||
var atlas_importer = GetBitmapsAtlasImporter(asset);
|
||||
atlas_importer.spritesheet = new SpriteMetaData[0];
|
||||
atlas_importer.textureType = TextureImporterType.Sprite;
|
||||
atlas_importer.spriteImportMode = SpriteImportMode.Multiple;
|
||||
atlas_importer.spriteImportMode = SpriteImportMode.Single;
|
||||
atlas_importer.spritePixelsPerUnit = asset.Settings.PixelsPerUnit;
|
||||
atlas_importer.mipmapEnabled = asset.Settings.GenerateMipMaps;
|
||||
atlas_importer.filterMode = SwfAtlasFilterToImporterFilter(asset.Settings.AtlasTextureFilter);
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
atlas_importer.textureCompression = SwfAtlasFormatToImporterCompression(asset.Settings.AtlasTextureFormat);
|
||||
#else
|
||||
atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
|
||||
AssetDatabase.WriteImportSettingsIfDirty(atlas_path);
|
||||
AssetDatabase.ImportAsset(atlas_path);
|
||||
#endif
|
||||
atlas_importer.SaveAndReimport();
|
||||
}
|
||||
|
||||
static TextureImporter GetBitmapsAtlasImporter(SwfAsset asset) {
|
||||
@@ -229,24 +238,37 @@ namespace FTEditor.Postprocessors {
|
||||
}
|
||||
}
|
||||
|
||||
static TextureImporterFormat SwfAtlasFormatToImporterFormat(
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
static TextureImporterCompression SwfAtlasFormatToImporterCompression(
|
||||
SwfSettingsData.AtlasFormat format)
|
||||
{
|
||||
switch ( format ) {
|
||||
case SwfSettingsData.AtlasFormat.AutomaticCompressed:
|
||||
return TextureImporterFormat.AutomaticCompressed;
|
||||
case SwfSettingsData.AtlasFormat.Automatic16bit:
|
||||
return TextureImporterFormat.Automatic16bit;
|
||||
return TextureImporterCompression.Compressed;
|
||||
case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
|
||||
return TextureImporterFormat.AutomaticTruecolor;
|
||||
case SwfSettingsData.AtlasFormat.AutomaticCrunched:
|
||||
return TextureImporterFormat.AutomaticCrunched;
|
||||
return TextureImporterCompression.Uncompressed;
|
||||
default:
|
||||
throw new UnityException(string.Format(
|
||||
"incorrect swf atlas format ({0})",
|
||||
format));
|
||||
}
|
||||
}
|
||||
#else
|
||||
static TextureImporterFormat SwfAtlasFormatToImporterFormat(
|
||||
SwfSettingsData.AtlasFormat format)
|
||||
{
|
||||
switch ( format ) {
|
||||
case SwfSettingsData.AtlasFormat.AutomaticCompressed:
|
||||
return TextureImporterFormat.AutomaticCompressed;
|
||||
case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
|
||||
return TextureImporterFormat.AutomaticTruecolor;
|
||||
default:
|
||||
throw new UnityException(string.Format(
|
||||
"incorrect swf atlas format ({0})",
|
||||
format));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
@@ -255,24 +277,28 @@ namespace FTEditor.Postprocessors {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
static SwfAssetData ConfigureClips(SwfAsset asset, SwfAssetData data) {
|
||||
asset.Clips = asset.Clips.Where(p => !!p).Distinct().ToList();
|
||||
foreach ( var symbol in data.Symbols ) {
|
||||
ConfigureClip(asset, data, symbol);
|
||||
for ( var i = 0; i < data.Symbols.Count; ++i ) {
|
||||
_progressBar.UpdateProgress(
|
||||
"configure clips",
|
||||
(float)(i + 1) / data.Symbols.Count);
|
||||
ConfigureClip(asset, data, data.Symbols[i]);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static void ConfigureClip(SwfAsset asset, SwfAssetData data, SwfSymbolData symbol) {
|
||||
var clip_asset = asset.Clips.FirstOrDefault(p => p.Name == symbol.Name);
|
||||
if ( clip_asset ) {
|
||||
ConfigureClipAsset(clip_asset, asset, data, symbol);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(clip_asset));
|
||||
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);
|
||||
asset.Clips.Add(new_clip_asset);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -281,10 +307,14 @@ namespace FTEditor.Postprocessors {
|
||||
static void ConfigureClipAsset(
|
||||
SwfClipAsset clip_asset, SwfAsset asset, SwfAssetData data, SwfSymbolData symbol)
|
||||
{
|
||||
var asset_guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset));
|
||||
var asset_atlas = AssetDatabase.LoadAssetAtPath<Sprite>(AssetDatabase.GetAssetPath(asset.Atlas));
|
||||
clip_asset.Name = symbol.Name;
|
||||
clip_asset.Atlas = asset.Atlas;
|
||||
clip_asset.Sprite = asset_atlas;
|
||||
clip_asset.FrameRate = data.FrameRate;
|
||||
clip_asset.AssetGUID = asset_guid;
|
||||
clip_asset.Sequences = LoadClipSequences(asset, data, symbol);
|
||||
EditorUtility.SetDirty(clip_asset);
|
||||
}
|
||||
|
||||
static List<SwfClipAsset.Sequence> LoadClipSequences(
|
||||
@@ -463,11 +493,15 @@ namespace FTEditor.Postprocessors {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
static void UpdateAssetClips(SwfAsset asset) {
|
||||
var clips = GameObject.FindObjectsOfType<SwfClip>();
|
||||
foreach ( var clip in clips ) {
|
||||
if ( clip && clip.clip && asset.Clips.Contains(clip.clip) ) {
|
||||
clip.Internal_UpdateAllProperties();
|
||||
}
|
||||
var asset_guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset));
|
||||
var scene_clips = GameObject.FindObjectsOfType<SwfClip>()
|
||||
.Where (p => p && p.clip && p.clip.AssetGUID == asset_guid)
|
||||
.ToList();
|
||||
for ( var i = 0; i < scene_clips.Count; ++i ) {
|
||||
_progressBar.UpdateProgress(
|
||||
"update scene clips",
|
||||
(float)(i + 1) / scene_clips.Count);
|
||||
scene_clips[i].Internal_UpdateAllProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ using FTSwfTools.SwfTypes;
|
||||
|
||||
namespace FTEditor.Postprocessors {
|
||||
class SwfPostprocessor : AssetPostprocessor {
|
||||
static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar();
|
||||
|
||||
static void OnPostprocessAllAssets(
|
||||
string[] imported_assets,
|
||||
string[] deleted_assets,
|
||||
@@ -30,7 +32,10 @@ namespace FTEditor.Postprocessors {
|
||||
EditorUtility.DisplayDialog(title, message, "Ok");
|
||||
} else {
|
||||
foreach ( var swf_path in swf_paths ) {
|
||||
SwfFileProcess(swf_path);
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfFileProcess(swf_path);
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,21 +54,27 @@ namespace FTEditor.Postprocessors {
|
||||
|
||||
static bool SafeLoadSwfAsset(string swf_path, SwfAsset swf_asset) {
|
||||
try {
|
||||
var new_data = LoadSwfAssetData(swf_path);
|
||||
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
swf_asset.Converting = new SwfAsset.ConvertingState();
|
||||
_progressBar.UpdateTitle(Path.GetFileName(swf_path));
|
||||
var new_data = LoadSwfAssetData(swf_path);
|
||||
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
swf_asset.Atlas = null;
|
||||
EditorUtility.SetDirty(swf_asset);
|
||||
return true;
|
||||
} catch ( Exception e ) {
|
||||
Debug.LogErrorFormat(
|
||||
"<b>[FlashTools]</b> Parsing swf error: {0}",
|
||||
e.Message);
|
||||
return false;
|
||||
} finally {
|
||||
_progressBar.HideProgress();
|
||||
}
|
||||
}
|
||||
|
||||
static SwfAssetData LoadSwfAssetData(string swf_path) {
|
||||
var library = new SwfLibrary();
|
||||
var decoder = new SwfDecoder(swf_path);
|
||||
var decoder = new SwfDecoder(swf_path, progress => {
|
||||
_progressBar.UpdateProgress("swf decoding", progress);
|
||||
});
|
||||
return new SwfAssetData{
|
||||
FrameRate = decoder.UncompressedHeader.FrameRate,
|
||||
Symbols = LoadSymbols(library, decoder),
|
||||
@@ -83,10 +94,15 @@ namespace FTEditor.Postprocessors {
|
||||
symbols.Add(LoadSymbol("_Stage_", library, decoder.Tags));
|
||||
var sprite_defs = library.Defines.Values
|
||||
.OfType<SwfLibrarySpriteDefine>()
|
||||
.Where(p => !string.IsNullOrEmpty(p.ExportName));
|
||||
foreach ( var sprite_def in sprite_defs ) {
|
||||
var name = sprite_def.ExportName;
|
||||
var tags = sprite_def.ControlTags.Tags;
|
||||
.Where(p => !string.IsNullOrEmpty(p.ExportName))
|
||||
.ToList();
|
||||
for ( var i = 0; i < sprite_defs.Count; ++i ) {
|
||||
_progressBar.UpdateProgress(
|
||||
"load swf symbols",
|
||||
(float)(i + 1) / sprite_defs.Count);
|
||||
var def = sprite_defs[i];
|
||||
var name = def.ExportName;
|
||||
var tags = def.ControlTags.Tags;
|
||||
symbols.Add(LoadSymbol(name, library, tags));
|
||||
}
|
||||
return symbols;
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace FTEditor {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public static SwfSettings GetSettingsHolder() {
|
||||
var holder = LoadFirstAssetByFilter<SwfSettings>("t:SwfSettings");
|
||||
var holder = LoadFirstAssetDBByFilter<SwfSettings>("t:SwfSettings");
|
||||
if ( !holder ) {
|
||||
throw new UnityException(
|
||||
"SwfEditorUtils. SwfSettings asset not found");
|
||||
@@ -152,13 +152,11 @@ namespace FTEditor {
|
||||
if ( asset ) {
|
||||
if ( act(asset, false) ) {
|
||||
EditorUtility.SetDirty(asset);
|
||||
AssetDatabase.ImportAsset(asset_path);
|
||||
}
|
||||
} else {
|
||||
asset = ScriptableObject.CreateInstance<T>();
|
||||
if ( act(asset, true) ) {
|
||||
AssetDatabase.CreateAsset(asset, asset_path);
|
||||
AssetDatabase.ImportAsset(asset_path);
|
||||
} else {
|
||||
ScriptableObject.DestroyImmediate(asset);
|
||||
}
|
||||
@@ -166,7 +164,7 @@ namespace FTEditor {
|
||||
return asset;
|
||||
}
|
||||
|
||||
public static T LoadFirstAssetByFilter<T>(string filter) where T : UnityEngine.Object {
|
||||
public static T LoadFirstAssetDBByFilter<T>(string filter) where T : UnityEngine.Object {
|
||||
var guids = AssetDatabase.FindAssets(filter);
|
||||
foreach ( var guid in guids ) {
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
@@ -178,6 +176,14 @@ namespace FTEditor {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static T[] LoadAllAssetsDBByFilter<T>(string filter) where T : UnityEngine.Object {
|
||||
return AssetDatabase.FindAssets(filter)
|
||||
.Select (p => AssetDatabase.GUIDToAssetPath(p))
|
||||
.Select (p => AssetDatabase.LoadAssetAtPath<T>(p))
|
||||
.Where (p => !!p)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] CompressAsset<T>(T asset) {
|
||||
var bytes = AssetToBytes(asset);
|
||||
var result = ZlibStream.CompressBuffer(bytes);
|
||||
@@ -226,6 +232,33 @@ namespace FTEditor {
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// ProgressBar
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public class ProgressBar {
|
||||
string _title = string.Empty;
|
||||
|
||||
public void UpdateTitle(string title) {
|
||||
_title = title;
|
||||
}
|
||||
|
||||
public void UpdateProgress(string info, float progress) {
|
||||
var bar_title = string.IsNullOrEmpty(_title)
|
||||
? "Flash Tools Process"
|
||||
: string.Format("Flash Tools Process: {0}", _title);
|
||||
var bar_info = string.Format("{0}...", info);
|
||||
var bar_progress = Mathf.Clamp01(progress);
|
||||
EditorUtility.DisplayProgressBar(bar_title, bar_info, bar_progress);
|
||||
}
|
||||
|
||||
public void HideProgress() {
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Menu
|
||||
@@ -236,6 +269,7 @@ namespace FTEditor {
|
||||
static void Tools_FlashTools_OpenSettings() {
|
||||
var settings_holder = SwfEditorUtils.GetSettingsHolder();
|
||||
Selection.objects = new Object[]{settings_holder};
|
||||
EditorGUIUtility.PingObject(settings_holder);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/FlashTools/Reimport all swf files")]
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace FTEditor {
|
||||
|
||||
static Shader SafeLoadShader(string shader_name) {
|
||||
var filter = string.Format("t:Shader {0}", shader_name);
|
||||
var shader = SwfEditorUtils.LoadFirstAssetByFilter<Shader>(filter);
|
||||
var shader = SwfEditorUtils.LoadFirstAssetDBByFilter<Shader>(filter);
|
||||
if ( !shader ) {
|
||||
throw new UnityException(string.Format(
|
||||
"SwfMaterialCache. Shader not found: {0}",
|
||||
|
||||
@@ -10,10 +10,13 @@ namespace FTSwfTools {
|
||||
public SwfLongHeader UncompressedHeader;
|
||||
public List<SwfTagBase> Tags = new List<SwfTagBase>();
|
||||
|
||||
public SwfDecoder(string swf_path) {
|
||||
public SwfDecoder(string swf_path) : this(swf_path, null) {
|
||||
}
|
||||
|
||||
public SwfDecoder(string swf_path, System.Action<float> progress_act) {
|
||||
var raw_data = File.ReadAllBytes(swf_path);
|
||||
var uncompressed_stream = DecompressSwfData(raw_data);
|
||||
DecodeSwf(new SwfStreamReader(uncompressed_stream));
|
||||
DecodeSwf(new SwfStreamReader(uncompressed_stream), progress_act);
|
||||
}
|
||||
|
||||
MemoryStream DecompressSwfData(byte[] raw_swf_data) {
|
||||
@@ -40,9 +43,12 @@ namespace FTSwfTools {
|
||||
}
|
||||
}
|
||||
|
||||
void DecodeSwf(SwfStreamReader reader) {
|
||||
void DecodeSwf(SwfStreamReader reader, System.Action<float> progress_act) {
|
||||
UncompressedHeader = SwfLongHeader.Read(reader);
|
||||
while ( !reader.IsEOF ) {
|
||||
if ( progress_act != null ) {
|
||||
progress_act((float)(reader.Position + 1) / reader.Length);
|
||||
}
|
||||
var tag = SwfTagBase.Read(reader);
|
||||
if ( tag.TagType == SwfTagType.End ) {
|
||||
break;
|
||||
|
||||
@@ -13,18 +13,6 @@ namespace FTSwfTools {
|
||||
BitContext _bitContext;
|
||||
BinaryReader _binaryReader;
|
||||
|
||||
long Length {
|
||||
get { return _binaryReader.BaseStream.Length; }
|
||||
}
|
||||
|
||||
long Position {
|
||||
get { return _binaryReader.BaseStream.Position; }
|
||||
}
|
||||
|
||||
long BytesLeft {
|
||||
get { return Length - Position; }
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Public
|
||||
@@ -44,6 +32,18 @@ namespace FTSwfTools {
|
||||
get { return Position >= Length; }
|
||||
}
|
||||
|
||||
public long Length {
|
||||
get { return _binaryReader.BaseStream.Length; }
|
||||
}
|
||||
|
||||
public long Position {
|
||||
get { return _binaryReader.BaseStream.Position; }
|
||||
}
|
||||
|
||||
public long BytesLeft {
|
||||
get { return Length - Position; }
|
||||
}
|
||||
|
||||
public void AlignToByte() {
|
||||
_bitContext.BitIndex = 0;
|
||||
_bitContext.CachedByte = 0;
|
||||
|
||||
@@ -71,18 +71,18 @@
|
||||
// Fonts and Text
|
||||
// -----------------------------
|
||||
|
||||
//DefineFont = 10,
|
||||
//DefineFontInfo = 13,
|
||||
//DefineFontInfo2 = 62,
|
||||
//DefineFont2 = 48,
|
||||
//DefineFont3 = 75,
|
||||
//DefineFontAlignZones = 73,
|
||||
//DefineFontName = 88,
|
||||
//DefineText = 11,
|
||||
//DefineText2 = 33,
|
||||
//DefineEditText = 37,
|
||||
//CSMTextSettings = 74,
|
||||
//DefineFont4 = 91,
|
||||
DefineFont = 10,
|
||||
DefineFontInfo = 13,
|
||||
DefineFontInfo2 = 62,
|
||||
DefineFont2 = 48,
|
||||
DefineFont3 = 75,
|
||||
DefineFontAlignZones = 73,
|
||||
DefineFontName = 88,
|
||||
DefineText = 11,
|
||||
DefineText2 = 33,
|
||||
DefineEditText = 37,
|
||||
CSMTextSettings = 74,
|
||||
DefineFont4 = 91,
|
||||
|
||||
// -----------------------------
|
||||
// Sounds
|
||||
@@ -199,6 +199,19 @@
|
||||
// Shape Morphing
|
||||
case (int)SwfTagType.DefineMorphShape: return UnsupportedTag.Create(SwfTagType.DefineMorphShape);
|
||||
case (int)SwfTagType.DefineMorphShape2: return UnsupportedTag.Create(SwfTagType.DefineMorphShape2);
|
||||
// Fonts and Text
|
||||
case (int)SwfTagType.DefineFont: return UnsupportedTag.Create(SwfTagType.DefineFont);
|
||||
case (int)SwfTagType.DefineFontInfo: return UnsupportedTag.Create(SwfTagType.DefineFontInfo);
|
||||
case (int)SwfTagType.DefineFontInfo2: return UnsupportedTag.Create(SwfTagType.DefineFontInfo2);
|
||||
case (int)SwfTagType.DefineFont2: return UnsupportedTag.Create(SwfTagType.DefineFont2);
|
||||
case (int)SwfTagType.DefineFont3: return UnsupportedTag.Create(SwfTagType.DefineFont3);
|
||||
case (int)SwfTagType.DefineFontAlignZones: return UnsupportedTag.Create(SwfTagType.DefineFontAlignZones);
|
||||
case (int)SwfTagType.DefineFontName: return UnsupportedTag.Create(SwfTagType.DefineFontName);
|
||||
case (int)SwfTagType.DefineText: return UnsupportedTag.Create(SwfTagType.DefineText);
|
||||
case (int)SwfTagType.DefineText2: return UnsupportedTag.Create(SwfTagType.DefineText2);
|
||||
case (int)SwfTagType.DefineEditText: return UnsupportedTag.Create(SwfTagType.DefineEditText);
|
||||
case (int)SwfTagType.CSMTextSettings: return UnsupportedTag.Create(SwfTagType.CSMTextSettings);
|
||||
case (int)SwfTagType.DefineFont4: return UnsupportedTag.Create(SwfTagType.DefineFont4);
|
||||
// Sprites and Movie Clips
|
||||
case (int)SwfTagType.DefineSprite: return DefineSpriteTag.Create(reader);
|
||||
// Video
|
||||
|
||||
@@ -4,30 +4,20 @@ using System.Collections.Generic;
|
||||
|
||||
namespace FTRuntime {
|
||||
public class SwfAsset : ScriptableObject {
|
||||
[System.Serializable]
|
||||
public struct ConvertingState {
|
||||
public int Stage;
|
||||
}
|
||||
[HideInInspector]
|
||||
public byte[] Data;
|
||||
public byte[] Data;
|
||||
[SwfReadOnly]
|
||||
public Texture2D Atlas;
|
||||
public Texture2D Atlas;
|
||||
[HideInInspector]
|
||||
public List<SwfClipAsset> Clips;
|
||||
[HideInInspector]
|
||||
public SwfSettingsData Settings;
|
||||
public SwfSettingsData Settings;
|
||||
[SwfDisplayName("Settings")]
|
||||
public SwfSettingsData Overridden;
|
||||
[HideInInspector]
|
||||
public ConvertingState Converting;
|
||||
public SwfSettingsData Overridden;
|
||||
|
||||
void Reset() {
|
||||
Data = new byte[0];
|
||||
Atlas = null;
|
||||
Clips = new List<SwfClipAsset>();
|
||||
Settings = SwfSettingsData.identity;
|
||||
Overridden = SwfSettingsData.identity;
|
||||
Converting = new ConvertingState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,12 +344,19 @@ namespace FTRuntime {
|
||||
_curPropBlock = new MaterialPropertyBlock();
|
||||
}
|
||||
_meshRenderer.GetPropertyBlock(_curPropBlock);
|
||||
_curPropBlock.SetColor(
|
||||
"_Tint",
|
||||
tint);
|
||||
_curPropBlock.SetTexture(
|
||||
"_MainTex",
|
||||
clip && clip.Atlas ? clip.Atlas : Texture2D.whiteTexture);
|
||||
_curPropBlock.SetColor("_Tint", tint);
|
||||
var sprite = clip ? clip.Sprite : null;
|
||||
var atlas = sprite && sprite.texture ? sprite.texture : Texture2D.whiteTexture;
|
||||
var atlasA = sprite ? sprite.associatedAlphaSplitTexture : null;
|
||||
if ( atlas ) {
|
||||
_curPropBlock.SetTexture("_MainTex", atlas);
|
||||
}
|
||||
if ( atlasA ) {
|
||||
_curPropBlock.SetTexture("_AlphaTex", atlasA);
|
||||
_curPropBlock.SetFloat("_ExternalAlpha", 1.0f);
|
||||
} else {
|
||||
_curPropBlock.SetFloat("_ExternalAlpha", 0.0f);
|
||||
}
|
||||
_meshRenderer.SetPropertyBlock(_curPropBlock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,16 +58,19 @@ namespace FTRuntime {
|
||||
[SwfReadOnly]
|
||||
public string Name;
|
||||
[SwfReadOnly]
|
||||
public Texture2D Atlas;
|
||||
public Sprite Sprite;
|
||||
[SwfReadOnly]
|
||||
public float FrameRate;
|
||||
[HideInInspector]
|
||||
public string AssetGUID;
|
||||
[HideInInspector]
|
||||
public List<Sequence> Sequences;
|
||||
|
||||
void Reset() {
|
||||
Name = string.Empty;
|
||||
Atlas = null;
|
||||
Sprite = null;
|
||||
FrameRate = 1.0f;
|
||||
AssetGUID = string.Empty;
|
||||
Sequences = new List<Sequence>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ namespace FTRuntime {
|
||||
[SerializeField]
|
||||
bool _autoPlay = true;
|
||||
|
||||
[SerializeField]
|
||||
bool _useUnscaledDt = false;
|
||||
|
||||
[SerializeField, SwfFloatRange(0.0f, float.MaxValue)]
|
||||
float _rateScale = 1.0f;
|
||||
|
||||
@@ -95,6 +98,15 @@ namespace FTRuntime {
|
||||
set { _autoPlay = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether controller uses unscaled delta time
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if uses unscaled delta time; otherwise, <c>false</c></value>
|
||||
public bool useUnscaledDt {
|
||||
get { return _useUnscaledDt; }
|
||||
set { _useUnscaledDt = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the controller rate scale
|
||||
/// </summary>
|
||||
@@ -296,9 +308,9 @@ namespace FTRuntime {
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
internal void Internal_Update(float dt) {
|
||||
internal void Internal_Update(float scaled_dt, float unscaled_dt) {
|
||||
if ( isPlaying ) {
|
||||
_tickTimer += dt;
|
||||
_tickTimer += useUnscaledDt ? unscaled_dt : scaled_dt;
|
||||
do {
|
||||
var frame_rate = clip ? clip.frameRate * rateScale : 0.0f;
|
||||
var frame_time = frame_rate > 0.0f ? 1.0f / frame_rate : 0.0f;
|
||||
|
||||
@@ -10,8 +10,10 @@ namespace FTRuntime {
|
||||
SwfList<SwfClipController> _safeUpdates = new SwfList<SwfClipController>();
|
||||
|
||||
bool _isPaused = false;
|
||||
bool _useUnscaledDt = false;
|
||||
float _rateScale = 1.0f;
|
||||
HashSet<string> _groupPauses = new HashSet<string>();
|
||||
HashSet<string> _groupUnscales = new HashSet<string>();
|
||||
Dictionary<string, float> _groupRateScales = new Dictionary<string, float>();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -78,6 +80,15 @@ namespace FTRuntime {
|
||||
set { _isPaused = !value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get or set a value indicating whether animation updates uses unscaled delta time
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if uses unscaled delta time; otherwise, <c>false</c></value>
|
||||
public bool useUnscaledDt {
|
||||
get { return _useUnscaledDt; }
|
||||
set { _useUnscaledDt = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get or set the global animation rate scale
|
||||
/// </summary>
|
||||
@@ -146,6 +157,30 @@ namespace FTRuntime {
|
||||
return !IsGroupPaused(group_name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the group of animations use unscaled delta time
|
||||
/// </summary>
|
||||
/// <param name="group_name">Group name</param>
|
||||
/// <param name="yesno"><c>true</c> if group will use unscaled delta time; otherwise, <c>false</c></param>
|
||||
public void SetGroupUseUnscaledDt(string group_name, bool yesno) {
|
||||
if ( !string.IsNullOrEmpty(group_name) ) {
|
||||
if ( yesno ) {
|
||||
_groupUnscales.Add(group_name);
|
||||
} else {
|
||||
_groupUnscales.Remove(group_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether group of animations uses unscaled delta time
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if group uses unscaled delta time; otherwise, <c>false</c></returns>
|
||||
/// <param name="group_name">Group name</param>
|
||||
public bool IsGroupUseUnscaledDt(string group_name) {
|
||||
return _groupUnscales.Contains(group_name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the group of animations rate scale
|
||||
/// </summary>
|
||||
@@ -232,17 +267,19 @@ namespace FTRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdateControllers(float dt) {
|
||||
void LateUpdateControllers(float scaled_dt, float unscaled_dt) {
|
||||
_controllers.AssignTo(_safeUpdates);
|
||||
for ( int i = 0, e = _safeUpdates.Count; i < e; ++i ) {
|
||||
var ctrl = _safeUpdates[i];
|
||||
if ( ctrl ) {
|
||||
var group_name = ctrl.groupName;
|
||||
var group_name = ctrl.groupName;
|
||||
if ( string.IsNullOrEmpty(group_name) ) {
|
||||
ctrl.Internal_Update(dt);
|
||||
ctrl.Internal_Update(scaled_dt, unscaled_dt);
|
||||
} else if ( IsGroupPlaying(group_name) ) {
|
||||
var group_rate_scale = GetGroupRateScale(group_name);
|
||||
ctrl.Internal_Update(group_rate_scale * dt);
|
||||
ctrl.Internal_Update(
|
||||
group_rate_scale * (IsGroupUseUnscaledDt(group_name) ? unscaled_dt : scaled_dt),
|
||||
group_rate_scale * unscaled_dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,8 +304,9 @@ namespace FTRuntime {
|
||||
|
||||
void LateUpdate() {
|
||||
if ( isPlaying ) {
|
||||
var dt = Time.deltaTime;
|
||||
LateUpdateControllers(rateScale * dt);
|
||||
LateUpdateControllers(
|
||||
rateScale * (useUnscaledDt ? Time.unscaledDeltaTime : Time.deltaTime),
|
||||
rateScale * Time.unscaledDeltaTime);
|
||||
}
|
||||
LateUpdateClips();
|
||||
}
|
||||
|
||||
@@ -11,10 +11,8 @@ namespace FTRuntime {
|
||||
}
|
||||
|
||||
public enum AtlasFormat {
|
||||
AutomaticCompressed,
|
||||
Automatic16bit,
|
||||
AutomaticTruecolor,
|
||||
AutomaticCrunched
|
||||
AutomaticCompressed = 0,
|
||||
AutomaticTruecolor = 2
|
||||
}
|
||||
|
||||
[SwfPowerOfTwoIfAttribute(5, 13, "AtlasPowerOfTwo")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e3bddf96333643c8a12fd862ebc9ec7
|
||||
guid: 91d10069039ad437fbd214463d482c1c
|
||||
folderAsset: yes
|
||||
timeCreated: 1480709542
|
||||
timeCreated: 1486819578
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
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:
|
||||
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitPlayStopped : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitPlayStopped(SwfClipController ctrl) {
|
||||
Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public SwfWaitPlayStopped Reuse(SwfClipController ctrl) {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitPlayStopped Subscribe(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnPlayStoppedEvent += OnPlayStopped;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnPlayStoppedEvent -= OnPlayStopped;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnPlayStopped(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92ee4f87c0bcf4943abc9e5cdaffea72
|
||||
timeCreated: 1486821636
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitRewindPlaying : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitRewindPlaying(SwfClipController ctrl) {
|
||||
Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public SwfWaitRewindPlaying Reuse(SwfClipController ctrl) {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitRewindPlaying Subscribe(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnRewindPlayingEvent += OnRewindPlaying;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnRewindPlayingEvent -= OnRewindPlaying;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnRewindPlaying(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a489e38279e094af4b5ef8859282295f
|
||||
timeCreated: 1486819593
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FTRuntime.Yields {
|
||||
public class SwfWaitStopPlaying : CustomYieldInstruction {
|
||||
SwfClipController _waitCtrl;
|
||||
|
||||
public SwfWaitStopPlaying(SwfClipController ctrl) {
|
||||
Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public SwfWaitStopPlaying Reuse(SwfClipController ctrl) {
|
||||
return Subscribe(ctrl);
|
||||
}
|
||||
|
||||
public override bool keepWaiting {
|
||||
get {
|
||||
return _waitCtrl != null;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Internal
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
SwfWaitStopPlaying Subscribe(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
if ( ctrl ) {
|
||||
_waitCtrl = ctrl;
|
||||
ctrl.OnStopPlayingEvent += OnStopPlaying;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
void Unsubscribe() {
|
||||
if ( _waitCtrl != null ) {
|
||||
_waitCtrl.OnStopPlayingEvent -= OnStopPlaying;
|
||||
_waitCtrl = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnStopPlaying(SwfClipController ctrl) {
|
||||
Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3be861087be4b442092da862ff38f151
|
||||
timeCreated: 1486819592
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -28,10 +28,6 @@
|
||||
<DefineConstants>FT_VERSION_FULL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Sources\" />
|
||||
<Folder Include="FTEditor\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib">
|
||||
<HintPath>..\DLLs\mscorlib.dll</HintPath>
|
||||
@@ -66,6 +62,9 @@
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="FTEditor\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\Editor\FTEditor\Editors.meta">
|
||||
<Link>FTEditor\Editors.meta</Link>
|
||||
|
||||
@@ -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>
|
||||
@@ -39,7 +41,6 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Sources\" />
|
||||
<Folder Include="FTRuntime\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -49,9 +50,6 @@
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAsset.cs.meta">
|
||||
<Link>FTRuntime\SwfAsset.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAttributes.cs.meta">
|
||||
<Link>FTRuntime\SwfAttributes.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfClip.cs.meta">
|
||||
<Link>FTRuntime\SwfClip.cs.meta</Link>
|
||||
</None>
|
||||
@@ -67,23 +65,41 @@
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfSettings.cs.meta">
|
||||
<Link>FTRuntime\SwfSettings.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields.meta">
|
||||
<Link>FTRuntime\Yields.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAssocList.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfAssocList.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAttributes.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfAttributes.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfList.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfList.cs.meta</Link>
|
||||
</None>
|
||||
<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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAsset.cs">
|
||||
<Link>FTRuntime\SwfAsset.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAttributes.cs">
|
||||
<Link>FTRuntime\SwfAttributes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfClip.cs">
|
||||
<Link>FTRuntime\SwfClip.cs</Link>
|
||||
</Compile>
|
||||
@@ -102,11 +118,29 @@
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAssocList.cs">
|
||||
<Link>FTRuntime\Internal\SwfAssocList.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAttributes.cs">
|
||||
<Link>FTRuntime\Internal\SwfAttributes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfList.cs">
|
||||
<Link>FTRuntime\Internal\SwfList.cs</Link>
|
||||
</Compile>
|
||||
<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>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Sources\" />
|
||||
<Folder Include="FTSwfTools\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,4 +6,4 @@ EditorBuildSettings:
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/FlashTools/Example/Scene.unity
|
||||
path: Assets/DevTests/Scene.unity
|
||||
|
||||
@@ -42,6 +42,7 @@ PlayerSettings:
|
||||
runInBackground: 1
|
||||
captureSingleScreen: 0
|
||||
Override IPod Music: 0
|
||||
muteOtherAudioSources: 0
|
||||
Prepare IOS For Recording: 0
|
||||
submitAnalytics: 1
|
||||
usePlayerLog: 1
|
||||
@@ -72,6 +73,7 @@ PlayerSettings:
|
||||
ignoreAlphaClear: 0
|
||||
xboxOneResolution: 0
|
||||
xboxOneMonoLoggingLevel: 0
|
||||
xboxOneLoggingLevel: 1
|
||||
ps3SplashScreen: {fileID: 0}
|
||||
videoMemoryForVertexBuffers: 0
|
||||
psp2PowerMode: 0
|
||||
@@ -91,7 +93,7 @@ PlayerSettings:
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleIdentifier: com.Company.ProductName
|
||||
bundleIdentifier: me.matov.ft_demo
|
||||
bundleVersion: 1.0
|
||||
preloadedAssets: []
|
||||
metroEnableIndependentInputSource: 0
|
||||
@@ -159,6 +161,10 @@ PlayerSettings:
|
||||
iOSLaunchScreeniPadSize: 100
|
||||
iOSLaunchScreeniPadCustomXibPath:
|
||||
iOSDeviceRequirements: []
|
||||
appleDeveloperTeamID:
|
||||
iOSManualSigningProvisioningProfileID:
|
||||
tvOSManualSigningProvisioningProfileID:
|
||||
appleEnableAutomaticSigning: 0
|
||||
AndroidTargetDevice: 0
|
||||
AndroidSplashScreenScale: 0
|
||||
androidSplashScreen: {fileID: 0}
|
||||
@@ -206,7 +212,9 @@ PlayerSettings:
|
||||
enableInternalProfiler: 0
|
||||
logObjCUncaughtExceptions: 1
|
||||
enableCrashReportAPI: 0
|
||||
cameraUsageDescription:
|
||||
locationUsageDescription:
|
||||
microphoneUsageDescription:
|
||||
XboxTitleId:
|
||||
XboxImageXexPath:
|
||||
XboxSpaPath:
|
||||
@@ -246,7 +254,8 @@ PlayerSettings:
|
||||
ps4AppType: 0
|
||||
ps4ParamSfxPath:
|
||||
ps4VideoOutPixelFormat: 0
|
||||
ps4VideoOutResolution: 4
|
||||
ps4VideoOutInitialWidth: 1920
|
||||
ps4VideoOutReprojectionRate: 120
|
||||
ps4PronunciationXMLPath:
|
||||
ps4PronunciationSIGPath:
|
||||
ps4BackgroundImagePath:
|
||||
@@ -275,14 +284,18 @@ PlayerSettings:
|
||||
ps4pnFriends: 1
|
||||
ps4pnGameCustomData: 1
|
||||
playerPrefsSupport: 0
|
||||
restrictedAudioUsageRights: 0
|
||||
ps4UseResolutionFallback: 0
|
||||
ps4ReprojectionSupport: 0
|
||||
ps4UseAudio3dBackend: 0
|
||||
ps4SocialScreenEnabled: 0
|
||||
ps4ScriptOptimizationLevel: 3
|
||||
ps4Audio3dVirtualSpeakerCount: 14
|
||||
ps4attribCpuUsage: 0
|
||||
ps4PatchPkgPath:
|
||||
ps4PatchLatestPkgPath:
|
||||
ps4PatchChangeinfoPath:
|
||||
ps4PatchDayOne: 0
|
||||
ps4attribUserManagement: 0
|
||||
ps4attribMoveSupport: 0
|
||||
ps4attrib3DSupport: 0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 5.3.6f1
|
||||
m_EditorVersion: 5.3.7p2
|
||||
m_StandardAssetsVersion: 0
|
||||
|
||||
Reference in New Issue
Block a user