修复了选曲的问题 优化了ui
This commit is contained in:
@@ -0,0 +1,451 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
|
||||
public class Anchors_Window : EditorWindow
|
||||
{
|
||||
private static EditorWindow window;
|
||||
private GUIStyle buttonContentStyle;
|
||||
|
||||
|
||||
private bool infoFoldout;
|
||||
private Vector2 windowScroll;
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/Anchors Window" , priority = 1 )]
|
||||
private static void ShowWindow ()
|
||||
{
|
||||
window = GetWindow<Anchors_Window> ( "Anchors Window" );
|
||||
|
||||
window.maxSize = new Vector2 ( 345 , 430 );
|
||||
window.minSize = new Vector2 ( 345 , 430 );
|
||||
window.Show ();
|
||||
}
|
||||
|
||||
|
||||
private void OnGUI ()
|
||||
{
|
||||
windowScroll = EditorGUILayout.BeginScrollView ( windowScroll , false , false );
|
||||
|
||||
//GUI.color = Color.gray;
|
||||
//WindowTitle_LABEL ();
|
||||
//GUI.color = Color.white;
|
||||
|
||||
EditorGUILayout.Space ( 20 );
|
||||
|
||||
ImportantInfo ();
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
GUI.color = Color.white;
|
||||
|
||||
DrawWindow ();
|
||||
|
||||
DrawRateBox ();
|
||||
DrawYoutube ();
|
||||
|
||||
EditorGUILayout.EndScrollView ();
|
||||
}
|
||||
|
||||
|
||||
private void WindowTitle_LABEL ()
|
||||
{
|
||||
GUILayout.Space ( 10 );
|
||||
|
||||
var titleLabelStyle = new GUIStyle ( GUI.skin.label ) { alignment = TextAnchor.UpperCenter , fontSize = 30 , fontStyle = FontStyle.Bold , fixedHeight = 50 };
|
||||
|
||||
EditorGUILayout.LabelField ( "Anchors Editor" , titleLabelStyle );
|
||||
EditorGUILayout.Space (); EditorGUILayout.Space (); EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.Space ( 30 );
|
||||
}
|
||||
|
||||
|
||||
private void ImportantInfo ()
|
||||
{
|
||||
infoFoldout = EditorGUILayout.BeginFoldoutHeaderGroup ( infoFoldout , "Important Info" );
|
||||
if ( infoFoldout )
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
|
||||
EditorGUILayout.HelpBox ( "Scale of RectTransform must be (1, 1, 1) in order for the anchors to be exact." , MessageType.Warning );
|
||||
EditorGUILayout.HelpBox ( "Sometimes, you may need to set anchors twice if the pivot is not centered." , MessageType.Info );
|
||||
EditorGUILayout.HelpBox ( "You can select multiple Game Objects, and use the shortcut ctrl, shift, q or ctrl, shift, w" , MessageType.Info );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/Anchors/Set Anchors To Fit Rect %#q" , priority = 2 )]
|
||||
public static void SetAnchorsToRectOnSelectedGameObjects_Shortcut ()
|
||||
{
|
||||
SetAnchorsToRectOnSelectedGameObjects ();
|
||||
}
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/Anchors/Align Selected To Anchors %#w" , priority = 2 )]
|
||||
public static void SetRectToAnchorsOnSelectedGameObjects_Shortcut ()
|
||||
{
|
||||
SetRectToAnchorsOnSelectedGameObjects ();
|
||||
}
|
||||
|
||||
|
||||
private void DrawWindow ()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal ();
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0.31f , 0.51f , 1 ) , fontSize: 11 , height: 100 );
|
||||
GUIContent buttonContent = new GUIContent ( "↖ ↗\n↙ ↘\nANCHORS TO RECT\n\nctrl, shift, q" );
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
SetAnchorsToRectOnSelectedGameObjects ();
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0.74f , 0 , 0.37f ) , fontSize: 11 , height: 100 );
|
||||
buttonContent = new GUIContent ( "↘ ↙\n↗ ↖\nRECT TO ANCHORS\n\nctrl, shift, w" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
SetRectToAnchorsOnSelectedGameObjects ();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal ();
|
||||
|
||||
GUILayout.Space ( 10 );
|
||||
|
||||
EditorGUILayout.BeginHorizontal ();
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "↖" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsTopLeft ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "▲" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsTop ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "↗" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsTopRight ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.BeginHorizontal ();
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "◄" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsLeft ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 1 , 0.46f , 0 ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "●" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsCenter ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "►" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsRight ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.BeginHorizontal ();
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "↙" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsBottomLeft ( rectTransform );
|
||||
}
|
||||
}
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "▼" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsBottom ( rectTransform );
|
||||
}
|
||||
}
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
SetButtonStyle ( new Color ( 0 , 1 , 0.9f ) , fontSize: 11 , 30 );
|
||||
buttonContent = new GUIContent ( "↘" );
|
||||
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( var g in Selection.gameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsBottomRight ( rectTransform );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Selection.gameObjects.Length > 0 )
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal ();
|
||||
|
||||
|
||||
EditorGUILayout.Space ( 20 );
|
||||
}
|
||||
|
||||
|
||||
private void DrawRateBox ()
|
||||
{
|
||||
GUILayout.Label ( "If you like Airy UI, Please Rate it On Asset Store ♡" );
|
||||
|
||||
SetButtonStyle ( new Color ( 0.317f , 1 , 0.43f ) , fontSize: 15 , height: 30 , width: 338 , alignment: TextAnchor.MiddleLeft );
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Rate ♡" , SetIcon ( "asset_store.png" ) );
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
Application.OpenURL ( "https://assetstore.unity.com/packages/tools/gui/airy-ui-easy-ui-animation-135898" );
|
||||
|
||||
GUILayout.Space ( 10 );
|
||||
}
|
||||
|
||||
|
||||
private void DrawYoutube ()
|
||||
{
|
||||
GUILayout.Label ( "And also, take a visit to my GameDev Youtube channel" );
|
||||
|
||||
SetButtonStyle ( new Color ( 0.31f , 0.51f , 1 ) , fontSize: 15 , height: 30 , width: 338 , alignment: TextAnchor.MiddleLeft );
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Visit ♡" , SetIcon ( "youtube.png" ) );
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
Application.OpenURL ( "https://youtube.com/ahmedsabrygamedev" );
|
||||
}
|
||||
|
||||
|
||||
private void SetButtonStyle ( Color backgroundColor , int fontSize = 0 , float height = 0 , float width = 0 , TextAnchor alignment = TextAnchor.MiddleCenter )
|
||||
{
|
||||
GUI.backgroundColor = backgroundColor;
|
||||
buttonContentStyle = null;
|
||||
buttonContentStyle = new GUIStyle ( GUI.skin.button );
|
||||
|
||||
buttonContentStyle.alignment = alignment;
|
||||
buttonContentStyle.normal.textColor = Color.white;
|
||||
buttonContentStyle.hover.textColor = Color.yellow;
|
||||
|
||||
if ( height != 0 )
|
||||
buttonContentStyle.fixedHeight = height;
|
||||
|
||||
if ( width != 0 )
|
||||
buttonContentStyle.fixedWidth = width;
|
||||
|
||||
if ( fontSize != 0 )
|
||||
buttonContentStyle.fontSize = fontSize;
|
||||
|
||||
buttonContentStyle.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
|
||||
|
||||
private Texture2D SetIcon ( string icon )
|
||||
{
|
||||
Texture2D buttonIcon = AssetDatabase.LoadAssetAtPath<Texture2D> ( "Assets/Airy UI/Sprites/Icons/" + icon );
|
||||
|
||||
return buttonIcon;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void SetAnchorsToRectOnSelectedGameObjects ()
|
||||
{
|
||||
GameObject [] selectedGameObjects = Selection.gameObjects;
|
||||
|
||||
foreach ( var g in selectedGameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetAnchorsToRect ( rectTransform );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
private static void SetRectToAnchorsOnSelectedGameObjects ()
|
||||
{
|
||||
GameObject [] selectedGameObjects = Selection.gameObjects;
|
||||
|
||||
foreach ( var g in selectedGameObjects )
|
||||
{
|
||||
RectTransform rectTransform = g.GetComponent<RectTransform> ();
|
||||
|
||||
if ( rectTransform != null )
|
||||
{
|
||||
Undo.RecordObject ( rectTransform , "Set Anchors" );
|
||||
Anchors.SetRectToAnchor ( rectTransform );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
PrintDoneMessage ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void PrintDoneMessage ()
|
||||
{
|
||||
Debug.Log ( "<color=orange><b>[Airy UI]</color></b>" +
|
||||
"<color=green><b>✓</color></b>" +
|
||||
" anchors set for "
|
||||
+ Selection.gameObjects.Length +
|
||||
" game object/s" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b54607e6e292a474491ff4e6f8e143f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 76009eabd85feab4db90da457c751412, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/Anchors_Window.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,775 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
[CustomEditor(typeof(AnimatedElement))]
|
||||
[CanEditMultipleObjects]
|
||||
public class AnimatedElement_Inspector : Editor
|
||||
{
|
||||
|
||||
|
||||
private AnimatedElement animatedElement;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _isControlledByGroup;
|
||||
private SerializedProperty _group;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _showTimeMode;
|
||||
private SerializedProperty _hideTimeMode;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _disableShowAnimation;
|
||||
private SerializedProperty _disableHideAnimation;
|
||||
private SerializedProperty _containerCanvas;
|
||||
private SerializedProperty _animateOnEnable;
|
||||
private SerializedProperty _animationShowDuration;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _addBounciness;
|
||||
private SerializedProperty _bouncinessPower;
|
||||
private SerializedProperty _bouncinessDuration;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _animationHideDuration;
|
||||
private SerializedProperty _rotateFrom;
|
||||
private SerializedProperty _rotateTo;
|
||||
private SerializedProperty _showAnimationType;
|
||||
private SerializedProperty _hideAnimationType;
|
||||
private SerializedProperty _fadeChildren;
|
||||
private SerializedProperty _animationMoveFrom;
|
||||
private SerializedProperty _animationMoveTo;
|
||||
private SerializedProperty _delayEnabled;
|
||||
private SerializedProperty _showDelay;
|
||||
private SerializedProperty _hideDelay;
|
||||
private SerializedProperty _onShowEvent;
|
||||
private SerializedProperty _onHideEvent;
|
||||
private SerializedProperty _onShowCompleteEvent;
|
||||
private SerializedProperty _onHideCompleteEvent;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private int currentTabIndex = 0;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private bool basicFoldout_SHOW;
|
||||
private bool animationFoldout_SHOW;
|
||||
private bool delayFoldout_SHOW;
|
||||
private bool bouncinessFoldout_SHOW;
|
||||
private bool eventsFoldout_SHOW;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private bool basicFoldout_HIDE;
|
||||
private bool animationFoldout_HIDE;
|
||||
private bool delayFoldout_HIDE;
|
||||
private bool eventsFoldout_HIDE;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private Color showPropsColor = new Color(0.52f, 1, 0.8f, 1);
|
||||
private Color hidePropsColor = new Color(1, 0.66f, 0.66f, 1);
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
GetSavedInspectorValues();
|
||||
|
||||
animatedElement = (AnimatedElement)target;
|
||||
|
||||
_isControlledByGroup = serializedObject.FindProperty("isControlledByGroup");
|
||||
_group = serializedObject.FindProperty("group");
|
||||
|
||||
_disableShowAnimation = serializedObject.FindProperty("disableShowAnimation");
|
||||
_disableHideAnimation = serializedObject.FindProperty("disableHideAnimation");
|
||||
|
||||
_containerCanvas = serializedObject.FindProperty("containerCanvas");
|
||||
|
||||
_showTimeMode = serializedObject.FindProperty("showTimeMode");
|
||||
_hideTimeMode = serializedObject.FindProperty("hideTimeMode");
|
||||
|
||||
_addBounciness = serializedObject.FindProperty("addBounciness");
|
||||
_bouncinessPower = serializedObject.FindProperty("bouncinessPower");
|
||||
_bouncinessDuration = serializedObject.FindProperty("bouncinessDuration");
|
||||
|
||||
_animateOnEnable = serializedObject.FindProperty("animateOnEnable");
|
||||
|
||||
_animationShowDuration = serializedObject.FindProperty("animationShowDuration");
|
||||
_animationHideDuration = serializedObject.FindProperty("animationHideDuration");
|
||||
|
||||
_rotateFrom = serializedObject.FindProperty("rotateFrom");
|
||||
_rotateTo = serializedObject.FindProperty("rotateTo");
|
||||
|
||||
_showAnimationType = serializedObject.FindProperty("showAnimationType");
|
||||
_hideAnimationType = serializedObject.FindProperty("hideAnimationType");
|
||||
|
||||
_fadeChildren = serializedObject.FindProperty("fadeChildren");
|
||||
|
||||
_animationMoveFrom = serializedObject.FindProperty("animationMoveFrom");
|
||||
_animationMoveTo = serializedObject.FindProperty("animationMoveTo");
|
||||
|
||||
_delayEnabled = serializedObject.FindProperty("delayEnabled");
|
||||
_showDelay = serializedObject.FindProperty("showDelay");
|
||||
_hideDelay = serializedObject.FindProperty("hideDelay");
|
||||
|
||||
_onShowEvent = serializedObject.FindProperty("OnShow");
|
||||
_onHideEvent = serializedObject.FindProperty("OnHide");
|
||||
_onShowCompleteEvent = serializedObject.FindProperty("OnShowComplete");
|
||||
_onHideCompleteEvent = serializedObject.FindProperty("OnHideComplete");
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (animatedElement.GetComponent<AnimatedElementsGroup>())
|
||||
{
|
||||
EditorGUILayout.HelpBox("You can't add 'Animated Element' on a game object that has 'Animated Elements Group' !", MessageType.Error);
|
||||
|
||||
animatedElement.enabled = false;
|
||||
animatedElement.disableShowAnimation = true;
|
||||
animatedElement.disableHideAnimation = true;
|
||||
|
||||
// Don't draw anything.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Undo.RecordObject(animatedElement, "animated element");
|
||||
GeneralSettings();
|
||||
|
||||
DrawLinkedGroup();
|
||||
|
||||
DrawTabs();
|
||||
|
||||
if (currentTabIndex == 0)
|
||||
{
|
||||
if (!animatedElement.disableShowAnimation)
|
||||
{
|
||||
GUI.color = showPropsColor;
|
||||
basicFoldout_SHOW = EditorGUILayout.BeginFoldoutHeaderGroup(basicFoldout_SHOW, "Basic");
|
||||
if (basicFoldout_SHOW)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawAnimateOnEnable_TOGGLE();
|
||||
DrawAnimationShowTimeMode_DROPDOWN();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = showPropsColor;
|
||||
animationFoldout_SHOW = EditorGUILayout.BeginFoldoutHeaderGroup(animationFoldout_SHOW, "Animation");
|
||||
if (animationFoldout_SHOW)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawShowAnimationType_GRID();
|
||||
DrawAnimationShowDuration_INPUT();
|
||||
DrawShowAnimationRotation_PROPERTIES();
|
||||
DrawFadeChildrenShow_TOGGLE();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = showPropsColor;
|
||||
delayFoldout_SHOW = EditorGUILayout.BeginFoldoutHeaderGroup(delayFoldout_SHOW, "Delay");
|
||||
if (delayFoldout_SHOW)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawShowAnimationDelay_PROPERTIES();
|
||||
DrawChildrenShowDelays_BUTTONS();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = showPropsColor;
|
||||
bouncinessFoldout_SHOW = EditorGUILayout.BeginFoldoutHeaderGroup(bouncinessFoldout_SHOW, "Bounciness");
|
||||
if (bouncinessFoldout_SHOW)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawAnimationShowBounciness();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = showPropsColor;
|
||||
eventsFoldout_SHOW = EditorGUILayout.BeginFoldoutHeaderGroup(eventsFoldout_SHOW, "Events");
|
||||
if (eventsFoldout_SHOW)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawOnShow_EVENT();
|
||||
DrawOnShowComplete_EVENT();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawOnShowComplete_EVENT();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
else if (currentTabIndex == 1)
|
||||
{
|
||||
if (!animatedElement.disableHideAnimation)
|
||||
{
|
||||
GUI.color = hidePropsColor;
|
||||
basicFoldout_HIDE = EditorGUILayout.BeginFoldoutHeaderGroup(basicFoldout_HIDE, "Basic");
|
||||
if (basicFoldout_HIDE)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawAnimationHideTimeMode_DROPDOWN();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = hidePropsColor;
|
||||
animationFoldout_HIDE = EditorGUILayout.BeginFoldoutHeaderGroup(animationFoldout_HIDE, "Animation");
|
||||
if (animationFoldout_HIDE)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawHideAnimationType_GRID();
|
||||
DrawAnimationHideDuration_INPUT();
|
||||
DrawHideAnimationRotaion_PROPERTIES();
|
||||
DrawFadeChildrenHide_TOGGLE();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = hidePropsColor;
|
||||
delayFoldout_HIDE = EditorGUILayout.BeginFoldoutHeaderGroup(delayFoldout_HIDE, "Delay");
|
||||
if (delayFoldout_HIDE)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawHideAnimationDelay_PROPERTIES();
|
||||
DrawChildrenHideDelays_BUTTONS();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
|
||||
GUI.color = hidePropsColor;
|
||||
eventsFoldout_HIDE = EditorGUILayout.BeginFoldoutHeaderGroup(eventsFoldout_HIDE, "Events");
|
||||
if (eventsFoldout_HIDE)
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawOnHide_EVENT();
|
||||
DrawOnHideComplete_EVENT();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
GUILayout.Space(20);
|
||||
|
||||
//===================
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
DrawOnHideComplete_EVENT();
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
SaveInspectorValues();
|
||||
}
|
||||
|
||||
|
||||
private void GeneralSettings()
|
||||
{
|
||||
//DrawInspectorTitle_LABEL ( "Animated UI Element" , true , false );
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUI.color = showPropsColor;
|
||||
EditorGUILayoutExtensions.ToggleLeft(_disableShowAnimation, new GUIContent("Disable Show Animation"));
|
||||
|
||||
GUI.color = hidePropsColor;
|
||||
EditorGUILayoutExtensions.ToggleLeft(_disableHideAnimation, new GUIContent("Disable Hide Animation"));
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUI.color = Color.white;
|
||||
DrawContainerCanvas_FIELD();
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawLinkedGroup()
|
||||
{
|
||||
EditorGUILayoutExtensions.ToggleLeft(_isControlledByGroup, new GUIContent("Is Controlled By Group?"));
|
||||
if (animatedElement.isControlledByGroup)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawTabs()
|
||||
{
|
||||
GUILayout.Space(20);
|
||||
|
||||
currentTabIndex = GUILayout.Toolbar(currentTabIndex, new string[] { "Show Animation", "Hide Animation" });
|
||||
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
|
||||
private void DrawContainerCanvas_FIELD()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.PropertyField(_containerCanvas, new GUIContent("Container Canvas"));
|
||||
|
||||
if (GUILayout.Button("Auto Find"))
|
||||
{
|
||||
foreach (var go in Selection.gameObjects)
|
||||
{
|
||||
go.GetComponent<AnimatedElement>().containerCanvas = go.GetComponentInParent<Canvas>();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (animatedElement.containerCanvas == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Please assign the container canvas in order to get the most accurate results and to avoid errors !", MessageType.Warning);
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawInspectorTitle_LABEL(string text, bool spaceBefore, bool spaceAfter)
|
||||
{
|
||||
if (spaceBefore)
|
||||
GUILayout.Space(20);
|
||||
|
||||
var titleLabelStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.UpperCenter, fontSize = 20, fontStyle = FontStyle.Bold, fixedHeight = 50 };
|
||||
|
||||
EditorGUILayout.LabelField(text, titleLabelStyle);
|
||||
|
||||
if (spaceAfter)
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimationShowTimeMode_DROPDOWN()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_showTimeMode, new GUIContent("Time Mode"));
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimationHideTimeMode_DROPDOWN()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_hideTimeMode, new GUIContent("Time Mode"));
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimateOnEnable_TOGGLE()
|
||||
{
|
||||
EditorGUILayoutExtensions.ToggleLeft(_animateOnEnable, new GUIContent("Animate On Enable"));
|
||||
|
||||
if (animatedElement.isControlledByGroup && animatedElement.group != null)
|
||||
{
|
||||
animatedElement.animateOnEnable = false;
|
||||
EditorGUILayout.HelpBox("You can't enable 'Animate On Enable' because this Animated Element is controlled by an 'Animated Elements Group'", MessageType.None);
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawShowAnimationType_GRID()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_showAnimationType, new GUIContent("Animation"));
|
||||
|
||||
if (animatedElement.showAnimationType == AnimationType.FadeColor)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Note: This GameObject must have a graphical component (Image, Text, or RawImage) in order to fade its color !", MessageType.Info);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
if (animatedElement.showAnimationType == AnimationType.MoveWithScale || animatedElement.showAnimationType == AnimationType.Move)
|
||||
{
|
||||
GUILayout.Space(5);
|
||||
EditorGUILayout.PropertyField(_animationMoveFrom, new GUIContent("Start From"));
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawHideAnimationType_GRID()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_hideAnimationType, new GUIContent("Animation"));
|
||||
|
||||
if (animatedElement.hideAnimationType == AnimationType.FadeColor)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Note: This GameObject must have a graphical component (Image, Text, or RawImage) in order to fade its color !", MessageType.Info);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
if (animatedElement.hideAnimationType == AnimationType.MoveWithScale || animatedElement.hideAnimationType == AnimationType.Move)
|
||||
{
|
||||
GUILayout.Space(5);
|
||||
EditorGUILayout.PropertyField(_animationMoveTo, new GUIContent("End To"));
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawFadeChildrenShow_TOGGLE()
|
||||
{
|
||||
if (animatedElement.showAnimationType == AnimationType.FadeColor)
|
||||
// animatedElement.fadeChildren = EditorGUILayout.ToggleLeft("Fade Children Simultaneously", animatedElement.fadeChildren);
|
||||
EditorGUILayoutExtensions.ToggleLeft(_fadeChildren, new GUIContent("Fade Children Simultaneously"));
|
||||
}
|
||||
|
||||
|
||||
private void DrawFadeChildrenHide_TOGGLE()
|
||||
{
|
||||
if (animatedElement.hideAnimationType == AnimationType.FadeColor)
|
||||
// animatedElement.fadeChildren = EditorGUILayout.ToggleLeft("Fade Children Simultaneously", animatedElement.fadeChildren);
|
||||
EditorGUILayoutExtensions.ToggleLeft(_fadeChildren, new GUIContent("Fade Children Simultaneously"));
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimationShowDuration_INPUT()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(_animationShowDuration, new GUIContent("Show Duration"));
|
||||
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimationShowBounciness()
|
||||
{
|
||||
|
||||
if (animatedElement.showAnimationType == AnimationType.FadeColor)
|
||||
{
|
||||
EditorGUILayout.HelpBox("No Bounciness in color fading!", MessageType.None);
|
||||
return;
|
||||
}
|
||||
|
||||
// EditorGUILayout.PropertyField(_addBounciness, new GUIContent("Add Bounciness"));
|
||||
// animatedElement.addBounciness = EditorGUILayout.ToggleLeft("Add Bounciness", animatedElement.addBounciness,);
|
||||
EditorGUILayoutExtensions.ToggleLeft(_addBounciness, new GUIContent("Add Bounciness"));
|
||||
|
||||
if (animatedElement.addBounciness)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_bouncinessPower, new GUIContent("Bounciness Power"));
|
||||
EditorGUILayout.PropertyField(_bouncinessDuration, new GUIContent("Bounciness Duration"));
|
||||
|
||||
if (animatedElement.showAnimationType == AnimationType.FadeColor)
|
||||
EditorGUILayout.HelpBox("Bounciness will not affect animation when type is fading color", MessageType.Warning);
|
||||
}
|
||||
|
||||
GUILayout.Space(20);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimationHideDuration_INPUT()
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
|
||||
EditorGUILayout.PropertyField(_animationHideDuration, new GUIContent("Hide Duration"));
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawShowAnimationDelay_PROPERTIES()
|
||||
{
|
||||
EditorGUILayoutExtensions.ToggleLeft(_delayEnabled, new GUIContent("Enable Delay"));
|
||||
|
||||
if (animatedElement.delayEnabled)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_showDelay, new GUIContent("Delay"));
|
||||
}
|
||||
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
|
||||
private void DrawShowAnimationRotation_PROPERTIES()
|
||||
{
|
||||
if (animatedElement.showAnimationType == AnimationType.Rotate)
|
||||
{
|
||||
// rotation from angle
|
||||
EditorGUILayout.PropertyField(_rotateFrom, new GUIContent("Rotate From"), true);
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawHideAnimationRotaion_PROPERTIES()
|
||||
{
|
||||
if (animatedElement.hideAnimationType == AnimationType.Rotate)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_rotateTo, new GUIContent("Rotate To"), true);
|
||||
GUILayout.Space(10);
|
||||
|
||||
#region Future Update
|
||||
|
||||
|
||||
//var titleLabelStyle = new GUIStyle ( GUI.skin.label ) { alignment = TextAnchor.MiddleCenter , fontSize = 13 , fontStyle = FontStyle.Normal };
|
||||
|
||||
//EditorGUILayout.LabelField ( "Rotation Pivot" , titleLabelStyle );
|
||||
|
||||
//rotationPivotGridIndex = GUILayout.SelectionGrid ( rotationPivotGridIndex , new string [] { "↖" , "▲" , "↗" , "◄" , "●" , "►" , "↙" , "▼" , "↘" } , 3 );
|
||||
|
||||
//AnimatedElement.pivotWhileRotating = ( AnimationStartPosition ) rotationPivotGridIndex;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawHideAnimationDelay_PROPERTIES()
|
||||
{
|
||||
EditorGUILayoutExtensions.ToggleLeft(_delayEnabled, new GUIContent("Enable Delay"));
|
||||
|
||||
if (animatedElement.delayEnabled)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_hideDelay, new GUIContent("Delay"));
|
||||
}
|
||||
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
|
||||
private void DrawOnShow_EVENT()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_onShowEvent, new GUIContent("On Animation Start"));
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
|
||||
private void DrawOnShowComplete_EVENT()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_onShowCompleteEvent, new GUIContent("On Animation Complete"));
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
|
||||
private void DrawOnHide_EVENT()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_onHideEvent, new GUIContent("On Animation Start"));
|
||||
}
|
||||
|
||||
|
||||
private void DrawOnHideComplete_EVENT()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_onHideCompleteEvent, new GUIContent("On Animation Complete"));
|
||||
}
|
||||
|
||||
|
||||
private void DrawChildrenShowDelays_BUTTONS()
|
||||
{
|
||||
GUILayout.Space(20);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
float addedTime = animatedElement.animationShowDuration;
|
||||
addedTime += (animatedElement.delayEnabled) ? animatedElement.showDelay : 0;
|
||||
|
||||
if (GUILayout.Button("<Auto Set>\nShow Delays In Children"))
|
||||
{
|
||||
AnimatedElement[] elementsInChildren = Selection.activeGameObject.GetComponentsInChildren<AnimatedElement>();
|
||||
|
||||
float step = (animatedElement.animationShowDuration / elementsInChildren.Length);
|
||||
float currentValue = 0;
|
||||
|
||||
for (int i = 1; i < elementsInChildren.Length; i++)
|
||||
{
|
||||
if (elementsInChildren[i].delayEnabled)
|
||||
elementsInChildren[i].showDelay = addedTime + currentValue;
|
||||
|
||||
currentValue += step;
|
||||
}
|
||||
Debug.Log("<color=orange><b>[Airy UI]</color></b>" +
|
||||
"<color=green><b>✓</color></b>" +
|
||||
" anchors set for "
|
||||
+ Selection.gameObjects.Length +
|
||||
" game object/s");
|
||||
Debug.Log("<color=orange><b>[Airy UI]</color></b> <color=green><b>✓</color></b> children hide delays set for " + elementsInChildren.Length + " game objects");
|
||||
}
|
||||
|
||||
//==============================================
|
||||
|
||||
if (GUILayout.Button("<Randomize>\nShow Delays In Children"))
|
||||
{
|
||||
AnimatedElement[] elementsInChildren = Selection.activeGameObject.GetComponentsInChildren<AnimatedElement>();
|
||||
|
||||
for (int i = 1; i < elementsInChildren.Length; i++)
|
||||
{
|
||||
if (elementsInChildren[i].delayEnabled)
|
||||
{
|
||||
elementsInChildren[i].showDelay = addedTime + UnityEngine.Random.Range(animatedElement.animationShowDuration / elementsInChildren.Length, animatedElement.animationShowDuration);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("<color=orange><b>[Airy UI]</color></b> <color=green><b>✓</color></b> children hide delays randomized for " + elementsInChildren.Length + " game objects");
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
|
||||
private void DrawChildrenHideDelays_BUTTONS()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
float addedTime = animatedElement.animationHideDuration;
|
||||
addedTime += (animatedElement.delayEnabled) ? animatedElement.hideDelay : 0;
|
||||
|
||||
if (GUILayout.Button("<Auto Set>\nHide Delays In Children"))
|
||||
{
|
||||
AnimatedElement[] elementsInChildren = Selection.activeGameObject.GetComponentsInChildren<AnimatedElement>();
|
||||
|
||||
float step = (animatedElement.animationHideDuration / elementsInChildren.Length);
|
||||
float currentValue = 0;
|
||||
|
||||
elementsInChildren[elementsInChildren.Length - 1].hideDelay = 0;
|
||||
for (int i = elementsInChildren.Length - 2; i >= 1; i--)
|
||||
{
|
||||
if (elementsInChildren[i].delayEnabled)
|
||||
elementsInChildren[i].hideDelay = step + currentValue;
|
||||
|
||||
currentValue += step;
|
||||
}
|
||||
|
||||
Debug.Log("<color=orange><b>[Airy UI]</color></b> <color=green><b>✓</color></b> children hide delays set for" + elementsInChildren.Length + " game objects");
|
||||
}
|
||||
|
||||
//==============================================
|
||||
|
||||
if (GUILayout.Button("<Randomize>\nHide Delays In Children"))
|
||||
{
|
||||
AnimatedElement[] elementsInChildren = Selection.activeGameObject.GetComponentsInChildren<AnimatedElement>();
|
||||
|
||||
addedTime = animatedElement.hideDelay;
|
||||
|
||||
for (int i = 1; i < elementsInChildren.Length; i++)
|
||||
{
|
||||
if (elementsInChildren[i].delayEnabled)
|
||||
{
|
||||
elementsInChildren[i].hideDelay = addedTime - UnityEngine.Random.Range(animatedElement.animationHideDuration / elementsInChildren.Length, animatedElement.animationHideDuration);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("<color=orange><b>[Airy UI]</color></b> <color=green><b>✓</color></b> children hide delays randomized for " + elementsInChildren.Length + " game objects");
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================================================
|
||||
|
||||
|
||||
private void SaveInspectorValues()
|
||||
{
|
||||
foreach (var id in Selection.instanceIDs)
|
||||
{
|
||||
EditorPrefs.SetInt("airyui/" + nameof(currentTabIndex), currentTabIndex);
|
||||
|
||||
EditorPrefs.SetBool("airyui/" + nameof(basicFoldout_SHOW), basicFoldout_SHOW);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(animationFoldout_SHOW), animationFoldout_SHOW);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(delayFoldout_SHOW), delayFoldout_SHOW);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(bouncinessFoldout_SHOW), bouncinessFoldout_SHOW);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(eventsFoldout_SHOW), eventsFoldout_SHOW);
|
||||
|
||||
EditorPrefs.SetBool("airyui/" + nameof(basicFoldout_HIDE), basicFoldout_HIDE);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(animationFoldout_HIDE), animationFoldout_HIDE);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(delayFoldout_HIDE), delayFoldout_HIDE);
|
||||
EditorPrefs.SetBool("airyui/" + nameof(eventsFoldout_HIDE), eventsFoldout_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void GetSavedInspectorValues()
|
||||
{
|
||||
currentTabIndex = EditorPrefs.GetInt("airyui/" + nameof(currentTabIndex), 0);
|
||||
|
||||
basicFoldout_SHOW = EditorPrefs.GetBool("airyui/" + nameof(basicFoldout_SHOW));
|
||||
animationFoldout_SHOW = EditorPrefs.GetBool("airyui/" + nameof(animationFoldout_SHOW));
|
||||
delayFoldout_SHOW = EditorPrefs.GetBool("airyui/" + nameof(delayFoldout_SHOW));
|
||||
bouncinessFoldout_SHOW = EditorPrefs.GetBool("airyui/" + nameof(bouncinessFoldout_SHOW));
|
||||
eventsFoldout_SHOW = EditorPrefs.GetBool("airyui/" + nameof(eventsFoldout_SHOW));
|
||||
|
||||
basicFoldout_HIDE = EditorPrefs.GetBool("airyui/" + nameof(basicFoldout_HIDE));
|
||||
animationFoldout_HIDE = EditorPrefs.GetBool("airyui/" + nameof(animationFoldout_HIDE));
|
||||
delayFoldout_HIDE = EditorPrefs.GetBool("airyui/" + nameof(delayFoldout_HIDE));
|
||||
eventsFoldout_HIDE = EditorPrefs.GetBool("airyui/" + nameof(eventsFoldout_HIDE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 872041dd0a8729c4193982932cb5d8bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 4350cb3056a566c48ac0f3588c16a85d, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/AnimatedElement_Inspector.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,73 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
[CustomEditor ( typeof ( AnimatedElementsGroup ) )]
|
||||
[CanEditMultipleObjects]
|
||||
public class AnimatedElementsGroup_Inspector : Editor
|
||||
{
|
||||
private AnimatedElementsGroup animatedGroup;
|
||||
|
||||
|
||||
private SerializedProperty _showAnimaitonOnEnable;
|
||||
private SerializedProperty animatedElements;
|
||||
|
||||
|
||||
private SerializedProperty _onShowEvent;
|
||||
private SerializedProperty _onHideEvent;
|
||||
|
||||
|
||||
private void OnEnable ()
|
||||
{
|
||||
animatedGroup = ( AnimatedElementsGroup ) target;
|
||||
|
||||
_showAnimaitonOnEnable = serializedObject.FindProperty ( "showAnimaitonOnEnable" );
|
||||
animatedElements = serializedObject.FindProperty ( "animatedElements" );
|
||||
|
||||
_onShowEvent = serializedObject.FindProperty ( "OnShow" );
|
||||
_onHideEvent = serializedObject.FindProperty ( "OnHide" );
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
Undo.RecordObject ( animatedGroup , "animated group" );
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
EditorGUILayout.PropertyField ( _showAnimaitonOnEnable , new GUIContent ( "Animate On Enable" ) );
|
||||
|
||||
if ( animatedGroup.showAnimaitonOnEnable )
|
||||
{
|
||||
EditorGUILayout.HelpBox ( "TRUE: All Animated Elements in this Group will animate automatically when this GameObject is enabled.\n\nFALSE: You control the animation by calling ShowGroup() in this script." , MessageType.None );
|
||||
}
|
||||
|
||||
GUILayout.Space ( 10 );
|
||||
|
||||
EditorGUILayout.PropertyField ( animatedElements , new GUIContent ( "Animated Elements" ) );
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
DrawOnShow_EVENT ();
|
||||
DrawOnHide_EVENT ();
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
serializedObject.ApplyModifiedProperties ();
|
||||
}
|
||||
|
||||
|
||||
private void DrawOnShow_EVENT ()
|
||||
{
|
||||
EditorGUILayout.PropertyField ( _onShowEvent , new GUIContent ( "On Show" ) );
|
||||
EditorGUILayout.Space (); EditorGUILayout.Space ();
|
||||
}
|
||||
|
||||
|
||||
private void DrawOnHide_EVENT ()
|
||||
{
|
||||
EditorGUILayout.PropertyField ( _onHideEvent , new GUIContent ( "On Hide" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2057bd040dbb83a45b41376ca5336bd5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c6d7f5a7c4a1c364c81769ff255bc0d9, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/AnimatedElementsGroup_Inspector.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,45 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
|
||||
|
||||
[CustomEditor ( typeof ( EscButtonController ) )]
|
||||
[CanEditMultipleObjects]
|
||||
public class CloseButtonController_Inspector : Editor
|
||||
{
|
||||
|
||||
private EscButtonController esc_manager;
|
||||
|
||||
|
||||
private SerializedProperty _esc_buttons;
|
||||
|
||||
|
||||
private void OnEnable ()
|
||||
{
|
||||
esc_manager = ( EscButtonController ) target;
|
||||
|
||||
_esc_buttons = serializedObject.FindProperty ( "esc_buttons" );
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
EditorGUILayout.Space ( 10 );
|
||||
|
||||
EditorGUILayout.HelpBox ( "This game object is automatically added When you add EscBackButton please don't remove it" , MessageType.Info );
|
||||
|
||||
EditorGUILayout.Space ( 10 );
|
||||
|
||||
EditorGUILayout.PropertyField ( _esc_buttons );
|
||||
|
||||
serializedObject.ApplyModifiedProperties ();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a732036fa711b849967a979ac4753b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 7f02f0462f80e0340b3014e7a07c5ac2, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/CloseButtonController_Inspector.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
|
||||
|
||||
[CustomEditor ( typeof ( CloseButton ) , true )]
|
||||
[CanEditMultipleObjects]
|
||||
public class CloseButton_Inspector : Editor
|
||||
{
|
||||
|
||||
|
||||
private CloseButton close_button;
|
||||
|
||||
|
||||
private SerializedProperty _backButtonAffects;
|
||||
private SerializedProperty _animatedElement;
|
||||
private SerializedProperty _animatedElementsGroup;
|
||||
|
||||
private SerializedProperty _buttonComponent;
|
||||
|
||||
|
||||
private void OnEnable ()
|
||||
{
|
||||
close_button = ( CloseButton ) target;
|
||||
|
||||
_backButtonAffects = serializedObject.FindProperty ( "backButtonAffects" );
|
||||
_animatedElement = serializedObject.FindProperty ( "affectedAnimatedElement" );
|
||||
_animatedElementsGroup = serializedObject.FindProperty ( "affectedAnimatedElementsGroup" );
|
||||
|
||||
if ( close_button is UICloseButton )
|
||||
{
|
||||
_buttonComponent = serializedObject.FindProperty ( "buttonComponent" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
EditorGUILayout.Space ( 10 );
|
||||
|
||||
EditorGUILayout.PropertyField ( _backButtonAffects );
|
||||
|
||||
EditorGUILayout.Space ( 10 );
|
||||
|
||||
if ( close_button.backButtonAffects == BackButtonAffects.AnimatedElement )
|
||||
{
|
||||
EditorGUILayout.PropertyField ( _animatedElement );
|
||||
}
|
||||
else if ( close_button.backButtonAffects == BackButtonAffects.AnimatedElementsGroup )
|
||||
{
|
||||
EditorGUILayout.PropertyField ( _animatedElementsGroup );
|
||||
}
|
||||
|
||||
EditorGUILayout.Space ( 10 );
|
||||
|
||||
if ( close_button is UICloseButton )
|
||||
{
|
||||
EditorGUILayout.PropertyField ( _buttonComponent );
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties ();
|
||||
}
|
||||
|
||||
|
||||
private void InspectorTitle_LABEL ( string text , bool spaceBefore , bool spaceAfter )
|
||||
{
|
||||
if ( spaceBefore )
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
var titleLabelStyle = new GUIStyle ( GUI.skin.label ) { alignment = TextAnchor.UpperCenter , fontSize = 20 , fontStyle = FontStyle.Bold , fixedHeight = 50 };
|
||||
|
||||
EditorGUILayout.LabelField ( text , titleLabelStyle );
|
||||
|
||||
if ( spaceAfter )
|
||||
GUILayout.Space ( 20 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19d50b70d8e402447a73338bd8aecf26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 7f02f0462f80e0340b3014e7a07c5ac2, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/CloseButton_Inspector.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,630 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
[CustomEditor(typeof(CustomAnimatedElement))]
|
||||
[CanEditMultipleObjects]
|
||||
public class CustomAnimatedElement_Inspector : Editor
|
||||
{
|
||||
private CustomAnimatedElement animatedElement;
|
||||
|
||||
private SerializedProperty _isControlledByGroup;
|
||||
|
||||
private SerializedProperty _animateOnEnable;
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _showTimeMode;
|
||||
private SerializedProperty _hideTimeMode;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _group;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _containerCanvas;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _componentsToAnimate_SHOW;
|
||||
private SerializedProperty _transformAnimationRecords_SHOW;
|
||||
private SerializedProperty _graphicAnimationRecords_SHOW;
|
||||
private SerializedProperty _transformAndGraphicAnimationRecords_SHOW;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _componentsToAnimate_HIDE;
|
||||
private SerializedProperty _transformAnimationRecords_HIDE;
|
||||
private SerializedProperty _graphicAnimationRecords_HIDE;
|
||||
private SerializedProperty _transformAndGraphicAnimationRecords_HIDE;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _currentRecordDuration;
|
||||
private SerializedProperty _currentRecordDelay;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _showDelay;
|
||||
private SerializedProperty _hideDelay;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private SerializedProperty _onShowEvent;
|
||||
private SerializedProperty _onHideEvent;
|
||||
private SerializedProperty _onShowCompleteEvent;
|
||||
private SerializedProperty _onHideCompleteEvent;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private string[] tabsTexts = { "Show", "Hide" };
|
||||
private int currentTabIndex = 0;
|
||||
|
||||
public float currentRecordDuration = 0.5f;
|
||||
public float currentRecordStartsAt = 0;
|
||||
|
||||
private bool recordModeActive;
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private Color showPropsColor = new Color(0.52f, 1, 0.8f, 1);
|
||||
private Color hidePropsColor = new Color(1, 0.66f, 0.66f, 1);
|
||||
|
||||
|
||||
//===================
|
||||
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
GetSavedInspectorValues();
|
||||
|
||||
animatedElement = (CustomAnimatedElement)target;
|
||||
|
||||
_isControlledByGroup = serializedObject.FindProperty("isControlledByGroup");
|
||||
_group = serializedObject.FindProperty("group");
|
||||
|
||||
_animateOnEnable = serializedObject.FindProperty("animateOnEnable");
|
||||
|
||||
_containerCanvas = serializedObject.FindProperty("containerCanvas");
|
||||
|
||||
_showTimeMode = serializedObject.FindProperty("showTimeMode");
|
||||
_hideTimeMode = serializedObject.FindProperty("hideTimeMode");
|
||||
|
||||
_componentsToAnimate_SHOW = serializedObject.FindProperty("componentsToAnimate_SHOW");
|
||||
_transformAnimationRecords_SHOW = serializedObject.FindProperty("TransformAnimationRecords_SHOW");
|
||||
_graphicAnimationRecords_SHOW = serializedObject.FindProperty("GraphicAnimationRecords_SHOW");
|
||||
_transformAndGraphicAnimationRecords_SHOW = serializedObject.FindProperty("TransformAndGraphicAnimationRecords_SHOW");
|
||||
|
||||
_componentsToAnimate_HIDE = serializedObject.FindProperty("componentsToAnimate_HIDE");
|
||||
_transformAnimationRecords_HIDE = serializedObject.FindProperty("TransformAnimationRecords_HIDE");
|
||||
_graphicAnimationRecords_HIDE = serializedObject.FindProperty("GraphicAnimationRecords_HIDE");
|
||||
_transformAndGraphicAnimationRecords_HIDE = serializedObject.FindProperty("TransformAndGraphicAnimationRecords_HIDE");
|
||||
|
||||
_currentRecordDuration = serializedObject.FindProperty("currentRecordDuration");
|
||||
_currentRecordDelay = serializedObject.FindProperty("currentRecordDelay");
|
||||
|
||||
_showDelay = serializedObject.FindProperty("showDelay");
|
||||
_hideDelay = serializedObject.FindProperty("hideDelay");
|
||||
|
||||
_onShowEvent = serializedObject.FindProperty("OnShow");
|
||||
_onHideEvent = serializedObject.FindProperty("OnHide");
|
||||
_onShowCompleteEvent = serializedObject.FindProperty("OnShowComplete");
|
||||
_onHideCompleteEvent = serializedObject.FindProperty("OnHideComplete");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (animatedElement.GetComponent<AnimatedElementsGroup>())
|
||||
{
|
||||
EditorGUILayout.HelpBox("You can't add 'Custom Animated Element' on a game object that has 'Animated Elements Group' !", MessageType.Error);
|
||||
|
||||
animatedElement.enabled = false;
|
||||
animatedElement.disableShowAnimation = true;
|
||||
animatedElement.disableHideAnimation = true;
|
||||
|
||||
|
||||
// Don't draw anything.
|
||||
return;
|
||||
}
|
||||
|
||||
Undo.RecordObject(animatedElement, "custom animated element");
|
||||
|
||||
GeneralSettings();
|
||||
|
||||
DrawLinkedGroup();
|
||||
|
||||
DrawAnimateOnEnable_TOGGLE();
|
||||
|
||||
Tabs();
|
||||
|
||||
if (currentTabIndex == 0)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(SetContainerBoxStyle(new Color(0.52f, 1, 0.8f, 0.1f)));
|
||||
|
||||
if (!animatedElement.disableShowAnimation)
|
||||
{
|
||||
|
||||
Loop_TOGGLE();
|
||||
ComponentsToAnimateShow_DROPDOWN();
|
||||
AnimationShowTimeMode_DROPDOWN();
|
||||
RecordMode_BUTTONS();
|
||||
ShowAnimationDelay_PROPS();
|
||||
Duration_PROPS();
|
||||
TransformAnimationRecordsShow_LIST();
|
||||
GraphicAnimationRecordsShow_LIST();
|
||||
TransformAndGraphicAnimationRecordsShow_LIST();
|
||||
OnShow_EVENT();
|
||||
OnShowComplete_EVENT();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnShowComplete_EVENT();
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
else if (currentTabIndex == 1)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(SetContainerBoxStyle(new Color(1, 0.66f, 0.66f, 0.1f)));
|
||||
|
||||
|
||||
if (!animatedElement.disableHideAnimation)
|
||||
{
|
||||
ComponentsToAnimateHide_DROPDOWN();
|
||||
AnimationHideTimeMode_DROPDOWN();
|
||||
RecordMode_BUTTONS();
|
||||
HideAnimationDelay_PROPS();
|
||||
Duration_PROPS();
|
||||
TransformAnimationRecordsHide_LIST();
|
||||
GraphicAnimationRecordsHide_LIST();
|
||||
TransformAndGraphicAnimationRecordsHide_LIST();
|
||||
OnHide_EVENT();
|
||||
OnHideComplete_EVENT();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnHideComplete_EVENT();
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
SaveInspectorValues();
|
||||
}
|
||||
|
||||
private void GeneralSettings()
|
||||
{
|
||||
//Title_LABEL ();
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUI.color = showPropsColor;
|
||||
animatedElement.disableShowAnimation = EditorGUILayout.ToggleLeft("Disable Show Animation", animatedElement.disableShowAnimation);
|
||||
|
||||
GUI.color = hidePropsColor;
|
||||
animatedElement.disableHideAnimation = EditorGUILayout.ToggleLeft("Disable Hide Animation", animatedElement.disableHideAnimation);
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUI.color = Color.white;
|
||||
ContainerCanvas();
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawLinkedGroup()
|
||||
{
|
||||
animatedElement.isControlledByGroup = EditorGUILayout.ToggleLeft("Is Controlled By Group?", animatedElement.isControlledByGroup);
|
||||
if (animatedElement.isControlledByGroup)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_group);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimateOnEnable_TOGGLE()
|
||||
{
|
||||
EditorGUILayoutExtensions.ToggleLeft(_animateOnEnable, new GUIContent("Animate On Enable"));
|
||||
|
||||
if (animatedElement.isControlledByGroup && animatedElement.group != null)
|
||||
{
|
||||
animatedElement.animateOnEnable = false;
|
||||
EditorGUILayout.HelpBox("You can't enable 'Animate On Enable' because this Animated Element is controlled by an 'Animated Elements Group'", MessageType.None);
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void Tabs()
|
||||
{
|
||||
GUILayout.Space(20);
|
||||
|
||||
currentTabIndex = GUILayout.Toolbar(currentTabIndex, new string[] { "Show Animation", "Hide Animation" });
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void ContainerCanvas()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.PropertyField(_containerCanvas, new GUIContent("Container Canvas"));
|
||||
|
||||
if (GUILayout.Button("Auto Find"))
|
||||
{
|
||||
foreach (var go in Selection.gameObjects)
|
||||
{
|
||||
go.GetComponent<AnimatedElement>().containerCanvas = go.GetComponentInParent<Canvas>();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private GUIStyle SetContainerBoxStyle(Color color)
|
||||
{
|
||||
GUIStyle boxStyle = new GUIStyle("box");
|
||||
boxStyle.padding = new RectOffset(20, 20, 20, 20);
|
||||
boxStyle.margin = new RectOffset(5, 5, 5, 5);
|
||||
|
||||
var texture = new Texture2D(1, 1);
|
||||
texture.SetPixel(0, 0, color);
|
||||
texture.Apply();
|
||||
|
||||
boxStyle.normal.background = texture;
|
||||
|
||||
|
||||
return boxStyle;
|
||||
}
|
||||
|
||||
|
||||
private void AnimationShowTimeMode_DROPDOWN()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_showTimeMode, new GUIContent("Time Mode"));
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
private void AnimationHideTimeMode_DROPDOWN()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_hideTimeMode, new GUIContent("Time Mode"));
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
|
||||
private void Loop_TOGGLE()
|
||||
{
|
||||
animatedElement.loop = EditorGUILayout.ToggleLeft("Loop", animatedElement.loop);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
private void Title_LABEL()
|
||||
{
|
||||
GUILayout.Space(20);
|
||||
var titleLabelStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.UpperCenter, fontSize = 20, fontStyle = FontStyle.Bold, fixedHeight = 50 };
|
||||
|
||||
EditorGUILayout.LabelField("Custom Animated Element", titleLabelStyle);
|
||||
|
||||
GUILayout.Space(30);
|
||||
}
|
||||
|
||||
private void ComponentsToAnimateShow_DROPDOWN()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_componentsToAnimate_SHOW, new GUIContent("What to animate"), true);
|
||||
|
||||
GUI.color = Color.white;
|
||||
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
private void ComponentsToAnimateHide_DROPDOWN()
|
||||
{
|
||||
//GUI.color = Color.cyan;
|
||||
EditorGUILayout.PropertyField(_componentsToAnimate_HIDE, new GUIContent("What to animate"), true);
|
||||
GUI.color = Color.white;
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
private void Duration_PROPS()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
GUI.color = Color.yellow;
|
||||
|
||||
EditorGUILayout.PropertyField(_currentRecordDuration);
|
||||
|
||||
GUI.color = Color.green;
|
||||
|
||||
EditorGUILayout.PropertyField(_currentRecordDelay);
|
||||
|
||||
GUI.color = Color.white;
|
||||
GUILayout.Space(20);
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void TransformAnimationRecordsShow_LIST()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (animatedElement.componentsToAnimate_SHOW == CustomAnimatedElement.ComponentsToAnimate.Transform)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_transformAnimationRecords_SHOW, new GUIContent("Animation Records"));
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void TransformAnimationRecordsHide_LIST()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (animatedElement.componentsToAnimate_HIDE == CustomAnimatedElement.ComponentsToAnimate.Transform)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_transformAnimationRecords_HIDE, new GUIContent("Animation Records"), true);
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void GraphicAnimationRecordsShow_LIST()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (animatedElement.componentsToAnimate_SHOW == CustomAnimatedElement.ComponentsToAnimate.Graphic)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_graphicAnimationRecords_SHOW, new GUIContent("Animation Records"), true);
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void GraphicAnimationRecordsHide_LIST()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (animatedElement.componentsToAnimate_HIDE == CustomAnimatedElement.ComponentsToAnimate.Graphic)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_graphicAnimationRecords_HIDE, new GUIContent("Animation Records"), true);
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void TransformAndGraphicAnimationRecordsShow_LIST()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (animatedElement.componentsToAnimate_SHOW == CustomAnimatedElement.ComponentsToAnimate.Both)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_transformAndGraphicAnimationRecords_SHOW, new GUIContent("Animation Records"), true);
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void TransformAndGraphicAnimationRecordsHide_LIST()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (animatedElement.componentsToAnimate_HIDE == CustomAnimatedElement.ComponentsToAnimate.Both)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_transformAndGraphicAnimationRecords_HIDE, new GUIContent("Animation Records"), true);
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void RecordMode_BUTTONS()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUI.BeginDisabledGroup(recordModeActive);
|
||||
|
||||
GUI.color = new Color(1, 0.45f, 0, 1);
|
||||
if (GUILayout.Button("●\n<color=white>RECORD</color>", new GUIStyle(GUI.skin.button) { fontSize = 12, fontStyle = FontStyle.Bold, fixedWidth = 100, richText = true }))
|
||||
{
|
||||
foreach (var g in Selection.gameObjects)
|
||||
{
|
||||
CustomAnimatedElement aniamtedElement = g.GetComponent<CustomAnimatedElement>();
|
||||
if (aniamtedElement)
|
||||
{
|
||||
aniamtedElement.EnterRecordMode(g, (CustomAnimatedElement.AnimationShowOrHide)currentTabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
recordModeActive = true;
|
||||
}
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
EditorGUILayout.Space(5);
|
||||
|
||||
EditorGUI.BeginDisabledGroup(!recordModeActive);
|
||||
|
||||
GUI.color = Color.yellow;
|
||||
if (GUILayout.Button("■\n<color=white>STOP</color> ", new GUIStyle(GUI.skin.button) { fontSize = 12, fontStyle = FontStyle.Bold, fixedWidth = 100, richText = true }))
|
||||
{
|
||||
foreach (var g in Selection.gameObjects)
|
||||
{
|
||||
CustomAnimatedElement aniamtedElement = g.GetComponent<CustomAnimatedElement>();
|
||||
if (aniamtedElement)
|
||||
{
|
||||
aniamtedElement.ExitRecordMode(g, (CustomAnimatedElement.AnimationShowOrHide)currentTabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
recordModeActive = false;
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Space(5);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUI.BeginDisabledGroup(!recordModeActive);
|
||||
|
||||
|
||||
GUI.color = new Color(0.66f, 0, 1, 1);
|
||||
|
||||
if (GUILayout.Button("⌦\n<color=white>KEYFRAME</color>", new GUIStyle(GUI.skin.button) { fontSize = 12, fontStyle = FontStyle.Bold, richText = true }))
|
||||
{
|
||||
if (currentTabIndex == 0)
|
||||
{
|
||||
foreach (var g in Selection.gameObjects)
|
||||
{
|
||||
CustomAnimatedElement aniamtedElement = g.GetComponent<CustomAnimatedElement>();
|
||||
if (aniamtedElement)
|
||||
{
|
||||
aniamtedElement.Record(g, CustomAnimatedElement.AnimationShowOrHide.Show);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (currentTabIndex == 1)
|
||||
{
|
||||
foreach (var g in Selection.gameObjects)
|
||||
{
|
||||
CustomAnimatedElement aniamtedElement = g.GetComponent<CustomAnimatedElement>();
|
||||
if (aniamtedElement)
|
||||
{
|
||||
aniamtedElement.Record(g, CustomAnimatedElement.AnimationShowOrHide.Hide);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
//GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(20);
|
||||
}
|
||||
|
||||
private void ShowAnimationDelay_PROPS()
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
animatedElement.delayEnabled = EditorGUILayout.ToggleLeft("Enable Delay", animatedElement.delayEnabled);
|
||||
|
||||
if (animatedElement.delayEnabled)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_showDelay, new GUIContent("Show Delay"));
|
||||
}
|
||||
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
private void HideAnimationDelay_PROPS()
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
animatedElement.delayEnabled = EditorGUILayout.ToggleLeft("Enable Delay", animatedElement.delayEnabled);
|
||||
|
||||
if (animatedElement.delayEnabled)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_hideDelay, new GUIContent("Hide Delay"));
|
||||
}
|
||||
|
||||
EditorGUILayout.Space(); EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
private void OnShow_EVENT()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
EditorGUILayout.PropertyField(_onShowEvent, new GUIContent("On Animation Start"));
|
||||
GUILayout.Space(10);
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void OnShowComplete_EVENT()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
EditorGUILayout.PropertyField(_onShowCompleteEvent, new GUIContent("On Animation Complete"));
|
||||
GUILayout.Space(10);
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void OnHide_EVENT()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
EditorGUILayout.PropertyField(_onHideEvent, new GUIContent("On Animation Start"));
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void OnHideComplete_EVENT()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
EditorGUILayout.PropertyField(_onHideCompleteEvent, new GUIContent("On Animation Complete"));
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
|
||||
private void SaveInspectorValues()
|
||||
{
|
||||
foreach (var id in Selection.instanceIDs)
|
||||
{
|
||||
EditorPrefs.SetInt("airyui/custom/" + nameof(currentTabIndex), currentTabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetSavedInspectorValues()
|
||||
{
|
||||
currentTabIndex = EditorPrefs.GetInt("airyui/custom/" + nameof(currentTabIndex), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca397c1c5f6fa984abd9caafd619f284
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 5012f5c66ad8aef43950aabb25f0b7e0, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/CustomAnimatedElement_Inspector.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
|
||||
|
||||
public static class EditorGUILayoutExtensions
|
||||
{
|
||||
public static void ToggleLeft(this SerializedProperty prop, GUIContent label, params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = prop.hasMultipleDifferentValues;
|
||||
var newValue = EditorGUILayout.ToggleLeft(label, prop.boolValue, options);
|
||||
EditorGUI.showMixedValue = false;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
prop.boolValue = newValue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a EditorGUILayout.Slider which properly handles multi-object editing
|
||||
/// We apply the 'convIn' conversion to the SerializedProperty value before exposing it as a Slider.
|
||||
/// We apply the 'convOut' conversion to the Slider value to store it back to the SerializedProperty.
|
||||
/// </summary>
|
||||
/// <param name="prop">The value the slider shows. This determines the position of the draggable thumb.</param>
|
||||
/// <param name="label">Label in front of the slider.</param>
|
||||
/// <param name="leftValue">The value at the left end of the slider.</param>
|
||||
/// <param name="rightValue">The value at the right end of the slider.</param>
|
||||
/// <param name="convIn">Conversion function applied on the SerializedProperty to get the Slider value</param>
|
||||
/// <param name="convOut">Conversion function applied on the Slider value to get the SerializedProperty</param>
|
||||
public static void FloatSlider(
|
||||
this SerializedProperty prop,
|
||||
GUIContent label,
|
||||
float leftValue, float rightValue,
|
||||
Func<float, float> convIn,
|
||||
Func<float, float> convOut,
|
||||
params GUILayoutOption[] options)
|
||||
{
|
||||
var floatValue = convIn(prop.floatValue);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
EditorGUI.showMixedValue = prop.hasMultipleDifferentValues;
|
||||
{
|
||||
floatValue = EditorGUILayout.Slider(label, floatValue, leftValue, rightValue, options);
|
||||
}
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
prop.floatValue = convOut(floatValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0ec872a0a1c26340835775ab18f99ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/EditorGUILayoutExtensions.cs
|
||||
uploadId: 760159
|
||||
@@ -0,0 +1,275 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AiryUI
|
||||
{
|
||||
public class MainWindow : EditorWindow
|
||||
{
|
||||
|
||||
|
||||
private static EditorWindow window;
|
||||
private GUIStyle buttonContentStyle;
|
||||
private Vector2 windowScroll;
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/Main Window" , priority = 0 )]
|
||||
private static void ShowWindow ()
|
||||
{
|
||||
window = GetWindow<MainWindow> ( "Airy UI" );
|
||||
window.Show ();
|
||||
|
||||
window.maxSize = new Vector2 ( 370 , 650 );
|
||||
window.minSize = new Vector2 ( 370 , 620 );
|
||||
}
|
||||
|
||||
|
||||
private void OnGUI ()
|
||||
{
|
||||
windowScroll = EditorGUILayout.BeginScrollView ( windowScroll , false , false );
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
DrawAnimationManager_BUTTONS ();
|
||||
|
||||
DrawAnimatedElement_BUTTONS ();
|
||||
|
||||
DrawBackBtn_BUTTONS ();
|
||||
|
||||
DrawRateBox ();
|
||||
|
||||
DrawYoutube ();
|
||||
|
||||
EditorGUILayout.EndScrollView ();
|
||||
}
|
||||
|
||||
|
||||
private void WindowTitle_LABEL ()
|
||||
{
|
||||
GUI.color = Color.white;
|
||||
|
||||
|
||||
GUILayout.Space ( 10 );
|
||||
|
||||
var titleLabelStyle = new GUIStyle ( GUI.skin.label ) { alignment = TextAnchor.MiddleLeft , fontSize = 25 , fontStyle = FontStyle.Bold , fixedHeight = 50 };
|
||||
|
||||
EditorGUILayout.LabelField ( "Airy UI Main Window" , titleLabelStyle );
|
||||
GUILayout.Space ( 50 );
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimationManager_BUTTONS ()
|
||||
{
|
||||
SetButtonStyle ( new Color ( 0.48f , 0.56f , 1 ) );
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Add Animated Elements Group" , SetIcon ( "manager_add.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
Undo.AddComponent<AnimatedElementsGroup> ( g );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buttonContent = new GUIContent ( " Remove Animated Elements Group" , SetIcon ( "manager_remove.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
if ( g.GetComponent<AnimatedElementsGroup> () != null )
|
||||
{
|
||||
Undo.DestroyObjectImmediate ( g.GetComponent<AnimatedElementsGroup> () );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void DrawAnimatedElement_BUTTONS ()
|
||||
{
|
||||
SetButtonStyle ( new Color ( 1 , 0.29f , 0.74f ) );
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Add Animated Element" , SetIcon ( "animation_add.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
Undo.AddComponent<AnimatedElement> ( g );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buttonContent = new GUIContent ( " Add Custom Animated Element" , SetIcon ( "c_animation_add.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
if ( g.GetComponent<CustomAnimatedElement> () == null )
|
||||
{
|
||||
Undo.AddComponent<CustomAnimatedElement> ( g );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buttonContent = new GUIContent ( " Remove Animated Element" , SetIcon ( "animation_remove.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
Undo.RecordObject ( g , "Remove Animated Element" );
|
||||
if ( g.GetComponent<AnimatedElement> () != null )
|
||||
Undo.DestroyObjectImmediate ( g.GetComponent<AnimatedElement> () );
|
||||
|
||||
if ( g.GetComponent<CustomAnimatedElement> () != null )
|
||||
Undo.DestroyObjectImmediate ( g.GetComponent<CustomAnimatedElement> () );
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void DrawBackBtn_BUTTONS ()
|
||||
{
|
||||
SetButtonStyle ( new Color ( 1 , 0.52f , 0.28f ) );
|
||||
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Add Esc Button" , SetIcon ( "esc_add.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
if ( g.GetComponent<EscCloseButton> () == null )
|
||||
{
|
||||
Undo.AddComponent<EscCloseButton> ( g );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buttonContent = new GUIContent ( " Remove Esc Button" , SetIcon ( "esc_remove.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
if ( g.GetComponent<EscCloseButton> () != null )
|
||||
{
|
||||
Undo.DestroyObjectImmediate ( g.GetComponent<EscCloseButton> () );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
|
||||
SetButtonStyle ( new Color ( 1 , 0.38f , 0.28f ) );
|
||||
|
||||
|
||||
buttonContent = new GUIContent ( " Add UI Close Button" , SetIcon ( "back_add.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
if ( g.GetComponent<UICloseButton> () == null )
|
||||
{
|
||||
Undo.AddComponent<UICloseButton> ( g );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buttonContent = new GUIContent ( " Remove UI Close Button" , SetIcon ( "back_remove.png" ) );
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
{
|
||||
foreach ( GameObject g in Selection.gameObjects )
|
||||
{
|
||||
if ( g.GetComponent<UICloseButton> () != null )
|
||||
{
|
||||
Undo.DestroyObjectImmediate ( g.GetComponent<UICloseButton> () );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GUILayout.Space ( 20 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/Rate On Asset Store" , priority = 15 )]
|
||||
public static void RateOnAssetStore ()
|
||||
{
|
||||
Application.OpenURL ( "https://assetstore.unity.com/packages/tools/gui/airy-ui-2-easy-ui-animation-135898#reviews" );
|
||||
}
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/Suggest | Report Bug" , priority = 16 )]
|
||||
public static void ReportBug ()
|
||||
{
|
||||
Application.OpenURL ( "https://forms.gle/4a9BU3C9ScP4XBoS8" );
|
||||
}
|
||||
|
||||
|
||||
[MenuItem ( "Airy UI/My Youtube Channel" , priority = 36 )]
|
||||
public static void YoutubeChannel ()
|
||||
{
|
||||
Application.OpenURL ( "https://youtube.com/ahmedsabrygamedev" );
|
||||
}
|
||||
|
||||
|
||||
private void DrawRateBox ()
|
||||
{
|
||||
GUILayout.Label ( "If you like Airy UI, Please Rate it On Asset Store ♡" );
|
||||
|
||||
SetButtonStyle ( new Color ( 0.317f , 1 , 0.43f ) , 30 );
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Rate ♡" , SetIcon ( "asset_store.png" ) );
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
Application.OpenURL ( "https://assetstore.unity.com/packages/tools/gui/airy-ui-2-easy-ui-animation-135898#reviews" );
|
||||
|
||||
GUILayout.Space ( 10 );
|
||||
}
|
||||
|
||||
|
||||
private void DrawYoutube ()
|
||||
{
|
||||
GUILayout.Label ( "And also, take a visit to my GameDev Youtube channel" );
|
||||
|
||||
SetButtonStyle ( new Color ( 0.31f , 0.51f , 1 ) , 30 );
|
||||
|
||||
GUIContent buttonContent = new GUIContent ( " Visit ♡" , SetIcon ( "youtube.png" ) );
|
||||
|
||||
if ( GUILayout.Button ( buttonContent , buttonContentStyle ) )
|
||||
Application.OpenURL ( "https://youtube.com/ahmedsabrygamedev" );
|
||||
}
|
||||
|
||||
|
||||
private void SetButtonStyle ( Color backgroundColor , float height = 40 )
|
||||
{
|
||||
GUI.backgroundColor = backgroundColor;
|
||||
|
||||
buttonContentStyle = new GUIStyle ( GUI.skin.button );
|
||||
|
||||
buttonContentStyle.alignment = TextAnchor.MiddleLeft;
|
||||
buttonContentStyle.normal.textColor = Color.white;
|
||||
buttonContentStyle.hover.textColor = Color.yellow;
|
||||
buttonContentStyle.fixedHeight = height;
|
||||
buttonContentStyle.fixedWidth = 361;
|
||||
buttonContentStyle.fontSize = 17;
|
||||
buttonContentStyle.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
|
||||
|
||||
private Texture2D SetIcon ( string icon )
|
||||
{
|
||||
Texture2D buttonIcon = AssetDatabase.LoadAssetAtPath<Texture2D> ( "Assets/Airy UI/Sprites/Icons/" + icon );
|
||||
|
||||
return buttonIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1605469f191200d40b9930ba490515f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 0c86d94cc61dd1f4d9e208a11aed6c15, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 135898
|
||||
packageName: Airy UI 2 - Easy UI Animation
|
||||
packageVersion: 2.0.2
|
||||
assetPath: Assets/Airy UI/Editor/MainWindow.cs
|
||||
uploadId: 760159
|
||||
Reference in New Issue
Block a user