mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 01:42:37 +08:00
Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ed3fce5fa5 | |||
| 4bbe569248 | |||
| 9d911eb581 | |||
| bc87c42cdd | |||
| 972235ec44 | |||
| e4fa6aff30 | |||
| b80ff1498e | |||
| ea83602102 | |||
| df5f723e11 | |||
| 32293858bf | |||
| e7bec9849b | |||
| 8ae051b7b2 | |||
| bb300bef59 | |||
| 30884fd349 | |||
| f477f1174a | |||
| aaf79b76a9 | |||
| 2c8b994aa0 | |||
| 49c3855c49 | |||
| 537784c0f3 | |||
| bf8b4833fd | |||
| c78bc86cf1 | |||
| 0ad6bd7693 | |||
| 3fda891b35 | |||
| efefad1a73 | |||
| 1e9cea00cb | |||
| f17183d1b0 | |||
| 7d699f08db | |||
| db98e1f0ce | |||
| eaa78e2bb4 | |||
| 068783767a | |||
| fe18d0f82f | |||
| f529ccdef7 | |||
| f9a7e317fe | |||
| 1a8265ecfa | |||
| 75f6939385 | |||
| 44579dfb40 | |||
| bd29ae6e9f | |||
| 15ebd63b8c | |||
| 49fa49c249 | |||
| 4ae260f0a3 | |||
| 5ea4461082 | |||
| 21c416aa5b | |||
| 995e03987b | |||
| f33ab503d6 | |||
| ab5f988cf1 | |||
| 5ab1e0f300 | |||
| 79f8e34c3c | |||
| 3217c7f015 | |||
| 72eb81de95 | |||
| 314313a45d | |||
| f27b3c0541 | |||
| 7779af835a | |||
| 6123ac3bd4 | |||
| 2d46d47566 | |||
| ac2ef42521 | |||
| 5648bd6020 | |||
| 9d4a2e64f9 | |||
| 3a295f8677 | |||
| b2c4e58de2 | |||
| f8eeb4a5db | |||
| 55b8de2855 | |||
| 303fcfbe64 | |||
| 782ae2b1c3 | |||
| b18c3bf387 | |||
| bf4116b9ab | |||
| deb632081e | |||
| 674c1e858b | |||
| 67c35affec | |||
| 7fe0b44e56 | |||
| 0c2a515abc | |||
| 2c7df2a749 | |||
| cc02d8945b | |||
| 866cf34048 | |||
| c5836f81f5 | |||
| d9fc2be699 | |||
| ed3f43e8e8 | |||
| 8179346170 |
@@ -0,0 +1,6 @@
|
||||
user=mob-sakai
|
||||
project=UIEffect
|
||||
issues-wo-labels=false
|
||||
pr-wo-labels=false
|
||||
exclude_labels=duplicate,question,invalid,wontfix,Duplicate,Question,Invalid,Wontfix,Meta: Exclude From Changelog,unreleased
|
||||
unreleased=false
|
||||
@@ -30,3 +30,7 @@ sysinfo.txt
|
||||
|
||||
# Builds
|
||||
*.apk
|
||||
|
||||
|
||||
# Packages
|
||||
*.unitypackage
|
||||
@@ -1,23 +0,0 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityEditor.UI
|
||||
{
|
||||
public static class ExportPackage
|
||||
{
|
||||
const string kPackageName = "UIEffect.unitypackage";
|
||||
static readonly string[] kAssetPathes = {
|
||||
"Assets/UIEffect",
|
||||
};
|
||||
|
||||
[MenuItem ("Export Package/" + kPackageName)]
|
||||
[InitializeOnLoadMethod]
|
||||
static void Export ()
|
||||
{
|
||||
if (EditorApplication.isPlayingOrWillChangePlaymode)
|
||||
return;
|
||||
|
||||
AssetDatabase.ExportPackage (kAssetPathes, kPackageName, ExportPackageOptions.Recurse | ExportPackageOptions.Default);
|
||||
UnityEngine.Debug.Log ("Export successfully : " + kPackageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../CHANGELOG.md
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fe75f65a37454bf5aa2dab183b4305a
|
||||
timeCreated: 1522651812
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+12984
-4828
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
public class Demo_UIEffect : MonoBehaviour
|
||||
{
|
||||
[SerializeField] RectMask2D mask;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
if (mask)
|
||||
{
|
||||
mask.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89691001b43234d4db48a9fab0f1260a
|
||||
timeCreated: 1502937469
|
||||
guid: e94f1a0bc56a14944aadc5064f5f485a
|
||||
timeCreated: 1525599611
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
public class Demo_UIEffectDialog : MonoBehaviour
|
||||
{
|
||||
public void Open()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
GetComponent<Animator>().SetTrigger("Open");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
GetComponent<Animator>().SetTrigger("Close");
|
||||
}
|
||||
|
||||
public void Closed()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void CaptureBackground()
|
||||
{
|
||||
GetComponentInChildren<UIEffectCapturedImage>().Capture();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &-1353081132
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Animation
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Location
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: f19b7e2285c104f6ca47d583f3e5444f, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Location
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: ce76b7a490bd74f34a2f2752641aea24, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 0.5
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1.5
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Horizontal
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: 9bb4e59514e90489d985e9a17c838085, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 0.5
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1.5
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Veritical
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: 9bb4e59514e90489d985e9a17c838085, type: 3}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 12
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- path: 0
|
||||
attribute: 2830261733
|
||||
script: {fileID: 11500000, guid: f19b7e2285c104f6ca47d583f3e5444f, type: 3}
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- path: 0
|
||||
attribute: 2830261733
|
||||
script: {fileID: 11500000, guid: ce76b7a490bd74f34a2f2752641aea24, type: 3}
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- path: 0
|
||||
attribute: 3652906371
|
||||
script: {fileID: 11500000, guid: 9bb4e59514e90489d985e9a17c838085, type: 3}
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- path: 0
|
||||
attribute: 1301824207
|
||||
script: {fileID: 11500000, guid: 9bb4e59514e90489d985e9a17c838085, type: 3}
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 2
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Location
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: f19b7e2285c104f6ca47d583f3e5444f, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Location
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: ce76b7a490bd74f34a2f2752641aea24, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 0.5
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1.5
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Horizontal
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: 9bb4e59514e90489d985e9a17c838085, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 0.5
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 1.5
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
- serializedVersion: 2
|
||||
time: 2
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Veritical
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: 9bb4e59514e90489d985e9a17c838085, type: 3}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_IsEmpty: 0
|
||||
m_Events: []
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Shiny, Dissolve, Flip
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters:
|
||||
- m_Name: New Bool
|
||||
m_Type: 4
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 110755890}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1102 &110250372
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Animation
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_Motion: {fileID: -1353081132}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
--- !u!1107 &110755890
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 110250372}
|
||||
m_Position: {x: 240, y: 120, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 48, y: 72, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: 110250372}
|
||||
--- !u!1102 &558841200
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Animation
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_Motion: {fileID: 0}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efc039787ac554a5d9ac2068e70d0c44
|
||||
timeCreated: 1502936794
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1edb2b7979e364afba561a955f4708ba
|
||||
guid: e129a7bccac914fc0b15dab3c2395cd3
|
||||
timeCreated: 1488199687
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
|
||||
@@ -5,7 +5,7 @@ AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Mono
|
||||
m_Name: Transition
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
@@ -46,6 +46,46 @@ AnimationClip:
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: f8b2ed11d675446c5a49da1ea296d490, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: -180
|
||||
inSlope: 0
|
||||
outSlope: 180
|
||||
tangentMode: 21
|
||||
- time: 2
|
||||
value: 180
|
||||
inSlope: 180
|
||||
outSlope: 0
|
||||
tangentMode: 21
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Rotation
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: 3fb48d82dc0e94a2b9246d17d04f8748, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
- time: 3
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Enabled
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 12
|
||||
m_WrapMode: 0
|
||||
@@ -60,6 +100,18 @@ AnimationClip:
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- path: 0
|
||||
attribute: 3746581727
|
||||
script: {fileID: 11500000, guid: 3fb48d82dc0e94a2b9246d17d04f8748, type: 3}
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- path: 0
|
||||
attribute: 3305885265
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
classID: 114
|
||||
customType: 24
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
@@ -112,6 +164,46 @@ AnimationClip:
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: f8b2ed11d675446c5a49da1ea296d490, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: -180
|
||||
inSlope: 0
|
||||
outSlope: 180
|
||||
tangentMode: 21
|
||||
- time: 2
|
||||
value: 180
|
||||
inSlope: 180
|
||||
outSlope: 0
|
||||
tangentMode: 21
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Rotation
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: 3fb48d82dc0e94a2b9246d17d04f8748, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
- time: 3
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Enabled
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
@@ -145,7 +237,7 @@ AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Blur
|
||||
m_Name: Capture
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
@@ -186,6 +278,26 @@ AnimationClip:
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: e96dacbf1b116f64da658fbad66839e2, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
- time: 3
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Enabled
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 12
|
||||
m_WrapMode: 0
|
||||
@@ -200,6 +312,12 @@ AnimationClip:
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
- path: 0
|
||||
attribute: 3305885265
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
classID: 114
|
||||
customType: 24
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
@@ -252,6 +370,26 @@ AnimationClip:
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: e96dacbf1b116f64da658fbad66839e2, type: 3}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
- time: 3
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Enabled
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
@@ -264,6 +402,93 @@ AnimationClip:
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
--- !u!74 &7437890
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Idle
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Enabled
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 12
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- path: 0
|
||||
attribute: 3305885265
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
classID: 114
|
||||
customType: 24
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 0
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 31
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Enabled
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: -98529514, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events: []
|
||||
--- !u!74 &7450624
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 3
|
||||
@@ -446,123 +671,6 @@ AnimationClip:
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events: []
|
||||
--- !u!74 &7475794
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Cutoff
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- time: 2
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- time: 3
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_ToneLevel
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: f8b2ed11d675446c5a49da1ea296d490, type: 3}
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 12
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- path: 0
|
||||
attribute: 2148837408
|
||||
script: {fileID: 11500000, guid: f8b2ed11d675446c5a49da1ea296d490, type: 3}
|
||||
classID: 114
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 3
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- time: 2
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
- time: 3
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_ToneLevel
|
||||
path:
|
||||
classID: 114
|
||||
script: {fileID: 11500000, guid: f8b2ed11d675446c5a49da1ea296d490, type: 3}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events: []
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -571,24 +679,18 @@ AnimatorController:
|
||||
m_Name: Transition
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters:
|
||||
- m_Name: Cutoff
|
||||
- m_Name: Capture
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: Mono
|
||||
m_Controller: {fileID: 0}
|
||||
- m_Name: Transition
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: Blur
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
m_Controller: {fileID: 0}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
@@ -602,30 +704,6 @@ AnimatorController:
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1101 &110109394
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: Mono
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 110244674}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.9
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &110120972
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -634,7 +712,7 @@ AnimatorStateTransition:
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: Cutoff
|
||||
m_ConditionEvent: Transition
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 110299230}
|
||||
@@ -650,27 +728,6 @@ AnimatorStateTransition:
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &110147560
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions: []
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 0}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 1
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 0
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &110161426
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -700,7 +757,7 @@ AnimatorStateTransition:
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: Blur
|
||||
m_ConditionEvent: Capture
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 110202250}
|
||||
@@ -778,7 +835,7 @@ AnimatorState:
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_Motion: {fileID: 0}
|
||||
m_Motion: {fileID: 7437890}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
@@ -789,7 +846,7 @@ AnimatorState:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Blur
|
||||
m_Name: Capture
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
@@ -807,17 +864,17 @@ AnimatorState:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
--- !u!1102 &110244674
|
||||
--- !u!1102 &110299230
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_ObjectHideFlags: 3
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Mono
|
||||
m_Name: Transition
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 110147560}
|
||||
- {fileID: 110176334}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@@ -831,30 +888,6 @@ AnimatorState:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
--- !u!1102 &110299230
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Cutoff
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 110176334}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_Motion: {fileID: 7475794}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
--- !u!1107 &110755890
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 5
|
||||
@@ -863,9 +896,6 @@ AnimatorStateMachine:
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 110244674}
|
||||
m_Position: {x: 336, y: 108, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 110299230}
|
||||
m_Position: {x: 336, y: 48, z: 0}
|
||||
@@ -874,10 +904,9 @@ AnimatorStateMachine:
|
||||
m_Position: {x: 336, y: -12, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 110202250}
|
||||
m_Position: {x: 336, y: 168, z: 0}
|
||||
m_Position: {x: 336, y: 108, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions:
|
||||
- {fileID: 110109394}
|
||||
- {fileID: 110120972}
|
||||
- {fileID: 110166844}
|
||||
m_EntryTransitions: []
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
public class UIEffectDialogDemo : MonoBehaviour {
|
||||
|
||||
public void Open()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
GetComponent<Animator>().SetTrigger("Open");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
GetComponent<Animator>().SetTrigger("Close");
|
||||
}
|
||||
|
||||
public void Closed()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void CaptureBackground()
|
||||
{
|
||||
GetComponentInChildren<UIEffectCapturedImage>().Capture();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using UnityEngine;
|
||||
using DesamplingRate = Coffee.UIExtensions.UIEffectCapturedImage.DesamplingRate;
|
||||
|
||||
namespace UnityEditor.UI
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIEffectCapturedImage editor.
|
||||
@@ -11,6 +12,41 @@ namespace UnityEditor.UI
|
||||
[CanEditMultipleObjects]
|
||||
public class UIEffectCapturedImageEditor : RawImageEditor
|
||||
{
|
||||
//################################
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
|
||||
public enum QualityMode : int
|
||||
{
|
||||
Fast = (DesamplingRate.x2 << 0) + (DesamplingRate.x2 << 4) + (FilterMode.Bilinear << 8) + (1 << 10),
|
||||
Medium = (DesamplingRate.x1 << 0) + (DesamplingRate.x1 << 4) + (FilterMode.Bilinear << 8) + (1 << 10),
|
||||
Detail = (DesamplingRate.None << 0) + (DesamplingRate.x1 << 4) + (FilterMode.Bilinear << 8) + (1 << 10),
|
||||
Custom = -1,
|
||||
}
|
||||
|
||||
|
||||
//################################
|
||||
// Public/Protected Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// This function is called when the object becomes enabled and active.
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
_spTexture = serializedObject.FindProperty("m_Texture");
|
||||
_spColor = serializedObject.FindProperty("m_Color");
|
||||
_spRaycastTarget = serializedObject.FindProperty("m_RaycastTarget");
|
||||
_spDesamplingRate = serializedObject.FindProperty("m_DesamplingRate");
|
||||
_spReductionRate = serializedObject.FindProperty("m_ReductionRate");
|
||||
_spFilterMode = serializedObject.FindProperty("m_FilterMode");
|
||||
_spIterations = serializedObject.FindProperty("m_Iterations");
|
||||
_spKeepSizeToRootCanvas = serializedObject.FindProperty("m_KeepCanvasSize");
|
||||
|
||||
|
||||
_customAdvancedOption = (qualityMode == QualityMode.Custom);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this function to make a custom inspector.
|
||||
/// </summary>
|
||||
@@ -21,16 +57,16 @@ namespace UnityEditor.UI
|
||||
//================
|
||||
// Basic properties.
|
||||
//================
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Texture"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Color"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RaycastTarget"));
|
||||
EditorGUILayout.PropertyField(_spTexture);
|
||||
EditorGUILayout.PropertyField(_spColor);
|
||||
EditorGUILayout.PropertyField(_spRaycastTarget);
|
||||
|
||||
//================
|
||||
// Capture effect.
|
||||
//================
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.LabelField("Capture Effect", EditorStyles.boldLabel);
|
||||
UIEffectEditor.DrawEffectProperties(serializedObject);
|
||||
UIEffectEditor.DrawEffectProperties(UIEffectCapturedImage.shaderName, serializedObject);
|
||||
|
||||
//================
|
||||
// Advanced option.
|
||||
@@ -38,14 +74,24 @@ namespace UnityEditor.UI
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.LabelField("Advanced Option", EditorStyles.boldLabel);
|
||||
|
||||
// Desampling rate.
|
||||
DrawDesamplingRate(serializedObject.FindProperty("m_DesamplingRate"));
|
||||
EditorGUI.BeginChangeCheck();
|
||||
QualityMode quality = qualityMode;
|
||||
quality = (QualityMode)EditorGUILayout.EnumPopup("Quality Mode", quality);
|
||||
if(EditorGUI.EndChangeCheck())
|
||||
{
|
||||
_customAdvancedOption = (quality == QualityMode.Custom);
|
||||
qualityMode = quality;
|
||||
}
|
||||
|
||||
// Reduction rate.
|
||||
DrawDesamplingRate(serializedObject.FindProperty("m_ReductionRate"));
|
||||
|
||||
// Filter Mode.
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_FilterMode"));
|
||||
// When qualityMode is `Custom`, show advanced option.
|
||||
if (_customAdvancedOption)
|
||||
{
|
||||
DrawDesamplingRate(_spDesamplingRate);// Desampling rate.
|
||||
DrawDesamplingRate(_spReductionRate);// Reduction rate.
|
||||
EditorGUILayout.PropertyField(_spFilterMode);// Filter Mode.
|
||||
EditorGUILayout.PropertyField(_spIterations);// Iterations.
|
||||
}
|
||||
EditorGUILayout.PropertyField(_spKeepSizeToRootCanvas);// Iterations.
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
@@ -64,6 +110,48 @@ namespace UnityEditor.UI
|
||||
}
|
||||
}
|
||||
|
||||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
const int Bits4 = (1 << 4) - 1;
|
||||
const int Bits2 = (1 << 2) - 1;
|
||||
bool _customAdvancedOption = false;
|
||||
SerializedProperty _spTexture;
|
||||
SerializedProperty _spColor;
|
||||
SerializedProperty _spRaycastTarget;
|
||||
SerializedProperty _spDesamplingRate;
|
||||
SerializedProperty _spReductionRate;
|
||||
SerializedProperty _spFilterMode;
|
||||
SerializedProperty _spIterations;
|
||||
SerializedProperty _spKeepSizeToRootCanvas;
|
||||
|
||||
QualityMode qualityMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_customAdvancedOption)
|
||||
return QualityMode.Custom;
|
||||
|
||||
int qualityValue = (_spDesamplingRate.intValue << 0)
|
||||
+ (_spReductionRate.intValue << 4)
|
||||
+ (_spFilterMode.intValue << 8)
|
||||
+ (_spIterations.intValue << 10);
|
||||
|
||||
return System.Enum.IsDefined(typeof(QualityMode), qualityValue) ? (QualityMode)qualityValue : QualityMode.Custom;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != QualityMode.Custom)
|
||||
{
|
||||
int qualityValue = (int)value;
|
||||
_spDesamplingRate.intValue = (qualityValue >> 0) & Bits4;
|
||||
_spReductionRate.intValue = (qualityValue >> 4) & Bits4;
|
||||
_spFilterMode.intValue = (qualityValue >> 8) & Bits2;
|
||||
_spIterations.intValue = (qualityValue >> 10) & Bits4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the desampling rate.
|
||||
/// </summary>
|
||||
@@ -87,10 +175,10 @@ namespace UnityEditor.UI
|
||||
bool enable = current.enabled;
|
||||
current.enabled = false;
|
||||
current.Release();
|
||||
if(capture)
|
||||
if (capture)
|
||||
current.Capture();
|
||||
|
||||
EditorApplication.delayCall += ()=>current.enabled = enable;
|
||||
EditorApplication.delayCall += () => current.enabled = enable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using UnityEditorInternal;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityEditor.UI
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIEffect editor.
|
||||
@@ -11,20 +11,31 @@ namespace UnityEditor.UI
|
||||
[CanEditMultipleObjects]
|
||||
public class UIEffectEditor : Editor
|
||||
{
|
||||
ReorderableList roAdditionalShadows;
|
||||
SerializedProperty spAdditionalShadows;
|
||||
SerializedProperty spBlurMode;
|
||||
|
||||
//################################
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Implement this function to make a custom inspector.
|
||||
/// Draw effect properties.
|
||||
/// </summary>
|
||||
public static void DrawEffectProperties(SerializedObject serializedObject)
|
||||
public static void DrawEffectProperties(string shaderName, SerializedObject serializedObject)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
//================
|
||||
// Effect material.
|
||||
//================
|
||||
var spMaterial = serializedObject.FindProperty("m_EffectMaterial");
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.PropertyField(spMaterial);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
//================
|
||||
// Tone setting.
|
||||
//================
|
||||
var spToneMode = serializedObject.FindProperty("m_ToneMode");
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(spToneMode);
|
||||
changed |= EditorGUI.EndChangeCheck();
|
||||
|
||||
// When tone is enable, show parameters.
|
||||
if (spToneMode.intValue != (int)UIEffect.ToneMode.None)
|
||||
@@ -38,7 +49,9 @@ namespace UnityEditor.UI
|
||||
// Color setting.
|
||||
//================
|
||||
var spColorMode = serializedObject.FindProperty("m_ColorMode");
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(spColorMode);
|
||||
changed |= EditorGUI.EndChangeCheck();
|
||||
|
||||
// When color is enable, show parameters.
|
||||
if (spColorMode.intValue != (int)UIEffect.ColorMode.None)
|
||||
@@ -52,7 +65,9 @@ namespace UnityEditor.UI
|
||||
// Blur setting.
|
||||
//================
|
||||
var spBlurMode = serializedObject.FindProperty("m_BlurMode");
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(spBlurMode);
|
||||
changed |= EditorGUI.EndChangeCheck();
|
||||
|
||||
// When blur is enable, show parameters.
|
||||
if (spBlurMode.intValue != (int)UIEffect.BlurMode.None)
|
||||
@@ -61,25 +76,63 @@ namespace UnityEditor.UI
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Blur"));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
// Set effect material.
|
||||
if (!serializedObject.isEditingMultipleObjects && spToneMode.intValue == 0 && spColorMode.intValue == 0 && spBlurMode.intValue == 0)
|
||||
{
|
||||
spMaterial.objectReferenceValue = null;
|
||||
}
|
||||
else if (changed || !serializedObject.isEditingMultipleObjects)
|
||||
{
|
||||
spMaterial.objectReferenceValue = UIEffect.GetOrGenerateMaterialVariant(Shader.Find(shaderName),
|
||||
(UIEffect.ToneMode)spToneMode.intValue,
|
||||
(UIEffect.ColorMode)spColorMode.intValue,
|
||||
(UIEffect.BlurMode)spBlurMode.intValue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
ReorderableList _roAdditionalShadows;
|
||||
SerializedProperty _spAdditionalShadows;
|
||||
SerializedProperty _spBlurMode;
|
||||
SerializedProperty _spCustomEffect;
|
||||
SerializedProperty _spEffectMaterial;
|
||||
SerializedProperty _spEffectColor;
|
||||
SerializedProperty _spCustomFactorX;
|
||||
SerializedProperty _spCustomFactorY;
|
||||
SerializedProperty _spCustomFactorZ;
|
||||
SerializedProperty _spCustomFactorW;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
spAdditionalShadows = serializedObject.FindProperty("m_AdditionalShadows");
|
||||
spBlurMode = serializedObject.FindProperty("m_BlurMode");
|
||||
_spAdditionalShadows = serializedObject.FindProperty("m_AdditionalShadows");
|
||||
_spBlurMode = serializedObject.FindProperty("m_BlurMode");
|
||||
_spEffectColor = serializedObject.FindProperty("m_EffectColor");
|
||||
|
||||
_spCustomEffect = serializedObject.FindProperty("m_CustomEffect");
|
||||
_spEffectMaterial = serializedObject.FindProperty("m_EffectMaterial");
|
||||
var spFactor = serializedObject.FindProperty("m_CustomFactor");
|
||||
_spCustomFactorX = spFactor.FindPropertyRelative("x");
|
||||
_spCustomFactorY = spFactor.FindPropertyRelative("y");
|
||||
_spCustomFactorZ = spFactor.FindPropertyRelative("z");
|
||||
_spCustomFactorW = spFactor.FindPropertyRelative("w");
|
||||
|
||||
_roAdditionalShadows = new ReorderableList(serializedObject, _spAdditionalShadows, true, true, true, true);
|
||||
_roAdditionalShadows.drawElementCallback = DrawElementCallback;
|
||||
_roAdditionalShadows.drawHeaderCallback = (rect) => EditorGUI.LabelField(rect, "Additional Shadows");
|
||||
_roAdditionalShadows.onAddCallback = OnAddCallback;
|
||||
_roAdditionalShadows.elementHeightCallback = ElementHeightCallback;
|
||||
|
||||
roAdditionalShadows = new ReorderableList(serializedObject, spAdditionalShadows, true, true, true, true);
|
||||
roAdditionalShadows.drawElementCallback = DrawElementCallback;
|
||||
roAdditionalShadows.drawHeaderCallback = (rect) => EditorGUI.LabelField(rect, "Additional Shadows");
|
||||
roAdditionalShadows.onAddCallback = OnAddCallback;
|
||||
roAdditionalShadows.elementHeightCallback = ElementHeightCallback;
|
||||
}
|
||||
|
||||
void OnAddCallback(ReorderableList ro)
|
||||
{
|
||||
spAdditionalShadows.InsertArrayElementAtIndex(ro.count);
|
||||
var element = spAdditionalShadows.GetArrayElementAtIndex(ro.count - 1);
|
||||
element.FindPropertyRelative("shadowMode").intValue = (int)UIEffect.ShadowMode.Shadow;
|
||||
_spAdditionalShadows.InsertArrayElementAtIndex(ro.count);
|
||||
var element = _spAdditionalShadows.GetArrayElementAtIndex(ro.count - 1);
|
||||
element.FindPropertyRelative("shadowMode").intValue = (int)UIEffect.ShadowStyle.Shadow;
|
||||
element.FindPropertyRelative("shadowColor").colorValue = Color.black;
|
||||
element.FindPropertyRelative("effectDistance").vector2Value = new Vector2(1f, -1f);
|
||||
element.FindPropertyRelative("useGraphicAlpha").boolValue = true;
|
||||
@@ -88,11 +141,11 @@ namespace UnityEditor.UI
|
||||
|
||||
float ElementHeightCallback(int index)
|
||||
{
|
||||
var element = spAdditionalShadows.GetArrayElementAtIndex(index);
|
||||
if (element.FindPropertyRelative("shadowMode").intValue == (int)UIEffect.ShadowMode.None)
|
||||
var element = _spAdditionalShadows.GetArrayElementAtIndex(index);
|
||||
if (element.FindPropertyRelative("shadowMode").intValue == (int)UIEffect.ShadowStyle.None)
|
||||
return 16;
|
||||
|
||||
return (spBlurMode.intValue == (int)UIEffect.BlurMode.None ? 66 : 84) + (EditorGUIUtility.wideMode ? 0 : 18);
|
||||
return (_spBlurMode.intValue == (int)UIEffect.BlurMode.None ? 66 : 84) + (EditorGUIUtility.wideMode ? 0 : 18);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,13 +153,13 @@ namespace UnityEditor.UI
|
||||
/// </summary>
|
||||
void DrawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
var sp = roAdditionalShadows.serializedProperty.GetArrayElementAtIndex(index);
|
||||
var sp = _roAdditionalShadows.serializedProperty.GetArrayElementAtIndex(index);
|
||||
|
||||
Rect r = new Rect(rect);
|
||||
r.height = EditorGUIUtility.singleLineHeight;
|
||||
var spMode = sp.FindPropertyRelative("shadowMode");
|
||||
EditorGUI.PropertyField(r, spMode);
|
||||
if (spMode.intValue == (int)UIEffect.ShadowMode.None)
|
||||
if (spMode.intValue == (int)UIEffect.ShadowStyle.None)
|
||||
return;
|
||||
|
||||
r.y += r.height;
|
||||
@@ -116,7 +169,7 @@ namespace UnityEditor.UI
|
||||
r.y += EditorGUIUtility.wideMode ? r.height : r.height * 2;
|
||||
EditorGUI.PropertyField(r, sp.FindPropertyRelative("useGraphicAlpha"));
|
||||
|
||||
if (spBlurMode.intValue != (int)UIEffect.BlurMode.None)
|
||||
if (_spBlurMode.intValue != (int)UIEffect.BlurMode.None)
|
||||
{
|
||||
r.y += r.height;
|
||||
EditorGUI.PropertyField(r, sp.FindPropertyRelative("shadowBlur"));
|
||||
@@ -129,23 +182,41 @@ namespace UnityEditor.UI
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
DrawEffectProperties(serializedObject);
|
||||
|
||||
// Custom effect.
|
||||
EditorGUILayout.PropertyField(_spCustomEffect);
|
||||
if(_spCustomEffect.boolValue)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_spEffectMaterial);
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.Slider(_spCustomFactorX, 0, 1, new GUIContent("Effect Factor X"));
|
||||
EditorGUILayout.Slider(_spCustomFactorY, 0, 1, new GUIContent("Effect Factor Y"));
|
||||
EditorGUILayout.Slider(_spCustomFactorZ, 0, 1, new GUIContent("Effect Factor Z"));
|
||||
EditorGUILayout.Slider(_spCustomFactorW, 0, 1, new GUIContent("Effect Factor W"));
|
||||
EditorGUILayout.PropertyField(_spEffectColor);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawEffectProperties(UIEffect.shaderName, serializedObject);
|
||||
}
|
||||
|
||||
//================
|
||||
// Shadow setting.
|
||||
//================
|
||||
var spShadowMode = serializedObject.FindProperty("m_ShadowMode");
|
||||
var spShadowMode = serializedObject.FindProperty("m_ShadowStyle");
|
||||
EditorGUILayout.PropertyField(spShadowMode);
|
||||
|
||||
// When shadow is enable, show parameters.
|
||||
if (spShadowMode.intValue != (int)UIEffect.ShadowMode.None)
|
||||
if (spShadowMode.intValue != (int)UIEffect.ShadowStyle.None)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_EffectDistance"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ShadowColor"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_UseGraphicAlpha"));
|
||||
|
||||
if (spBlurMode.intValue != (int)UIEffect.BlurMode.None)
|
||||
if (_spBlurMode.intValue != (int)UIEffect.BlurMode.None)
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ShadowBlur"));
|
||||
}
|
||||
@@ -155,19 +226,23 @@ namespace UnityEditor.UI
|
||||
//================
|
||||
// Additional shadow setting.
|
||||
//================
|
||||
roAdditionalShadows.DoLayoutList();
|
||||
_roAdditionalShadows.DoLayoutList();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
var canvas = (target as UIEffect).graphic.canvas;
|
||||
if( 0 == (canvas.additionalShaderChannels & AdditionalCanvasShaderChannels.TexCoord1))
|
||||
var graphic = (target as UIEffect).graphic;
|
||||
if(graphic)
|
||||
{
|
||||
using (new GUILayout.HorizontalScope())
|
||||
var canvas = graphic.canvas;
|
||||
if( canvas && 0 == (canvas.additionalShaderChannels & AdditionalCanvasShaderChannels.TexCoord1))
|
||||
{
|
||||
EditorGUILayout.HelpBox("[Unity5.6+] Enable TexCoord1 of Canvas.additionalShaderChannels to use UIEffect.", MessageType.Warning);
|
||||
if (GUILayout.Button("Fix"))
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
|
||||
using (new GUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.HelpBox("[Unity5.6+] Enable TexCoord1 of Canvas.additionalShaderChannels to use UIEffect.", MessageType.Warning);
|
||||
if (GUILayout.Button("Fix"))
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIEffect editor.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UIGradient))]
|
||||
[CanEditMultipleObjects]
|
||||
public class UIGradientEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
//================
|
||||
// Direction.
|
||||
//================
|
||||
var spDirection = serializedObject.FindProperty("m_Direction");
|
||||
EditorGUILayout.PropertyField(spDirection);
|
||||
|
||||
|
||||
//================
|
||||
// Color.
|
||||
//================
|
||||
var spColor1 = serializedObject.FindProperty("m_Color1");
|
||||
var spColor2 = serializedObject.FindProperty("m_Color2");
|
||||
var spColor3 = serializedObject.FindProperty("m_Color3");
|
||||
var spColor4 = serializedObject.FindProperty("m_Color4");
|
||||
switch ((UIGradient.Direction)spDirection.intValue)
|
||||
{
|
||||
case UIGradient.Direction.Horizontal:
|
||||
EditorGUILayout.PropertyField(spColor1, new GUIContent("Left"));
|
||||
EditorGUILayout.PropertyField(spColor2, new GUIContent("Right"));
|
||||
break;
|
||||
case UIGradient.Direction.Vertical:
|
||||
EditorGUILayout.PropertyField(spColor1, new GUIContent("Top"));
|
||||
EditorGUILayout.PropertyField(spColor2, new GUIContent("Bottom"));
|
||||
break;
|
||||
case UIGradient.Direction.Angle:
|
||||
EditorGUILayout.PropertyField(spColor1, new GUIContent("Color 1"));
|
||||
EditorGUILayout.PropertyField(spColor2, new GUIContent("Color 2"));
|
||||
break;
|
||||
case UIGradient.Direction.Diagonal:
|
||||
Rect r = EditorGUILayout.GetControlRect(false, 34);
|
||||
|
||||
r = EditorGUI.PrefixLabel(r, new GUIContent("Diagonal Color"));
|
||||
float w = r.width / 2;
|
||||
|
||||
EditorGUI.PropertyField(new Rect(r.x, r.y, w, 16), spColor3, GUIContent.none);
|
||||
EditorGUI.PropertyField(new Rect(r.x + w, r.y, w, 16), spColor4, GUIContent.none);
|
||||
EditorGUI.PropertyField(new Rect(r.x, r.y + 18, w, 16), spColor1, GUIContent.none);
|
||||
EditorGUI.PropertyField(new Rect(r.x + w, r.y + 18, w, 16), spColor2, GUIContent.none);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//================
|
||||
// Angle.
|
||||
//================
|
||||
if ((int)UIGradient.Direction.Angle <= spDirection.intValue)
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Rotation"));
|
||||
}
|
||||
|
||||
|
||||
//================
|
||||
// Offset.
|
||||
//================
|
||||
if ((int)UIGradient.Direction.Diagonal == spDirection.intValue)
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Offset1"), new GUIContent("Vertical Offset"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Offset2"), new GUIContent("Horizontal Offset"));
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Offset1"), new GUIContent("Offset"));
|
||||
}
|
||||
|
||||
|
||||
//================
|
||||
// Advanced options.
|
||||
//================
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Advanced Options", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
{
|
||||
if ((target as UIGradient).graphic is Text)
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_GradientStyle"));
|
||||
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ColorSpace"));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_IgnoreAspectRatio"));
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c28dcc885fbba4a5187a6a1aa5fb1b3b
|
||||
timeCreated: 1515895646
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +0,0 @@
|
||||
Copyright 2017 mob-sakai
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
./../../LICENSE.txt
|
||||
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b535d57ef51543408dea9bdc2ac90a0
|
||||
guid: 39ac2ac7853a94fbc9d9e3d1151b9dfe
|
||||
folderAsset: yes
|
||||
timeCreated: 1502937466
|
||||
timeCreated: 1515203270
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,172 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: UI-Effect-Shiny
|
||||
m_Shader: {fileID: 4800000, guid: 20ffe76c2439c403aabdd25bd94bf011, type: 3}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _ColorMask
|
||||
second: 15
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _ShineLocation
|
||||
second: 0.03
|
||||
- first:
|
||||
name: _ShineWidth
|
||||
second: 0.612
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _Stencil
|
||||
second: 0
|
||||
- first:
|
||||
name: _StencilComp
|
||||
second: 8
|
||||
- first:
|
||||
name: _StencilOp
|
||||
second: 0
|
||||
- first:
|
||||
name: _StencilReadMask
|
||||
second: 255
|
||||
- first:
|
||||
name: _StencilWriteMask
|
||||
second: 255
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _UseUIAlphaClip
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _alpha
|
||||
second: 0.4
|
||||
- first:
|
||||
name: _angle
|
||||
second: 180
|
||||
- first:
|
||||
name: _factor
|
||||
second: 16.2
|
||||
- first:
|
||||
name: _width
|
||||
second: 9969.5
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _effectcolor
|
||||
second: {r: 0.14812386, g: 0, b: 0.9338235, a: 0.441}
|
||||
- first:
|
||||
name: _size
|
||||
second: {r: 112, g: 317, b: 100, a: 1000}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9dc7e810a87b444ab96919f3215c2fe5
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aee96bc531e6eba468ec405e536f515f
|
||||
timeCreated: 1516545204
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a1a8e44196ca754a9a7b9cb80e17573
|
||||
timeCreated: 1516545204
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,100 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e04c247fb2604af186173fce0bc62de
|
||||
timeCreated: 1524468976
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 2
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 10
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: iPhone
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../README.md
|
||||
@@ -1,167 +0,0 @@
|
||||
UIEffect
|
||||
===
|
||||
|
||||

|
||||
|
||||
Easy to use effects for uGUI. Supports following effects.
|
||||
|
||||
* Grayscale tone
|
||||
* Sepia tone
|
||||
* Nega tone
|
||||
* Pixelation
|
||||
* Cutoff (alpha-based)
|
||||
* Mono (alpha-based)
|
||||
* Color setting
|
||||
* Color additive
|
||||
* Color subtract
|
||||
* Blur fast(3x4)
|
||||
* Blur medium(6x4)
|
||||
* Blur detail(6x8)
|
||||
|
||||
|
||||
#### And, more features!
|
||||
|
||||
* Animation
|
||||

|
||||
* Use for transition
|
||||

|
||||
* Multiple shadow effect to reduce rendering vertices
|
||||

|
||||
* Capture image with effect, like post effect
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
## Requirement
|
||||
|
||||
* Unity 5.3+ *(included Unity 2017.x)*
|
||||
* No other SDK are required
|
||||
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
1. Download [UIEffect.unitypackage](https://github.com/mob-sakai/UIEffect/raw/master/UIEffect.unitypackage) and install to your project.
|
||||
1. Import the package into your Unity project. Select `Import Package > Custom Package` from the `Assets` menu.
|
||||
1. Add `UIEffect` component to UI element (Image, RawImage, Text, etc...) from `Add Component` in inspector.
|
||||
1. Choose effect type and adjust values in inspector.
|
||||

|
||||
1. Enjoy!
|
||||
|
||||
|
||||
|
||||
|
||||
## UIEffect for CapturedImage
|
||||
|
||||

|
||||
|
||||
`UIEffectCapturedImage` is like post effects, but it only provides effects on the rendered result (= captured image) of a frame.
|
||||
This effect is non-realtime, light-weight, less-camera, blit only once, but effective.
|
||||
|
||||
* Camera for processing effect is unnecessary.
|
||||
* Process effect only once after `UIEffectCapturedImage.Capture`.
|
||||
* Using reduction buffer, keep used memory size small and keep rendering load are small.
|
||||
* When GameObjects with motion are on the screen, a result texture may be stirred.
|
||||
* You can overlay and display like as: [Screen] | [UIEffectCapturedImage] | [Dialog A] | [UIEffectCapturedImage] | [Dialog B]. See also demo.
|
||||
|
||||
|
||||
|
||||
|
||||
## Note: Unity 5.6+
|
||||
|
||||
In Unity 5.6+, Canvas supports **Additional Shader Channels**.
|
||||
Please enable `TexCoord1` to use UIEffect.
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
## Demo
|
||||
|
||||
[WebGL Demo](https://developer.cloud.unity3d.com/share/-y4XQpqcZm/webgl/)
|
||||
|
||||
* Effect sample
|
||||
* Transition
|
||||
* Dialog window with blur background
|
||||
* Included in unitypackage
|
||||
|
||||
|
||||
|
||||
|
||||
## Release Notes
|
||||
|
||||
### ver.1.3.0
|
||||
|
||||
* Feature: Capture image with effect, like post effect.
|
||||
* Demo: Add transition blur button & dialog with captured image effect.
|
||||

|
||||
|
||||
|
||||
### ver.1.2.0
|
||||
|
||||
* Fixed : Pixelaration shifts to the lower right.
|
||||
* Fixed : Cutoff alpha is incorrect.
|
||||
* Feature: Supports multiple shadow effect for reduce rendering vertices.
|
||||

|
||||
* Feature: New blur effect mode : `Medium`.
|
||||
* Feature: Fix button to enable TexCoord1 of Canvas.additionalShaderChannels to use UIEffect.
|
||||

|
||||
* Changed : UIEffect.color is obsolete, use UIEffect.effectColor instead.
|
||||
* Changed: Blur range is [0-2].
|
||||
* Refactoring: Shader refactoring.
|
||||
* Demo: Add transition button & multiple shadows.
|
||||
|
||||
|
||||
### ver.1.1.0
|
||||
|
||||
* Feature: Add Pixelaration effect.
|
||||
* Feature: Add Cutoff/Mono effect for patterned alpha images. It can be used for masks and transitions!
|
||||

|
||||
|
||||
|
||||
### ver.1.0.0
|
||||
|
||||
* Feature: Shader supports pre-processer macros (for example UNITY_VERTEX_OUTPUT_STEREO) for Unity 5.3.x, 5.4.x and 5.5.x.
|
||||
* Feature: Supports changing value from animation.
|
||||
* Feature: Supports Tone effect.
|
||||
* grayscale
|
||||
* sepia
|
||||
* nega
|
||||
* Feature: Supports Color effect.
|
||||
* set
|
||||
* add
|
||||
* sub
|
||||
* Feature: Supports Blur effect.
|
||||
* fast
|
||||
* detail
|
||||
* Fix: Color effect will not be properly when it was rotated.
|
||||
* Performance: Shader supports multi-compile for performance.
|
||||
* Performance: Cache same effect materials to reduce draw calls.
|
||||
* Improve: Supports mobile devices.
|
||||
* Improve: Simplify component & inspector.
|
||||
|
||||
|
||||
|
||||
|
||||
## License
|
||||
|
||||
* MIT
|
||||
* © UTJ/UCL
|
||||
|
||||
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
[mob-sakai](https://github.com/mob-sakai)
|
||||
|
||||
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
* GitHub Page : https://github.com/mob-sakai/UIEffect
|
||||
* Issue tracker : https://github.com/mob-sakai/UIEffect/issues
|
||||
@@ -0,0 +1,82 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: UI-Effect-Dissolve
|
||||
m_Shader: {fileID: 4800000, guid: e1b48dc831eb147e9886c049033213bf, type: 3}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _NoiseTex
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 3e04c247fb2604af186173fce0bc62de, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _ColorMask
|
||||
second: 15
|
||||
- first:
|
||||
name: _EdgeWidth
|
||||
second: 0.1
|
||||
- first:
|
||||
name: _InnerSoftClip
|
||||
second: 0.468
|
||||
- first:
|
||||
name: _InnerSoftness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _OuterSoftClip
|
||||
second: 0.776
|
||||
- first:
|
||||
name: _OuterSoftness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _Stencil
|
||||
second: 0
|
||||
- first:
|
||||
name: _StencilComp
|
||||
second: 8
|
||||
- first:
|
||||
name: _StencilOp
|
||||
second: 0
|
||||
- first:
|
||||
name: _StencilReadMask
|
||||
second: 255
|
||||
- first:
|
||||
name: _StencilWriteMask
|
||||
second: 255
|
||||
- first:
|
||||
name: _UseUIAlphaClip
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EdgeInnerColor
|
||||
second: {r: 1, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _EdgeOuterColor
|
||||
second: {r: 1, g: 0.7529412, b: 0, a: 1}
|
||||
- first:
|
||||
name: _InnerEdgeColor
|
||||
second: {r: 1, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _OuterEdgeColor
|
||||
second: {r: 1, g: 0.75, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17b17d6effbe14075a3bbdf1fda1f6e1
|
||||
timeCreated: 1524469054
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,160 @@
|
||||
Shader "UI/Hidden/UI-Effect-Dissolve"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
|
||||
[Header(Dissolve)]
|
||||
_NoiseTex ("Noise Texture (A)", 2D) = "white" {}
|
||||
_EdgeWidth ("Edge width", Range (0.0001, 1)) = 0.05
|
||||
_OuterEdgeColor ("Outer edge color", Color) = (1.0, 0.75, 0.0, 1.0)
|
||||
_OuterSoftness ("Outer softness", Range (0.0001, 1)) = 0.5
|
||||
_InnerEdgeColor ("Inner edge color", Color) = (1.0, 0.0, 0.0, 1.0)
|
||||
_InnerSoftness ("Inner softness", Range (0.0001, 1)) = 0.5
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Default"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
|
||||
float2 uv1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
|
||||
half3 effectFactor : TEXCOORD2;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
sampler2D _MainTex;
|
||||
|
||||
sampler2D _NoiseTex;
|
||||
float _EdgeWidth;
|
||||
float3 _OuterEdgeColor;
|
||||
float _OuterSoftness;
|
||||
float3 _InnerEdgeColor;
|
||||
float _InnerSoftness;
|
||||
|
||||
fixed3 UnpackToVec3(float value)
|
||||
{
|
||||
const int PACKER_STEP = 256;
|
||||
const int PRECISION = PACKER_STEP - 1;
|
||||
fixed3 vec;
|
||||
|
||||
vec.x = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
vec.y = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
vec.z = (value % PACKER_STEP) / PRECISION;
|
||||
return vec;
|
||||
}
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
OUT.worldPosition = IN.vertex;
|
||||
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
|
||||
OUT.texcoord = IN.texcoord;
|
||||
|
||||
OUT.color = IN.color * _Color;
|
||||
|
||||
//xy: Noize uv
|
||||
//z: Dissolve factor
|
||||
OUT.effectFactor = UnpackToVec3(IN.uv1.x);
|
||||
return OUT;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
|
||||
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
|
||||
float cutout = tex2D(_NoiseTex, IN.effectFactor.xy).a;
|
||||
fixed factor = cutout - IN.effectFactor.z;
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (min(color.a - 0.01, factor));
|
||||
#endif
|
||||
|
||||
fixed edgeLerp = step(cutout, color.a) * saturate((_EdgeWidth - factor)*16/_InnerSoftness);
|
||||
fixed3 edgeColor = lerp(_OuterEdgeColor, _InnerEdgeColor, (factor)/_EdgeWidth);
|
||||
|
||||
color.rgb =lerp(color.rgb, edgeColor, edgeLerp);
|
||||
color.a *= saturate((factor)*32/_OuterSoftness);
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1b48dc831eb147e9886c049033213bf
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,144 @@
|
||||
Shader "UI/Hidden/UI-Effect-Shiny"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Default"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
|
||||
float2 uv1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
|
||||
half4 effectFactor : TEXCOORD2;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize;
|
||||
|
||||
fixed4 UnpackToVec4(float value)
|
||||
{
|
||||
const int PACKER_STEP = 64;
|
||||
const int PRECISION = PACKER_STEP - 1;
|
||||
fixed4 color;
|
||||
|
||||
color.r = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
color.g = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
color.b = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
color.a = (value % PACKER_STEP) / PRECISION;
|
||||
return color;
|
||||
}
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
OUT.worldPosition = IN.vertex;
|
||||
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
|
||||
OUT.texcoord = IN.texcoord;
|
||||
|
||||
OUT.color = IN.color * _Color;
|
||||
|
||||
OUT.effectFactor = UnpackToVec4(IN.uv1.x);
|
||||
OUT.effectFactor.y = OUT.effectFactor.y * 2 - 0.5;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
|
||||
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
fixed lowLevel = IN.effectFactor.y - IN.effectFactor.z;
|
||||
fixed highLevel = IN.effectFactor.y + IN.effectFactor.z;
|
||||
fixed shinePower = smoothstep(IN.effectFactor.z, 0, abs(abs(clamp(IN.effectFactor.x, lowLevel, highLevel) - IN.effectFactor.y)));
|
||||
|
||||
color.rgb += color.a * (shinePower / 2) * IN.effectFactor.w;
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20ffe76c2439c403aabdd25bd94bf011
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -6,7 +6,7 @@
|
||||
//################################
|
||||
#define PACKER_STEP 64
|
||||
|
||||
#if UI_TONE_GRAYSCALE | UI_TONE_SEPIA | UI_TONE_NEGA | UI_TONE_PIXEL | UI_TONE_MONO | UI_TONE_CUTOFF
|
||||
#if UI_TONE_GRAYSCALE | UI_TONE_SEPIA | UI_TONE_NEGA | UI_TONE_PIXEL | UI_TONE_MONO | UI_TONE_CUTOFF | UI_TONE_HUE
|
||||
#define UI_TONE
|
||||
#endif
|
||||
|
||||
@@ -40,44 +40,24 @@ fixed4 UnpackToVec4(float value)
|
||||
return color;
|
||||
}
|
||||
|
||||
// Unpack float to low-precision [0-1] half3.
|
||||
// The z value is a little high precision.
|
||||
half3 UnpackToVec3(float value)
|
||||
{
|
||||
const int PRECISION = PACKER_STEP - 1;
|
||||
const int PACKER_STEP_HIGH = PACKER_STEP * PACKER_STEP;
|
||||
const int PRECISION_HIGH = PACKER_STEP_HIGH - 1;
|
||||
half3 color;
|
||||
|
||||
color.x = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
color.y = (value % PACKER_STEP) / PRECISION;
|
||||
value = floor(value / PACKER_STEP);
|
||||
|
||||
color.z = (value % PACKER_STEP_HIGH) / (PRECISION_HIGH - 1);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
//################################
|
||||
// Blur effect
|
||||
//################################
|
||||
// Calculate blur effect.
|
||||
// Sample texture by blured uv, with bias.
|
||||
fixed4 Blur(sampler2D tex, half2 uv, half addUv, half bias)
|
||||
fixed4 Blur(sampler2D tex, half2 uv, half2 addUv, half bias)
|
||||
{
|
||||
return
|
||||
(
|
||||
tex2D(tex, uv + half2(addUv, addUv))
|
||||
+ tex2D(tex, uv + half2(-addUv, addUv))
|
||||
+ tex2D(tex, uv + half2(addUv, -addUv))
|
||||
+ tex2D(tex, uv + half2(-addUv, -addUv))
|
||||
tex2D(tex, uv + half2(addUv.x, addUv.y))
|
||||
+ tex2D(tex, uv + half2(-addUv.x, addUv.y))
|
||||
+ tex2D(tex, uv + half2(addUv.x, -addUv.y))
|
||||
+ tex2D(tex, uv + half2(-addUv.x, -addUv.y))
|
||||
#if UI_BLUR_DETAIL
|
||||
+ tex2D(tex, uv + half2(addUv, 0))
|
||||
+ tex2D(tex, uv + half2(-addUv, 0))
|
||||
+ tex2D(tex, uv + half2(0, addUv))
|
||||
+ tex2D(tex, uv + half2(0, -addUv))
|
||||
+ tex2D(tex, uv + half2(addUv.x, 0))
|
||||
+ tex2D(tex, uv + half2(-addUv.x, 0))
|
||||
+ tex2D(tex, uv + half2(0, addUv.y))
|
||||
+ tex2D(tex, uv + half2(0, -addUv.y))
|
||||
)
|
||||
* bias / 2;
|
||||
#else
|
||||
@@ -90,7 +70,7 @@ fixed4 Blur(sampler2D tex, half2 uv, half addUv, half bias)
|
||||
// * Fast: Sample texture with 3x4 blurring.
|
||||
// * Medium: Sample texture with 6x4 blurring.
|
||||
// * Detail: Sample texture with 6x8 blurring.
|
||||
fixed4 Tex2DBlurring(sampler2D tex, half2 uv, half blur)
|
||||
fixed4 Tex2DBlurring(sampler2D tex, half2 uv, half2 blur)
|
||||
{
|
||||
half4 color = tex2D(tex, uv);
|
||||
|
||||
@@ -116,6 +96,24 @@ fixed4 Tex2DBlurring(sampler2D tex, half2 uv, half blur)
|
||||
//################################
|
||||
// Tone effect
|
||||
//################################
|
||||
fixed3 shift_hue(fixed3 RGB, half VSU, half VSW)
|
||||
{
|
||||
fixed3 RESULT;
|
||||
RESULT.x = (0.299 + 0.701*VSU + 0.168*VSW)*RGB.x
|
||||
+ (0.587 - 0.587*VSU + 0.330*VSW)*RGB.y
|
||||
+ (0.114 - 0.114*VSU - 0.497*VSW)*RGB.z;
|
||||
|
||||
RESULT.y = (0.299 - 0.299*VSU - 0.328*VSW)*RGB.x
|
||||
+ (0.587 + 0.413*VSU + 0.035*VSW)*RGB.y
|
||||
+ (0.114 - 0.114*VSU + 0.292*VSW)*RGB.z;
|
||||
|
||||
RESULT.z = (0.299 - 0.3*VSU + 1.25*VSW)*RGB.x
|
||||
+ (0.587 - 0.588*VSU - 1.05*VSW)*RGB.y
|
||||
+ (0.114 + 0.886*VSU - 0.203*VSW)*RGB.z;
|
||||
|
||||
return (RESULT);
|
||||
}
|
||||
|
||||
// Apply tone effect.
|
||||
fixed4 ApplyToneEffect(fixed4 color, fixed factor)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Shader "UI/Hidden/UIEffect"
|
||||
Shader "UI/Hidden/UI-Effect"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
@@ -50,34 +50,26 @@ Shader "UI/Hidden/UIEffect"
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#if UNITY_VERSION >= 540
|
||||
#pragma target 2.0
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
// vvvv [For UIEffect] vvvv : Define keyword and include.
|
||||
#pragma multi_compile __ UI_TONE_GRAYSCALE UI_TONE_SEPIA UI_TONE_NEGA UI_TONE_PIXEL UI_TONE_MONO UI_TONE_CUTOFF
|
||||
#pragma multi_compile __ UI_COLOR_ADD UI_COLOR_SUB UI_COLOR_SET
|
||||
#pragma multi_compile __ UI_BLUR_FAST UI_BLUR_MEDIUM UI_BLUR_DETAIL
|
||||
#pragma shader_feature __ UI_TONE_GRAYSCALE UI_TONE_SEPIA UI_TONE_NEGA UI_TONE_PIXEL UI_TONE_MONO UI_TONE_CUTOFF UI_TONE_HUE
|
||||
#pragma shader_feature __ UI_COLOR_ADD UI_COLOR_SUB UI_COLOR_SET
|
||||
#pragma shader_feature __ UI_BLUR_FAST UI_BLUR_MEDIUM UI_BLUR_DETAIL
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
#include "UI-Effect.cginc"
|
||||
// ^^^^ [For UIEffect] ^^^^
|
||||
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
#ifdef UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
#endif
|
||||
|
||||
// vvvv [For UIEffect] vvvv
|
||||
float2 uv1 : TEXCOORD1;
|
||||
// ^^^^ [For UIEffect] ^^^^
|
||||
};
|
||||
|
||||
struct v2f
|
||||
@@ -86,79 +78,72 @@ Shader "UI/Hidden/UIEffect"
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
#ifdef UNITY_VERTEX_OUTPUT_STEREO
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
#endif
|
||||
|
||||
// vvvv [For UIEffect] vvvv
|
||||
#if defined (UI_COLOR) // Add color effect factor.
|
||||
#if defined (UI_COLOR)
|
||||
fixed4 colorFactor : COLOR1;
|
||||
#endif
|
||||
|
||||
#if defined (UI_TONE) || defined (UI_BLUR) // Add other effect factor.
|
||||
half3 effectFactor : TEXCOORD2;
|
||||
#if defined (UI_TONE) || defined (UI_BLUR)
|
||||
half4 effectFactor : TEXCOORD2;
|
||||
#endif
|
||||
#if UI_TONE_HUE || UI_TONE_PIXEL
|
||||
half4 extraFactor : TEXCOORD3;
|
||||
#endif
|
||||
// ^^^^ [For UIEffect] ^^^^
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
#ifdef UNITY_SETUP_INSTANCE_ID
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
#endif
|
||||
OUT.worldPosition = IN.vertex;
|
||||
OUT.vertex = mul(UNITY_MATRIX_MVP, OUT.worldPosition);
|
||||
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
|
||||
|
||||
OUT.texcoord = IN.texcoord;
|
||||
|
||||
#if defined (UNITY_HALF_TEXEL_OFFSET) && UNITY_VERSION < 550
|
||||
#if UNITY_VERSION >= 540
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0) * float2(-1,1) * OUT.vertex.w;
|
||||
#else
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0) * float2(-1,1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
OUT.color = IN.color * _Color;
|
||||
|
||||
// vvvv [For UIEffect] vvvv : Calculate effect parameter.
|
||||
#if defined (UI_TONE) || defined (UI_BLUR)
|
||||
OUT.effectFactor = UnpackToVec3(IN.uv1.x);
|
||||
OUT.effectFactor.y = OUT.effectFactor.z / 4;
|
||||
OUT.effectFactor = UnpackToVec4(IN.uv1.x);
|
||||
#endif
|
||||
|
||||
#if UI_TONE_HUE
|
||||
OUT.extraFactor.x = cos(OUT.effectFactor.x*3.14159265359 * 2);
|
||||
OUT.extraFactor.y = sin(OUT.effectFactor.x*3.14159265359 * 2);
|
||||
#elif UI_TONE_PIXEL
|
||||
OUT.extraFactor.xy = max(2, (1-OUT.effectFactor.x*0.98) * _MainTex_TexelSize.zw);
|
||||
#endif
|
||||
|
||||
#if defined (UI_COLOR)
|
||||
OUT.colorFactor = UnpackToVec4(IN.uv1.y);
|
||||
#endif
|
||||
// ^^^^ [For UIEffect] ^^^^
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
#if UI_TONE_PIXEL
|
||||
float pixelRate = max(1,(1-IN.effectFactor.x) * 256);
|
||||
IN.texcoord = round(IN.texcoord * pixelRate) / pixelRate;
|
||||
IN.texcoord = round(IN.texcoord * IN.extraFactor.xy) / IN.extraFactor.xy;
|
||||
#endif
|
||||
|
||||
#if defined (UI_BLUR)
|
||||
half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, IN.effectFactor.y) + _TextureSampleAdd) * IN.color;
|
||||
half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, IN.effectFactor.z * _MainTex_TexelSize.xy * 2) + _TextureSampleAdd) * IN.color;
|
||||
#else
|
||||
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
|
||||
#endif
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
|
||||
#ifdef UI_TONE_CUTOFF
|
||||
clip (color.a - IN.effectFactor.x * 1.001);
|
||||
clip (color.a - 1 + IN.effectFactor.x * 1.001);
|
||||
#elif UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
@@ -166,12 +151,14 @@ Shader "UI/Hidden/UIEffect"
|
||||
#if UI_TONE_MONO
|
||||
color.rgb = IN.color.rgb;
|
||||
color.a = color.a * tex2D(_MainTex, IN.texcoord).a + IN.effectFactor.x * 2 - 1;
|
||||
#elif UI_TONE_HUE
|
||||
color.rgb = shift_hue(color.rgb, IN.extraFactor.x, IN.extraFactor.y);
|
||||
#elif defined (UI_TONE) & !UI_TONE_CUTOFF
|
||||
color = ApplyToneEffect(color, IN.effectFactor.x); // Tone effect.
|
||||
color = ApplyToneEffect(color, IN.effectFactor.x);
|
||||
#endif
|
||||
|
||||
#if defined (UI_COLOR)
|
||||
color = ApplyColorEffect(color, IN.colorFactor); // Color effect.
|
||||
color = ApplyColorEffect(color, IN.colorFactor) * IN.color;
|
||||
#endif
|
||||
|
||||
return color;
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
Shader "UI/Hidden/UI-EffectCapture"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Fog{ Mode off }
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Default"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma shader_feature __ UI_TONE_GRAYSCALE UI_TONE_SEPIA UI_TONE_NEGA UI_TONE_PIXEL UI_TONE_MONO UI_TONE_CUTOFF UI_TONE_HUE
|
||||
#pragma shader_feature __ UI_COLOR_ADD UI_COLOR_SUB UI_COLOR_SET
|
||||
#pragma shader_feature __ UI_BLUR_FAST UI_BLUR_MEDIUM UI_BLUR_DETAIL
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UI-Effect.cginc"
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
||||
#if defined (UI_COLOR)
|
||||
fixed4 colorFactor : COLOR1;
|
||||
#endif
|
||||
|
||||
half4 effectFactor : TEXCOORD2;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_TexelSize;
|
||||
half4 _EffectFactor;
|
||||
fixed4 _ColorFactor;
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
OUT.texcoord = v.texcoord;
|
||||
OUT.effectFactor = _EffectFactor;
|
||||
|
||||
#if UI_TONE_HUE
|
||||
OUT.effectFactor.y = sin(OUT.effectFactor.x*3.14159265359*2);
|
||||
OUT.effectFactor.x = cos(OUT.effectFactor.x*3.14159265359*2);
|
||||
#elif UI_TONE_PIXEL
|
||||
OUT.effectFactor.xy = max(2, (1-OUT.effectFactor.x) * _MainTex_TexelSize.zw);
|
||||
#endif
|
||||
|
||||
#if defined (UI_COLOR)
|
||||
OUT.colorFactor = _ColorFactor;
|
||||
#endif
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
OUT.texcoord.y = lerp(OUT.texcoord.y, 1 - OUT.texcoord.y, OUT.effectFactor.w);
|
||||
#endif
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
#if UI_TONE_PIXEL
|
||||
IN.texcoord = round(IN.texcoord * IN.effectFactor.xy) / IN.effectFactor.xy;
|
||||
#endif
|
||||
|
||||
#if defined (UI_BLUR)
|
||||
half4 color = Tex2DBlurring(_MainTex, IN.texcoord, IN.effectFactor.z * _MainTex_TexelSize.xy * 2);
|
||||
#else
|
||||
half4 color = tex2D(_MainTex, IN.texcoord);
|
||||
#endif
|
||||
|
||||
#if UI_TONE_HUE
|
||||
color.rgb = shift_hue(color.rgb, IN.effectFactor.x, IN.effectFactor.y);
|
||||
#elif defined (UI_TONE)
|
||||
color = ApplyToneEffect(color, IN.effectFactor.x);
|
||||
#endif
|
||||
|
||||
#if defined (UI_COLOR)
|
||||
color = ApplyColorEffect(color, IN.colorFactor);
|
||||
#endif
|
||||
|
||||
color.a = 1;
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
Shader "UI/Hidden/UIEffectCapturedImage"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Fog{ Mode off }
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Default"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#if UNITY_VERSION >= 540
|
||||
#pragma target 2.0
|
||||
#endif
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
// vvvv [For UIEffect] vvvv : Define keyword and include.
|
||||
#pragma multi_compile __ UI_TONE_GRAYSCALE UI_TONE_SEPIA UI_TONE_NEGA UI_TONE_PIXEL
|
||||
#pragma multi_compile __ UI_COLOR_ADD UI_COLOR_SUB UI_COLOR_SET
|
||||
#pragma multi_compile __ UI_BLUR_FAST UI_BLUR_MEDIUM UI_BLUR_DETAIL
|
||||
#include "UI-Effect.cginc"
|
||||
// ^^^^ [For UIEffect] ^^^^
|
||||
|
||||
v2f_img vert(appdata_img v)
|
||||
{
|
||||
v2f_img o;
|
||||
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.uv = half2(v.texcoord.x, 1 - v.texcoord.y);
|
||||
#else
|
||||
o.uv = v.texcoord;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
half2 _EffectFactor;
|
||||
fixed4 _ColorFactor;
|
||||
|
||||
fixed4 frag(v2f_img IN) : SV_Target
|
||||
{
|
||||
#if UI_TONE_PIXEL
|
||||
float pixelRate = max(1,(1 - _EffectFactor.x) * 256);
|
||||
IN.uv = round(IN.uv * pixelRate) / pixelRate;
|
||||
#endif
|
||||
|
||||
#if defined (UI_BLUR)
|
||||
half4 color = Tex2DBlurring(_MainTex, IN.uv, _EffectFactor.y);
|
||||
#else
|
||||
half4 color = tex2D(_MainTex, IN.uv);
|
||||
#endif
|
||||
|
||||
#if defined (UI_TONE)
|
||||
color = ApplyToneEffect(color, _EffectFactor.x); // Tone effect.
|
||||
#endif
|
||||
|
||||
#if defined (UI_COLOR)
|
||||
color = ApplyColorEffect(color, _ColorFactor); // Color effect.
|
||||
#endif
|
||||
|
||||
color.a = 1;
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIDissolve.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
[DisallowMultipleComponent]
|
||||
public class UIDissolve : BaseMeshEffect
|
||||
#if UNITY_EDITOR
|
||||
, ISerializationCallbackReceiver
|
||||
#endif
|
||||
{
|
||||
//################################
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
public const string shaderName = "UI/Hidden/UI-Effect-Dissolve";
|
||||
|
||||
|
||||
//################################
|
||||
// Serialize Members.
|
||||
//################################
|
||||
[SerializeField] [Range(0, 1)] float m_Location = 0;
|
||||
[SerializeField] Material m_EffectMaterial;
|
||||
|
||||
|
||||
//################################
|
||||
// Public Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Graphic affected by the UIEffect.
|
||||
/// </summary>
|
||||
new public Graphic graphic { get { return base.graphic; } }
|
||||
|
||||
/// <summary>
|
||||
/// Location for effect.
|
||||
/// </summary>
|
||||
public float location { get { return m_Location; } set { m_Location = Mathf.Clamp(value, 0, 1); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Effect material.
|
||||
/// </summary>
|
||||
public virtual Material effectMaterial { get { return m_EffectMaterial; } }
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the object becomes enabled and active.
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
graphic.material = effectMaterial;
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the behaviour becomes disabled () or inactive.
|
||||
/// </summary>
|
||||
protected override void OnDisable()
|
||||
{
|
||||
graphic.material = null;
|
||||
base.OnDisable();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
var obj = this;
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
if (Application.isPlaying || !obj || !obj.graphic)
|
||||
return;
|
||||
|
||||
if(!m_EffectMaterial)
|
||||
{
|
||||
m_EffectMaterial = GetMaterial(shaderName);
|
||||
EditorUtility.SetDirty(this);
|
||||
EditorApplication.delayCall +=AssetDatabase.SaveAssets;
|
||||
}
|
||||
if(obj.isActiveAndEnabled && graphic.material != m_EffectMaterial)
|
||||
{
|
||||
graphic.material = m_EffectMaterial;
|
||||
EditorUtility.SetDirty(graphic);
|
||||
EditorApplication.delayCall +=AssetDatabase.SaveAssets;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Material GetMaterial(string shaderName)
|
||||
{
|
||||
string name = Path.GetFileName (shaderName);
|
||||
return AssetDatabase.FindAssets("t:Material " + name)
|
||||
.Select(x => AssetDatabase.GUIDToAssetPath(x))
|
||||
.SelectMany(x => AssetDatabase.LoadAllAssetsAtPath(x))
|
||||
.OfType<Material>()
|
||||
.FirstOrDefault(x => x.name == name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the mesh.
|
||||
/// </summary>
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
|
||||
if (!IsActive())
|
||||
return;
|
||||
|
||||
// rect.
|
||||
Rect rect = graphic.rectTransform.rect;
|
||||
|
||||
// Calculate vertex position.
|
||||
UIVertex vertex = default(UIVertex);
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
|
||||
var x = Mathf.Clamp01 (vertex.position.x / rect.width + 0.5f);
|
||||
var y = Mathf.Clamp01 (vertex.position.y / rect.height + 0.5f);
|
||||
vertex.uv1 = new Vector2 (_PackToFloat (x, y, location), 0);
|
||||
|
||||
vh.SetUIVertex(vertex, i);
|
||||
}
|
||||
}
|
||||
|
||||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Mark the UIEffect as dirty.
|
||||
/// </summary>
|
||||
void _SetDirty()
|
||||
{
|
||||
if(graphic)
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pack 3 low-precision [0-1] floats values to a float.
|
||||
/// Each value [0-1] has 256 steps(8 bits).
|
||||
/// </summary>
|
||||
static float _PackToFloat(float x, float y, float z)
|
||||
{
|
||||
const int PRECISION = (1 << 8) - 1;
|
||||
return (Mathf.FloorToInt(z * PRECISION) << 16)
|
||||
+ (Mathf.FloorToInt(y * PRECISION) << 8)
|
||||
+ Mathf.FloorToInt(x * PRECISION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce76b7a490bd74f34a2f2752641aea24
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+219
-229
@@ -1,8 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIEffect.
|
||||
@@ -10,7 +17,10 @@ namespace UnityEngine.UI
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Graphic))]
|
||||
[DisallowMultipleComponent]
|
||||
public class UIEffect : MonoBehaviour, IMeshModifier
|
||||
public class UIEffect : BaseMeshEffect
|
||||
#if UNITY_EDITOR
|
||||
, ISerializationCallbackReceiver
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// Additional shadow.
|
||||
@@ -21,13 +31,12 @@ namespace UnityEngine.UI
|
||||
/// <summary>
|
||||
/// How far is the blurring shadow from the graphic.
|
||||
/// </summary>
|
||||
[Range(0, 2)]
|
||||
public float shadowBlur = 0.25f;
|
||||
[Range(0, 1)] public float shadowBlur = 0.25f;
|
||||
|
||||
/// <summary>
|
||||
/// Shadow effect mode.
|
||||
/// </summary>
|
||||
public ShadowMode shadowMode = ShadowMode.Shadow;
|
||||
public ShadowStyle shadowMode = ShadowStyle.Shadow;
|
||||
|
||||
/// <summary>
|
||||
/// Color for the shadow effect.
|
||||
@@ -46,8 +55,10 @@ namespace UnityEngine.UI
|
||||
}
|
||||
|
||||
//################################
|
||||
// Constant Members.
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
public const string shaderName = "UI/Hidden/UI-Effect";
|
||||
|
||||
/// <summary>
|
||||
/// Tone effect mode.
|
||||
/// </summary>
|
||||
@@ -60,6 +71,7 @@ namespace UnityEngine.UI
|
||||
Pixel,
|
||||
Mono,
|
||||
Cutoff,
|
||||
Hue,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,14 +86,15 @@ namespace UnityEngine.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shadow effect mode.
|
||||
/// Shadow effect style.
|
||||
/// </summary>
|
||||
public enum ShadowMode
|
||||
public enum ShadowStyle
|
||||
{
|
||||
None = 0,
|
||||
Shadow,
|
||||
Outline,
|
||||
Outline8,
|
||||
Shadow3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,151 +110,126 @@ namespace UnityEngine.UI
|
||||
|
||||
|
||||
//################################
|
||||
// Static Members.
|
||||
// Serialize Members.
|
||||
//################################
|
||||
static readonly List<UIVertex> s_Verts = new List<UIVertex>();
|
||||
static readonly Dictionary<Shader, Material[]> s_SharedMaterials = new Dictionary<Shader, Material[]>();
|
||||
[SerializeField][Range(0, 1)] float m_ToneLevel = 1;
|
||||
[SerializeField][Range(0, 1)] float m_Blur = 0.25f;
|
||||
[SerializeField][Range(0, 1)] float m_ShadowBlur = 0.25f;
|
||||
[SerializeField] ShadowStyle m_ShadowStyle;
|
||||
[SerializeField] ToneMode m_ToneMode;
|
||||
[SerializeField] ColorMode m_ColorMode;
|
||||
[SerializeField] BlurMode m_BlurMode;
|
||||
[SerializeField] Color m_ShadowColor = Color.black;
|
||||
[SerializeField] Vector2 m_EffectDistance = new Vector2(1f, -1f);
|
||||
[SerializeField] bool m_UseGraphicAlpha = true;
|
||||
[SerializeField] Color m_EffectColor = Color.white;
|
||||
[SerializeField] Material m_EffectMaterial;
|
||||
[SerializeField] List<AdditionalShadow> m_AdditionalShadows = new List<AdditionalShadow>();
|
||||
|
||||
|
||||
[SerializeField] bool m_CustomEffect = false;
|
||||
[SerializeField] Vector4 m_CustomFactor = new Vector4();
|
||||
|
||||
//################################
|
||||
// Public or Serialize Members.
|
||||
// Public Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Graphic affected by the UIEffect.
|
||||
/// </summary>
|
||||
new public Graphic graphic { get { return base.graphic; } }
|
||||
|
||||
/// <summary>
|
||||
/// Tone effect level between 0(no effect) and 1(complete effect).
|
||||
/// </summary>
|
||||
public float toneLevel{ get { return m_ToneLevel; } set { m_ToneLevel = Mathf.Clamp(value, 0, 1); SetDirty(); } }
|
||||
|
||||
[SerializeField][Range(0, 1)] float m_ToneLevel = 1;
|
||||
public float toneLevel{ get { return m_ToneLevel; } set { m_ToneLevel = Mathf.Clamp(value, 0, 1); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// How far is the blurring from the graphic.
|
||||
/// </summary>
|
||||
public float blur { get { return m_Blur; } set { m_Blur = Mathf.Clamp(value, 0, 4); SetDirty(); } }
|
||||
|
||||
[SerializeField][Range(0, 2)] float m_Blur = 0.25f;
|
||||
public float blur { get { return m_Blur; } set { m_Blur = Mathf.Clamp(value, 0, 2); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// How far is the blurring shadow from the graphic.
|
||||
/// </summary>
|
||||
public float shadowBlur { get { return m_ShadowBlur; } set { m_ShadowBlur = Mathf.Clamp(value, 0, 4); SetDirty(); } }
|
||||
|
||||
[SerializeField][Range(0, 2)] float m_ShadowBlur = 0.25f;
|
||||
public float shadowBlur { get { return m_ShadowBlur; } set { m_ShadowBlur = Mathf.Clamp(value, 0, 2); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Shadow effect mode.
|
||||
/// </summary>
|
||||
public ShadowMode shadowMode { get { return m_ShadowMode; } set { m_ShadowMode = value; SetDirty(); } }
|
||||
|
||||
[SerializeField] ShadowMode m_ShadowMode;
|
||||
public ShadowStyle shadowStyle { get { return m_ShadowStyle; } set { m_ShadowStyle = value; _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Tone effect mode.
|
||||
/// </summary>
|
||||
public ToneMode toneMode { get { return m_ToneMode; } set { m_ToneMode = value; SetDirty(true); } }
|
||||
|
||||
[SerializeField] ToneMode m_ToneMode;
|
||||
public ToneMode toneMode { get { return m_ToneMode; } }
|
||||
|
||||
/// <summary>
|
||||
/// Color effect mode.
|
||||
/// </summary>
|
||||
public ColorMode colorMode { get { return m_ColorMode; } set { m_ColorMode = value; SetDirty(true); } }
|
||||
|
||||
[SerializeField] ColorMode m_ColorMode;
|
||||
public ColorMode colorMode { get { return m_ColorMode; } }
|
||||
|
||||
/// <summary>
|
||||
/// Blur effect mode.
|
||||
/// </summary>
|
||||
public BlurMode blurMode { get { return m_BlurMode; } set { m_BlurMode = value; SetDirty(true); } }
|
||||
|
||||
[SerializeField] BlurMode m_BlurMode;
|
||||
public BlurMode blurMode { get { return m_BlurMode; } }
|
||||
|
||||
/// <summary>
|
||||
/// Color for the shadow effect.
|
||||
/// </summary>
|
||||
public Color shadowColor { get { return m_ShadowColor; } set { m_ShadowColor = value; SetDirty(); } }
|
||||
|
||||
[SerializeField] Color m_ShadowColor = Color.black;
|
||||
public Color shadowColor { get { return m_ShadowColor; } set { m_ShadowColor = value; _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// How far is the shadow from the graphic.
|
||||
/// </summary>
|
||||
public Vector2 effectDistance { get { return m_EffectDistance; } set { m_EffectDistance = value; SetDirty(); } }
|
||||
|
||||
[SerializeField] Vector2 m_EffectDistance = new Vector2(1f, -1f);
|
||||
public Vector2 effectDistance { get { return m_EffectDistance; } set { m_EffectDistance = value; _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Should the shadow inherit the alpha from the graphic?
|
||||
/// </summary>
|
||||
public bool useGraphicAlpha { get { return m_UseGraphicAlpha; } set { m_UseGraphicAlpha = value; SetDirty(); } }
|
||||
|
||||
[SerializeField] bool m_UseGraphicAlpha = true;
|
||||
public bool useGraphicAlpha { get { return m_UseGraphicAlpha; } set { m_UseGraphicAlpha = value; _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Color for the color effect.
|
||||
/// </summary>
|
||||
[Obsolete("UIEffect.color is obsolete, use UIEffect.effectColor instead. (UnityUpgradable) -> effectColor")]
|
||||
public Color color { get { return m_EffectColor; } set { m_EffectColor = value; SetDirty(); } }
|
||||
public Color effectColor { get { return m_EffectColor; } set { m_EffectColor = value; _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Color for the color effect.
|
||||
/// Effect material.
|
||||
/// </summary>
|
||||
public Color effectColor { get { return m_EffectColor; } set { m_EffectColor = value; SetDirty(); } }
|
||||
|
||||
[SerializeField][FormerlySerializedAs("m_Color")] Color m_EffectColor = Color.white;
|
||||
|
||||
/// <summary>
|
||||
/// Effect shader.
|
||||
/// </summary>
|
||||
public virtual Shader shader { get { if (m_Shader == null) m_Shader = Shader.Find("UI/Hidden/UIEffect"); return m_Shader; } }
|
||||
|
||||
[SerializeField] Shader m_Shader;
|
||||
|
||||
/// <summary>
|
||||
/// Graphic affected by the UIEffect.
|
||||
/// </summary>
|
||||
public Graphic graphic { get { if (m_Graphic == null) m_Graphic = GetComponent<Graphic>(); return m_Graphic; } }
|
||||
|
||||
Graphic m_Graphic;
|
||||
public virtual Material effectMaterial { get { return m_EffectMaterial; } }
|
||||
|
||||
/// <summary>
|
||||
/// Additional Shadows.
|
||||
/// </summary>
|
||||
public List<AdditionalShadow> additionalShadows { get { return m_AdditionalShadows; } }
|
||||
|
||||
[SerializeField] List<AdditionalShadow> m_AdditionalShadows = new List<AdditionalShadow>();
|
||||
|
||||
|
||||
//################################
|
||||
// MonoBehaior Callbacks.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Custom effect factor.
|
||||
/// </summary>
|
||||
public Vector4 customFactor { get { return m_CustomFactor; } set { m_CustomFactor = value; _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the object becomes enabled and active.
|
||||
/// </summary>
|
||||
protected virtual void OnEnable()
|
||||
protected override void OnEnable()
|
||||
{
|
||||
SetDirty(true);
|
||||
graphic.material = effectMaterial;
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the behaviour becomes disabled () or inactive.
|
||||
/// </summary>
|
||||
protected virtual void OnDisable()
|
||||
protected override void OnDisable()
|
||||
{
|
||||
graphic.material = null;
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback for when properties have been changed by animation.
|
||||
/// </summary>
|
||||
protected virtual void OnDidApplyAnimationProperties()
|
||||
{
|
||||
SetDirty(true);
|
||||
base.OnDisable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the mesh.
|
||||
/// </summary>
|
||||
public virtual void ModifyMesh(VertexHelper vh)
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
@@ -257,8 +245,8 @@ namespace UnityEngine.UI
|
||||
{
|
||||
// Pack some effect factors to 1 float.
|
||||
Vector2 factor = new Vector2(
|
||||
PackToFloat(toneLevel, 0, blur / graphic.mainTexture.width * 4),
|
||||
PackToFloat(effectColor.r, effectColor.g, effectColor.b, effectColor.a)
|
||||
m_CustomEffect ? _PackToFloat(m_CustomFactor) : _PackToFloat(toneLevel, 0, blur, 0),
|
||||
_PackToFloat(effectColor.r, effectColor.g, effectColor.b, effectColor.a)
|
||||
);
|
||||
|
||||
for (int i = 0; i < s_Verts.Count; i++)
|
||||
@@ -283,11 +271,11 @@ namespace UnityEngine.UI
|
||||
for (int i = additionalShadows.Count - 1; 0 <= i; i--)
|
||||
{
|
||||
AdditionalShadow shadow = additionalShadows[i];
|
||||
ApplyShadow(s_Verts, ref start, ref end, shadow.shadowMode, toneLevel, shadow.shadowBlur / graphic.mainTexture.width * 4, shadow.effectDistance, shadow.shadowColor, shadow.useGraphicAlpha);
|
||||
_ApplyShadow(s_Verts, ref start, ref end, shadow.shadowMode, toneLevel, shadow.shadowBlur, shadow.effectDistance, shadow.shadowColor, shadow.useGraphicAlpha);
|
||||
}
|
||||
|
||||
// Shadow.
|
||||
ApplyShadow(s_Verts, ref start, ref end, shadowMode, toneLevel, shadowBlur / graphic.mainTexture.width * 4, effectDistance, shadowColor, useGraphicAlpha);
|
||||
_ApplyShadow(s_Verts, ref start, ref end, shadowStyle, toneLevel, shadowBlur, effectDistance, shadowColor, useGraphicAlpha);
|
||||
}
|
||||
|
||||
vh.Clear();
|
||||
@@ -296,59 +284,163 @@ namespace UnityEngine.UI
|
||||
s_Verts.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the mesh.
|
||||
/// </summary>
|
||||
[System.Obsolete("use IMeshModifier.ModifyMesh (VertexHelper verts) instead")]
|
||||
public void ModifyMesh(Mesh mesh)
|
||||
#if UNITY_EDITOR
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only).
|
||||
/// </summary>
|
||||
protected virtual void OnValidate()
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
SetDirty(true);
|
||||
if (m_CustomEffect)
|
||||
return;
|
||||
|
||||
var obj = this;
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
if (Application.isPlaying || !obj)
|
||||
return;
|
||||
|
||||
var mat = (0 == toneMode) && (0 == colorMode) && (0 == blurMode)
|
||||
? null
|
||||
: GetOrGenerateMaterialVariant(Shader.Find(shaderName), toneMode, colorMode, blurMode);
|
||||
|
||||
if(m_EffectMaterial == mat && graphic.material == mat)
|
||||
return;
|
||||
|
||||
graphic.material = m_EffectMaterial = mat;
|
||||
EditorUtility.SetDirty(this);
|
||||
EditorUtility.SetDirty(graphic);
|
||||
EditorApplication.delayCall +=AssetDatabase.SaveAssets;
|
||||
};
|
||||
}
|
||||
|
||||
public static Material GetMaterial(Shader shader, ToneMode tone, ColorMode color, BlurMode blur)
|
||||
{
|
||||
string variantName = GetVariantName(shader, tone, color, blur);
|
||||
return AssetDatabase.FindAssets("t:Material " + Path.GetFileName(shader.name))
|
||||
.Select(x => AssetDatabase.GUIDToAssetPath(x))
|
||||
.SelectMany(x => AssetDatabase.LoadAllAssetsAtPath(x))
|
||||
.OfType<Material>()
|
||||
.FirstOrDefault(x => x.name == variantName);
|
||||
}
|
||||
|
||||
|
||||
public static Material GetOrGenerateMaterialVariant(Shader shader, ToneMode tone, ColorMode color, BlurMode blur)
|
||||
{
|
||||
if (!shader)
|
||||
return null;
|
||||
|
||||
Material mat = GetMaterial(shader, tone, color, blur);
|
||||
|
||||
if (!mat)
|
||||
{
|
||||
Debug.Log("Generate material : " + GetVariantName(shader, tone, color, blur));
|
||||
mat = new Material(shader);
|
||||
|
||||
if (0 < tone)
|
||||
mat.EnableKeyword("UI_TONE_" + tone.ToString().ToUpper());
|
||||
if (0 < color)
|
||||
mat.EnableKeyword("UI_COLOR_" + color.ToString().ToUpper());
|
||||
if (0 < blur)
|
||||
mat.EnableKeyword("UI_BLUR_" + blur.ToString().ToUpper());
|
||||
|
||||
mat.name = GetVariantName(shader, tone, color, blur);
|
||||
mat.hideFlags |= HideFlags.NotEditable;
|
||||
|
||||
#if UIEFFECT_SEPARATE
|
||||
bool isMainAsset = true;
|
||||
string dir = Path.GetDirectoryName(GetDefaultMaterialPath (shader));
|
||||
string materialPath = Path.Combine(Path.Combine(dir, "Separated"), mat.name + ".mat");
|
||||
#else
|
||||
bool isMainAsset = (0 == tone) && (0 == color) && (0 == blur);
|
||||
string materialPath = GetDefaultMaterialPath (shader);
|
||||
#endif
|
||||
if (isMainAsset)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(materialPath));
|
||||
AssetDatabase.CreateAsset(mat, materialPath);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.hideFlags |= HideFlags.HideInHierarchy;
|
||||
AssetDatabase.AddObjectToAsset(mat, materialPath);
|
||||
}
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
public static string GetDefaultMaterialPath(Shader shader)
|
||||
{
|
||||
var name = Path.GetFileName (shader.name);
|
||||
return AssetDatabase.FindAssets("t:Material " + name)
|
||||
.Select(x => AssetDatabase.GUIDToAssetPath(x))
|
||||
.FirstOrDefault(x => Path.GetFileNameWithoutExtension(x) == name)
|
||||
?? ("Assets/UIEffect/Materials/" + name + ".mat");
|
||||
}
|
||||
|
||||
public static string GetVariantName(Shader shader, ToneMode tone, ColorMode color, BlurMode blur)
|
||||
{
|
||||
return
|
||||
#if UIEFFECT_SEPARATE
|
||||
"[Separated] " + Path.GetFileName(shader.name)
|
||||
#else
|
||||
Path.GetFileName(shader.name)
|
||||
#endif
|
||||
+ (0 < tone ? "-" + tone : "")
|
||||
+ (0 < color ? "-" + color : "")
|
||||
+ (0 < blur ? "-" + blur : "");
|
||||
}
|
||||
#endif
|
||||
|
||||
//################################
|
||||
// Internal Method.
|
||||
// Private Members.
|
||||
//################################
|
||||
static readonly List<UIVertex> s_Verts = new List<UIVertex>();
|
||||
|
||||
/// <summary>
|
||||
/// Append shadow vertices.
|
||||
/// * It is similar to Shadow component implementation.
|
||||
/// </summary>
|
||||
static void ApplyShadow(List<UIVertex> verts, ref int start, ref int end, ShadowMode mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha)
|
||||
void _ApplyShadow(List<UIVertex> verts, ref int start, ref int end, ShadowStyle mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha)
|
||||
{
|
||||
if (ShadowMode.None == mode)
|
||||
if (ShadowStyle.None == mode)
|
||||
return;
|
||||
|
||||
var factor = new Vector2(
|
||||
PackToFloat(toneLevel, 0, blur),
|
||||
PackToFloat(color.r, color.g, color.b, 1)
|
||||
_PackToFloat(toneLevel, 0, blur, 0),
|
||||
_PackToFloat(color.r, color.g, color.b, 1)
|
||||
);
|
||||
|
||||
// Append Shadow.
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
|
||||
// Append Shadow3.
|
||||
if (ShadowStyle.Shadow3 == mode)
|
||||
{
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, 0, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
}
|
||||
|
||||
// Append Outline.
|
||||
if (ShadowMode.Outline <= mode)
|
||||
else if (ShadowStyle.Outline == mode)
|
||||
{
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
}
|
||||
|
||||
// Append Outline8.
|
||||
if (ShadowMode.Outline8 <= mode)
|
||||
else if (ShadowStyle.Outline8 == mode)
|
||||
{
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, 0, factor, color, useGraphicAlpha);
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, 0, factor, color, useGraphicAlpha);
|
||||
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, 0, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, -effectDistance.y, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, 0, factor, color, useGraphicAlpha);
|
||||
_ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, effectDistance.y, factor, color, useGraphicAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +448,7 @@ namespace UnityEngine.UI
|
||||
/// Append shadow vertices.
|
||||
/// * It is similar to Shadow component implementation.
|
||||
/// </summary>
|
||||
static void ApplyShadowZeroAlloc(List<UIVertex> verts, ref int start, ref int end, float x, float y, Vector2 factor, Color color, bool useGraphicAlpha)
|
||||
void _ApplyShadowZeroAlloc(List<UIVertex> verts, ref int start, ref int end, float x, float y, Vector2 factor, Color color, bool useGraphicAlpha)
|
||||
{
|
||||
// Check list capacity.
|
||||
var neededCapacity = verts.Count + end - start;
|
||||
@@ -375,6 +467,12 @@ namespace UnityEngine.UI
|
||||
vt.position.Set(v.x + x, v.y + y, v.z);
|
||||
|
||||
Color vertColor = color;
|
||||
|
||||
if(colorMode != ColorMode.None)
|
||||
{
|
||||
vertColor.r = vertColor.g = vertColor.b = 1;
|
||||
}
|
||||
|
||||
vertColor.a = useGraphicAlpha ? color.a * vt.color.a / 255 : color.a;
|
||||
vt.color = vertColor;
|
||||
|
||||
@@ -391,119 +489,17 @@ namespace UnityEngine.UI
|
||||
/// <summary>
|
||||
/// Mark the UIEffect as dirty.
|
||||
/// </summary>
|
||||
/// <param name="isMaterialDirty">If set to true material dirty.</param>
|
||||
void SetDirty(bool isMaterialDirty = false)
|
||||
void _SetDirty()
|
||||
{
|
||||
|
||||
// Update material if needed.
|
||||
if (isMaterialDirty)
|
||||
{
|
||||
graphic.material = GetSharedMaterial(shader, toneMode, colorMode, blurMode);
|
||||
}
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get shared material for identifier.
|
||||
/// </summary>
|
||||
/// <param name="isMaterialDirty">If set to true material dirty.</param>
|
||||
public static Material GetSharedMaterial(Shader shader, ToneMode toneMode, ColorMode colorMode, BlurMode blurMode, bool nullDefault = true)
|
||||
{
|
||||
// Update material if needed.
|
||||
const int TONE_SHIFT = 0;
|
||||
const int TONE_GRAYSCALE = (int)ToneMode.Grayscale;
|
||||
const int TONE_SEPIA = (int)ToneMode.Sepia;
|
||||
const int TONE_NEGA = (int)ToneMode.Nega;
|
||||
const int TONE_PIXEL = (int)ToneMode.Pixel;
|
||||
const int TONE_MONO = (int)ToneMode.Mono;
|
||||
const int TONE_CUTOFF = (int)ToneMode.Cutoff;
|
||||
|
||||
const int COLOR_SHIFT = 3;
|
||||
const int COLOR_SET = (int)ColorMode.Set;
|
||||
const int COLOR_ADD = (int)ColorMode.Add;
|
||||
const int COLOR_SUB = (int)ColorMode.Sub;
|
||||
|
||||
const int BLUR_SHIFT = 5;
|
||||
const int BLUR_FAST = (int)BlurMode.Fast;
|
||||
const int BLUR_MEDIUM = (int)BlurMode.Medium;
|
||||
const int BLUR_DETAIL = (int)BlurMode.Detail;
|
||||
|
||||
// Calculate shader keyword identifier from effect modes.
|
||||
int identifier = ((int)toneMode << TONE_SHIFT)
|
||||
| ((int)colorMode << COLOR_SHIFT)
|
||||
| ((int)blurMode << BLUR_SHIFT);
|
||||
|
||||
// When all effect modes are disable(None), graphic uses default material.
|
||||
if (nullDefault && identifier == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Material[] materials;
|
||||
|
||||
if (!s_SharedMaterials.TryGetValue(shader, out materials))
|
||||
{
|
||||
materials = new Material[128];
|
||||
s_SharedMaterials.Add(shader, materials);
|
||||
}
|
||||
|
||||
// Generate and cache new material by given identifier.
|
||||
if (!materials[identifier])
|
||||
{
|
||||
if (!materials[0])
|
||||
{
|
||||
materials[0] = new Material(shader);
|
||||
materials[0].name += identifier.ToString();
|
||||
}
|
||||
if (identifier == 0)
|
||||
{
|
||||
return materials[0];
|
||||
}
|
||||
|
||||
Material mat = new Material(materials[0]);
|
||||
|
||||
// Bits for tone effect.
|
||||
int toneBits = identifier >> TONE_SHIFT;
|
||||
mat.EnableKeyword(
|
||||
TONE_CUTOFF == (toneBits & TONE_CUTOFF) ? "UI_TONE_CUTOFF"
|
||||
: TONE_MONO == (toneBits & TONE_MONO) ? "UI_TONE_MONO"
|
||||
: TONE_PIXEL == (toneBits & TONE_PIXEL) ? "UI_TONE_PIXEL"
|
||||
: TONE_NEGA == (toneBits & TONE_NEGA) ? "UI_TONE_NEGA"
|
||||
: TONE_SEPIA == (toneBits & TONE_SEPIA) ? "UI_TONE_SEPIA"
|
||||
: TONE_GRAYSCALE == (toneBits & TONE_GRAYSCALE) ? "UI_TONE_GRAYSCALE"
|
||||
: "UI_TONE_OFF"
|
||||
);
|
||||
|
||||
// Bits for color effect.
|
||||
int colorBits = identifier >> COLOR_SHIFT;
|
||||
mat.EnableKeyword(
|
||||
COLOR_SUB == (colorBits & COLOR_SUB) ? "UI_COLOR_SUB"
|
||||
: COLOR_ADD == (colorBits & COLOR_ADD) ? "UI_COLOR_ADD"
|
||||
: COLOR_SET == (colorBits & COLOR_SET) ? "UI_COLOR_SET"
|
||||
: "UI_COLOR_OFF"
|
||||
);
|
||||
|
||||
// Bits for blur effect.
|
||||
int blurBits = identifier >> BLUR_SHIFT;
|
||||
mat.EnableKeyword(
|
||||
BLUR_DETAIL == (blurBits & BLUR_DETAIL) ? "UI_BLUR_DETAIL"
|
||||
: BLUR_MEDIUM == (blurBits & BLUR_MEDIUM) ? "UI_BLUR_MEDIUM"
|
||||
: BLUR_FAST == (blurBits & BLUR_FAST) ? "UI_BLUR_FAST"
|
||||
: "UI_BLUR_OFF"
|
||||
);
|
||||
|
||||
mat.name += identifier.ToString();
|
||||
materials[identifier] = mat;
|
||||
}
|
||||
return materials[identifier];
|
||||
if(graphic)
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pack 4 low-precision [0-1] floats values to a float.
|
||||
/// Each value [0-1] has 64 steps(6 bits).
|
||||
/// </summary>
|
||||
static float PackToFloat(float x, float y, float z, float w)
|
||||
static float _PackToFloat(float x, float y, float z, float w)
|
||||
{
|
||||
const int PRECISION = (1 << 6) - 1;
|
||||
return (Mathf.FloorToInt(w * PRECISION) << 18)
|
||||
@@ -513,18 +509,12 @@ namespace UnityEngine.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pack 3 low-precision [0-1] floats values to a float.
|
||||
/// The x and y values [0-1] have 64 steps(6 bits).
|
||||
/// The z value [0-1] is a little high precision(12 bits).
|
||||
/// Pack 4 low-precision [0-1] floats values to a float.
|
||||
/// Each value [0-1] has 64 steps(6 bits).
|
||||
/// </summary>
|
||||
static float PackToFloat(float x, float y, float z)
|
||||
static float _PackToFloat(Vector4 factor)
|
||||
{
|
||||
const int PRECISION = (1 << 6) - 1;
|
||||
const int PRECISION_HIGH = (1 << 12) - 1;
|
||||
|
||||
return (Mathf.FloorToInt(z * PRECISION_HIGH) << 12)
|
||||
+ (Mathf.FloorToInt(y * PRECISION) << 6)
|
||||
+ Mathf.FloorToInt(x * PRECISION);
|
||||
return _PackToFloat(Mathf.Clamp01(factor.x), Mathf.Clamp01(factor.y), Mathf.Clamp01(factor.z), Mathf.Clamp01(factor.w));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,30 @@ using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
using BlurMode = UIEffect.BlurMode;
|
||||
using ColorMode = UIEffect.ColorMode;
|
||||
using ToneMode = UIEffect.ToneMode;
|
||||
|
||||
/// <summary>
|
||||
/// UIEffectCapturedImage
|
||||
/// </summary>
|
||||
public class UIEffectCapturedImage : RawImage
|
||||
#if UNITY_EDITOR
|
||||
, ISerializationCallbackReceiver
|
||||
#endif
|
||||
{
|
||||
|
||||
//################################
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
public const string shaderName = "UI/Hidden/UI-EffectCapture";
|
||||
|
||||
/// <summary>
|
||||
/// Desampling rate.
|
||||
/// </summary>
|
||||
@@ -22,139 +39,184 @@ namespace UnityEngine.UI
|
||||
x8 = 8,
|
||||
}
|
||||
|
||||
|
||||
//################################
|
||||
// Serialize Members.
|
||||
//################################
|
||||
[SerializeField][Range(0, 1)] float m_ToneLevel = 1;
|
||||
[SerializeField][Range(0, 1)] float m_Blur = 0;
|
||||
[SerializeField] ToneMode m_ToneMode;
|
||||
[SerializeField] ColorMode m_ColorMode;
|
||||
[SerializeField] BlurMode m_BlurMode;
|
||||
[SerializeField] Color m_EffectColor = Color.white;
|
||||
[SerializeField] DesamplingRate m_DesamplingRate;
|
||||
[SerializeField] DesamplingRate m_ReductionRate;
|
||||
[SerializeField] FilterMode m_FilterMode = FilterMode.Bilinear;
|
||||
[SerializeField] Material m_EffectMaterial;
|
||||
[SerializeField][Range(1, 8)] int m_Iterations = 1;
|
||||
[SerializeField] bool m_KeepCanvasSize = true;
|
||||
|
||||
|
||||
//################################
|
||||
// Public Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Tone effect level between 0(no effect) and 1(complete effect).
|
||||
/// </summary>
|
||||
public float toneLevel { get { return m_ToneLevel; } set { m_ToneLevel = Mathf.Clamp (value, 0, 1); } }
|
||||
|
||||
[SerializeField]
|
||||
[Range (0, 1)]
|
||||
float m_ToneLevel = 1;
|
||||
public float toneLevel { get { return m_ToneLevel; } set { m_ToneLevel = Mathf.Clamp(value, 0, 1); } }
|
||||
|
||||
/// <summary>
|
||||
/// How far is the blurring from the graphic.
|
||||
/// </summary>
|
||||
public float blur { get { return m_Blur; } set { m_Blur = Mathf.Clamp (value, 0, 4); } }
|
||||
|
||||
[SerializeField]
|
||||
[Range (0, 4)]
|
||||
float m_Blur = 0;
|
||||
public float blur { get { return m_Blur; } set { m_Blur = Mathf.Clamp(value, 0, 4); } }
|
||||
|
||||
/// <summary>
|
||||
/// Tone effect mode.
|
||||
/// </summary>
|
||||
public UIEffect.ToneMode toneMode { get { return m_ToneMode; } set { m_ToneMode = value; } }
|
||||
|
||||
[SerializeField]
|
||||
UIEffect.ToneMode m_ToneMode;
|
||||
public ToneMode toneMode { get { return m_ToneMode; } set { m_ToneMode = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Color effect mode.
|
||||
/// </summary>
|
||||
public UIEffect.ColorMode colorMode { get { return m_ColorMode; } set { m_ColorMode = value; } }
|
||||
|
||||
[SerializeField]
|
||||
UIEffect.ColorMode m_ColorMode;
|
||||
public ColorMode colorMode { get { return m_ColorMode; } set { m_ColorMode = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Blur effect mode.
|
||||
/// </summary>
|
||||
public UIEffect.BlurMode blurMode { get { return m_BlurMode; } set { m_BlurMode = value; } }
|
||||
|
||||
[SerializeField]
|
||||
UIEffect.BlurMode m_BlurMode;
|
||||
public BlurMode blurMode { get { return m_BlurMode; } set { m_BlurMode = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Color for the color effect.
|
||||
/// </summary>
|
||||
public Color effectColor { get { return m_EffectColor; } set { m_EffectColor = value; } }
|
||||
|
||||
[SerializeField]
|
||||
Color m_EffectColor = Color.white;
|
||||
|
||||
/// <summary>
|
||||
/// Effect shader.
|
||||
/// Effect material.
|
||||
/// </summary>
|
||||
public virtual Shader shader {
|
||||
get {
|
||||
if (m_Shader == null)
|
||||
m_Shader = Shader.Find ("UI/Hidden/UIEffectCapturedImage");
|
||||
return m_Shader;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
Shader m_Shader;
|
||||
public virtual Material effectMaterial { get { return m_EffectMaterial; } }
|
||||
|
||||
/// <summary>
|
||||
/// Desampling rate of the generated RenderTexture.
|
||||
/// </summary>
|
||||
public DesamplingRate desamplingRate { get { return m_DesamplingRate; } set { m_DesamplingRate = value; } }
|
||||
|
||||
[SerializeField]
|
||||
DesamplingRate m_DesamplingRate;
|
||||
|
||||
/// <summary>
|
||||
/// Desampling rate of reduction buffer to apply effect.
|
||||
/// </summary>
|
||||
public DesamplingRate reductionRate { get { return m_ReductionRate; } set { m_ReductionRate = value; } }
|
||||
|
||||
[SerializeField]
|
||||
DesamplingRate m_ReductionRate;
|
||||
|
||||
/// <summary>
|
||||
/// FilterMode for capture.
|
||||
/// </summary>
|
||||
public FilterMode filterMode { get { return m_FilterMode; } set { m_FilterMode = value; } }
|
||||
|
||||
[SerializeField]
|
||||
FilterMode m_FilterMode = FilterMode.Bilinear;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Captured texture.
|
||||
/// </summary>
|
||||
public RenderTexture capturedTexture { get { return _rt; } }
|
||||
|
||||
/// <summary>
|
||||
/// Iterations.
|
||||
/// </summary>
|
||||
public int iterations { get { return m_Iterations; } set { m_Iterations = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Fits graphic size to the root canvas.
|
||||
/// </summary>
|
||||
public bool keepCanvasSize { get { return m_KeepCanvasSize; } set { m_KeepCanvasSize = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the MonoBehaviour will be destroyed.
|
||||
/// </summary>
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
_Release(true);
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback function when a UI element needs to generate vertices.
|
||||
/// </summary>
|
||||
protected override void OnPopulateMesh(VertexHelper vh)
|
||||
{
|
||||
// When not displaying, clear vertex.
|
||||
if (texture == null || effectColor.a < 1 / 255f || canvasRenderer.GetAlpha() < 1 / 255f)
|
||||
vh.Clear();
|
||||
else
|
||||
base.OnPopulateMesh(vh);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
var obj = this;
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
if (Application.isPlaying || !obj)
|
||||
return;
|
||||
|
||||
var mat = (0 == toneMode) && (0 == colorMode) && (0 == blurMode)
|
||||
? null
|
||||
: UIEffect.GetOrGenerateMaterialVariant(Shader.Find(shaderName), toneMode, colorMode, blurMode);
|
||||
|
||||
if (m_EffectMaterial == mat)
|
||||
return;
|
||||
|
||||
m_EffectMaterial = mat;
|
||||
EditorUtility.SetDirty(this);
|
||||
EditorApplication.delayCall += AssetDatabase.SaveAssets;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the desampling.
|
||||
/// </summary>
|
||||
public void GetDesamplingSize (DesamplingRate rate, out int w, out int h)
|
||||
public void GetDesamplingSize(DesamplingRate rate, out int w, out int h)
|
||||
{
|
||||
var cam = canvas.worldCamera ?? Camera.main;
|
||||
h = cam.pixelHeight;
|
||||
w = cam.pixelWidth;
|
||||
if (rate != DesamplingRate.None) {
|
||||
h = Mathf.ClosestPowerOfTwo (h / (int)rate);
|
||||
w = Mathf.ClosestPowerOfTwo (w / (int)rate);
|
||||
if (rate != DesamplingRate.None)
|
||||
{
|
||||
h = Mathf.ClosestPowerOfTwo(h / (int)rate);
|
||||
w = Mathf.ClosestPowerOfTwo(w / (int)rate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Capture rendering result.
|
||||
/// </summary>
|
||||
public void Capture ()
|
||||
public void Capture()
|
||||
{
|
||||
// Camera for command buffer.
|
||||
_camera = canvas.worldCamera ?? Camera.main;
|
||||
|
||||
// Cache id for RT.
|
||||
if (s_CopyId == 0) {
|
||||
s_CopyId = Shader.PropertyToID ("_ScreenCopy");
|
||||
s_EffectId = Shader.PropertyToID ("_Effect");
|
||||
if (s_CopyId == 0)
|
||||
{
|
||||
s_CopyId = Shader.PropertyToID("_UIEffectCapturedImage_ScreenCopyId");
|
||||
s_EffectId1 = Shader.PropertyToID("_UIEffectCapturedImage_EffectId1");
|
||||
s_EffectId2 = Shader.PropertyToID("_UIEffectCapturedImage_EffectId2");
|
||||
}
|
||||
|
||||
// If size of generated result RT has changed, relese it.
|
||||
int w, h;
|
||||
GetDesamplingSize (m_DesamplingRate, out w, out h);
|
||||
if (_rt && (_rt.width != w || _rt.height != h)) {
|
||||
GetDesamplingSize(m_DesamplingRate, out w, out h);
|
||||
if (_rt && (_rt.width != w || _rt.height != h))
|
||||
{
|
||||
_rtToRelease = _rt;
|
||||
_rt = null;
|
||||
}
|
||||
|
||||
// Generate result RT.
|
||||
if (_rt == null) {
|
||||
_rt = new RenderTexture (w, h, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
|
||||
if (_rt == null)
|
||||
{
|
||||
_rt = new RenderTexture(w, h, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
|
||||
_rt.filterMode = m_FilterMode;
|
||||
_rt.useMipMap = false;
|
||||
_rt.wrapMode = TextureWrapMode.Clamp;
|
||||
@@ -162,77 +224,89 @@ namespace UnityEngine.UI
|
||||
}
|
||||
|
||||
// Create command buffer.
|
||||
if (_buffer == null) {
|
||||
var rtId = new RenderTargetIdentifier (_rt);
|
||||
if (_buffer == null)
|
||||
{
|
||||
var rtId = new RenderTargetIdentifier(_rt);
|
||||
|
||||
// Material for effect.
|
||||
var mat = UIEffect.GetSharedMaterial (shader, toneMode, colorMode, blurMode, false);
|
||||
Material mat = effectMaterial;
|
||||
|
||||
_buffer = new CommandBuffer ();
|
||||
_buffer.name = mat.name;
|
||||
_rt.name = mat.name;
|
||||
_buffer = new CommandBuffer();
|
||||
_buffer.name =
|
||||
_rt.name =
|
||||
mat ? mat.name : "noeffect";
|
||||
|
||||
// Copy to temporary RT.
|
||||
_buffer.GetTemporaryRT (s_CopyId, -1, -1, 0, FilterMode.Bilinear);
|
||||
_buffer.Blit (BuiltinRenderTextureType.CurrentActive, s_CopyId);
|
||||
_buffer.GetTemporaryRT(s_CopyId, -1, -1, 0, m_FilterMode);
|
||||
_buffer.Blit(BuiltinRenderTextureType.CurrentActive, s_CopyId);
|
||||
|
||||
// Set properties.
|
||||
_buffer.SetGlobalVector ("_EffectFactor", new Vector4 (toneLevel, blur / w));
|
||||
_buffer.SetGlobalVector ("_ColorFactor", new Vector4 (effectColor.r, effectColor.g, effectColor.b, effectColor.a));
|
||||
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 1));
|
||||
_buffer.SetGlobalVector("_ColorFactor", new Vector4(effectColor.r, effectColor.g, effectColor.b, effectColor.a));
|
||||
|
||||
// Blit with reduction buffer.
|
||||
if (m_DesamplingRate < m_ReductionRate) {
|
||||
GetDesamplingSize (m_ReductionRate, out w, out h);
|
||||
_buffer.GetTemporaryRT (s_EffectId, w, h, 0, FilterMode.Bilinear);
|
||||
_buffer.Blit (s_CopyId, s_EffectId, mat);
|
||||
_buffer.ReleaseTemporaryRT (s_CopyId);
|
||||
_buffer.Blit (s_EffectId, rtId);
|
||||
_buffer.ReleaseTemporaryRT (s_EffectId);
|
||||
// Blit without effect.
|
||||
if (!mat)
|
||||
{
|
||||
_buffer.Blit(s_CopyId, rtId);
|
||||
_buffer.ReleaseTemporaryRT(s_CopyId);
|
||||
}
|
||||
// Blit without reduction buffer.
|
||||
else {
|
||||
_buffer.Blit (s_CopyId, rtId, mat);
|
||||
_buffer.ReleaseTemporaryRT (s_CopyId);
|
||||
// Blit with effect.
|
||||
else
|
||||
{
|
||||
GetDesamplingSize(m_ReductionRate, out w, out h);
|
||||
_buffer.GetTemporaryRT(s_EffectId1, w, h, 0, m_FilterMode);
|
||||
_buffer.Blit(s_CopyId, s_EffectId1, mat); // Apply effect (copied screen -> effect1).
|
||||
_buffer.ReleaseTemporaryRT(s_CopyId);
|
||||
|
||||
// Iterate the operation.
|
||||
if(1 < m_Iterations)
|
||||
{
|
||||
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0));
|
||||
_buffer.GetTemporaryRT(s_EffectId2, w, h, 0, m_FilterMode);
|
||||
for (int i = 1; i < m_Iterations; i++)
|
||||
{
|
||||
// Apply effect (effect1 -> effect2, or effect2 -> effect1).
|
||||
_buffer.Blit(i % 2 == 0 ? s_EffectId2 : s_EffectId1, i % 2 == 0 ? s_EffectId1 : s_EffectId2, mat);
|
||||
}
|
||||
}
|
||||
|
||||
_buffer.Blit(m_Iterations % 2 == 0 ? s_EffectId2 : s_EffectId1, rtId);
|
||||
_buffer.ReleaseTemporaryRT(s_EffectId1);
|
||||
if (1 < m_Iterations)
|
||||
{
|
||||
_buffer.ReleaseTemporaryRT(s_EffectId2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add command buffer to camera.
|
||||
_camera.AddCommandBuffer (kCameraEvent, _buffer);
|
||||
_camera.AddCommandBuffer(kCameraEvent, _buffer);
|
||||
|
||||
// StartCoroutine by CanvasScaler.
|
||||
#if UNITY_5_4_OR_NEWER
|
||||
canvas.rootCanvas.GetComponent<CanvasScaler>().StartCoroutine(_CoUpdateTextureOnNextFrame());
|
||||
#else
|
||||
canvas.GetComponentInParent<CanvasScaler> ().StartCoroutine (_CoUpdateTextureOnNextFrame ());
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Release ()
|
||||
{
|
||||
_Release (true);
|
||||
var rootCanvas = canvas.rootCanvas;
|
||||
var scaler = rootCanvas.GetComponent<CanvasScaler>();
|
||||
scaler.StartCoroutine(_CoUpdateTextureOnNextFrame());
|
||||
if (m_KeepCanvasSize)
|
||||
{
|
||||
var size = (rootCanvas.transform as RectTransform).rect.size;
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size.x);
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size.y);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the MonoBehaviour will be destroyed.
|
||||
/// Release captured image.
|
||||
/// </summary>
|
||||
protected override void OnDestroy ()
|
||||
public void Release()
|
||||
{
|
||||
_Release (true);
|
||||
base.OnDestroy ();
|
||||
_Release(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback function when a UI element needs to generate vertices.
|
||||
/// </summary>
|
||||
protected override void OnPopulateMesh (VertexHelper vh)
|
||||
{
|
||||
// 非表示状態ならば、vhをクリアし、オーバードローを抑えます.
|
||||
if (texture == null || effectColor.a < 1 / 255f || canvasRenderer.GetAlpha () < 1 / 255f)
|
||||
vh.Clear ();
|
||||
else
|
||||
base.OnPopulateMesh (vh);
|
||||
}
|
||||
|
||||
|
||||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
const CameraEvent kCameraEvent = CameraEvent.AfterEverything;
|
||||
Camera _camera;
|
||||
RenderTexture _rt;
|
||||
@@ -240,31 +314,37 @@ namespace UnityEngine.UI
|
||||
CommandBuffer _buffer;
|
||||
|
||||
static int s_CopyId;
|
||||
static int s_EffectId;
|
||||
static int s_EffectId1;
|
||||
static int s_EffectId2;
|
||||
|
||||
/// <summary>
|
||||
/// Release genarated objects.
|
||||
/// </summary>
|
||||
void _Release (bool releaseRT)
|
||||
/// <param name="releaseRT">If set to <c>true</c> release cached RenderTexture.</param>
|
||||
void _Release(bool releaseRT)
|
||||
{
|
||||
if (releaseRT) {
|
||||
if (releaseRT)
|
||||
{
|
||||
texture = null;
|
||||
|
||||
if (_rt != null) {
|
||||
_rt.Release ();
|
||||
if (_rt != null)
|
||||
{
|
||||
_rt.Release();
|
||||
_rt = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (_buffer != null) {
|
||||
if (_buffer != null)
|
||||
{
|
||||
if (_camera != null)
|
||||
_camera.RemoveCommandBuffer (kCameraEvent, _buffer);
|
||||
_buffer.Release ();
|
||||
_camera.RemoveCommandBuffer(kCameraEvent, _buffer);
|
||||
_buffer.Release();
|
||||
_buffer = null;
|
||||
}
|
||||
|
||||
if (_rtToRelease) {
|
||||
_rtToRelease.Release ();
|
||||
if (_rtToRelease)
|
||||
{
|
||||
_rtToRelease.Release();
|
||||
_rtToRelease = null;
|
||||
}
|
||||
}
|
||||
@@ -272,11 +352,11 @@ namespace UnityEngine.UI
|
||||
/// <summary>
|
||||
/// Set texture on next frame.
|
||||
/// </summary>
|
||||
IEnumerator _CoUpdateTextureOnNextFrame ()
|
||||
IEnumerator _CoUpdateTextureOnNextFrame()
|
||||
{
|
||||
yield return new WaitForEndOfFrame ();
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
_Release (false);
|
||||
_Release(false);
|
||||
texture = _rt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
|
||||
[RequireComponent(typeof(Graphic))]
|
||||
[DisallowMultipleComponent]
|
||||
public class UIFlip : BaseMeshEffect
|
||||
{
|
||||
//################################
|
||||
// Serialize Members.
|
||||
//################################
|
||||
[SerializeField] private bool m_Horizontal = false;
|
||||
[SerializeField] private bool m_Veritical = false;
|
||||
|
||||
//################################
|
||||
// Public Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Coffee.UIExtensions.UIFlip"/> should be flipped horizontally.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if be flipped horizontally; otherwise, <c>false</c>.</value>
|
||||
public bool horizontal { get { return this.m_Horizontal; } set { this.m_Horizontal = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Coffee.UIExtensions.UIFlip"/> should be flipped vertically.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if be flipped horizontally; otherwise, <c>false</c>.</value>
|
||||
public bool vertical { get { return this.m_Veritical; } set { this.m_Veritical = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Call used to modify mesh.
|
||||
/// </summary>
|
||||
/// <param name="vh">VertexHelper.</param>
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
RectTransform rt = graphic.rectTransform;
|
||||
UIVertex vt = default(UIVertex);
|
||||
Vector3 pos;
|
||||
Vector2 center = rt.rect.center;
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vt, i);
|
||||
pos = vt.position;
|
||||
vt.position = new Vector3(
|
||||
m_Horizontal ? -pos.x : pos.x,
|
||||
m_Veritical ? -pos.y : pos.y
|
||||
// m_Horizontal ? (pos.x + (center.x - pos.x) * 2) : pos.x,
|
||||
// m_Veritical ? (pos.y + (center.y - pos.y) * 2) : pos.y
|
||||
);
|
||||
vh.SetUIVertex(vt, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bb4e59514e90489d985e9a17c838085
|
||||
timeCreated: 1525607243
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Executable
+245
@@ -0,0 +1,245 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIGradient.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
public class UIGradient : BaseMeshEffect
|
||||
{
|
||||
//################################
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
|
||||
/// <summary>
|
||||
/// Gradient direction.
|
||||
/// </summary>
|
||||
public enum Direction
|
||||
{
|
||||
Horizontal,
|
||||
Vertical,
|
||||
Angle,
|
||||
Diagonal,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gradient space for Text.
|
||||
/// </summary>
|
||||
public enum GradientStyle
|
||||
{
|
||||
Rect,
|
||||
Fit,
|
||||
Split,
|
||||
}
|
||||
|
||||
|
||||
//################################
|
||||
// Serialize Members.
|
||||
//################################
|
||||
[SerializeField] Direction m_Direction;
|
||||
[SerializeField] Color m_Color1 = Color.white;
|
||||
[SerializeField] Color m_Color2 = Color.white;
|
||||
[SerializeField] Color m_Color3 = Color.white;
|
||||
[SerializeField] Color m_Color4 = Color.white;
|
||||
[SerializeField][Range(-180, 180)] float m_Rotation;
|
||||
[SerializeField][Range(-1, 1)] float m_Offset1;
|
||||
[SerializeField][Range(-1, 1)] float m_Offset2;
|
||||
[SerializeField] GradientStyle m_GradientStyle;
|
||||
[SerializeField] ColorSpace m_ColorSpace = ColorSpace.Uninitialized;
|
||||
[SerializeField] bool m_IgnoreAspectRatio = true;
|
||||
|
||||
|
||||
//################################
|
||||
// Public Members.
|
||||
//################################
|
||||
new public Graphic graphic { get { return base.graphic; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gradient Direction.
|
||||
/// </summary>
|
||||
public Direction direction { get { return m_Direction; } set { if (m_Direction != value) { m_Direction = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Color1: Top or Left.
|
||||
/// </summary>
|
||||
public Color color1 { get { return m_Color1; } set { if (m_Color1 != value) { m_Color1 = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Color2: Bottom or Right.
|
||||
/// </summary>
|
||||
public Color color2 { get { return m_Color2; } set { if (m_Color2 != value) { m_Color2 = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Color3: For diagonal.
|
||||
/// </summary>
|
||||
public Color color3 { get { return m_Color3; } set { if (m_Color3 != value) { m_Color3 = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Color4: For diagonal.
|
||||
/// </summary>
|
||||
public Color color4 { get { return m_Color4; } set { if (m_Color4 != value) { m_Color4 = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Gradient rotation.
|
||||
/// </summary>
|
||||
public float rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Direction == Direction.Horizontal ? -90
|
||||
: m_Direction == Direction.Vertical ? 0
|
||||
: m_Rotation;
|
||||
}
|
||||
set { if (!Mathf.Approximately(m_Rotation, value)) { m_Rotation = value; graphic.SetVerticesDirty(); } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gradient offset for Horizontal, Vertical or Angle.
|
||||
/// </summary>
|
||||
public float offset { get { return m_Offset1; } set { if (m_Offset1 != value) { m_Offset1 = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Gradient offset for Diagonal.
|
||||
/// </summary>
|
||||
public Vector2 offset2 { get { return new Vector2(m_Offset2, m_Offset1); } set { if (m_Offset1 != value.y || m_Offset2 != value.x) { m_Offset1 = value.y; m_Offset2 = value.x; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Gradient style for Text.
|
||||
/// </summary>
|
||||
public GradientStyle gradientStyle { get { return m_GradientStyle; } set { if (m_GradientStyle != value) { m_GradientStyle = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Color space to correct color.
|
||||
/// </summary>
|
||||
public ColorSpace colorSpace { get { return m_ColorSpace; } set { if (m_ColorSpace != value) { m_ColorSpace = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
/// <summary>
|
||||
/// Ignore aspect ratio.
|
||||
/// </summary>
|
||||
public bool ignoreAspectRatio { get { return m_IgnoreAspectRatio; } set { if (m_IgnoreAspectRatio != value) { m_IgnoreAspectRatio = value; graphic.SetVerticesDirty(); } } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Call used to modify mesh.
|
||||
/// </summary>
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
if (!IsActive())
|
||||
return;
|
||||
|
||||
// Gradient space.
|
||||
Rect rect = default(Rect);
|
||||
UIVertex vertex = default(UIVertex);
|
||||
if (!(graphic is Text) || m_GradientStyle == GradientStyle.Rect)
|
||||
{
|
||||
// RectTransform.
|
||||
rect = graphic.rectTransform.rect;
|
||||
}
|
||||
else if (m_GradientStyle == GradientStyle.Split)
|
||||
{
|
||||
// Each characters.
|
||||
rect.Set(0, 0, 1, 1);
|
||||
}
|
||||
else if (m_GradientStyle == GradientStyle.Fit)
|
||||
{
|
||||
// Fit to contents.
|
||||
rect.xMin = rect.yMin = float.MaxValue;
|
||||
rect.xMax = rect.yMax = float.MinValue;
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
rect.xMin = Mathf.Min(rect.xMin, vertex.position.x);
|
||||
rect.yMin = Mathf.Min(rect.yMin, vertex.position.y);
|
||||
rect.xMax = Mathf.Max(rect.xMax, vertex.position.x);
|
||||
rect.yMax = Mathf.Max(rect.yMax, vertex.position.y);
|
||||
}
|
||||
}
|
||||
|
||||
// Gradient rotation.
|
||||
float rad = rotation * Mathf.Deg2Rad;
|
||||
Vector2 dir = new Vector2(Mathf.Cos(rad), Mathf.Sin(rad));
|
||||
if (!m_IgnoreAspectRatio && Direction.Angle <= m_Direction)
|
||||
{
|
||||
dir.x *= rect.height / rect.width;
|
||||
dir = dir.normalized;
|
||||
}
|
||||
|
||||
// Calculate vertex color.
|
||||
Color color;
|
||||
Vector2 nomalizedPos;
|
||||
Matrix2x3 localMatrix = new Matrix2x3(rect, dir.x, dir.y); // Get local matrix.
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
|
||||
// Normalize vertex position by local matrix.
|
||||
if (m_GradientStyle == GradientStyle.Split)
|
||||
{
|
||||
// Each characters.
|
||||
nomalizedPos = localMatrix * s_SplitedCharacterPosition[i % 4] + offset2;
|
||||
}
|
||||
else
|
||||
{
|
||||
nomalizedPos = localMatrix * vertex.position + offset2;
|
||||
}
|
||||
|
||||
// Interpolate vertex color.
|
||||
if (direction == Direction.Diagonal)
|
||||
{
|
||||
color = Color.LerpUnclamped(
|
||||
Color.LerpUnclamped(m_Color1, m_Color2, nomalizedPos.x),
|
||||
Color.LerpUnclamped(m_Color3, m_Color4, nomalizedPos.x),
|
||||
nomalizedPos.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.LerpUnclamped(m_Color2, m_Color1, nomalizedPos.y);
|
||||
}
|
||||
|
||||
// Correct color.
|
||||
vertex.color *= (m_ColorSpace == ColorSpace.Gamma) ? color.gamma
|
||||
: (m_ColorSpace == ColorSpace.Linear) ? color.linear
|
||||
: color;
|
||||
|
||||
vh.SetUIVertex(vertex, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
static readonly Vector2[] s_SplitedCharacterPosition = { Vector2.up, Vector2.one, Vector2.right, Vector2.zero };
|
||||
|
||||
/// <summary>
|
||||
/// Matrix2x3.
|
||||
/// </summary>
|
||||
struct Matrix2x3
|
||||
{
|
||||
public float m00, m01, m02, m10, m11, m12;
|
||||
|
||||
public Matrix2x3(Rect rect, float cos, float sin)
|
||||
{
|
||||
const float center = 0.5f;
|
||||
float dx = -rect.xMin / rect.width - center;
|
||||
float dy = -rect.yMin / rect.height - center;
|
||||
m00 = cos / rect.width;
|
||||
m01 = -sin / rect.height;
|
||||
m02 = dx * cos - dy * sin + center;
|
||||
m10 = sin / rect.width;
|
||||
m11 = cos / rect.height;
|
||||
m12 = dx * sin + dy * cos + center;
|
||||
}
|
||||
|
||||
public static Vector2 operator*(Matrix2x3 m, Vector2 v)
|
||||
{
|
||||
return new Vector2(
|
||||
(m.m00 * v.x) + (m.m01 * v.y) + m.m02,
|
||||
(m.m10 * v.x) + (m.m11 * v.y) + m.m12
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fb48d82dc0e94a2b9246d17d04f8748
|
||||
timeCreated: 1515744842
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,227 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// UIEffect.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
[DisallowMultipleComponent]
|
||||
public class UIShiny : BaseMeshEffect
|
||||
#if UNITY_EDITOR
|
||||
, ISerializationCallbackReceiver
|
||||
#endif
|
||||
{
|
||||
//################################
|
||||
// Constant or Static Members.
|
||||
//################################
|
||||
public const string shaderName = "UI/Hidden/UI-Effect-Shiny";
|
||||
|
||||
|
||||
//################################
|
||||
// Serialize Members.
|
||||
//################################
|
||||
[SerializeField] [Range(0, 1)] float m_Location = 0;
|
||||
[SerializeField] [Range(0, 1)] float m_Width = 0.25f;
|
||||
[SerializeField] [Range(0, 1)] float m_Alpha = 1f;
|
||||
[SerializeField] [Range(-180, 180)] float m_Rotation;
|
||||
[SerializeField] Material m_EffectMaterial;
|
||||
|
||||
|
||||
//################################
|
||||
// Public Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Graphic affected by the UIEffect.
|
||||
/// </summary>
|
||||
new public Graphic graphic { get { return base.graphic; } }
|
||||
|
||||
/// <summary>
|
||||
/// Location for shiny effect.
|
||||
/// </summary>
|
||||
public float location { get { return m_Location; } set { m_Location = Mathf.Clamp(value, 0, 1); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Width for shiny effect.
|
||||
/// </summary>
|
||||
public float width { get { return m_Width; } set { m_Width = Mathf.Clamp(value, 0, 2); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Alpha for shiny effect.
|
||||
/// </summary>
|
||||
public float alpha { get { return m_Alpha; } set { m_Alpha = Mathf.Clamp(value, 0, 1); _SetDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Rotation for shiny effect.
|
||||
/// </summary>
|
||||
public float rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Rotation;
|
||||
}
|
||||
set { if (!Mathf.Approximately(m_Rotation, value)) { m_Rotation = value; _SetDirty(); } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effect material.
|
||||
/// </summary>
|
||||
public virtual Material effectMaterial { get { return m_EffectMaterial; } }
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the object becomes enabled and active.
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
graphic.material = effectMaterial;
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the behaviour becomes disabled () or inactive.
|
||||
/// </summary>
|
||||
protected override void OnDisable()
|
||||
{
|
||||
graphic.material = null;
|
||||
base.OnDisable();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
var obj = this;
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
if (Application.isPlaying || !obj)
|
||||
return;
|
||||
|
||||
var mat = GetMaterial(shaderName);
|
||||
if(m_EffectMaterial == mat && graphic.material == mat)
|
||||
return;
|
||||
|
||||
graphic.material = m_EffectMaterial = mat;
|
||||
EditorUtility.SetDirty(this);
|
||||
EditorUtility.SetDirty(graphic);
|
||||
EditorApplication.delayCall +=AssetDatabase.SaveAssets;
|
||||
};
|
||||
}
|
||||
|
||||
public static Material GetMaterial(string shaderName)
|
||||
{
|
||||
string name = Path.GetFileName (shaderName);
|
||||
return AssetDatabase.FindAssets("t:Material " + name)
|
||||
.Select(x => AssetDatabase.GUIDToAssetPath(x))
|
||||
.SelectMany(x => AssetDatabase.LoadAllAssetsAtPath(x))
|
||||
.OfType<Material>()
|
||||
.FirstOrDefault(x => x.name == name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the mesh.
|
||||
/// </summary>
|
||||
public override void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
|
||||
if (!IsActive())
|
||||
return;
|
||||
|
||||
// rect.
|
||||
Rect rect = graphic.rectTransform.rect;
|
||||
|
||||
// rotation.
|
||||
float rad = rotation * Mathf.Deg2Rad;
|
||||
Vector2 dir = new Vector2(Mathf.Cos(rad), Mathf.Sin(rad));
|
||||
dir.x *= rect.height / rect.width;
|
||||
dir = dir.normalized;
|
||||
|
||||
// Calculate vertex position.
|
||||
UIVertex vertex = default(UIVertex);
|
||||
Vector2 nomalizedPos;
|
||||
Matrix2x3 localMatrix = new Matrix2x3(rect, dir.x, dir.y); // Get local matrix.
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
|
||||
// Normalize vertex position by local matrix.
|
||||
nomalizedPos = localMatrix * vertex.position;
|
||||
|
||||
vertex.uv1 = new Vector2(
|
||||
_PackToFloat(Mathf.Clamp01(nomalizedPos.y), location, width, alpha),
|
||||
0
|
||||
);
|
||||
|
||||
vh.SetUIVertex(vertex, i);
|
||||
}
|
||||
}
|
||||
|
||||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Mark the UIEffect as dirty.
|
||||
/// </summary>
|
||||
void _SetDirty()
|
||||
{
|
||||
if(graphic)
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pack 4 low-precision [0-1] floats values to a float.
|
||||
/// Each value [0-1] has 64 steps(6 bits).
|
||||
/// </summary>
|
||||
static float _PackToFloat(float x, float y, float z, float w)
|
||||
{
|
||||
const int PRECISION = (1 << 6) - 1;
|
||||
return (Mathf.FloorToInt(w * PRECISION) << 18)
|
||||
+ (Mathf.FloorToInt(z * PRECISION) << 12)
|
||||
+ (Mathf.FloorToInt(y * PRECISION) << 6)
|
||||
+ Mathf.FloorToInt(x * PRECISION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Matrix2x3.
|
||||
/// </summary>
|
||||
struct Matrix2x3
|
||||
{
|
||||
public float m00, m01, m02, m10, m11, m12;
|
||||
|
||||
public Matrix2x3(Rect rect, float cos, float sin)
|
||||
{
|
||||
const float center = 0.5f;
|
||||
float dx = -rect.xMin / rect.width - center;
|
||||
float dy = -rect.yMin / rect.height - center;
|
||||
m00 = cos / rect.width;
|
||||
m01 = -sin / rect.height;
|
||||
m02 = dx * cos - dy * sin + center;
|
||||
m10 = sin / rect.width;
|
||||
m11 = cos / rect.height;
|
||||
m12 = dx * sin + dy * cos + center;
|
||||
}
|
||||
|
||||
public static Vector2 operator*(Matrix2x3 m, Vector2 v)
|
||||
{
|
||||
return new Vector2(
|
||||
(m.m00 * v.x) + (m.m01 * v.y) + m.m02,
|
||||
(m.m10 * v.x) + (m.m11 * v.y) + m.m12
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f19b7e2285c104f6ca47d583f3e5444f
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
# Changelog
|
||||
|
||||
## [v2.3.1](https://github.com/mob-sakai/UIEffect/tree/v2.3.1) (2018-05-10)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.3.0...v2.3.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- UIEffectCapturedImage: When iteration count is even. the result image is flipped vertically \(on Windows\) [\#62](https://github.com/mob-sakai/UIEffect/issues/62)
|
||||
|
||||
## [v2.3.0](https://github.com/mob-sakai/UIEffect/tree/v2.3.0) (2018-05-08)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.2.0...v2.3.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: Flip horizontal/vertical [\#47](https://github.com/mob-sakai/UIEffect/issues/47)
|
||||
- Feature: Dissolve [\#45](https://github.com/mob-sakai/UIEffect/issues/45)
|
||||
- Feature: Shining effect [\#9](https://github.com/mob-sakai/UIEffect/issues/9)
|
||||
|
||||
## [v2.2.0](https://github.com/mob-sakai/UIEffect/tree/v2.2.0) (2018-04-12)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.1.0...v2.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: Customize shader/material. You can create a custom ui shader and control it with UIEffct. [\#46](https://github.com/mob-sakai/UIEffect/issues/46)
|
||||
- Feature: UIEffectCapturedImage supports keep canvas size. [\#54](https://github.com/mob-sakai/UIEffect/issues/54)
|
||||
- Feature: UIEffectCapturedImage supports `Quality Type` to easy setup. [\#53](https://github.com/mob-sakai/UIEffect/issues/53)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: Color effect on shadow is incorrect. [\#55](https://github.com/mob-sakai/UIEffect/issues/55)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Change: Reduce the pixelation effect when tone level = 1. [\#57](https://github.com/mob-sakai/UIEffect/issues/57)
|
||||
|
||||
## [v2.1.0](https://github.com/mob-sakai/UIEffect/tree/v2.1.0) (2018-04-04)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.0.0...v2.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: UIEffectCapturedImage support iterative operation [\#48](https://github.com/mob-sakai/UIEffect/issues/48)
|
||||
|
||||
## [v2.0.0](https://github.com/mob-sakai/UIEffect/tree/v2.0.0) (2018-01-25)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.6.1...v2.0.0)
|
||||
|
||||
**Breaking changes:**
|
||||
|
||||
- Important: Unity 5.3.x & 5.4.x are no longer supported. [\#40](https://github.com/mob-sakai/UIEffect/issues/40)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Improve: Reduce the materials. Too many effect materials are exist. [\#15](https://github.com/mob-sakai/UIEffect/issues/15)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Change: Change namespace to Coffee.UIExtensions [\#6](https://github.com/mob-sakai/UIEffect/issues/6)
|
||||
|
||||
## [v1.6.1](https://github.com/mob-sakai/UIEffect/tree/v1.6.1) (2018-01-25)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.6.0...v1.6.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: Cannot access protected member `UnityEngine.UI.BaseMeshEffect.graphic` [\#41](https://github.com/mob-sakai/UIEffect/issues/41)
|
||||
|
||||
## [v1.6.0](https://github.com/mob-sakai/UIEffect/tree/v1.6.0) (2018-01-18)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.5.1...v1.6.0)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: Pixelization is incorrect. [\#34](https://github.com/mob-sakai/UIEffect/issues/34)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Change: UIEffect inherit BaseMeshEffect. [\#35](https://github.com/mob-sakai/UIEffect/issues/35)
|
||||
- Change: Blur level range to \[0-1\] [\#32](https://github.com/mob-sakai/UIEffect/issues/32)
|
||||
- Change: ShadowMode -\> ShadowStyle [\#18](https://github.com/mob-sakai/UIEffect/issues/18)
|
||||
|
||||
## [v1.5.1](https://github.com/mob-sakai/UIEffect/tree/v1.5.1) (2018-01-18)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.5.0...v1.5.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: An error occurs when no effect is specified for UICapturedImage. [\#36](https://github.com/mob-sakai/UIEffect/issues/36)
|
||||
|
||||
## [v1.5.0](https://github.com/mob-sakai/UIEffect/tree/v1.5.0) (2018-01-16)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.4.4...v1.5.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: ShadowMode 'Shadow 3' [\#11](https://github.com/mob-sakai/UIEffect/issues/11)
|
||||
- Feature: Hue [\#8](https://github.com/mob-sakai/UIEffect/issues/8)
|
||||
- Feature: Gradient [\#7](https://github.com/mob-sakai/UIEffect/issues/7)
|
||||
|
||||
## [v1.4.4](https://github.com/mob-sakai/UIEffect/tree/v1.4.4) (2018-01-16)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.4.3...v1.4.4)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: Error has occur on edit prefab. [\#27](https://github.com/mob-sakai/UIEffect/issues/27)
|
||||
|
||||
## [v1.4.3](https://github.com/mob-sakai/UIEffect/tree/v1.4.3) (2018-01-15)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.4.2...v1.4.3)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: Color effect is incorrect. [\#19](https://github.com/mob-sakai/UIEffect/issues/19)
|
||||
|
||||
## [v1.4.2](https://github.com/mob-sakai/UIEffect/tree/v1.4.2) (2018-01-14)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.4.1...v1.4.2)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: ColorMode `Override` [\#12](https://github.com/mob-sakai/UIEffect/issues/12)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Bug: Error has occur OnAfterDeserialize in editor. [\#16](https://github.com/mob-sakai/UIEffect/issues/16)
|
||||
|
||||
## [v1.4.1](https://github.com/mob-sakai/UIEffect/tree/v1.4.1) (2018-01-10)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.4.0...v1.4.1)
|
||||
|
||||
## [v1.4.0](https://github.com/mob-sakai/UIEffect/tree/v1.4.0) (2018-01-07)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.3.0...v1.4.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: Exclude unused shader variants from build. [\#5](https://github.com/mob-sakai/UIEffect/issues/5)
|
||||
|
||||
## [v1.3.0](https://github.com/mob-sakai/UIEffect/tree/v1.3.0) (2018-01-06)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.2.0...v1.3.0)
|
||||
|
||||
## [v1.2.0](https://github.com/mob-sakai/UIEffect/tree/v1.2.0) (2018-01-05)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.1.0...v1.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: Fast multiple shadow effect. [\#2](https://github.com/mob-sakai/UIEffect/issues/2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Pixelaration shifts to the lower right. [\#4](https://github.com/mob-sakai/UIEffect/issues/4)
|
||||
|
||||
## [v1.1.0](https://github.com/mob-sakai/UIEffect/tree/v1.1.0) (2017-08-17)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v1.0.0...v1.1.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Feature: Pixelization effect [\#1](https://github.com/mob-sakai/UIEffect/issues/1)
|
||||
|
||||
## [v1.0.0](https://github.com/mob-sakai/UIEffect/tree/v1.0.0) (2017-03-01)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/a9c4ec4e72a055ca5e5c24f6a75c6720f0f6fd7f...v1.0.0)
|
||||
|
||||
|
||||
|
||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
||||
@@ -1 +0,0 @@
|
||||
./Assets/UIEffect/LICENSE.txt
|
||||
@@ -0,0 +1,7 @@
|
||||
Copyright 2017 mob-sakai
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -9,7 +9,7 @@ PlayerSettings:
|
||||
targetDevice: 2
|
||||
useOnDemandResources: 0
|
||||
accelerometerFrequency: 60
|
||||
companyName: DefaultCompany
|
||||
companyName: Coffee
|
||||
productName: UIEffect
|
||||
defaultCursor: {fileID: 0}
|
||||
cursorHotspot: {x: 0, y: 0}
|
||||
@@ -88,7 +88,7 @@ PlayerSettings:
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleIdentifier: com.Company.ProductName
|
||||
bundleIdentifier: com.coffee.uieffect
|
||||
bundleVersion: 1.0
|
||||
preloadedAssets: []
|
||||
metroEnableIndependentInputSource: 0
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
m_EditorVersion: 5.3.0f4
|
||||
m_StandardAssetsVersion: 0
|
||||
m_EditorVersion: 5.5.0p4
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
UIEffect
|
||||
===
|
||||
|
||||
UIEffect is an effect component for uGUI in Unity.
|
||||
Let's decorate your UI with effects!
|
||||
|
||||
[](https://github.com/mob-sakai/UIEffect/release)
|
||||
[](https://github.com/mob-sakai/UIEffect/releases)
|
||||

|
||||
[](https://github.com/mob-sakai/UIEffect/blob/master/LICENSE.txt)
|
||||
[](https://github.com/mob-sakai/UIEffect/commits/develop)
|
||||
[](https://github.com/mob-sakai/UIEffect/issues)
|
||||
|
||||
|
||||
|
||||
<< [Description](#Description) | [WebGL Demo](#demo) | [Download](https://github.com/mob-sakai/UIEffect/releases) | [Usage](#usage) | [Development Note](#development-note) | [Change log](https://github.com/mob-sakai/UIEffect/blob/develop/CHANGELOG.md) >>
|
||||
|
||||
|
||||
|
||||
<br><br><br><br>
|
||||
## Description
|
||||
|
||||
### New feature in v2.3.0!
|
||||

|
||||
|
||||
### Supports following effects!
|
||||

|
||||
|
||||
* Grayscale
|
||||
* Sepia tone
|
||||
* Nega tone
|
||||
* Pixelation
|
||||
* Hue shift
|
||||
* Cutoff (alpha-based)
|
||||
* Mono (alpha-based)
|
||||
* Color overwrite
|
||||
* Color additive
|
||||
* Color subtract
|
||||
* Blur fast(3x4)
|
||||
* Blur medium(6x4)
|
||||
* Blur detail(6x8)
|
||||
* Shadow with effect
|
||||
* Shadow
|
||||
* Shadow3
|
||||
* Outline
|
||||
* Outline8
|
||||
* Gradient vertex color
|
||||
* Horizontal
|
||||
* Vertical
|
||||
* Angle
|
||||
* Diagonal
|
||||
* Shiny
|
||||
* Dissolve
|
||||
* Flip horizontal/vertical
|
||||
|
||||
|
||||
### Easy to control effect parameters!
|
||||
|
||||

|
||||
|
||||
|
||||
### And, more features!
|
||||
|
||||
* Control the effect parameters without instantiating the material
|
||||
* Control the effect parameters with AnimationClip
|
||||

|
||||
* Use for screen transition
|
||||

|
||||
* Multiple shadow effect to reduce rendering vertices
|
||||

|
||||
* UICapturedEffectImage: The captured image with effect, like post effect
|
||||

|
||||
* UICapturedEffectImage: Dialog window with the captured image effect
|
||||

|
||||
* UIGradient: Change vertex color as gradient, with rotation, offset, color correction
|
||||

|
||||
* UIShiny: Shiny effect WITHOUT Mask component. This will suppress extra draw calls and improve performance.
|
||||
Merged from [ShinyEffectForUGUI](https://github.com/mob-sakai/ShinyEffectForUGUI).
|
||||

|
||||
* UIDissolve: Dissolve effect WITHOUT material instancing. This will suppress extra draw calls and improve performance.
|
||||
Merged from [DissolveEffectForUGUI](https://github.com/mob-sakai/DissolveEffectForUGUI).
|
||||

|
||||
* UIFlip: Flip horizontal/vertical.
|
||||
|
||||
|
||||
|
||||
<br><br><br><br>
|
||||
## Demo
|
||||
|
||||
[WebGL Demo](http://mob-sakai.github.io/UIEffect)
|
||||
|
||||
* Effect sample
|
||||
* Transition
|
||||
* Dialog window with blured background
|
||||
* Included in unitypackage
|
||||
|
||||
|
||||
|
||||
|
||||
<br><br><br><br>
|
||||
## Usage
|
||||
|
||||
1. Download UIEffect.unitypackage from [Releases](https://github.com/mob-sakai/UIEffect/releases).
|
||||
1. Import the package into your Unity project. Select `Import Package > Custom Package` from the `Assets` menu.
|
||||
1. Add `UIEffect` component to UI element (Image, RawImage, Text, etc...) from `Add Component` in inspector.
|
||||
1. Choose effect type and adjust values in inspector.
|
||||

|
||||
1. Enjoy!
|
||||
|
||||
|
||||
##### Requirement
|
||||
|
||||
* Unity 5.5+ *(included Unity 2017.x)*
|
||||
* No other SDK are required
|
||||
|
||||
|
||||
|
||||
|
||||
<br><br><br><br>
|
||||
## Development Note
|
||||
|
||||
#### How does UIEffectCapturedImage work?
|
||||
|
||||

|
||||
|
||||
`UIEffectCapturedImage` is similar to post effect, but uses `CommandBuffer` to give effect only on the rendering result (= captured image) of a specific frame.
|
||||
This effect is non-realtime, light-weight, less-camera, blit only once, but effective.
|
||||
|
||||
* Camera for processing effect is unnecessary.
|
||||
* Process effect only once after `UIEffectCapturedImage.Capture`.
|
||||
* Using reduction buffer, keep used memory size small and keep rendering load are small.
|
||||
* When GameObjects with motion are on the screen, a result texture may be stirred.
|
||||
* You can overlay and display like as: [Screen] | [UIEffectCapturedImage] | [Dialog A] | [UIEffectCapturedImage] | [Dialog B].
|
||||
See also [Demo](#demo).
|
||||
|
||||
|
||||
#### Why is UIEffect lightweight?
|
||||
|
||||
* UIEffect pre-generates material from a combination of effects. This has the following benefits.
|
||||
* Draw call batching If possible, draw calls will decrease.
|
||||
* Since only the required material and shader variants are included in the build, the build size will be smaller.
|
||||
|
||||
|
||||
#### How to control effect parameters for uGUI element WITHOUT MaterialPropertyBlock?
|
||||
|
||||
* In general, you can use [MaterialPropertyBlock](https://docs.unity3d.com/ScriptReference/MaterialPropertyBlock.html) for renderers to control minor changes in the material without different batches.
|
||||
* However, changing the [MaterialPropertyBlock](https://docs.unity3d.com/ScriptReference/MaterialPropertyBlock.html) of the uGUI element from the script will cause different batches and draw calls to increase.
|
||||
* So UIEffect encodes multiple effect parameters to UV1 channel with [IMeshModifier](https://docs.unity3d.com/ScriptReference/UI.IMeshModifier.html).
|
||||
* Pack four 6-bit [0-1] (64 steps) parameters into one float value.
|
||||
* The parameters are low precision, but sufficient.
|
||||
|
||||
| uv1 | 6-bit [0-1] | 6-bit [0-1] | 6-bit [0-1] | 6-bit [0-1] |
|
||||
|-|-|-|-|-|
|
||||
| x(32bit float) | Tone level | *Empty* | Blur level | *Empty* |
|
||||
| y(32bit float) | Red channel | Green channel | Blue channel | Alpha channel |
|
||||
|
||||
|
||||
#### Note: Unity 5.6+
|
||||
|
||||
In Unity 5.6+, Canvas supports **Additional Shader Channels**.
|
||||
Please enable `TexCoord1` to use UIEffect.
|
||||

|
||||

|
||||
|
||||
|
||||
#### Note: if you include prefabs / scenes containing UIEffect in AssetBundle.
|
||||
|
||||
Use script define symbol `UIEFFECT_SEPARATE`.
|
||||
Unused shader variants and materials will be excluded from AssetBundles.
|
||||
|
||||
||Combined mode (default)|Separated mode|
|
||||
|-|-|-|
|
||||
|Script define symbol| - |`UIEFFECT_SEPARATE`|
|
||||
|Included in build|Only used variants|Only used variants|
|
||||
|Included in AssetBundle|All variants (Heavy!)|Only used variants|
|
||||
|Look in editor|||
|
||||
|
||||
|
||||
#### How to improve performance?
|
||||
|
||||
* Use `ShaderVariantCollection` to preload shader.
|
||||
https://docs.unity3d.com/Manual/OptimizingShaderLoadTime.html
|
||||
* Set camera's clear flag to "Solid Color".
|
||||
* Enable multi thread rendering.
|
||||
|
||||
|
||||
|
||||
|
||||
<br><br><br><br>
|
||||
## License
|
||||
|
||||
* MIT
|
||||
* © UTJ/UCL
|
||||
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
[mob-sakai](https://github.com/mob-sakai)
|
||||
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
* GitHub page : https://github.com/mob-sakai/UIEffect
|
||||
* Releases : https://github.com/mob-sakai/UIEffect/releases
|
||||
* Issue tracker : https://github.com/mob-sakai/UIEffect/issues
|
||||
* Current project : https://github.com/mob-sakai/UIEffect/projects/1
|
||||
* Change log : https://github.com/mob-sakai/UIEffect/blob/master/CHANGELOG.md
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "UIEffect",
|
||||
"version": "2.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mob-sakai/UIEffect.git"
|
||||
},
|
||||
"src": "Assets/UIEffect",
|
||||
"unity": "/Applications/Unity2017.1.0p5/Unity2017.1.0p5.app/Contents/MacOS/Unity",
|
||||
"license": "MIT"
|
||||
}
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# NOTE: Set an environment variable `CHANGELOG_GITHUB_TOKEN` by running the following command at the prompt, or by adding it to your shell profile (e.g., ~/.bash_profile or ~/.zshrc):
|
||||
# export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"
|
||||
|
||||
# Release the project with the following steps:
|
||||
# 1. Update the release version in package.json.
|
||||
# 2. Update "CHANGELOG.md" using "github_changelog_generator-1.15.0.pre.rc".
|
||||
# 3. Commit package.json and CHANGELOG.md.
|
||||
# 4. Merge into master branch.
|
||||
# 5. Export unitypackage.
|
||||
# 6. Release using "gh-release-3.2.0". (Upload unitypackage)
|
||||
|
||||
|
||||
# input release version
|
||||
PACKAGE_NAME=`node -pe 'require("./package.json").name'`
|
||||
echo Github Release: $PACKAGE_NAME
|
||||
read -p "[? release version (for example: 1.0.0): " RELEASE_VERSION
|
||||
[ -z "$RELEASE_VERSION" ] && exit
|
||||
|
||||
|
||||
# update version in package.json
|
||||
git checkout -B release develop
|
||||
sed -i -e "s/\"version\": \(.*\)/\"version\": \"${RELEASE_VERSION}\",/g" package.json
|
||||
|
||||
|
||||
# generate change log
|
||||
TAG=v$RELEASE_VERSION
|
||||
git tag $TAG
|
||||
git push --tags
|
||||
github_changelog_generator
|
||||
git tag -d $TAG
|
||||
git push --delete origin $TAG
|
||||
|
||||
|
||||
git diff -- CHANGELOG.md
|
||||
read -p "[? continue? (y/N):" yn
|
||||
case "$yn" in [yY]*) ;; *) exit ;; esac
|
||||
|
||||
|
||||
# export unitypackage
|
||||
UNITY_EDITOR=`node -pe 'require("./package.json").unity'`
|
||||
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
|
||||
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"
|
||||
|
||||
|
||||
# commit files
|
||||
git add CHANGELOG.md -f
|
||||
git add package.json -f
|
||||
git commit -m "update change log"
|
||||
|
||||
|
||||
# merge and push
|
||||
git checkout master
|
||||
git merge --no-ff release -m "release $TAG"
|
||||
git branch -D release
|
||||
git push origin master
|
||||
git checkout develop
|
||||
git merge --ff master
|
||||
git push origin develop
|
||||
|
||||
|
||||
# upload unitypackage and release on Github
|
||||
gh-release --draft --assets "$PACKAGE_NAME.unitypackage"
|
||||
|
||||
|
||||
echo "\n\n$PACKAGE_NAME v$RELEASE_VERSION has been successfully released!\n"
|
||||
Reference in New Issue
Block a user