From 8d6b20bd2847ac2e4e0f8a561f30db41dcdb0682 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sat, 8 Oct 2016 01:48:38 +0700 Subject: [PATCH] SwfManager docs --- .../FTRuntime/Sources/Internal/SwfUtils.cs | 8 +-- FTSources/FTRuntime/Sources/SwfManager.cs | 64 +++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/FTSources/FTRuntime/Sources/Internal/SwfUtils.cs b/FTSources/FTRuntime/Sources/Internal/SwfUtils.cs index 4b1573c..3a05e75 100644 --- a/FTSources/FTRuntime/Sources/Internal/SwfUtils.cs +++ b/FTSources/FTRuntime/Sources/Internal/SwfUtils.cs @@ -103,8 +103,8 @@ namespace FTRuntime.Internal { } for ( int i = 0, e = uvs.Length; i < e; i += 2 ) { float min_x, min_y, max_x, max_y; - SwfUtils.UnpackUV(uvs[i+0], out min_x, out min_y); - SwfUtils.UnpackUV(uvs[i+1], out max_x, out max_y); + UnpackUV(uvs[i+0], out min_x, out min_y); + UnpackUV(uvs[i+1], out max_x, out max_y); UV0.x = min_x; UV0.y = min_y; UV1.x = max_x; UV1.y = min_y; @@ -126,7 +126,7 @@ namespace FTRuntime.Internal { AddColors.Capacity = colors.Length * 2 * 2; } for ( int i = 0, e = colors.Length; i < e; i += 2 ) { - SwfUtils.UnpackFColorFromUInts( + UnpackFColorFromUInts( colors[i+0], colors[i+1], out AddColor.x, out AddColor.y, out AddColor.z, out AddColor.w); @@ -145,7 +145,7 @@ namespace FTRuntime.Internal { MulColors.Capacity = colors.Length * 2 * 2; } for ( int i = 0, e = colors.Length; i < e; i += 2 ) { - SwfUtils.UnpackFColorFromUInts( + UnpackFColorFromUInts( colors[i+0], colors[i+1], out MulColor.r, out MulColor.g, out MulColor.b, out MulColor.a); diff --git a/FTSources/FTRuntime/Sources/SwfManager.cs b/FTSources/FTRuntime/Sources/SwfManager.cs index 80b89f7..02c7c18 100644 --- a/FTSources/FTRuntime/Sources/SwfManager.cs +++ b/FTSources/FTRuntime/Sources/SwfManager.cs @@ -3,6 +3,9 @@ using FTRuntime.Internal; using System.Collections.Generic; namespace FTRuntime { + /// + /// General manager for update and controlling animations and animation groups + /// [ExecuteInEditMode, DisallowMultipleComponent] public class SwfManager : MonoBehaviour { SwfAssocList _clips = new SwfAssocList(); @@ -21,6 +24,12 @@ namespace FTRuntime { // --------------------------------------------------------------------- static SwfManager _instance; + + /// + /// Get cached manager instance from scene or create it (if allowed) + /// + /// The manager instance + /// If set to true allow create public static SwfManager GetInstance(bool allow_create) { if ( !_instance ) { _instance = FindObjectOfType(); @@ -38,24 +47,44 @@ namespace FTRuntime { // // --------------------------------------------------------------------- + /// + /// Get animation clip count on scene + /// + /// Clip count public int clipCount { get { return _clips.Count; } } + /// + /// Get animation clip controller count on scene + /// + /// Clip controller count public int controllerCount { get { return _controllers.Count; } } + /// + /// Get or set a value indicating whether animation updates is paused + /// + /// true if is paused; otherwise, false. public bool isPaused { get { return _isPaused; } set { _isPaused = value; } } + /// + /// Get or set a value indicating whether animation updates is playing + /// + /// true if is playing; otherwise, false. public bool isPlaying { get { return !_isPaused; } set { _isPaused = !value; } } + /// + /// Get or set the global animation rate scale + /// + /// Global rate scale public float rateScale { get { return _rateScale; } set { _rateScale = Mathf.Clamp(value, 0.0f, float.MaxValue); } @@ -67,40 +96,75 @@ namespace FTRuntime { // // --------------------------------------------------------------------- + /// + /// Pause animation updates + /// public void Pause() { isPaused = true; } + /// + /// Resume animation updates + /// public void Resume() { isPlaying = true; } + /// + /// Pause the group of animations by name + /// + /// Group name public void PauseGroup(string group_name) { if ( !string.IsNullOrEmpty(group_name) ) { _groupPauses.Add(group_name); } } + /// + /// Resume the group of animations by name + /// + /// Group name public void ResumeGroup(string group_name) { if ( !string.IsNullOrEmpty(group_name) ) { _groupPauses.Remove(group_name); } } + /// + /// Determines whether group of animations is paused + /// + /// true if group is paused; otherwise, false. + /// Group name public bool IsGroupPaused(string group_name) { return _groupPauses.Contains(group_name); } + + /// + /// Determines whether group of animations is playing + /// + /// true if group is playing; otherwise, false. + /// Group name public bool IsGroupPlaying(string group_name) { return !IsGroupPaused(group_name); } + /// + /// Set the group of animations rate scale + /// + /// Group name + /// Rate scale public void SetGroupRateScale(string group_name, float rate_scale) { if ( !string.IsNullOrEmpty(group_name) ) { _groupRateScales[group_name] = Mathf.Clamp(rate_scale, 0.0f, float.MaxValue); } } + /// + /// Get the group of animations rate scale + /// + /// The group rate scale. + /// Group name. public float GetGroupRateScale(string group_name) { float rate_scale; return _groupRateScales.TryGetValue(group_name, out rate_scale)