Skip to content

Commit

Permalink
Update Logo and Icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ls9512 committed Feb 20, 2021
1 parent c299fe6 commit 6888320
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 15 deletions.
Binary file added Core/EditorResources/Icon_512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Core/Resources/TweenEditorSetting.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ef1c704e8e6509647bacb2ec6b42e749, type: 3}
m_Name: TweenEditorSetting
m_EditorClassIdentifier:
IconLogo: {fileID: 2800000, guid: 6d048f6968a5d3d4a94457c136277103, type: 3}
IconPlay: {fileID: 2800000, guid: c686fbed16129ed4e81babc55d689c56, type: 3}
IconPause: {fileID: 2800000, guid: 9dd4b8cce4e39ec4ab80c6735da1bc11, type: 3}
IconRefresh: {fileID: 2800000, guid: f4145439ba354c64f91a25ed628cf2e6, type: 3}
3 changes: 2 additions & 1 deletion Core/Resources/TweenSetting.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f6665a411bc260e479c734e26cb8fdce, type: 3}
m_Name: TweenSetting
m_EditorClassIdentifier:
ShowManagerInHierarchy: 1
ShowManagerObject: 1
ShowTweenAnimationCounter: 1
DefaultCurve:
serializedVersion: 2
m_Curve:
Expand Down
73 changes: 73 additions & 0 deletions Core/Script/Editor/TweenManagerHierarchyCallBack.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
//
// Script : TweenManagerHierarchyCallBack.cs
// Info : TweenManager Hierarchy 回调
// Author : ls9512 2019
// E-mail : [email protected]
//
/////////////////////////////////////////////////////////////////////////////
#if UNITY_EDITOR
using System;
using UnityEditor;
using UnityEngine;

namespace Aya.Tween
{
[InitializeOnLoad]
public class TweenManagerHierarchyCallBack
{
public static readonly EditorApplication.HierarchyWindowItemCallback HierarchyItemCallback;

private static readonly GUIStyle TweenCounterStyle = new GUIStyle
{
alignment = TextAnchor.LowerRight,
fontSize = 9,
normal = new GUIStyleState()
{
textColor = new Color(0.9f, 0.9f, 0.9f, 1f)
}
};

static TweenManagerHierarchyCallBack()
{
HierarchyItemCallback = DrawHierarchyIcon;
EditorApplication.hierarchyWindowItemOnGUI =
(EditorApplication.HierarchyWindowItemCallback) Delegate.Combine(
EditorApplication.hierarchyWindowItemOnGUI, HierarchyItemCallback);
}

private static void DrawHierarchyIcon(int instanceID, Rect selectionRect)
{
var go = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (go == null) return;

var check = false;
var condition1 = go.name.Contains("UTween");
var count = 0;
if (TweenSetting.Ins.ShowTweenAnimationCounter)
{
count = go.GetComponentsInChildren<TweenAnimation>(true).Length;
}

var condition2 = count > 0;
check = condition1 || condition2;

if (check && count == 0)
{
var iconRect = new Rect(selectionRect.x + selectionRect.width - 16f + 1f, selectionRect.y + 1f, 14f, 14f);
GUI.DrawTexture(iconRect, TweenEditorSetting.Ins.IconLogo);
}

if (check && count > 0)
{
var iconRect = new Rect(selectionRect.x + selectionRect.width - 16f + 1f, selectionRect.y + 1f, 14f, 14f);
GUI.DrawTexture(iconRect, TweenEditorSetting.Ins.IconLogo, ScaleMode.ScaleToFit, true, 0f, Color.white * 0.55f,
Vector4.zero, Vector4.zero);

var textRect = new Rect(selectionRect.x + selectionRect.width - 48f, selectionRect.y , 48f, 16f);
EditorGUI.LabelField(textRect, count.ToString(),TweenCounterStyle);
}
}
}
}
#endif
11 changes: 11 additions & 0 deletions Core/Script/Editor/TweenManagerHierarchyCallBack.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Core/Script/TweenAnimation.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Core/Script/TweenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,19 @@ public static TweenManager Ins
Instance = FindObjectOfType<TweenManager>();
if (Instance == null)
{
var hideFlag = TweenSetting.Ins.ShowManagerInHierarchy ? HideFlags.None : HideFlags.HideAndDontSave;
var insName = nameof(TweenManager);
var hideFlag = TweenSetting.Ins.ShowManagerObject ? HideFlags.None : HideFlags.HideAndDontSave;
var insName = "UTween";
if (!Application.isPlaying)
{
insName = "~" + nameof(TweenManager) + " (Editor)";
insName = "UTween (Editor)";
}

var obj = new GameObject
{
name = insName,
hideFlags = hideFlag,
};

Instance = obj.AddComponent<TweenManager>();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Script/TweenManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Core/Script/_Setting/TweenAnimationAsset.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Core/Script/_Setting/TweenEditorSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ internal static TweenEditorSetting Load(string fileName)
#endregion

[Header("Icon")]
public Texture2D IconLogo;
public Texture2D IconPlay;
public Texture2D IconPause;
public Texture2D IconRefresh;
Expand Down
5 changes: 3 additions & 2 deletions Core/Script/_Setting/TweenSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ internal static TweenSetting Load(string fileName)

#endregion

[Header("General Setting")]
public bool ShowManagerInHierarchy = true;
[Header("Hierarchy Setting")]
public bool ShowManagerObject = true;
public bool ShowTweenAnimationCounter = true;

[Header("Default Value")]
public AnimationCurve DefaultCurve = new AnimationCurve(new Keyframe(0, 0, 1, 1), new Keyframe(1, 1, 1, 1));
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# UTween
<img src="/Res/Logo_1200x284.png"/>

**UTween** is an interpolation animation component for **Unity**. You can quickly configure animations through built-in components or write animations through code.

![topLanguage](https://img.shields.io/github/languages/top/ls9512/UTween)
Expand All @@ -11,7 +12,7 @@
[[中文文档]](README_CN.md)

<!-- vscode-markdown-toc -->
* 1. [Quick start](#Quickstart)
* 1. [Quick Start](#QuickStart)
* 1.1. [Features](#Features)
* 1.2. [Environment](#Environment)
* 1.3. [Preview](#Preview)
Expand Down Expand Up @@ -51,7 +52,7 @@
/vscode-markdown-toc-config -->
<!-- /vscode-markdown-toc -->

## 1. <a name='Quickstart'></a>Quick start
## 1. <a name='QuickStart'></a>Quick Start
### 1.1. <a name='Features'></a>Features
* Provide detailed parameters to achieve high freedom of custom animation.
* Built-in animation realization of translation, rotation, scaling, value, color, etc. of a large number of commonly used components.
Expand Down Expand Up @@ -363,7 +364,7 @@ public class TweenTextFontSize : TweenFloatBase<Text>
{
Component.fontSize = (int)value;
#if UNITY_EDITOR
// 确保编辑器预览刷新
// Refresh for editor preview
if (!Application.isPlaying)
{
UnityEditor.EditorUtility.SetDirty(Component);
Expand Down
3 changes: 2 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# UTween
<img src="/Res/Logo_1200x284.png"/>

**UTween** 是一个 **Unity** 环境下的插值动画组件,可以通过内置组件快速配置动画,或者通过代码编写动画。

![topLanguage](https://img.shields.io/github/languages/top/ls9512/UTween)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions Res/Logo_1200x284.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6888320

Please sign in to comment.