You've already forked taptap2024_GJ_chidouren
init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# [1.0.0]
|
||||
|
||||
基础版本.
|
||||
|
||||
# [1.0.1]
|
||||
|
||||
### 修复
|
||||
|
||||
* 优化package.json文件
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c6bb78b5f8e27d42847d328bcdecdfb
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f49b29483d9030a43ac674c5899ebe07
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "CCFramework.UI",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:9d61d29b329d622458c8165d250bc2d9",
|
||||
"GUID:d4bb0bd753f95014db401a3eb2adcb5e",
|
||||
"MintAnimation.Runtime"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04c76d5f1e8a4cf468fcbc69ae1b35c5
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17474e58f38fba44bb3a6bdea4f88e1e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c0ecdbba0f74ea4fb0ce2c7df374454
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
## [0.2.0]-2019-7-25
|
||||
- <20>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
- <20>ع<EFBFBD>Core<72>ײ<EFBFBD>
|
||||
## [0.1.9]-2019-7-24
|
||||
- <20><><EFBFBD>ӡ<EFBFBD>IsReversal<61><6C><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
||||
- <20>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC>Ľṹ
|
||||
- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>
|
||||
## [0.1.5]-2019-7-2
|
||||
- Add Bezier in Position Component
|
||||
- Add Played Default Action
|
||||
- Add animation in Transform
|
||||
- Update animation
|
||||
## [0.1.3]-2019-6-3
|
||||
- Add "Rotation" animation component (with Euler)
|
||||
## [0.1.2]-2019-5-19
|
||||
- Add "Canvas Alpha" animation component
|
||||
## [0.1.0]-2019-5-18
|
||||
- Frist version
|
||||
- Support animation component: Scale, Position, Color
|
||||
- Support custom animation
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9faac1161672ff1409298ee53725bc4d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9567f9d75e175e408583734cea95431
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
using MintAnimation.Runtime.Components;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Editor
|
||||
{
|
||||
[CustomEditor(typeof(MintAnimConfig))]
|
||||
public class MintAnimConfigEditor: UnityEditor.Editor
|
||||
{
|
||||
private ReorderableList _reorderableList;
|
||||
private void OnEnable()
|
||||
{
|
||||
this._reorderableList = new ReorderableList(this.serializedObject , this.serializedObject.FindProperty("Anims") , true , true , true , true);
|
||||
this._reorderableList.drawElementCallback = (rect, index, active, focused) =>
|
||||
{
|
||||
SerializedProperty serializedProperty = this._reorderableList.serializedProperty.GetArrayElementAtIndex(index);
|
||||
this._reorderableList.elementHeight = EditorGUI.GetPropertyHeight(serializedProperty);
|
||||
EditorGUI.PropertyField(rect, serializedProperty);
|
||||
};
|
||||
this._reorderableList.drawHeaderCallback = rect =>
|
||||
{
|
||||
GUI.Label(rect , "Animations");
|
||||
};
|
||||
this._reorderableList.onRemoveCallback = list =>
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoRemoveButton(list);
|
||||
};
|
||||
this._reorderableList.onAddCallback = list =>
|
||||
{
|
||||
if (list.serializedProperty != null)
|
||||
{
|
||||
list.serializedProperty.arraySize++;
|
||||
list.index = list.serializedProperty.arraySize - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoAddButton(list);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
this.serializedObject.Update();
|
||||
EditorGUILayout.Space();
|
||||
this._reorderableList.DoLayoutList();
|
||||
this.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2da79fd611c84a959b92b8574f206e9b
|
||||
timeCreated: 1587892066
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "MintAnimation.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"MintAnimation.Runtime"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28240bbd64781d94a8fb60ecb5568f89
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,108 @@
|
||||
using System.Collections.Generic;
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(MintPlayerBase), true)]
|
||||
public class MintAnimationBaseEditor : PropertyDrawer
|
||||
{
|
||||
|
||||
public static Dictionary<string, Color> HandlerColors = new Dictionary<string, Color>()
|
||||
{
|
||||
{"MintPlayerEuler", Color.magenta},
|
||||
{"MintPlayerGraphicColor", Color.blue},
|
||||
{"MintPlayerPosition", Color.cyan},
|
||||
{"MintPlayerRotation", Color.red},
|
||||
{"MintPlayerScale", Color.yellow},
|
||||
{"MintPlayerAnchoredPos", Color.green},
|
||||
{"MintPlayerGraphicAlpha", new Color(0.72f, 0f, 1f)},
|
||||
{"MintPlayerSizeDelta", new Color(1f, 0.4f, 0f)},
|
||||
{"MintPlayerRendererColor", new Color(0.97f, 1f, 0.01f)},
|
||||
};
|
||||
|
||||
protected float _propertyHeight;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var defaultHeight = 60;
|
||||
var titleRect = new Rect(position.position, new Vector2(position.width, defaultHeight));
|
||||
if (HandlerColors.ContainsKey(property.type))
|
||||
{
|
||||
EditorGUI.DrawRect(titleRect, HandlerColors[property.type] * new Color(1, 1, 1, 0.15f));
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.DrawRect(titleRect, Color.black * new Color(1, 1, 1, 0.15f));
|
||||
}
|
||||
|
||||
this._propertyHeight = 0;
|
||||
this.DrawExtend(position, property);
|
||||
this._propertyHeight += defaultHeight;
|
||||
this.DrawBase(position, property);
|
||||
}
|
||||
|
||||
protected void DrawBase(Rect position, SerializedProperty property)
|
||||
{
|
||||
var tweenOptions = property.FindPropertyRelative("TweenOptions");
|
||||
var isLocal = property.FindPropertyRelative("IsLocal");
|
||||
var isAutoStartValue = property.FindPropertyRelative("IsAutoStartValue");
|
||||
var width = position.width;
|
||||
var labelWidth = EditorGUIUtility.labelWidth;
|
||||
this._propertyHeight += 3;
|
||||
var isLocalRect = new Rect(position.position + new Vector2(width * 0.5f, this._propertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
var isAutoRect = new Rect(position.position + new Vector2(0, this._propertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
this._propertyHeight += EditorGUIUtility.singleLineHeight + 5;
|
||||
|
||||
var optionsRect = new Rect(position.position + new Vector2(0, this._propertyHeight), new Vector2(width, this._propertyHeight));
|
||||
this._propertyHeight += EditorGUI.GetPropertyHeight(tweenOptions);
|
||||
|
||||
EditorGUI.PropertyField(optionsRect, tweenOptions);
|
||||
EditorGUIUtility.labelWidth = width * 0.25f;
|
||||
if (this.ShowAutoBool())
|
||||
EditorGUI.PropertyField(isAutoRect, isAutoStartValue);
|
||||
else
|
||||
isAutoStartValue.boolValue = false;
|
||||
if (this.ShowLocalBool())
|
||||
isLocal.boolValue = EditorGUI.Popup(isLocalRect, isLocal.boolValue ? 1 : 0, new string[] {"World", "Local"}) == 1;
|
||||
else
|
||||
isLocal.boolValue = false;
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
}
|
||||
|
||||
protected virtual void DrawExtend(Rect position, SerializedProperty property)
|
||||
{
|
||||
var curHeight = 5f;
|
||||
var width = position.width;
|
||||
var labelWidth = EditorGUIUtility.labelWidth;
|
||||
var startRect = new Rect(position.position + new Vector2(0, curHeight), new Vector2(width, EditorGUIUtility.singleLineHeight));
|
||||
curHeight += startRect.height + 10;
|
||||
var endRect = new Rect(position.position + new Vector2(0, curHeight), new Vector2(width, EditorGUIUtility.singleLineHeight));
|
||||
EditorGUIUtility.labelWidth = width * 0.25f;
|
||||
var startValue = property.FindPropertyRelative("StartValue");
|
||||
var endValue = property.FindPropertyRelative("EndValue");
|
||||
if (startValue != null)
|
||||
{
|
||||
EditorGUI.PropertyField(startRect, startValue);
|
||||
}
|
||||
|
||||
if (endValue != null)
|
||||
{
|
||||
EditorGUI.PropertyField(endRect, endValue);
|
||||
}
|
||||
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
}
|
||||
|
||||
protected virtual bool ShowLocalBool() { return true; }
|
||||
protected virtual bool ShowAutoBool() { return true; }
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return this._propertyHeight;
|
||||
// return 199;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03c824f58bff43feb6f3ff9e067de428
|
||||
timeCreated: 1587709057
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(MintPlayerMix))]
|
||||
public class MintAnimationMixEditor : MintAnimationBaseEditor
|
||||
{
|
||||
|
||||
public static Dictionary<MintPlayerType, Color> TypeColors = new Dictionary<MintPlayerType, Color>()
|
||||
{
|
||||
{MintPlayerType.None, Color.white},
|
||||
{MintPlayerType.Euler, Color.magenta},
|
||||
{MintPlayerType.GraphicColor, Color.blue},
|
||||
{MintPlayerType.Position, Color.cyan},
|
||||
{MintPlayerType.Rotation, Color.red},
|
||||
{MintPlayerType.Scale, Color.yellow},
|
||||
{MintPlayerType.AnchoredPos, Color.green},
|
||||
{MintPlayerType.GraphicAlpha, new Color(0.72f, 0f, 1f)},
|
||||
{MintPlayerType.SizeDelta, new Color(1f, 0.4f, 0f)},
|
||||
{MintPlayerType.RendererColor, new Color(1f, 0.91f, 0f)},
|
||||
};
|
||||
|
||||
protected override void DrawExtend(Rect position, SerializedProperty property)
|
||||
{
|
||||
var IsSync = property.FindPropertyRelative("IsSync");
|
||||
var AnimType = property.FindPropertyRelative("PlayerType");
|
||||
|
||||
var titleRect = new Rect(position.position, new Vector2(position.width, EditorGUIUtility.singleLineHeight));
|
||||
var typeRect = new Rect(position.position, new Vector2(position.width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
var asyncRect = new Rect(position.position + new Vector2(position.width * 0.75f, 0), new Vector2(position.width * 0.25f, EditorGUIUtility.singleLineHeight));
|
||||
AnimType.enumValueIndex = EditorGUI.Popup(typeRect, AnimType.enumValueIndex, AnimType.enumNames);
|
||||
IsSync.boolValue = EditorGUI.Popup(asyncRect, IsSync.boolValue ? 1 : 0, new[] {"Wait", "Sync"}) == 1;
|
||||
EditorGUI.DrawRect(titleRect, TypeColors[(MintPlayerType) AnimType.enumValueIndex] * new Color(1, 1, 1, 0.3f));
|
||||
|
||||
var curHeight = titleRect.height;
|
||||
var width = position.width;
|
||||
var labelWidth = EditorGUIUtility.labelWidth;
|
||||
var startRect = new Rect(position.position + new Vector2(0, curHeight), new Vector2(width, EditorGUIUtility.singleLineHeight));
|
||||
curHeight += startRect.height + 5;
|
||||
var endRect = new Rect(position.position + new Vector2(0, curHeight), new Vector2(width, EditorGUIUtility.singleLineHeight));
|
||||
EditorGUIUtility.labelWidth = width * 0.25f;
|
||||
var startValue = property.FindPropertyRelative($"Start{this.GetValueName((MintPlayerType) AnimType.enumValueIndex)}");
|
||||
var endValue = property.FindPropertyRelative($"End{this.GetValueName((MintPlayerType) AnimType.enumValueIndex)}");
|
||||
if (startValue != null)
|
||||
{
|
||||
if (((MintPlayerType) AnimType.enumValueIndex) == MintPlayerType.Rotation)
|
||||
{
|
||||
startValue.vector4Value = this.DrawVector4(startRect, startValue.vector4Value, "StartValue");
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(startRect, startValue, new GUIContent("StartValue"));
|
||||
}
|
||||
}
|
||||
|
||||
if (endValue != null)
|
||||
{
|
||||
if (((MintPlayerType) AnimType.enumValueIndex) == MintPlayerType.Rotation)
|
||||
{
|
||||
endValue.vector4Value = this.DrawVector4(endRect, endValue.vector4Value, "EndValue");
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(endRect, endValue, new GUIContent("EndValue"));
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
}
|
||||
|
||||
protected string GetValueName(MintPlayerType playerType)
|
||||
{
|
||||
switch (playerType)
|
||||
{
|
||||
case MintPlayerType.None:
|
||||
break;
|
||||
case MintPlayerType.Position:
|
||||
return "V3";
|
||||
case MintPlayerType.Rotation:
|
||||
return "V4";
|
||||
case MintPlayerType.Scale:
|
||||
return "V3";
|
||||
case MintPlayerType.Euler:
|
||||
return "V3";
|
||||
case MintPlayerType.GraphicColor:
|
||||
return "Col";
|
||||
case MintPlayerType.AnchoredPos:
|
||||
return "V3";
|
||||
case MintPlayerType.GraphicAlpha:
|
||||
return "F";
|
||||
case MintPlayerType.SizeDelta:
|
||||
return "V3";
|
||||
case MintPlayerType.RendererColor:
|
||||
return "Col";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Vector4 DrawVector4(Rect rect, Vector4 value, string label)
|
||||
{
|
||||
var labelRect = new Rect(rect.position, new Vector2(rect.width * 0.24f, rect.height));
|
||||
var x = value.x;
|
||||
var y = value.y;
|
||||
var z = value.z;
|
||||
var w = value.w;
|
||||
EditorGUI.PrefixLabel(labelRect, new GUIContent(label));
|
||||
var width = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = rect.width * 0.19f * 0.2f;
|
||||
x = EditorGUI.FloatField(new Rect(rect.position + new Vector2(rect.width * (0 * 0.19f + 0.24f), 0), new Vector2(rect.width * 0.19f, rect.height)), "x" ,x);
|
||||
y = EditorGUI.FloatField(new Rect(rect.position + new Vector2(rect.width * (1 * 0.19f + 0.24f), 0), new Vector2(rect.width * 0.19f, rect.height)), "y" ,y);
|
||||
z = EditorGUI.FloatField(new Rect(rect.position + new Vector2(rect.width * (2 * 0.19f + 0.24f), 0), new Vector2(rect.width * 0.19f, rect.height)), "z" ,z);
|
||||
w = EditorGUI.FloatField(new Rect(rect.position + new Vector2(rect.width * (3 * 0.19f + 0.24f), 0), new Vector2(rect.width * 0.19f, rect.height)), "w" ,w);
|
||||
EditorGUIUtility.labelWidth = width;
|
||||
return new Vector4(x, y, z, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34fc12bf7de043c4b5e35f266d32a818
|
||||
timeCreated: 1587724491
|
||||
@@ -0,0 +1,63 @@
|
||||
using MintAnimation.Runtime.Components;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Editor
|
||||
{
|
||||
[CustomEditor(typeof(MintAnimator))]
|
||||
public class MintAnimatorEditor : UnityEditor.Editor
|
||||
{
|
||||
|
||||
private ReorderableList _reorderableList;
|
||||
private SerializedProperty _isAutoPlay;
|
||||
private SerializedProperty _isLoop;
|
||||
private SerializedProperty _mintConfig;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
this._reorderableList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty("Anims"), true, true, true, true);
|
||||
this._isAutoPlay = this.serializedObject.FindProperty("IsAutoPlay");
|
||||
this._isLoop = this.serializedObject.FindProperty("IsLoop");
|
||||
this._mintConfig = this.serializedObject.FindProperty("AnimConfig");
|
||||
this._reorderableList.drawElementCallback = (rect, index, active, focused) =>
|
||||
{
|
||||
SerializedProperty serializedProperty = this._reorderableList.serializedProperty.GetArrayElementAtIndex(index);
|
||||
this._reorderableList.elementHeight = EditorGUI.GetPropertyHeight(serializedProperty);
|
||||
EditorGUI.PropertyField(rect, serializedProperty);
|
||||
};
|
||||
this._reorderableList.drawHeaderCallback = rect => { GUI.Label(rect, "Animations"); };
|
||||
this._reorderableList.onRemoveCallback = list => { ReorderableList.defaultBehaviours.DoRemoveButton(list); };
|
||||
this._reorderableList.onAddCallback = list =>
|
||||
{
|
||||
if (list.serializedProperty != null)
|
||||
{
|
||||
list.serializedProperty.arraySize++;
|
||||
list.index = list.serializedProperty.arraySize - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReorderableList.defaultBehaviours.DoAddButton(list);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
this.serializedObject.Update();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PropertyField(this._isAutoPlay);
|
||||
EditorGUILayout.PropertyField(this._isLoop);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.PropertyField(this._mintConfig);
|
||||
if (this._mintConfig.objectReferenceValue == null)
|
||||
{
|
||||
this._reorderableList.DoLayoutList();
|
||||
}
|
||||
|
||||
this.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab5fb68de9ca4da481e48a6b5370ee0d
|
||||
timeCreated: 1587806054
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Editor
|
||||
{
|
||||
[CustomEditor(typeof(MintDriveComponent))]
|
||||
public class MintDriveEditor : UnityEditor.Editor
|
||||
{
|
||||
|
||||
private MintDriveComponent _driveComponent;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
this.serializedObject.Update();
|
||||
this._driveComponent = (MintDriveComponent) serializedObject.targetObject;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Update Count:", this._driveComponent.UpdateCount + "");
|
||||
EditorGUILayout.LabelField("Peak :", this._driveComponent.MaxUpdateCount + "");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Fixed Update Count:", this._driveComponent.FixedUpdateCount + "");
|
||||
EditorGUILayout.LabelField("Peak :", this._driveComponent.MaxFixedUpdateCount + "");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Enumerator Count:", this._driveComponent.EnumeratorCount + "");
|
||||
EditorGUILayout.LabelField("Peak :", this._driveComponent.MaxEnumeratorCount + "");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("TimeOffset", this._driveComponent.TimeOffset + "");
|
||||
this.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c7c0ed7272c46c9bff118c11d11d207
|
||||
timeCreated: 1619575034
|
||||
@@ -0,0 +1,78 @@
|
||||
using MintAnimation.Core;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(MintTweenOptions))]
|
||||
public class MintTweenOptionsEditor : PropertyDrawer
|
||||
{
|
||||
|
||||
public float PropertyHeight;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var width = position.width;
|
||||
var labelWidth = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = width * 0.25f;
|
||||
this.PropertyHeight = 0;
|
||||
var titleRect = new Rect(position.position, new Vector2(width, 5));
|
||||
this.PropertyHeight += 5;
|
||||
var durationRect = new Rect(position.position + new Vector2(0, this.PropertyHeight), new Vector2(width, EditorGUIUtility.singleLineHeight));
|
||||
this.PropertyHeight += EditorGUIUtility.singleLineHeight + 2;;
|
||||
var flipRect = new Rect(position.position + new Vector2(0, this.PropertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
var backRect = new Rect(position.position + new Vector2(width * 0.5f, this.PropertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
this.PropertyHeight += EditorGUIUtility.singleLineHeight + 2;;
|
||||
var loopRect = new Rect(position.position + new Vector2(0, this.PropertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
var loopCountRect = new Rect(position.position + new Vector2(width * 0.5f, this.PropertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
this.PropertyHeight += EditorGUIUtility.singleLineHeight + 2;;
|
||||
var customEaseRect = new Rect(position.position + new Vector2(0, this.PropertyHeight), new Vector2(width * 0.4f, EditorGUIUtility.singleLineHeight));
|
||||
var easeRect = new Rect(position.position + new Vector2(width * 0.4f, this.PropertyHeight), new Vector2(width * 0.6f, EditorGUIUtility.singleLineHeight));
|
||||
this.PropertyHeight += EditorGUIUtility.singleLineHeight + 2;;
|
||||
var updaterTypeRect = new Rect(position.position + new Vector2(0, this.PropertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
var updaterTweenTypeRect = new Rect(position.position + new Vector2(width * 0.5f, this.PropertyHeight), new Vector2(width * 0.5f, EditorGUIUtility.singleLineHeight));
|
||||
this.PropertyHeight += EditorGUIUtility.singleLineHeight + 10;
|
||||
var Duration = property.FindPropertyRelative("Duration");
|
||||
var IsBack = property.FindPropertyRelative("IsBack");
|
||||
var IsFlip = property.FindPropertyRelative("IsFlip");
|
||||
var IsLoop = property.FindPropertyRelative("IsLoop");
|
||||
var LoopCount = property.FindPropertyRelative("LoopCount");
|
||||
var IsCustomEase = property.FindPropertyRelative("IsCustomEase");
|
||||
var EaseType = property.FindPropertyRelative("EaseType");
|
||||
var TimeCurve = property.FindPropertyRelative("TimeCurve");
|
||||
var UpdaterTypeEnum = property.FindPropertyRelative("UpdaterTypeEnum");
|
||||
var UpdaterTweenTypeEnum = property.FindPropertyRelative("TweenType");
|
||||
|
||||
// EditorGUI.DrawRect(new Rect(position.position , new Vector2(width , this.PropertyHeight)) , new Color(0.38f, 0.09f, 0.56f, 0.41f));
|
||||
EditorGUI.DrawRect(titleRect , Color.black);
|
||||
// EditorGUI.Slider(durationRect, Duration, 0.01f , 50f );
|
||||
EditorGUI.PropertyField(durationRect, Duration);
|
||||
EditorGUI.PropertyField(flipRect, IsFlip);
|
||||
EditorGUI.PropertyField(backRect, IsBack);
|
||||
EditorGUI.PropertyField(loopRect, IsLoop);
|
||||
if (IsLoop.boolValue)
|
||||
{
|
||||
EditorGUI.PropertyField(loopCountRect, LoopCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(loopCountRect , "LoopCount" , "0");
|
||||
}
|
||||
EditorGUI.PropertyField(customEaseRect, IsCustomEase);
|
||||
if (IsCustomEase.boolValue)
|
||||
{
|
||||
EditorGUI.CurveField(easeRect, TimeCurve, Color.yellow, new Rect(0, 1, 0, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.PropertyField(easeRect, EaseType);
|
||||
}
|
||||
EditorGUI.PropertyField(updaterTypeRect, UpdaterTypeEnum);
|
||||
EditorGUI.PropertyField(updaterTweenTypeRect, UpdaterTweenTypeEnum);
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return this.PropertyHeight; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa43a37f7a1c61d40b0a4b9c4c0ef2aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
# MintAnimation
|
||||
|
||||
#### Description
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54e8a77d16c8cae4b9f0eb6a0cb39d6a
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
# MintAnimation
|
||||
|
||||
#### 简介
|
||||
MintAnimation是一款轻量级动画插件,在保证性能的情况下能够灵活简单的为你的UI/GameObject添加多样的动画。同时也可以通过该插件快速制作自定义动画。
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b145346eb1a598741a4a9a8e0f75f508
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7eeddc9198827f0499d902084e827de4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d390de241acb5da4f954f501b25fe561
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MintAnimation.Runtime.Components
|
||||
{
|
||||
public interface IMintAnim
|
||||
{
|
||||
void StartAnim();
|
||||
void PauseAnim();
|
||||
void ResumeAnim();
|
||||
void StopAnim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e55b1e7123b2411cadec14529e05d30c
|
||||
timeCreated: 1588823420
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components
|
||||
{
|
||||
[CreateAssetMenu( fileName = "MintAnimConfig" , menuName = "MintAnimConfig")]
|
||||
public class MintAnimConfig : ScriptableObject
|
||||
{
|
||||
public List<MintPlayerMix> Anims;
|
||||
|
||||
/// <summary>
|
||||
/// 从内存中单独创建一份
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<MintPlayerMix> CreateAnims()
|
||||
{
|
||||
List<MintPlayerMix> anims = new List<MintPlayerMix>(Anims.Count);
|
||||
for (int i = 0; i < Anims.Count; i++)
|
||||
{
|
||||
anims.Add(Anims[i].Clone());
|
||||
}
|
||||
return anims;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 217dd5ff45cd400ca9d307f064e87cf3
|
||||
timeCreated: 1587891655
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fa579337e2845b9ae02fad7908d4889
|
||||
timeCreated: 1588822369
|
||||
@@ -0,0 +1,13 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/AnchoredPos")]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class MintAnimAnchoredPos : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerAnchoredPos MintPlayer = new MintPlayerAnchoredPos();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13792d2bb6eb4041ab22c21871f017d0
|
||||
timeCreated: 1588822504
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[Serializable]
|
||||
public abstract class MintAnimBase : MonoBehaviour, IMintAnim
|
||||
{
|
||||
public bool IsAutoPlay = true;
|
||||
protected bool _isInit;
|
||||
public abstract MintPlayerBase MintAnimation();
|
||||
public event Action OnComplete;
|
||||
private Action _oncomplete;
|
||||
|
||||
private MintTween _tween;
|
||||
|
||||
|
||||
public void Init()
|
||||
{
|
||||
if (this._isInit)
|
||||
return;
|
||||
if (this.MintAnimation().Init(this.transform))
|
||||
{
|
||||
this._tween = this.MintAnimation().Tween;
|
||||
this._isInit = true;
|
||||
this._tween.OnComplete += this._onComplete;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPlayTime(float time)
|
||||
{
|
||||
this.Init();
|
||||
this._tween.SetPlayTime(time);
|
||||
}
|
||||
|
||||
public void StartAnim (Action callback)
|
||||
{
|
||||
this._oncomplete = callback;
|
||||
StartAnim();
|
||||
}
|
||||
|
||||
public void StartAnim()
|
||||
{
|
||||
this.Init();
|
||||
this._tween.Start();
|
||||
}
|
||||
|
||||
public void PauseAnim()
|
||||
{
|
||||
if (!this._isInit) return;
|
||||
this._tween.Pause();
|
||||
}
|
||||
|
||||
public void ResumeAnim()
|
||||
{
|
||||
if (!this._isInit) return;
|
||||
this._tween.Resume();
|
||||
}
|
||||
|
||||
public void StopAnim()
|
||||
{
|
||||
if (!this._isInit) return;
|
||||
this._tween.End();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (this.IsAutoPlay)
|
||||
{
|
||||
this.StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
this.PauseAnim();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (this._isInit)
|
||||
{
|
||||
this._tween.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void _onComplete()
|
||||
{
|
||||
var oncomplete = this._oncomplete;
|
||||
this._oncomplete = null;
|
||||
oncomplete?.Invoke ();
|
||||
this.OnComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 758ac644b9b14e96918ae0b50ff76349
|
||||
timeCreated: 1588821101
|
||||
@@ -0,0 +1,12 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/Euler")]
|
||||
public class MintAnimEuler : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerEuler MintPlayer = new MintPlayerEuler();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5eb9f1e25cbc46e0ad6235587f9e6fe6
|
||||
timeCreated: 1588822957
|
||||
@@ -0,0 +1,13 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/GraphicAlpha")]
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class MintAnimGraphicAlpha : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerGraphicAlpha MintPlayer = new MintPlayerGraphicAlpha();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32ce154d21b948608e0ced1e7bbb698e
|
||||
timeCreated: 1588823793
|
||||
@@ -0,0 +1,12 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/GraphicColor")]
|
||||
public class MintAnimGraphicColor : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerGraphicColor MintPlayer = new MintPlayerGraphicColor();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc8942657adf4c7e82517aa1bf7657a0
|
||||
timeCreated: 1588823841
|
||||
@@ -0,0 +1,12 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/Position")]
|
||||
public class MintAnimPosition : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerPosition MintPlayer = new MintPlayerPosition();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f02463e6db843ee9f79d111f76ca57f
|
||||
timeCreated: 1588822264
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/RendererColor")]
|
||||
[RequireComponent(typeof(Renderer))]
|
||||
public class MintAnimRendererColor : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerRendererColor MintPlayer = new MintPlayerRendererColor();
|
||||
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation()
|
||||
{
|
||||
return this.MintPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d290fa098c494eaf9b9d621a8a925fea
|
||||
timeCreated: 1620033804
|
||||
@@ -0,0 +1,12 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/Rotation")]
|
||||
public class MintAnimRotation : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerRotation MintPlayer = new MintPlayerRotation();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f41672741b24e79b928a8972fb0ca4d
|
||||
timeCreated: 1588822912
|
||||
@@ -0,0 +1,12 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/Scale")]
|
||||
public class MintAnimScale : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerScale MintPlayer = new MintPlayerScale();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a081423ec3d040398636827c80f5f14c
|
||||
timeCreated: 1588823000
|
||||
@@ -0,0 +1,12 @@
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components.MintAnimation
|
||||
{
|
||||
[AddComponentMenu("MintAnimation/Animation/SizeDelta")]
|
||||
public class MintAnimSizeDelta : MintAnimBase
|
||||
{
|
||||
public Core.MintAnim.MintPlayerSizeDelta MintPlayer = new MintPlayerSizeDelta();
|
||||
public override Core.MintAnim.MintPlayerBase MintAnimation() { return this.MintPlayer; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77c0ec076ce748c48f0b9c892fba967c
|
||||
timeCreated: 1588823742
|
||||
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MintAnimation.Runtime.Core.MintAnim;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Components
|
||||
{
|
||||
[AddComponentMenu ("MintAnimation/Animator")]
|
||||
public class MintAnimator : MonoBehaviour, IMintAnim
|
||||
{
|
||||
public bool IsAutoPlay;
|
||||
public bool IsLoop;
|
||||
public MintAnimConfig AnimConfig;
|
||||
public List<MintPlayerMix> Anims;
|
||||
public List<MintPlayerMix> CurAnims => this._anims;
|
||||
|
||||
private bool _isInit;
|
||||
private List<MintPlayerMix> _anims;
|
||||
|
||||
private int _curIndex;
|
||||
private int _curPlayingCount;
|
||||
private List<MintPlayerMix> _curPlayingAnims;
|
||||
|
||||
public Action OnComplete;
|
||||
private Action _onceOnComplete;
|
||||
|
||||
public bool HasPlaying => this._curPlayingCount > 0;
|
||||
|
||||
public void Init ()
|
||||
{
|
||||
if (this._isInit == false)
|
||||
{
|
||||
this._anims = new List<MintPlayerMix> ();
|
||||
if (this.AnimConfig != null)
|
||||
{
|
||||
this._anims.AddRange (this.AnimConfig.CreateAnims ());
|
||||
}
|
||||
else
|
||||
{
|
||||
this._anims.AddRange (this.Anims);
|
||||
}
|
||||
|
||||
this._curPlayingAnims = new List<MintPlayerMix> ();
|
||||
foreach (var anim in this._anims)
|
||||
{
|
||||
if (anim.InitAnim (this.transform))
|
||||
{
|
||||
anim.OnComplete = this.OnAnimEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._isInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable ()
|
||||
{
|
||||
if (this.IsAutoPlay)
|
||||
{
|
||||
this.StartAnim ();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy ()
|
||||
{
|
||||
if (this._isInit)
|
||||
{
|
||||
foreach (var anim in this._anims)
|
||||
{
|
||||
anim.Player.Tween.Kill ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable ()
|
||||
{
|
||||
if (this._isInit)
|
||||
{
|
||||
this.PauseAnim ();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartAnim (Action onceCallback)
|
||||
{
|
||||
this._onceOnComplete = onceCallback;
|
||||
StartAnim();
|
||||
}
|
||||
|
||||
public void StartAnim ()
|
||||
{
|
||||
this.Init ();
|
||||
if (!this._isInit)
|
||||
return;
|
||||
this._curIndex = 0;
|
||||
this._curPlayingCount = 0;
|
||||
this.ResetAnimState ();
|
||||
this.NextAnim ();
|
||||
}
|
||||
|
||||
public void PauseAnim ()
|
||||
{
|
||||
if (!this._isInit)
|
||||
return;
|
||||
foreach (var playingAnim in this._curPlayingAnims)
|
||||
{
|
||||
playingAnim.Player.Tween.Pause ();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeAnim ()
|
||||
{
|
||||
if (!this._isInit)
|
||||
return;
|
||||
foreach (var playingAnim in this._curPlayingAnims)
|
||||
{
|
||||
playingAnim.Player.Tween.Resume ();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置复合动画的初始状态
|
||||
/// </summary>
|
||||
public void ResetAnimState ()
|
||||
{
|
||||
if (!this._isInit)
|
||||
{
|
||||
Init ();
|
||||
}
|
||||
|
||||
var anims = this._anims;
|
||||
var types = new List<MintPlayerType> ();
|
||||
foreach (var playerMix in anims)
|
||||
{
|
||||
if (!types.Contains (playerMix.PlayerType))
|
||||
{
|
||||
playerMix.Player.Tween.SetPlayTime ();
|
||||
types.Add (playerMix.PlayerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopAnim ()
|
||||
{
|
||||
if (!this._isInit)
|
||||
return;
|
||||
foreach (var playingAnim in this._curPlayingAnims)
|
||||
{
|
||||
playingAnim.Player.Tween.Pause ();
|
||||
}
|
||||
|
||||
this._curIndex = this._anims.Count - 1;
|
||||
this._curPlayingAnims.Clear ();
|
||||
this._curPlayingCount = 0;
|
||||
this.OnCompleteAnim ();
|
||||
}
|
||||
|
||||
private void OnAnimEnd ()
|
||||
{
|
||||
this._curPlayingCount--;
|
||||
if (this._curPlayingCount == 0)
|
||||
{
|
||||
this._curPlayingAnims.Clear ();
|
||||
this._curIndex++;
|
||||
if (this._curIndex >= this._anims.Count)
|
||||
{
|
||||
if (this.IsLoop)
|
||||
{
|
||||
this.StartAnim ();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.OnCompleteAnim ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.NextAnim ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCompleteAnim ()
|
||||
{
|
||||
this._curIndex = -1;
|
||||
var callback = this._onceOnComplete;
|
||||
this._onceOnComplete = null;
|
||||
callback?.Invoke ();
|
||||
this.OnComplete?.Invoke ();
|
||||
}
|
||||
|
||||
private void NextAnim ()
|
||||
{
|
||||
this._curPlayingCount++;
|
||||
this._curPlayingAnims.Add (this._anims[this._curIndex]);
|
||||
this._anims[this._curIndex].Player.Tween.Start ();
|
||||
if (this._anims[this._curIndex].IsSync)
|
||||
{
|
||||
this._curIndex++;
|
||||
if (this._curIndex >= this._anims.Count)
|
||||
{
|
||||
this._curIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.NextAnim ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b565b5280d51b2d429b1ce4ae3cb495c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c03d22c63c887c47883530a44da790d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d7ecac7fcc9470d99a5b6fe204717f8
|
||||
timeCreated: 1563984016
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public interface IMintChannel
|
||||
{
|
||||
|
||||
void OnProcessUpdate(float processValue);
|
||||
void UpdateStartValue(object startValue);
|
||||
void UpdateEndValue(object endValue);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a8cd61f9d13463390725c16591cc3da
|
||||
timeCreated: 1584441222
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public abstract class MintChannelBase<T> where T : struct
|
||||
{
|
||||
protected T StartValue;
|
||||
protected T EndValue;
|
||||
public Action<T> OnProcess { get; protected set; }
|
||||
|
||||
protected MintChannelBase(Action<T> onProcess, T startValue, T endValue)
|
||||
{
|
||||
this.OnProcess = onProcess;
|
||||
this.RefreshValue(startValue, endValue);
|
||||
}
|
||||
|
||||
public void RefreshValue(T startValue, T endValue)
|
||||
{
|
||||
this.StartValue = startValue;
|
||||
this.EndValue = endValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6fd14ea2f6c4049832cb3593834bf0b
|
||||
timeCreated: 1584946706
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public class MintChannelColor : MintChannelBase<Color>, IMintChannel
|
||||
{
|
||||
|
||||
|
||||
public MintChannelColor(Action<Color> onProcess, Color startValue, Color endValue) : base(onProcess, startValue, endValue) { }
|
||||
public void OnProcessUpdate(float processValue) { this.OnProcess?.Invoke(Color.Lerp(this.StartValue, this.EndValue, processValue)); }
|
||||
public void UpdateStartValue(object startValue) { this.StartValue = (Color) startValue; }
|
||||
public void UpdateEndValue(object endValue) { this.EndValue = (Color) endValue; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23978790e7644ebb87bb1fa74b43b885
|
||||
timeCreated: 1587116577
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public class MintChannelFloat : MintChannelBase<float>, IMintChannel
|
||||
{
|
||||
|
||||
|
||||
public MintChannelFloat(Action<float> onProcess, float startValue, float endValue) : base(onProcess, startValue, endValue) { }
|
||||
public void OnProcessUpdate(float processValue) { this.OnProcess?.Invoke((this.EndValue - this.StartValue) * processValue + this.StartValue); }
|
||||
public void UpdateStartValue(object startValue) { this.StartValue = (float) startValue; }
|
||||
public void UpdateEndValue(object endValue) { this.StartValue = (float) endValue; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22d330f77a1749d98044a209ccbd492a
|
||||
timeCreated: 1587116469
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public class MintChannelRotation : MintChannelBase<Quaternion>, IMintChannel
|
||||
{
|
||||
public MintChannelRotation(Action<Quaternion> onProcess, Quaternion startValue, Quaternion endValue) : base(onProcess, startValue, endValue) { }
|
||||
public void OnProcessUpdate(float processValue) { this.OnProcess?.Invoke(Quaternion.Slerp(this.StartValue, this.EndValue, processValue)); }
|
||||
public void UpdateStartValue(object startValue) { this.StartValue = (Quaternion) startValue; }
|
||||
public void UpdateEndValue(object endValue) { this.StartValue = (Quaternion) endValue; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d429d7c7b72445b8578aa09d14a2845
|
||||
timeCreated: 1587552695
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public class MintChannelVector3 : MintChannelBase<Vector3>, IMintChannel
|
||||
{
|
||||
|
||||
public MintChannelVector3(Action<Vector3> onProcess, Vector3 startValue, Vector3 endValue) : base(onProcess, startValue, endValue) { }
|
||||
public void OnProcessUpdate(float processValue) { this.OnProcess?.Invoke((this.EndValue - this.StartValue) * processValue + this.StartValue); }
|
||||
public void UpdateStartValue(object startValue) { this.StartValue = (Vector3) startValue; }
|
||||
public void UpdateEndValue(object endValue) { this.StartValue = (Vector3) endValue; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 747d3095a0ce4acdb0a103e9d411eea1
|
||||
timeCreated: 1585203219
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 807c8a0f0fd852544bfb4cda08c116b7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,183 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
// /// <summary>
|
||||
// /// 动画驱动事件
|
||||
// /// </summary>
|
||||
// /// <param name="timeScale">时间间隔 (s)</param>
|
||||
// /// <returns></returns>
|
||||
// public delegate void DriveUpdater(float timeScale);
|
||||
|
||||
/// <summary>
|
||||
/// 动画驱动器
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class MintDriveComponent : MonoBehaviour
|
||||
{
|
||||
private List<MintTween> _updateDrive = null;
|
||||
private List<MintTween> _fixedUpdateDrive = null;
|
||||
private List<MintTween> _enumeratorDrive = null;
|
||||
|
||||
private int _updateCount;
|
||||
private int _fixedUpdateCount;
|
||||
private int _enumeratorCount;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public int UpdateCount => this._updateCount;
|
||||
public int FixedUpdateCount => this._fixedUpdateCount;
|
||||
public int EnumeratorCount => this._enumeratorCount;
|
||||
|
||||
public int MaxUpdateCount;
|
||||
public int MaxFixedUpdateCount;
|
||||
public int MaxEnumeratorCount;
|
||||
#endif
|
||||
|
||||
[Tooltip("时间缩放系数,改变此属性将影响所有使用改驱动器的动画速率")] public float TimeOffset = 1;
|
||||
|
||||
internal void Init()
|
||||
{
|
||||
this._updateDrive = new List<MintTween>();
|
||||
this._fixedUpdateDrive = new List<MintTween>();
|
||||
this._enumeratorDrive = new List<MintTween>();
|
||||
this._updateCount = 0;
|
||||
this._fixedUpdateCount = 0;
|
||||
this._enumeratorCount = 0;
|
||||
}
|
||||
|
||||
#region Public
|
||||
|
||||
internal void AddDriveAction(MintTween driveAction, UpdaterTypeEnum driveEnum = UpdaterTypeEnum.Update)
|
||||
{
|
||||
switch (driveEnum)
|
||||
{
|
||||
case UpdaterTypeEnum.Update:
|
||||
this._updateDrive.Add(driveAction);
|
||||
break;
|
||||
case UpdaterTypeEnum.FixedUpdate:
|
||||
this._fixedUpdateDrive.Add(driveAction);
|
||||
break;
|
||||
case UpdaterTypeEnum.Coroutine:
|
||||
this._enumeratorDrive.Add(driveAction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
internal void RemoveDriveAction(MintTween driveAction, UpdaterTypeEnum driveEnum = UpdaterTypeEnum.Update)
|
||||
{
|
||||
switch (driveEnum)
|
||||
{
|
||||
case UpdaterTypeEnum.Update:
|
||||
this._updateDrive.Remove(driveAction);
|
||||
break;
|
||||
case UpdaterTypeEnum.FixedUpdate:
|
||||
this._fixedUpdateDrive.Remove(driveAction);
|
||||
break;
|
||||
case UpdaterTypeEnum.Coroutine:
|
||||
this._enumeratorDrive.Remove(driveAction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddCount(UpdaterTypeEnum driveEnum)
|
||||
{
|
||||
switch (driveEnum)
|
||||
{
|
||||
case UpdaterTypeEnum.Update:
|
||||
this._updateCount++;
|
||||
break;
|
||||
case UpdaterTypeEnum.FixedUpdate:
|
||||
this._fixedUpdateCount++;
|
||||
break;
|
||||
case UpdaterTypeEnum.Coroutine:
|
||||
this._enumeratorCount++;
|
||||
break;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
this.MaxUpdateCount = Mathf.Max(this.MaxUpdateCount, this._updateCount);
|
||||
this.MaxFixedUpdateCount = Mathf.Max(this.MaxFixedUpdateCount, this._fixedUpdateCount);
|
||||
this.MaxEnumeratorCount = Mathf.Max(this.MaxEnumeratorCount, this._enumeratorCount);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
internal void RemoveCount(UpdaterTypeEnum driveEnum)
|
||||
{
|
||||
switch (driveEnum)
|
||||
{
|
||||
case UpdaterTypeEnum.Update:
|
||||
this._updateCount--;
|
||||
break;
|
||||
case UpdaterTypeEnum.FixedUpdate:
|
||||
this._fixedUpdateCount--;
|
||||
break;
|
||||
case UpdaterTypeEnum.Coroutine:
|
||||
this._enumeratorCount--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Updater
|
||||
|
||||
private void Update()
|
||||
{
|
||||
this.ExecuteUpdater(this._updateCount, this._updateDrive, Time.deltaTime * this.TimeOffset);
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
this.ExecuteUpdater(this._fixedUpdateCount, this._fixedUpdateDrive, Time.deltaTime * this.TimeOffset);
|
||||
}
|
||||
|
||||
IEnumerator Updater()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
this.ExecuteUpdater(this._enumeratorCount, this._enumeratorDrive, Time.deltaTime * this.TimeOffset);
|
||||
yield return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteUpdater(int tweenLength, List<MintTween> tweens, float deltaTime)
|
||||
{
|
||||
if (tweenLength == 0)
|
||||
return;
|
||||
for (int i = 0; i < tweens.Count; i++)
|
||||
{
|
||||
var tween = tweens[i];
|
||||
if (!tween.IsPause)
|
||||
{
|
||||
tween.UpdateTweenControl();
|
||||
tween.OnLastControl(deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
StartCoroutine(Updater());
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
for (int i = this._updateDrive.Count - 1; i >= 0; i--)
|
||||
this._updateDrive[i].Kill();
|
||||
for (int i = this._fixedUpdateDrive.Count - 1; i >= 0; i--)
|
||||
this._fixedUpdateDrive[i].Kill();
|
||||
for (int i = this._enumeratorDrive.Count - 1; i >= 0; i--)
|
||||
this._enumeratorDrive[i].Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c2265d5c82895e42a46df2cc01c5cb1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public class MintDriveComponentSinge : MonoBehaviour
|
||||
{
|
||||
private static bool mIsInit = false;
|
||||
private static MintDriveComponentSinge _instance;
|
||||
public static MintDriveComponentSinge Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null && !mIsInit)
|
||||
{
|
||||
var objs = FindObjectsOfType<MintDriveComponentSinge>();
|
||||
for (int i = 0; i < objs.Length; i++)
|
||||
{
|
||||
Destroy(objs[i]);
|
||||
}
|
||||
_instance = new GameObject().AddComponent<MintDriveComponentSinge>();
|
||||
_instance.Init();
|
||||
_instance.name = "[ MintAnimationDrive ]";
|
||||
DontDestroyOnLoad(_instance);
|
||||
mIsInit = true;
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public Dictionary<TweenType, MintDriveComponent> _DriveComponents;
|
||||
|
||||
private void Init()
|
||||
{
|
||||
this._DriveComponents = new Dictionary<TweenType, MintDriveComponent>();
|
||||
this.CheckDrive(TweenType.Ui);
|
||||
}
|
||||
|
||||
private void CheckDrive(TweenType tweenType)
|
||||
{
|
||||
if (this._DriveComponents.ContainsKey(tweenType))
|
||||
return;
|
||||
|
||||
var drive = new GameObject( "Drive_"+ tweenType).AddComponent<MintDriveComponent>();
|
||||
drive.transform.SetParent(this.transform);
|
||||
drive.Init();
|
||||
this._DriveComponents[tweenType] = drive;
|
||||
}
|
||||
|
||||
public MintDriveComponent this[TweenType key]
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckDrive(key);
|
||||
return this._DriveComponents[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10274a5bbbffbca4db5fe6965e121ba9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18b58ca133ace7743b89090db4dc7e5d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
|
||||
public enum DriveEnum {
|
||||
//自定义驱动器
|
||||
Custom,
|
||||
//MintDriveComponentSinge
|
||||
Globa
|
||||
}
|
||||
|
||||
public enum UpdaterTypeEnum
|
||||
{
|
||||
Update,
|
||||
FixedUpdate,
|
||||
Coroutine
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b422369b620177c48a8b4cc1c1f1d671
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public enum PlayEndAction
|
||||
{
|
||||
None,
|
||||
Disable,
|
||||
Destroy,
|
||||
DestroyAnimation
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9219a964453aec47a2bc045ee5a6ff7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public enum TweenType
|
||||
{
|
||||
Ui = 0,
|
||||
Game,
|
||||
Scene,
|
||||
Other
|
||||
//可自行扩展
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f512cb8ce9014b2a8232f7a139dc63f8
|
||||
timeCreated: 1619571644
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2baa14c86883a5b438519873d17fdf64
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public static class TransformExpansion
|
||||
{
|
||||
// public static MintTweener<Vector3> RotationTo(this Transform transform, Vector3 endRotation , float duration , MintEaseMethod easeTypoe = MintEaseMethod.Linear)
|
||||
// {
|
||||
// MintTweenDataBase<Vector3> tweenInfo = new MintTweenDataBase<Vector3>(){
|
||||
// EaseType = easeTypoe,
|
||||
// Duration = duration
|
||||
// };
|
||||
// tweenInfo.StartValue = transform.localRotation.eulerAngles;
|
||||
// tweenInfo.EndValue = endRotation;
|
||||
// return new MintTweener<Vector3>(() => transform.localEulerAngles,
|
||||
// rValue => transform.localEulerAngles = rValue, tweenInfo);
|
||||
// }
|
||||
//
|
||||
// public static MintTweener<Vector3> MoveTo(this Transform transform, Vector3 endPosition, float duration, MintEaseMethod easeTypoe = MintEaseMethod.Linear)
|
||||
// {
|
||||
// MintTweenDataBase<Vector3> tweenInfo = new MintTweenDataBase<Vector3>(){
|
||||
// EaseType = easeTypoe,
|
||||
// Duration = duration
|
||||
// };
|
||||
// tweenInfo.StartValue = transform.localPosition;
|
||||
// tweenInfo.EndValue = endPosition;
|
||||
//
|
||||
// return new MintTweener<Vector3>(() => transform.localPosition,
|
||||
// rValue => transform.localPosition = rValue, tweenInfo);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3b0375fa08686a4791782e4a1a254b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,479 @@
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace MintAnimation.Core
|
||||
{
|
||||
public enum MintEaseMethod
|
||||
{
|
||||
Linear,
|
||||
|
||||
Spring,
|
||||
|
||||
InBack,
|
||||
OutBack,
|
||||
InOutBack,
|
||||
|
||||
InQuad,
|
||||
OutQuad,
|
||||
InOutQuad,
|
||||
|
||||
InCubic,
|
||||
OutCubic,
|
||||
InOutCubic,
|
||||
|
||||
InQuart,
|
||||
OutQuart,
|
||||
InOutQuart,
|
||||
|
||||
InQuint,
|
||||
OutQuint,
|
||||
InOutQuint,
|
||||
|
||||
InSine,
|
||||
OutSine,
|
||||
InOutSine,
|
||||
|
||||
InExpo,
|
||||
OutExpo,
|
||||
InOutExpo,
|
||||
|
||||
InCirc,
|
||||
OutCirc,
|
||||
InOutCirc,
|
||||
|
||||
InBounce,
|
||||
OutBounce,
|
||||
InOutBounce,
|
||||
|
||||
InElastic,
|
||||
OutElastic,
|
||||
InOutElastic,
|
||||
}
|
||||
/// <summary>
|
||||
/// 缓动函数集
|
||||
/// </summary>
|
||||
public static class MintEaseAction
|
||||
{
|
||||
public static float GetEaseAction(MintEaseMethod ease_type, float x)
|
||||
{
|
||||
switch (ease_type)
|
||||
{
|
||||
case MintEaseMethod.InBack:
|
||||
return InBack(0, 1, x);
|
||||
case MintEaseMethod.InBounce:
|
||||
return InBounce(0, 1, x);
|
||||
case MintEaseMethod.InCirc:
|
||||
return InCirc(0, 1, x);
|
||||
case MintEaseMethod.InCubic:
|
||||
return InCubic(0, 1, x);
|
||||
case MintEaseMethod.InElastic:
|
||||
return InElastic(0, 1, x);
|
||||
case MintEaseMethod.InExpo:
|
||||
return InExpo(0, 1, x);
|
||||
case MintEaseMethod.InOutBack:
|
||||
return InOutBack(0, 1, x);
|
||||
case MintEaseMethod.InOutBounce:
|
||||
return InOutBounce(0, 1, x);
|
||||
case MintEaseMethod.InOutCirc:
|
||||
return InOutCirc(0, 1, x);
|
||||
case MintEaseMethod.InOutCubic:
|
||||
return InOutCubic(0, 1, x);
|
||||
case MintEaseMethod.InOutElastic:
|
||||
return InOutElastic(0, 1, x);
|
||||
case MintEaseMethod.InOutExpo:
|
||||
return InOutExpo(0, 1, x);
|
||||
case MintEaseMethod.InOutQuad:
|
||||
return InOutQuad(0, 1, x);
|
||||
case MintEaseMethod.InOutQuart:
|
||||
return InOutQuart(0, 1, x);
|
||||
case MintEaseMethod.InOutQuint:
|
||||
return InOutQuint(0, 1, x);
|
||||
case MintEaseMethod.InOutSine:
|
||||
return InOutSine(0, 1, x);
|
||||
case MintEaseMethod.InQuad:
|
||||
return InQuad(0, 1, x);
|
||||
case MintEaseMethod.InQuart:
|
||||
return InQuart(0, 1, x);
|
||||
case MintEaseMethod.InQuint:
|
||||
return InQuint(0, 1, x);
|
||||
case MintEaseMethod.InSine:
|
||||
return InSine(0, 1, x);
|
||||
case MintEaseMethod.Linear:
|
||||
return Linear(0, 1, x);
|
||||
case MintEaseMethod.OutBack:
|
||||
return OutBack(0, 1, x);
|
||||
case MintEaseMethod.OutBounce:
|
||||
return OutBounce(0, 1, x);
|
||||
case MintEaseMethod.OutCirc:
|
||||
return OutCirc(0, 1, x);
|
||||
case MintEaseMethod.OutCubic:
|
||||
return OutCubic(0, 1, x);
|
||||
case MintEaseMethod.OutElastic:
|
||||
return OutElastic(0, 1, x);
|
||||
case MintEaseMethod.OutExpo:
|
||||
return OutExpo(0, 1, x);
|
||||
case MintEaseMethod.OutQuad:
|
||||
return OutQuad(0, 1, x);
|
||||
case MintEaseMethod.OutQuart:
|
||||
return OutQuart(0, 1, x);
|
||||
case MintEaseMethod.OutQuint:
|
||||
return OutQuint(0, 1, x);
|
||||
case MintEaseMethod.OutSine:
|
||||
return OutSine(0, 1, x);
|
||||
case MintEaseMethod.Spring:
|
||||
return Spring(0, 1, x);
|
||||
default:
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static float Linear(float start, float end, float value)
|
||||
{
|
||||
return math.lerp(start, end, value);
|
||||
}
|
||||
|
||||
public static float Spring(float start, float end, float value)
|
||||
{
|
||||
value = math.clamp(value , 0 , 1f);
|
||||
value = (math.sin(value * math.PI * (0.2f + 2.5f * value * value * value)) * math.pow(1f - value, 2.2f) + value) * (1f + (1.2f * (1f - value)));
|
||||
return start + (end - start) * value;
|
||||
}
|
||||
|
||||
public static float InQuad(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * value * value + start;
|
||||
}
|
||||
|
||||
public static float OutQuad(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return -end * value * (value - 2) + start;
|
||||
}
|
||||
|
||||
public static float InOutQuad(float start, float end, float value)
|
||||
{
|
||||
value /= .5f;
|
||||
end -= start;
|
||||
if (value < 1) return end / 2 * value * value + start;
|
||||
value--;
|
||||
return -end / 2 * (value * (value - 2) - 1) + start;
|
||||
}
|
||||
|
||||
public static float InCubic(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * value * value * value + start;
|
||||
}
|
||||
|
||||
public static float OutCubic(float start, float end, float value)
|
||||
{
|
||||
value--;
|
||||
end -= start;
|
||||
return end * (value * value * value + 1) + start;
|
||||
}
|
||||
|
||||
public static float InOutCubic(float start, float end, float value)
|
||||
{
|
||||
value /= .5f;
|
||||
end -= start;
|
||||
if (value < 1) return end / 2 * value * value * value + start;
|
||||
value -= 2;
|
||||
return end / 2 * (value * value * value + 2) + start;
|
||||
}
|
||||
|
||||
public static float InQuart(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * value * value * value * value + start;
|
||||
}
|
||||
|
||||
public static float OutQuart(float start, float end, float value)
|
||||
{
|
||||
value--;
|
||||
end -= start;
|
||||
return -end * (value * value * value * value - 1) + start;
|
||||
}
|
||||
|
||||
public static float InOutQuart(float start, float end, float value)
|
||||
{
|
||||
value /= .5f;
|
||||
end -= start;
|
||||
if (value < 1) return end / 2 * value * value * value * value + start;
|
||||
value -= 2;
|
||||
return -end / 2 * (value * value * value * value - 2) + start;
|
||||
}
|
||||
|
||||
public static float InQuint(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * value * value * value * value * value + start;
|
||||
}
|
||||
|
||||
public static float OutQuint(float start, float end, float value)
|
||||
{
|
||||
value--;
|
||||
end -= start;
|
||||
return end * (value * value * value * value * value + 1) + start;
|
||||
}
|
||||
|
||||
public static float InOutQuint(float start, float end, float value)
|
||||
{
|
||||
value /= 0.5f;
|
||||
end -= start;
|
||||
if (value < 1) return end / 2 * value * value * value * value * value + start;
|
||||
value -= 2;
|
||||
return end / 2 * (value * value * value * value * value + 2) + start;
|
||||
}
|
||||
|
||||
public static float InSine(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return -end * math.cos(value / 1 * (math.PI / 2)) + end + start;
|
||||
}
|
||||
|
||||
public static float OutSine(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * math.sin(value / 1 * (math.PI / 2)) + start;
|
||||
}
|
||||
|
||||
public static float InOutSine(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return -end / 2 * (math.cos(math.PI * value / 1) - 1) + start;
|
||||
}
|
||||
|
||||
public static float InExpo(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * math.pow(2, 10 * (value / 1 - 1)) + start;
|
||||
}
|
||||
|
||||
public static float OutExpo(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return end * (-math.pow(2, -10 * value / 1) + 1) + start;
|
||||
}
|
||||
|
||||
public static float InOutExpo(float start, float end, float value)
|
||||
{
|
||||
value /= .5f;
|
||||
end -= start;
|
||||
if (value < 1) return end / 2 * math.pow(2, 10 * (value - 1)) + start;
|
||||
value--;
|
||||
return end / 2 * (-math.pow(2, -10 * value) + 2) + start;
|
||||
}
|
||||
|
||||
public static float InCirc(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
return -end * (math.sqrt(1 - value * value) - 1) + start;
|
||||
}
|
||||
|
||||
public static float OutCirc(float start, float end, float value)
|
||||
{
|
||||
value--;
|
||||
end -= start;
|
||||
return end * math.sqrt(1 - value * value) + start;
|
||||
}
|
||||
|
||||
public static float InOutCirc(float start, float end, float value)
|
||||
{
|
||||
value /= .5f;
|
||||
end -= start;
|
||||
if (value < 1) return -end / 2 * (math.sqrt(1 - value * value) - 1) + start;
|
||||
value -= 2;
|
||||
return end / 2 * (math.sqrt(1 - value * value) + 1) + start;
|
||||
}
|
||||
|
||||
public static float InBounce(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
float d = 1f;
|
||||
return end - OutBounce(0, end, d - value) + start;
|
||||
}
|
||||
|
||||
public static float OutBounce(float start, float end, float value)
|
||||
{
|
||||
value /= 1f;
|
||||
end -= start;
|
||||
if (value < (1 / 2.75f))
|
||||
{
|
||||
return end * (7.5625f * value * value) + start;
|
||||
}
|
||||
else if (value < (2 / 2.75f))
|
||||
{
|
||||
value -= (1.5f / 2.75f);
|
||||
return end * (7.5625f * (value) * value + .75f) + start;
|
||||
}
|
||||
else if (value < (2.5 / 2.75))
|
||||
{
|
||||
value -= (2.25f / 2.75f);
|
||||
return end * (7.5625f * (value) * value + .9375f) + start;
|
||||
}
|
||||
else
|
||||
{
|
||||
value -= (2.625f / 2.75f);
|
||||
return end * (7.5625f * (value) * value + .984375f) + start;
|
||||
}
|
||||
}
|
||||
|
||||
public static float InOutBounce(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
float d = 1f;
|
||||
if (value < d / 2) return InBounce(0, end, value * 2) * 0.5f + start;
|
||||
else return OutBounce(0, end, value * 2 - d) * 0.5f + end * 0.5f + start;
|
||||
}
|
||||
|
||||
public static float InBack(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
value /= 1;
|
||||
float s = 1.70158f;
|
||||
return end * (value) * value * ((s + 1) * value - s) + start;
|
||||
}
|
||||
|
||||
public static float OutBack(float start, float end, float value)
|
||||
{
|
||||
float s = 1.70158f;
|
||||
end -= start;
|
||||
value = (value / 1) - 1;
|
||||
return end * ((value) * value * ((s + 1) * value + s) + 1) + start;
|
||||
}
|
||||
|
||||
public static float InOutBack(float start, float end, float value)
|
||||
{
|
||||
float s = 1.70158f;
|
||||
end -= start;
|
||||
value /= .5f;
|
||||
if ((value) < 1)
|
||||
{
|
||||
s *= (1.525f);
|
||||
return end / 2 * (value * value * (((s) + 1) * value - s)) + start;
|
||||
}
|
||||
value -= 2;
|
||||
s *= (1.525f);
|
||||
return end / 2 * ((value) * value * (((s) + 1) * value + s) + 2) + start;
|
||||
}
|
||||
|
||||
public static float InElastic(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
|
||||
float d = 1f;
|
||||
float p = d * .3f;
|
||||
float s = 0;
|
||||
float a = 0;
|
||||
|
||||
if (value == 0) return start;
|
||||
|
||||
if ((value /= d) == 1) return start + end;
|
||||
|
||||
if (a == 0f || a < math.abs(end))
|
||||
{
|
||||
a = end;
|
||||
s = p / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = p / (2 * math.PI) * math.asin(end / a);
|
||||
}
|
||||
|
||||
return -(a * math.pow(2, 10 * (value -= 1)) * math.sin((value * d - s) * (2 * math.PI) / p)) + start;
|
||||
}
|
||||
|
||||
public static float OutElastic(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
|
||||
float d = 1f;
|
||||
float p = d * .3f;
|
||||
float s = 0;
|
||||
float a = 0;
|
||||
|
||||
if (value == 0) return start;
|
||||
|
||||
if ((value /= d) == 1) return start + end;
|
||||
|
||||
if (a == 0f || a < math.abs(end))
|
||||
{
|
||||
a = end;
|
||||
s = p / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = p / (2 * math.PI) * math.asin(end / a);
|
||||
}
|
||||
|
||||
return (a * math.pow(2, -10 * value) * math.sin((value * d - s) * (2 * math.PI) / p) + end + start);
|
||||
}
|
||||
|
||||
public static float InOutElastic(float start, float end, float value)
|
||||
{
|
||||
end -= start;
|
||||
|
||||
float d = 1f;
|
||||
float p = d * .3f;
|
||||
float s = 0;
|
||||
float a = 0;
|
||||
|
||||
if (value == 0) return start;
|
||||
|
||||
if ((value /= d / 2) == 2) return start + end;
|
||||
|
||||
if (a == 0f || a < math.abs(end))
|
||||
{
|
||||
a = end;
|
||||
s = p / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = p / (2 * math.PI) * math.asin(end / a);
|
||||
}
|
||||
|
||||
if (value < 1) return -0.5f * (a * math.pow(2, 10 * (value -= 1)) * math.sin((value * d - s) * (2 * math.PI) / p)) + start;
|
||||
return a * math.pow(2, -10 * (value -= 1)) * math.sin((value * d - s) * (2 * math.PI) / p) * 0.5f + end + start;
|
||||
}
|
||||
|
||||
static float Punch(float amplitude, float value)
|
||||
{
|
||||
float s = 9;
|
||||
if (value == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (value == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
float period = 1 * 0.3f;
|
||||
s = period / (2 * math.PI) * math.asin(0);
|
||||
return (amplitude * math.pow(2, -10 * value) * math.sin((value * 1 - s) * (2 * math.PI) / period));
|
||||
}
|
||||
|
||||
static float Clerp(float start, float end, float value)
|
||||
{
|
||||
float min = 0.0f;
|
||||
float max = 360.0f;
|
||||
float half = math.abs((max - min) / 2.0f);
|
||||
float retval = 0.0f;
|
||||
float diff = 0.0f;
|
||||
if ((end - start) < -half)
|
||||
{
|
||||
diff = ((max - start) + end) * value;
|
||||
retval = start + diff;
|
||||
}
|
||||
else if ((end - start) > half)
|
||||
{
|
||||
diff = -((max - end) + start) * value;
|
||||
retval = start + diff;
|
||||
}
|
||||
else retval = start + (end - start) * value;
|
||||
return retval;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e05ee2a80e0bc6e4cbd92196aae79d37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f81e35f2524e437d8a15f1665a7868ed
|
||||
timeCreated: 1587719416
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Core.MintAnim
|
||||
{
|
||||
[Serializable]
|
||||
public class MintPlayerAnchoredPos : MintPlayerBase
|
||||
{
|
||||
|
||||
public Vector3 StartValue;
|
||||
public Vector3 EndValue;
|
||||
|
||||
private RectTransform _rectTransform;
|
||||
|
||||
|
||||
public override bool Init(Transform transform)
|
||||
{
|
||||
this._rectTransform = (RectTransform) transform;
|
||||
if (this._rectTransform == null)
|
||||
{
|
||||
Debug.LogError("缺少关键组件: RectTransform");
|
||||
return false;
|
||||
}
|
||||
return base.Init(transform);
|
||||
}
|
||||
|
||||
protected override void SetMixData(MintPlayerMix playerMix)
|
||||
{
|
||||
this.StartValue = playerMix.StartV3;
|
||||
this.EndValue = playerMix.EndV3;
|
||||
}
|
||||
|
||||
protected override IMintChannel Channel() { return new MintChannelVector3(this.OnUpdate, this.StartValue, this.EndValue); }
|
||||
|
||||
public override void OnAutoStartValue() { this.StartValue = this._rectTransform.anchoredPosition3D; }
|
||||
|
||||
private void OnUpdate(Vector3 obj) { this._rectTransform.anchoredPosition3D = obj; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6d9c81fcc1a43909dc28bcb22b03da6
|
||||
timeCreated: 1588819373
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace MintAnimation.Runtime.Core.MintAnim
|
||||
{
|
||||
[Serializable]
|
||||
public abstract class MintPlayerBase
|
||||
{
|
||||
protected Transform _transform;
|
||||
public MintTweenOptions TweenOptions = new MintTweenOptions ();
|
||||
public bool IsLocal = false;
|
||||
public bool IsAutoStartValue = false;
|
||||
public MintTween Tween { get; protected set; }
|
||||
|
||||
public MintPlayerBase UpdateForMix (MintPlayerMix playerMix)
|
||||
{
|
||||
this.IsLocal = playerMix.IsLocal;
|
||||
this.IsAutoStartValue = playerMix.IsAutoStartValue;
|
||||
this.TweenOptions = playerMix.TweenOptions;
|
||||
this.SetMixData (playerMix);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected abstract void SetMixData (MintPlayerMix playerMix);
|
||||
|
||||
protected abstract IMintChannel Channel ();
|
||||
|
||||
public abstract void OnAutoStartValue ();
|
||||
|
||||
public virtual bool Init (Transform transform)
|
||||
{
|
||||
this._transform = transform;
|
||||
if (this.IsAutoStartValue)
|
||||
this.OnAutoStartValue ();
|
||||
this.Tween = new MintTween (this.Channel (), this.TweenOptions);
|
||||
return !ReferenceEquals (null, this._transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4aecaf0faf3d7cb429707848a3c2efd9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Core.MintAnim
|
||||
{
|
||||
[Serializable]
|
||||
public class MintPlayerEuler: MintPlayerBase
|
||||
{
|
||||
public Vector3 StartValue;
|
||||
public Vector3 EndValue;
|
||||
|
||||
protected override void SetMixData(MintPlayerMix playerMix)
|
||||
{
|
||||
this.StartValue = playerMix.StartV3;
|
||||
this.EndValue = playerMix.EndV3;
|
||||
}
|
||||
|
||||
protected override IMintChannel Channel() { return new MintChannelVector3(this.OnUpdate, this.StartValue, this.EndValue); }
|
||||
|
||||
private void OnUpdate(Vector3 obj)
|
||||
{
|
||||
if (this.IsLocal)
|
||||
{
|
||||
this._transform.localEulerAngles = obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._transform.eulerAngles = obj;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAutoStartValue()
|
||||
{
|
||||
if (this.IsLocal)
|
||||
{
|
||||
this.StartValue = this._transform.localEulerAngles;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.StartValue = this._transform.eulerAngles;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66da1343d1324eaea42059ae779b9e55
|
||||
timeCreated: 1587553234
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MintAnimation.Runtime.Core.MintAnim
|
||||
{
|
||||
[Serializable]
|
||||
public class MintPlayerGraphicAlpha : MintPlayerBase
|
||||
{
|
||||
public float StartValue = 0;
|
||||
public float EndValue = 1;
|
||||
|
||||
private CanvasGroup _graphic;
|
||||
|
||||
protected override void SetMixData(MintPlayerMix playerMix)
|
||||
{
|
||||
this.StartValue = playerMix.StartF;
|
||||
this.EndValue = playerMix.EndF;
|
||||
}
|
||||
|
||||
protected override IMintChannel Channel() { return new MintChannelFloat(this.OnUpdate, this.StartValue, this.EndValue); }
|
||||
|
||||
public override bool Init(Transform transform)
|
||||
{
|
||||
this._graphic = transform.GetComponent<CanvasGroup>();
|
||||
if (this._graphic == null)
|
||||
{
|
||||
Debug.LogError("缺少关键组件: CanvasGroup" , transform);
|
||||
return false;
|
||||
}
|
||||
return base.Init(transform);
|
||||
}
|
||||
private void OnUpdate(float obj) { this._graphic.alpha = obj; }
|
||||
|
||||
public override void OnAutoStartValue() { this.StartValue = this._graphic.alpha; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 979d54ef0232458eb57ed526c906adcd
|
||||
timeCreated: 1588818134
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MintAnimation.Runtime.Core.MintAnim
|
||||
{
|
||||
[Serializable]
|
||||
public class MintPlayerGraphicColor : MintPlayerBase
|
||||
{
|
||||
public Color StartValue = Color.white;
|
||||
public Color EndValue = Color.white;
|
||||
|
||||
private Graphic _graphic;
|
||||
|
||||
protected override void SetMixData(MintPlayerMix playerMix)
|
||||
{
|
||||
this.StartValue = playerMix.StartCol;
|
||||
this.EndValue = playerMix.EndCol;
|
||||
}
|
||||
|
||||
protected override IMintChannel Channel() { return new MintChannelColor(this.OnUpdate, this.StartValue, this.EndValue); }
|
||||
|
||||
public override bool Init(Transform transform)
|
||||
{
|
||||
this._graphic = transform.GetComponent<Graphic>();
|
||||
if (this._graphic == null)
|
||||
{
|
||||
Debug.LogError("缺少关键组件: Graphic");
|
||||
return false;
|
||||
}
|
||||
return base.Init(transform);
|
||||
}
|
||||
private void OnUpdate(Color obj) { this._graphic.color = obj; }
|
||||
|
||||
public override void OnAutoStartValue() { this.StartValue = this._graphic.color; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ae471a959b342958a91824ac26072b2
|
||||
timeCreated: 1587639788
|
||||
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using MintAnimation.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MintAnimation.Runtime.Core.MintAnim
|
||||
{
|
||||
[Serializable]
|
||||
public class MintPlayerMix
|
||||
{
|
||||
|
||||
public Vector3 StartV3;
|
||||
public Vector3 EndV3;
|
||||
|
||||
public Color StartCol;
|
||||
public Color EndCol;
|
||||
|
||||
public float StartF;
|
||||
public float EndF;
|
||||
|
||||
public Vector4 StartV4;
|
||||
public Vector4 EndV4;
|
||||
|
||||
public MintTweenOptions TweenOptions;
|
||||
|
||||
public bool IsLocal;
|
||||
public bool IsAutoStartValue;
|
||||
|
||||
public bool IsSync;
|
||||
public MintPlayerType PlayerType;
|
||||
|
||||
public MintPlayerBase Player { get; private set; }
|
||||
|
||||
private Transform _transform;
|
||||
private MintPlayerType _curPlayerType;
|
||||
|
||||
public Action OnComplete;
|
||||
|
||||
public MintPlayerMix Clone()
|
||||
{
|
||||
MintPlayerMix playerMix = new MintPlayerMix() {
|
||||
StartV3 = this.StartV3,
|
||||
StartF = this.StartF,
|
||||
StartCol = this.StartCol,
|
||||
StartV4 = this.StartV4,
|
||||
EndF = this.EndF,
|
||||
EndCol = this.EndCol,
|
||||
EndV3 = this.EndV3,
|
||||
EndV4 = this.EndV4,
|
||||
IsAutoStartValue = this.IsAutoStartValue,
|
||||
IsLocal = this.IsLocal,
|
||||
IsSync = this.IsSync,
|
||||
PlayerType = this.PlayerType,
|
||||
TweenOptions = this.TweenOptions,
|
||||
};
|
||||
return playerMix;
|
||||
}
|
||||
|
||||
public bool InitAnim(Transform transform)
|
||||
{
|
||||
this._transform = transform;
|
||||
switch (this.PlayerType)
|
||||
{
|
||||
case MintPlayerType.None:
|
||||
this.Player = new MintPlayerNone();
|
||||
break;
|
||||
case MintPlayerType.Position:
|
||||
this.Player = new MintPlayerPosition();
|
||||
break;
|
||||
case MintPlayerType.Rotation:
|
||||
this.Player = new MintPlayerRotation();
|
||||
break;
|
||||
case MintPlayerType.Scale:
|
||||
this.Player = new MintPlayerScale();
|
||||
break;
|
||||
case MintPlayerType.Euler:
|
||||
this.Player = new MintPlayerEuler();
|
||||
break;
|
||||
case MintPlayerType.GraphicColor:
|
||||
this.Player = new MintPlayerGraphicColor();
|
||||
break;
|
||||
case MintPlayerType.GraphicAlpha:
|
||||
this.Player = new MintPlayerGraphicAlpha();
|
||||
break;
|
||||
case MintPlayerType.AnchoredPos:
|
||||
this.Player = new MintPlayerAnchoredPos();
|
||||
break;
|
||||
case MintPlayerType.SizeDelta:
|
||||
this.Player = new MintPlayerSizeDelta();
|
||||
break;
|
||||
case MintPlayerType.RendererColor:
|
||||
this.Player = new MintPlayerRendererColor();
|
||||
break;
|
||||
}
|
||||
this._curPlayerType = this.PlayerType;
|
||||
this.Player.UpdateForMix(this);
|
||||
var t = this.Player.Init(transform);
|
||||
if (t)
|
||||
{
|
||||
this.Player.Tween.OnComplete += this.OnCompleteAnim;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public void UpdateData()
|
||||
{
|
||||
if (this.PlayerType != this._curPlayerType)
|
||||
{
|
||||
this.Player.Tween?.Kill();
|
||||
this.InitAnim(this._transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Player.UpdateForMix(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshData()
|
||||
{
|
||||
this.Player.Tween?.Kill();
|
||||
this.InitAnim(this._transform);
|
||||
}
|
||||
|
||||
private void OnCompleteAnim()
|
||||
{
|
||||
this.OnComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user