forked from sin365/AxibugEmuOnline
Merge pull request 'master' (#60) from Alienjack/AxibugEmuOnline:master into master
Reviewed-on: sin365/AxibugEmuOnline#60
This commit is contained in:
commit
ae3471fd5e
@ -1,5 +1,4 @@
|
||||
using AxibugEmuOnline.Client;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
namespace AxibugEmuOnline.Editors
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AxiReplay
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace AxiReplay
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit,Size = 44)]
|
||||
[StructLayout(LayoutKind.Explicit, Size = 44)]
|
||||
public struct ReplayHandler
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
@ -51,7 +51,7 @@ namespace AxiReplay
|
||||
FM32IP32,
|
||||
FM32IP64,
|
||||
}
|
||||
public static void GetStringByteData(string str,out byte[] data,out int lenghtWithEnd,Encoding encoding)
|
||||
public static void GetStringByteData(string str, out byte[] data, out int lenghtWithEnd, Encoding encoding)
|
||||
{
|
||||
data = encoding.GetBytes(str);
|
||||
lenghtWithEnd = data.Length + 1;
|
||||
|
@ -128,14 +128,14 @@ namespace AxiReplay
|
||||
/// </summary>
|
||||
public bool NextFrame(out ReplayStep data)
|
||||
{
|
||||
return TakeFrame(1,out data);
|
||||
return TakeFrame(1, out data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 往前推进指定帧数量的Input (返回是否变化)
|
||||
/// </summary>
|
||||
/// <param name="addFrame"></param>
|
||||
public bool TakeFrame(int addFrame,out ReplayStep data)
|
||||
public bool TakeFrame(int addFrame, out ReplayStep data)
|
||||
{
|
||||
bool Changed = false;
|
||||
mCurrFrame += addFrame;
|
||||
|
@ -57,7 +57,7 @@ namespace AxiReplay
|
||||
/// 往前推进帧的,指定帧下标
|
||||
/// </summary>
|
||||
/// <param name="frameInput"></param>
|
||||
public void NextFramebyFrameIdx(int FrameID,UInt64 frameInput)
|
||||
public void NextFramebyFrameIdx(int FrameID, UInt64 frameInput)
|
||||
{
|
||||
TakeFrame(FrameID - byFrameIdx, frameInput);
|
||||
byFrameIdx = FrameID;
|
||||
@ -140,7 +140,7 @@ namespace AxiReplay
|
||||
temp.Add($"CreateTime => {handler.CreateTime}");
|
||||
temp.Add($"AllFrame => {handler.AllFrame}");
|
||||
temp.Add($"SingleLenght => {handler.SingleLenght}");
|
||||
dbgList.InsertRange(0,temp);
|
||||
dbgList.InsertRange(0, temp);
|
||||
File.WriteAllLines(dumppath, dbgList);
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ namespace Coffee.UIExtensions
|
||||
#if TMP_PRESENT
|
||||
static readonly List<Vector2> s_Uv0 = new List<Vector2> (4096);
|
||||
static readonly List<Vector2> s_Uv1 = new List<Vector2> (4096);
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
static readonly List<Vector2> s_Uv2 = new List<Vector2> (4096);
|
||||
static readonly List<Vector2> s_Uv3 = new List<Vector2> (4096);
|
||||
#endif
|
||||
#endif
|
||||
static readonly List<Vector3> s_Vertices = new List<Vector3> (4096);
|
||||
static readonly List<int> s_Indices = new List<int> (4096);
|
||||
static readonly List<Vector3> s_Normals = new List<Vector3> (4096);
|
||||
@ -42,7 +42,7 @@ namespace Coffee.UIExtensions
|
||||
static readonly List<UIVertex> s_UIVertices = new List<UIVertex> (4096);
|
||||
static readonly List<BaseMeshEffect> s_TmpEffects = new List<BaseMeshEffect>(4);
|
||||
#endif
|
||||
static readonly Material [] s_EmptyMaterials = new Material [0];
|
||||
static readonly Material[] s_EmptyMaterials = new Material[0];
|
||||
|
||||
|
||||
//################################
|
||||
@ -51,12 +51,12 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// The Graphic attached to this GameObject.
|
||||
/// </summary>
|
||||
public Graphic graphic { get { Initialize (); return _graphic; } }
|
||||
public Graphic graphic { get { Initialize(); return _graphic; } }
|
||||
|
||||
/// <summary>
|
||||
/// The CanvasRenderer attached to this GameObject.
|
||||
/// </summary>
|
||||
public CanvasRenderer canvasRenderer { get { Initialize (); return _canvasRenderer; } }
|
||||
public CanvasRenderer canvasRenderer { get { Initialize(); return _canvasRenderer; } }
|
||||
|
||||
#if TMP_PRESENT
|
||||
/// <summary>
|
||||
@ -68,7 +68,7 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// The RectTransform attached to this GameObject.
|
||||
/// </summary>
|
||||
public RectTransform rectTransform { get { Initialize (); return _rectTransform; } }
|
||||
public RectTransform rectTransform { get { Initialize(); return _rectTransform; } }
|
||||
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
/// <summary>
|
||||
@ -146,7 +146,7 @@ namespace Coffee.UIExtensions
|
||||
#endif
|
||||
if (graphic)
|
||||
{
|
||||
_materials [0] = graphic.material;
|
||||
_materials[0] = graphic.material;
|
||||
return _materials;
|
||||
}
|
||||
else
|
||||
@ -160,7 +160,7 @@ namespace Coffee.UIExtensions
|
||||
/// Call used to modify mesh. (legacy)
|
||||
/// </summary>
|
||||
/// <param name="mesh">Mesh.</param>
|
||||
public virtual void ModifyMesh (Mesh mesh)
|
||||
public virtual void ModifyMesh(Mesh mesh)
|
||||
{
|
||||
}
|
||||
|
||||
@ -168,14 +168,14 @@ namespace Coffee.UIExtensions
|
||||
/// Call used to modify mesh.
|
||||
/// </summary>
|
||||
/// <param name="vh">VertexHelper.</param>
|
||||
public virtual void ModifyMesh (VertexHelper vh)
|
||||
public virtual void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mark the vertices as dirty.
|
||||
/// </summary>
|
||||
public virtual void SetVerticesDirty ()
|
||||
public virtual void SetVerticesDirty()
|
||||
{
|
||||
#if TMP_PRESENT
|
||||
if (textMeshPro)
|
||||
@ -213,11 +213,11 @@ namespace Coffee.UIExtensions
|
||||
#endif
|
||||
if (graphic)
|
||||
{
|
||||
graphic.SetVerticesDirty ();
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowTMProWarning (Shader shader, Shader mobileShader, Shader spriteShader, System.Action<Material> onCreatedMaterial)
|
||||
public void ShowTMProWarning(Shader shader, Shader mobileShader, Shader spriteShader, System.Action<Material> onCreatedMaterial)
|
||||
{
|
||||
#if UNITY_EDITOR && TMP_PRESENT
|
||||
if(!textMeshPro || !textMeshPro.fontSharedMaterial)
|
||||
@ -324,14 +324,14 @@ namespace Coffee.UIExtensions
|
||||
protected virtual bool isLegacyMeshModifier { get { return false; } }
|
||||
|
||||
|
||||
protected virtual void Initialize ()
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
_initialized = true;
|
||||
_graphic = _graphic ?? GetComponent<Graphic> ();
|
||||
_canvasRenderer = _canvasRenderer ?? GetComponent<CanvasRenderer> ();
|
||||
_rectTransform = _rectTransform ?? GetComponent<RectTransform> ();
|
||||
_graphic = _graphic ?? GetComponent<Graphic>();
|
||||
_canvasRenderer = _canvasRenderer ?? GetComponent<CanvasRenderer>();
|
||||
_rectTransform = _rectTransform ?? GetComponent<RectTransform>();
|
||||
#if TMP_PRESENT
|
||||
_textMeshPro = _textMeshPro ?? GetComponent<TMP_Text> ();
|
||||
#endif
|
||||
@ -341,10 +341,10 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// This function is called when the object becomes enabled and active.
|
||||
/// </summary>
|
||||
protected override void OnEnable ()
|
||||
protected override void OnEnable()
|
||||
{
|
||||
_initialized = false;
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
#if TMP_PRESENT
|
||||
if (textMeshPro)
|
||||
{
|
||||
@ -366,7 +366,7 @@ namespace Coffee.UIExtensions
|
||||
var canvas = graphic.canvas;
|
||||
if (canvas && (canvas.additionalShaderChannels & channels) != channels)
|
||||
{
|
||||
Debug.LogWarningFormat (this, "Enable {1} of Canvas.additionalShaderChannels to use {0}.", GetType ().Name, channels);
|
||||
Debug.LogWarningFormat(this, "Enable {1} of Canvas.additionalShaderChannels to use {0}.", GetType().Name, channels);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -375,12 +375,12 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// This function is called when the behaviour becomes disabled () or inactive.
|
||||
/// </summary>
|
||||
protected override void OnDisable ()
|
||||
protected override void OnDisable()
|
||||
{
|
||||
#if TMP_PRESENT
|
||||
TMPro_EventManager.TEXT_CHANGED_EVENT.Remove (OnTextChanged);
|
||||
#endif
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
|
||||
#if UNITY_EDITOR && TMP_PRESENT
|
||||
if (graphic && textMeshPro)
|
||||
@ -394,7 +394,7 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// LateUpdate is called every frame, if the Behaviour is enabled.
|
||||
/// </summary>
|
||||
protected virtual void LateUpdate ()
|
||||
protected virtual void LateUpdate()
|
||||
{
|
||||
#if TMP_PRESENT
|
||||
if (textMeshPro)
|
||||
@ -411,18 +411,18 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// Callback for when properties have been changed by animation.
|
||||
/// </summary>
|
||||
protected override void OnDidApplyAnimationProperties ()
|
||||
protected override void OnDidApplyAnimationProperties()
|
||||
{
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
#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 override void OnValidate ()
|
||||
protected override void OnValidate()
|
||||
{
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -434,7 +434,7 @@ namespace Coffee.UIExtensions
|
||||
CanvasRenderer _canvasRenderer;
|
||||
RectTransform _rectTransform;
|
||||
Graphic _graphic;
|
||||
Material [] _materials = new Material [1];
|
||||
Material[] _materials = new Material[1];
|
||||
|
||||
#if TMP_PRESENT
|
||||
bool _isTextMeshProActive;
|
||||
@ -532,12 +532,12 @@ namespace Coffee.UIExtensions
|
||||
mesh.GetTangents (s_Tangents);
|
||||
mesh.GetIndices (s_Indices, 0);
|
||||
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
mesh.GetUVs (2, s_Uv2);
|
||||
mesh.GetUVs (3, s_Uv3);
|
||||
bool useUv2 = 0 < s_Uv2.Count;
|
||||
bool useUv3 = 0 < s_Uv3.Count;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
s_UIVertices.Clear();
|
||||
UIVertex v = default(UIVertex);
|
||||
@ -547,12 +547,12 @@ namespace Coffee.UIExtensions
|
||||
v.color = s_Colors[i];
|
||||
v.uv0 = s_Uv0[i];
|
||||
v.uv1 = s_Uv1[i];
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
if (useUv2 && i < s_Uv2.Count)
|
||||
v.uv2 = s_Uv2[i];
|
||||
if (useUv3 && i < s_Uv3.Count)
|
||||
v.uv3 = s_Uv3[i];
|
||||
#endif
|
||||
#endif
|
||||
v.normal = s_Normals[i];
|
||||
v.tangent = s_Tangents[i];
|
||||
|
||||
|
@ -16,12 +16,12 @@ namespace Coffee.UIExtensions
|
||||
public static class EffectAreaExtensions
|
||||
{
|
||||
static readonly Rect rectForCharacter = new Rect(0, 0, 1, 1);
|
||||
static readonly Vector2 [] splitedCharacterPosition = { Vector2.up, Vector2.one, Vector2.right, Vector2.zero };
|
||||
static readonly Vector2[] splitedCharacterPosition = { Vector2.up, Vector2.one, Vector2.right, Vector2.zero };
|
||||
|
||||
/// <summary>
|
||||
/// Gets effect for area.
|
||||
/// </summary>
|
||||
public static Rect GetEffectArea (this EffectArea area, VertexHelper vh, Rect rectangle, float aspectRatio = -1)
|
||||
public static Rect GetEffectArea(this EffectArea area, VertexHelper vh, Rect rectangle, float aspectRatio = -1)
|
||||
{
|
||||
Rect rect = default(Rect);
|
||||
switch (area)
|
||||
@ -34,7 +34,7 @@ namespace Coffee.UIExtensions
|
||||
break;
|
||||
case EffectArea.Fit:
|
||||
// Fit to contents.
|
||||
UIVertex vertex = default (UIVertex);
|
||||
UIVertex vertex = default(UIVertex);
|
||||
float xMin = float.MaxValue;
|
||||
float yMin = float.MaxValue;
|
||||
float xMax = float.MinValue;
|
||||
@ -49,7 +49,7 @@ namespace Coffee.UIExtensions
|
||||
xMax = Mathf.Max(xMax, x);
|
||||
yMax = Mathf.Max(yMax, y);
|
||||
}
|
||||
rect.Set (xMin, yMin, xMax - xMin, yMax - yMin);
|
||||
rect.Set(xMin, yMin, xMax - xMin, yMax - yMin);
|
||||
break;
|
||||
default:
|
||||
rect = rectangle;
|
||||
@ -57,7 +57,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
|
||||
|
||||
if(0 < aspectRatio)
|
||||
if (0 < aspectRatio)
|
||||
{
|
||||
if (rect.width < rect.height)
|
||||
{
|
||||
@ -74,34 +74,34 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// Gets position factor for area.
|
||||
/// </summary>
|
||||
public static void GetPositionFactor (this EffectArea area, int index, Rect rect, Vector2 position, bool isText, bool isTMPro, out float x, out float y)
|
||||
public static void GetPositionFactor(this EffectArea area, int index, Rect rect, Vector2 position, bool isText, bool isTMPro, out float x, out float y)
|
||||
{
|
||||
if (isText && area == EffectArea.Character)
|
||||
{
|
||||
index = isTMPro ? (index + 3) % 4 : index % 4;
|
||||
x = splitedCharacterPosition [index].x;
|
||||
y = splitedCharacterPosition [index].y;
|
||||
x = splitedCharacterPosition[index].x;
|
||||
y = splitedCharacterPosition[index].y;
|
||||
}
|
||||
else if (area == EffectArea.Fit)
|
||||
{
|
||||
x = Mathf.Clamp01 ((position.x - rect.xMin) / rect.width);
|
||||
y = Mathf.Clamp01 ((position.y - rect.yMin) / rect.height);
|
||||
x = Mathf.Clamp01((position.x - rect.xMin) / rect.width);
|
||||
y = Mathf.Clamp01((position.y - rect.yMin) / rect.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = Mathf.Clamp01 (position.x / rect.width + 0.5f);
|
||||
y = Mathf.Clamp01 (position.y / rect.height + 0.5f);
|
||||
x = Mathf.Clamp01(position.x / rect.width + 0.5f);
|
||||
y = Mathf.Clamp01(position.y / rect.height + 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalize vertex position by local matrix.
|
||||
/// </summary>
|
||||
public static void GetNormalizedFactor (this EffectArea area, int index, Matrix2x3 matrix, Vector2 position, bool isText, out Vector2 nomalizedPos)
|
||||
public static void GetNormalizedFactor(this EffectArea area, int index, Matrix2x3 matrix, Vector2 position, bool isText, out Vector2 nomalizedPos)
|
||||
{
|
||||
if (isText && area == EffectArea.Character)
|
||||
{
|
||||
nomalizedPos = matrix * splitedCharacterPosition [(index + 3) % 4];
|
||||
nomalizedPos = matrix * splitedCharacterPosition[(index + 3) % 4];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace Coffee.UIExtensions
|
||||
/// Gets or sets the duration.
|
||||
/// </summary>
|
||||
[Tooltip("Duration.")]
|
||||
[Range(0.01f,10f)]
|
||||
[Range(0.01f, 10f)]
|
||||
public float duration = 1;
|
||||
|
||||
/// <summary>
|
||||
@ -44,7 +44,7 @@ namespace Coffee.UIExtensions
|
||||
/// Gets or sets the delay before looping.
|
||||
/// </summary>
|
||||
[Tooltip("Delay before looping.")]
|
||||
[Range(0f,10f)]
|
||||
[Range(0f, 10f)]
|
||||
public float loopDelay = 0;
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
@ -114,7 +114,7 @@ namespace Coffee.UIExtensions
|
||||
s_StringBuilder.Append("[Separated] ");
|
||||
#endif
|
||||
s_StringBuilder.Append(Path.GetFileName(shader.name));
|
||||
foreach (object mode in append.Where(x=>0<(int)x))
|
||||
foreach (object mode in append.Where(x => 0 < (int)x))
|
||||
{
|
||||
s_StringBuilder.Append("-");
|
||||
s_StringBuilder.Append(mode.ToString());
|
||||
|
@ -22,7 +22,7 @@ namespace Coffee.UIExtensions
|
||||
m12 = dx * sin + dy * cos + center;
|
||||
}
|
||||
|
||||
public static Vector2 operator*(Matrix2x3 m, Vector2 v)
|
||||
public static Vector2 operator *(Matrix2x3 m, Vector2 v)
|
||||
{
|
||||
return new Vector2(
|
||||
(m.m00 * v.x) + (m.m01 * v.y) + m.m02,
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
public static class Packer
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using System;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
@ -55,7 +53,7 @@ namespace Coffee.UIExtensions
|
||||
if (target.parameterIndex <= 0 && 0 < _stack.Count)
|
||||
{
|
||||
target.parameterIndex = _stack.Pop();
|
||||
// Debug.LogFormat("<color=green>@@@ Register {0} : {1}</color>", target, target.parameterIndex);
|
||||
// Debug.LogFormat("<color=green>@@@ Register {0} : {1}</color>", target, target.parameterIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +65,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
if (0 < target.parameterIndex)
|
||||
{
|
||||
// Debug.LogFormat("<color=red>@@@ Unregister {0} : {1}</color>", target, target.parameterIndex);
|
||||
// Debug.LogFormat("<color=red>@@@ Unregister {0} : {1}</color>", target, target.parameterIndex);
|
||||
_stack.Push(target.parameterIndex);
|
||||
target.parameterIndex = 0;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace Coffee.UIExtensions
|
||||
/// </summary>
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate ();
|
||||
base.OnValidate();
|
||||
|
||||
var mat = GetMaterial();
|
||||
if (m_EffectMaterial != mat)
|
||||
@ -62,8 +62,8 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
|
||||
ModifyMaterial();
|
||||
SetVerticesDirty ();
|
||||
SetDirty ();
|
||||
SetVerticesDirty();
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
@ -123,7 +123,7 @@ namespace Coffee.UIExtensions
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable ();
|
||||
base.OnEnable();
|
||||
|
||||
if (ptex != null)
|
||||
{
|
||||
@ -139,9 +139,9 @@ namespace Coffee.UIExtensions
|
||||
/// </summary>
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable ();
|
||||
base.OnDisable();
|
||||
|
||||
ModifyMaterial ();
|
||||
ModifyMaterial();
|
||||
SetVerticesDirty();
|
||||
if (ptex != null)
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
@ -7,59 +6,59 @@ namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
public class BaseMeshEffectEditor : Editor
|
||||
{
|
||||
List<MaterialEditor> _materialEditors = new List<MaterialEditor> ();
|
||||
List<MaterialEditor> _materialEditors = new List<MaterialEditor>();
|
||||
|
||||
protected virtual void OnEnable ()
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
ClearMaterialEditors ();
|
||||
ClearMaterialEditors();
|
||||
}
|
||||
|
||||
protected virtual void OnDisable ()
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
ClearMaterialEditors ();
|
||||
ClearMaterialEditors();
|
||||
}
|
||||
|
||||
void ClearMaterialEditors ()
|
||||
void ClearMaterialEditors()
|
||||
{
|
||||
foreach (var e in _materialEditors)
|
||||
{
|
||||
if (e)
|
||||
{
|
||||
DestroyImmediate (e);
|
||||
DestroyImmediate(e);
|
||||
}
|
||||
}
|
||||
_materialEditors.Clear ();
|
||||
_materialEditors.Clear();
|
||||
}
|
||||
|
||||
protected void ShowMaterialEditors (Material [] materials, int startIndex, int count)
|
||||
protected void ShowMaterialEditors(Material[] materials, int startIndex, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (_materialEditors.Count == i)
|
||||
{
|
||||
_materialEditors.Add (null);
|
||||
_materialEditors.Add(null);
|
||||
}
|
||||
|
||||
var mat = materials [startIndex + i];
|
||||
var editor = _materialEditors [i];
|
||||
var mat = materials[startIndex + i];
|
||||
var editor = _materialEditors[i];
|
||||
if (editor && editor.target != mat)
|
||||
{
|
||||
DestroyImmediate (editor);
|
||||
DestroyImmediate(editor);
|
||||
editor = null;
|
||||
}
|
||||
|
||||
if (!editor)
|
||||
{
|
||||
editor = _materialEditors [i] = Editor.CreateEditor (mat) as MaterialEditor;
|
||||
editor = _materialEditors[i] = Editor.CreateEditor(mat) as MaterialEditor;
|
||||
}
|
||||
|
||||
editor.DrawHeader ();
|
||||
editor.OnInspectorGUI ();
|
||||
editor.DrawHeader();
|
||||
editor.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void ShowCanvasChannelsWarning ()
|
||||
protected void ShowCanvasChannelsWarning()
|
||||
{
|
||||
BaseMeshEffect effect = target as BaseMeshEffect;
|
||||
if (!effect || !effect.graphic)
|
||||
@ -72,13 +71,13 @@ namespace Coffee.UIExtensions.Editors
|
||||
var canvas = effect.graphic.canvas;
|
||||
if (canvas && (canvas.additionalShaderChannels & channels) != channels)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal ();
|
||||
EditorGUILayout.HelpBox (string.Format ("Enable {1} of Canvas.additionalShaderChannels to use {0}.", effect.GetType ().Name, channels), MessageType.Warning);
|
||||
if (GUILayout.Button ("Fix"))
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox(string.Format("Enable {1} of Canvas.additionalShaderChannels to use {0}.", effect.GetType().Name, channels), MessageType.Warning);
|
||||
if (GUILayout.Button("Fix"))
|
||||
{
|
||||
canvas.additionalShaderChannels |= channels;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal ();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
@ -24,7 +22,7 @@ namespace Coffee.UIExtensions.Editors
|
||||
};
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.InitializeOnLoadMethod]
|
||||
static void RemoveFiles()
|
||||
{
|
||||
@ -48,6 +46,6 @@ namespace Coffee.UIExtensions.Editors
|
||||
UnityEngine.Debug.Log(sb);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
@ -24,7 +21,7 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable ();
|
||||
base.OnEnable();
|
||||
|
||||
_spMaterial = serializedObject.FindProperty("m_EffectMaterial");
|
||||
_spEffectFactor = serializedObject.FindProperty("m_EffectFactor");
|
||||
@ -45,11 +42,11 @@ namespace Coffee.UIExtensions.Editors
|
||||
_spLoopDelay = player.FindPropertyRelative("loopDelay");
|
||||
_spUpdateMode = player.FindPropertyRelative("updateMode");
|
||||
|
||||
s_NoiseTexId = Shader.PropertyToID ("_NoiseTex");
|
||||
s_NoiseTexId = Shader.PropertyToID("_NoiseTex");
|
||||
|
||||
_shader = Shader.Find ("TextMeshPro/Distance Field (UIDissolve)");
|
||||
_mobileShader = Shader.Find ("TextMeshPro/Mobile/Distance Field (UIDissolve)");
|
||||
_spriteShader = Shader.Find ("TextMeshPro/Sprite (UIDissolve)");
|
||||
_shader = Shader.Find("TextMeshPro/Distance Field (UIDissolve)");
|
||||
_mobileShader = Shader.Find("TextMeshPro/Mobile/Distance Field (UIDissolve)");
|
||||
_spriteShader = Shader.Find("TextMeshPro/Sprite (UIDissolve)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -57,25 +54,25 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
foreach (var d in targets.Cast<UIDissolve> ())
|
||||
foreach (var d in targets.Cast<UIDissolve>())
|
||||
{
|
||||
var mat = d.material;
|
||||
if (d.isTMPro && mat && mat.HasProperty(s_NoiseTexId))
|
||||
{
|
||||
ColorMode colorMode =
|
||||
mat.IsKeywordEnabled ("ADD") ? ColorMode.Add
|
||||
: mat.IsKeywordEnabled ("SUBTRACT") ? ColorMode.Subtract
|
||||
: mat.IsKeywordEnabled ("FILL") ? ColorMode.Fill
|
||||
mat.IsKeywordEnabled("ADD") ? ColorMode.Add
|
||||
: mat.IsKeywordEnabled("SUBTRACT") ? ColorMode.Subtract
|
||||
: mat.IsKeywordEnabled("FILL") ? ColorMode.Fill
|
||||
: ColorMode.Multiply;
|
||||
|
||||
Texture noiseTexture = mat.GetTexture(s_NoiseTexId);
|
||||
|
||||
if (d.colorMode != colorMode || d.noiseTexture != noiseTexture)
|
||||
{
|
||||
var so = new SerializedObject (d);
|
||||
so.FindProperty ("m_ColorMode").intValue = (int)colorMode;
|
||||
so.FindProperty ("m_NoiseTexture").objectReferenceValue = noiseTexture;
|
||||
so.ApplyModifiedProperties ();
|
||||
var so = new SerializedObject(d);
|
||||
so.FindProperty("m_ColorMode").intValue = (int)colorMode;
|
||||
so.FindProperty("m_NoiseTexture").objectReferenceValue = noiseTexture;
|
||||
so.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,10 +95,10 @@ namespace Coffee.UIExtensions.Editors
|
||||
EditorGUILayout.PropertyField(_spColor);
|
||||
|
||||
bool isAnyTMPro = targets.Cast<UIDissolve>().Any(x => x.isTMPro);
|
||||
using (new EditorGUI.DisabledGroupScope (isAnyTMPro))
|
||||
using (new EditorGUI.DisabledGroupScope(isAnyTMPro))
|
||||
{
|
||||
EditorGUILayout.PropertyField (_spColorMode);
|
||||
EditorGUILayout.PropertyField (_spNoiseTexture);
|
||||
EditorGUILayout.PropertyField(_spColorMode);
|
||||
EditorGUILayout.PropertyField(_spNoiseTexture);
|
||||
}
|
||||
|
||||
//================
|
||||
@ -139,16 +136,17 @@ namespace Coffee.UIExtensions.Editors
|
||||
}
|
||||
|
||||
var c = target as UIDissolve;
|
||||
c.ShowTMProWarning (_shader, _mobileShader, _spriteShader, mat => {
|
||||
if(mat.shader == _spriteShader)
|
||||
c.ShowTMProWarning(_shader, _mobileShader, _spriteShader, mat =>
|
||||
{
|
||||
if (mat.shader == _spriteShader)
|
||||
{
|
||||
mat.shaderKeywords = c.material.shaderKeywords;
|
||||
mat.SetTexture ("_NoiseTex", c.material.GetTexture ("_NoiseTex"));
|
||||
mat.SetTexture("_NoiseTex", c.material.GetTexture("_NoiseTex"));
|
||||
}
|
||||
});
|
||||
ShowCanvasChannelsWarning ();
|
||||
ShowCanvasChannelsWarning();
|
||||
|
||||
ShowMaterialEditors (c.materials, 1, c.materials.Length - 1);
|
||||
ShowMaterialEditors(c.materials, 1, c.materials.Length - 1);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
@ -13,7 +12,7 @@ namespace Coffee.UIExtensions.Editors
|
||||
[CanEditMultipleObjects]
|
||||
public class UIEffectEditor : BaseMeshEffectEditor
|
||||
{
|
||||
static readonly GUIContent contentEffectColor = new GUIContent ("Effect Color");
|
||||
static readonly GUIContent contentEffectColor = new GUIContent("Effect Color");
|
||||
|
||||
|
||||
//################################
|
||||
@ -59,19 +58,21 @@ namespace Coffee.UIExtensions.Editors
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
SerializedProperty spColor = serializedObject.FindProperty(colorProperty);
|
||||
if (spColor == null && serializedObject.targetObject is UIEffect) {
|
||||
spColor = new SerializedObject (serializedObject.targetObjects.Select(x=>(x as UIEffect).targetGraphic).ToArray()).FindProperty(colorProperty);
|
||||
if (spColor == null && serializedObject.targetObject is UIEffect)
|
||||
{
|
||||
spColor = new SerializedObject(serializedObject.targetObjects.Select(x => (x as UIEffect).targetGraphic).ToArray()).FindProperty(colorProperty);
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = spColor.hasMultipleDifferentValues;
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
spColor.colorValue = EditorGUILayout.ColorField (contentEffectColor, spColor.colorValue, true, false, false);
|
||||
spColor.colorValue = EditorGUILayout.ColorField(contentEffectColor, spColor.colorValue, true, false, false);
|
||||
#else
|
||||
spColor.colorValue = EditorGUILayout.ColorField (contentEffectColor, spColor.colorValue, true, false, false, null);
|
||||
#endif
|
||||
if (EditorGUI.EndChangeCheck ()) {
|
||||
spColor.serializedObject.ApplyModifiedProperties ();
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
spColor.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ColorFactor"));
|
||||
@ -102,14 +103,14 @@ namespace Coffee.UIExtensions.Editors
|
||||
int GetEnum<T>(Material mat)
|
||||
{
|
||||
Type type = typeof(T);
|
||||
string[] names = System.Enum.GetNames (type);
|
||||
int[] values = System.Enum.GetValues (type) as int[];
|
||||
string[] names = System.Enum.GetNames(type);
|
||||
int[] values = System.Enum.GetValues(type) as int[];
|
||||
|
||||
int mode = 0;
|
||||
for(int i=0;i<names.Length;i++)
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
{
|
||||
if (mat.IsKeywordEnabled (names [i].ToUpper()))
|
||||
mode = values [i];
|
||||
if (mat.IsKeywordEnabled(names[i].ToUpper()))
|
||||
mode = values[i];
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
@ -120,23 +121,23 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
foreach (var d in targets.Cast<UIEffect> ())
|
||||
foreach (var d in targets.Cast<UIEffect>())
|
||||
{
|
||||
var mat = d.material;
|
||||
if (d.isTMPro && mat)
|
||||
{
|
||||
var so = new SerializedObject (d);
|
||||
EffectMode eMode = (EffectMode)GetEnum<EffectMode> (mat);
|
||||
ColorMode cMode = (ColorMode)GetEnum<ColorMode> (mat);
|
||||
BlurMode bMode = (BlurMode)GetEnum<BlurMode> (mat);
|
||||
var so = new SerializedObject(d);
|
||||
EffectMode eMode = (EffectMode)GetEnum<EffectMode>(mat);
|
||||
ColorMode cMode = (ColorMode)GetEnum<ColorMode>(mat);
|
||||
BlurMode bMode = (BlurMode)GetEnum<BlurMode>(mat);
|
||||
bool aBlur = mat.IsKeywordEnabled("EX");
|
||||
if (d.effectMode != eMode || d.colorMode != cMode || d.blurMode != bMode || so.FindProperty ("m_AdvancedBlur").boolValue != aBlur)
|
||||
if (d.effectMode != eMode || d.colorMode != cMode || d.blurMode != bMode || so.FindProperty("m_AdvancedBlur").boolValue != aBlur)
|
||||
{
|
||||
so.FindProperty ("m_EffectMode").intValue = (int)eMode;
|
||||
so.FindProperty ("m_ColorMode").intValue = (int)cMode;
|
||||
so.FindProperty ("m_BlurMode").intValue = (int)bMode;
|
||||
so.FindProperty ("m_AdvancedBlur").boolValue = aBlur;
|
||||
so.ApplyModifiedProperties ();
|
||||
so.FindProperty("m_EffectMode").intValue = (int)eMode;
|
||||
so.FindProperty("m_ColorMode").intValue = (int)cMode;
|
||||
so.FindProperty("m_BlurMode").intValue = (int)bMode;
|
||||
so.FindProperty("m_AdvancedBlur").boolValue = aBlur;
|
||||
so.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -182,19 +183,21 @@ namespace Coffee.UIExtensions.Editors
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
SerializedProperty spColor = serializedObject.FindProperty("m_Color");
|
||||
if (spColor == null && serializedObject.targetObject is UIEffect) {
|
||||
spColor = new SerializedObject (serializedObject.targetObjects.Select(x=>(x as UIEffect).targetGraphic).ToArray()).FindProperty(!isAnyTMPro ? "m_Color" : "m_fontColor");
|
||||
if (spColor == null && serializedObject.targetObject is UIEffect)
|
||||
{
|
||||
spColor = new SerializedObject(serializedObject.targetObjects.Select(x => (x as UIEffect).targetGraphic).ToArray()).FindProperty(!isAnyTMPro ? "m_Color" : "m_fontColor");
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = spColor.hasMultipleDifferentValues;
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
spColor.colorValue = EditorGUILayout.ColorField (contentEffectColor, spColor.colorValue, true, false, false);
|
||||
#else
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
spColor.colorValue = EditorGUILayout.ColorField(contentEffectColor, spColor.colorValue, true, false, false);
|
||||
#else
|
||||
spColor.colorValue = EditorGUILayout.ColorField (contentEffectColor, spColor.colorValue, true, false, false, null);
|
||||
#endif
|
||||
if (EditorGUI.EndChangeCheck ()) {
|
||||
spColor.serializedObject.ApplyModifiedProperties ();
|
||||
#endif
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
spColor.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ColorFactor"));
|
||||
@ -222,10 +225,10 @@ namespace Coffee.UIExtensions.Editors
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
c.ShowTMProWarning (_shader, _mobileShader, _spriteShader, mat => {});
|
||||
ShowCanvasChannelsWarning ();
|
||||
c.ShowTMProWarning(_shader, _mobileShader, _spriteShader, mat => { });
|
||||
ShowCanvasChannelsWarning();
|
||||
|
||||
ShowMaterialEditors (c.materials, 1, c.materials.Length - 1);
|
||||
ShowMaterialEditors(c.materials, 1, c.materials.Length - 1);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
@ -235,11 +238,11 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable ();
|
||||
base.OnEnable();
|
||||
|
||||
_shader = Shader.Find ("TextMeshPro/Distance Field (UIEffect)");
|
||||
_mobileShader = Shader.Find ("TextMeshPro/Mobile/Distance Field (UIEffect)");
|
||||
_spriteShader = Shader.Find ("TextMeshPro/Sprite (UIEffect)");
|
||||
_shader = Shader.Find("TextMeshPro/Distance Field (UIEffect)");
|
||||
_mobileShader = Shader.Find("TextMeshPro/Mobile/Distance Field (UIEffect)");
|
||||
_spriteShader = Shader.Find("TextMeshPro/Sprite (UIEffect)");
|
||||
}
|
||||
|
||||
//################################
|
||||
|
@ -1,6 +1,5 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
@ -20,7 +18,7 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable ();
|
||||
base.OnEnable();
|
||||
|
||||
_spMaterial = serializedObject.FindProperty("m_EffectMaterial");
|
||||
_spTargetColor = serializedObject.FindProperty("m_TargetColor");
|
||||
@ -29,9 +27,9 @@ namespace Coffee.UIExtensions.Editors
|
||||
_spSaturation = serializedObject.FindProperty("m_Saturation");
|
||||
_spValue = serializedObject.FindProperty("m_Value");
|
||||
|
||||
_shader = Shader.Find ("TextMeshPro/Distance Field (UIHsvModifier)");
|
||||
_mobileShader = Shader.Find ("TextMeshPro/Mobile/Distance Field (UIHsvModifier)");
|
||||
_spriteShader = Shader.Find ("TextMeshPro/Sprite (UIHsvModifier)");
|
||||
_shader = Shader.Find("TextMeshPro/Distance Field (UIHsvModifier)");
|
||||
_mobileShader = Shader.Find("TextMeshPro/Mobile/Distance Field (UIHsvModifier)");
|
||||
_spriteShader = Shader.Find("TextMeshPro/Sprite (UIHsvModifier)");
|
||||
}
|
||||
|
||||
|
||||
@ -59,10 +57,10 @@ namespace Coffee.UIExtensions.Editors
|
||||
EditorGUILayout.PropertyField(_spValue);
|
||||
|
||||
var c = target as UIHsvModifier;
|
||||
c.ShowTMProWarning (_shader, _mobileShader, _spriteShader, mat => {});
|
||||
ShowCanvasChannelsWarning ();
|
||||
c.ShowTMProWarning(_shader, _mobileShader, _spriteShader, mat => { });
|
||||
ShowCanvasChannelsWarning();
|
||||
|
||||
ShowMaterialEditors (c.materials, 1, c.materials.Length - 1);
|
||||
ShowMaterialEditors(c.materials, 1, c.materials.Length - 1);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
@ -20,7 +18,7 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable ();
|
||||
base.OnEnable();
|
||||
|
||||
_spMaterial = serializedObject.FindProperty("m_EffectMaterial");
|
||||
_spEffectFactor = serializedObject.FindProperty("m_EffectFactor");
|
||||
@ -39,9 +37,9 @@ namespace Coffee.UIExtensions.Editors
|
||||
_spUpdateMode = player.FindPropertyRelative("updateMode");
|
||||
|
||||
|
||||
_shader = Shader.Find ("TextMeshPro/Distance Field (UIShiny)");
|
||||
_mobileShader = Shader.Find ("TextMeshPro/Mobile/Distance Field (UIShiny)");
|
||||
_spriteShader = Shader.Find ("TextMeshPro/Sprite (UIShiny)");
|
||||
_shader = Shader.Find("TextMeshPro/Distance Field (UIShiny)");
|
||||
_mobileShader = Shader.Find("TextMeshPro/Mobile/Distance Field (UIShiny)");
|
||||
_spriteShader = Shader.Find("TextMeshPro/Sprite (UIShiny)");
|
||||
}
|
||||
|
||||
|
||||
@ -102,10 +100,10 @@ namespace Coffee.UIExtensions.Editors
|
||||
}
|
||||
|
||||
var c = target as UIShiny;
|
||||
c.ShowTMProWarning (_shader, _mobileShader, _spriteShader, mat => {});
|
||||
ShowCanvasChannelsWarning ();
|
||||
c.ShowTMProWarning(_shader, _mobileShader, _spriteShader, mat => { });
|
||||
ShowCanvasChannelsWarning();
|
||||
|
||||
ShowMaterialEditors (c.materials, 1, c.materials.Length - 1);
|
||||
ShowMaterialEditors(c.materials, 1, c.materials.Length - 1);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
@ -55,32 +54,32 @@ namespace Coffee.UIExtensions.Editors
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
foreach (var d in targets.Cast<UITransitionEffect> ())
|
||||
foreach (var d in targets.Cast<UITransitionEffect>())
|
||||
{
|
||||
var mat = d.material;
|
||||
if (d.isTMPro && mat && mat.HasProperty (s_NoiseTexId))
|
||||
if (d.isTMPro && mat && mat.HasProperty(s_NoiseTexId))
|
||||
{
|
||||
Texture noiseTexture = mat.GetTexture (s_NoiseTexId);
|
||||
Texture noiseTexture = mat.GetTexture(s_NoiseTexId);
|
||||
UITransitionEffect.EffectMode mode =
|
||||
mat.IsKeywordEnabled ("CUTOFF") ? UITransitionEffect.EffectMode.Cutoff
|
||||
: mat.IsKeywordEnabled ("FADE") ? UITransitionEffect.EffectMode.Fade
|
||||
: mat.IsKeywordEnabled ("DISSOLVE") ? UITransitionEffect.EffectMode.Dissolve
|
||||
mat.IsKeywordEnabled("CUTOFF") ? UITransitionEffect.EffectMode.Cutoff
|
||||
: mat.IsKeywordEnabled("FADE") ? UITransitionEffect.EffectMode.Fade
|
||||
: mat.IsKeywordEnabled("DISSOLVE") ? UITransitionEffect.EffectMode.Dissolve
|
||||
: (UITransitionEffect.EffectMode)0;
|
||||
|
||||
if (mode == (UITransitionEffect.EffectMode)0)
|
||||
{
|
||||
mode = UITransitionEffect.EffectMode.Cutoff;
|
||||
mat.EnableKeyword ("CUTOFF");
|
||||
mat.EnableKeyword("CUTOFF");
|
||||
}
|
||||
|
||||
bool hasChanged = d.transitionTexture != noiseTexture || d.effectMode != mode;
|
||||
|
||||
if (hasChanged)
|
||||
{
|
||||
var so = new SerializedObject (d);
|
||||
so.FindProperty ("m_TransitionTexture").objectReferenceValue = noiseTexture;
|
||||
so.FindProperty ("m_EffectMode").intValue = (int)mode;
|
||||
so.ApplyModifiedProperties ();
|
||||
var so = new SerializedObject(d);
|
||||
so.FindProperty("m_TransitionTexture").objectReferenceValue = noiseTexture;
|
||||
so.FindProperty("m_EffectMode").intValue = (int)mode;
|
||||
so.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
@ -23,16 +23,16 @@ namespace Coffee.UIExtensions
|
||||
//################################
|
||||
[Tooltip("Current location[0-1] for dissolve effect. 0 is not dissolved, 1 is completely dissolved.")]
|
||||
[FormerlySerializedAs("m_Location")]
|
||||
[SerializeField] [Range(0, 1)] float m_EffectFactor = 0.5f;
|
||||
[SerializeField][Range(0, 1)] float m_EffectFactor = 0.5f;
|
||||
|
||||
[Tooltip("Edge width.")]
|
||||
[SerializeField] [Range(0, 1)] float m_Width = 0.5f;
|
||||
[SerializeField][Range(0, 1)] float m_Width = 0.5f;
|
||||
|
||||
[Tooltip("Edge softness.")]
|
||||
[SerializeField] [Range(0, 1)] float m_Softness = 0.5f;
|
||||
[SerializeField][Range(0, 1)] float m_Softness = 0.5f;
|
||||
|
||||
[Tooltip("Edge color.")]
|
||||
[SerializeField] [ColorUsage(false)] Color m_Color = new Color(0.0f, 0.25f, 1.0f);
|
||||
[SerializeField][ColorUsage(false)] Color m_Color = new Color(0.0f, 0.25f, 1.0f);
|
||||
|
||||
[Tooltip("Edge color effect mode.")]
|
||||
[SerializeField] ColorMode m_ColorMode = ColorMode.Add;
|
||||
@ -54,12 +54,14 @@ namespace Coffee.UIExtensions
|
||||
[FormerlySerializedAs("m_ReverseAnimation")]
|
||||
[SerializeField] bool m_Reverse = false;
|
||||
|
||||
#pragma warning disable 0414
|
||||
[Obsolete][HideInInspector]
|
||||
#pragma warning disable 0414
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField][Range(0.1f, 10)] float m_Duration = 1;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] AnimatorUpdateMode m_UpdateMode = AnimatorUpdateMode.Normal;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning restore 0414
|
||||
|
||||
|
||||
//################################
|
||||
@ -197,7 +199,7 @@ namespace Coffee.UIExtensions
|
||||
if (m_KeepAspectRatio != value)
|
||||
{
|
||||
m_KeepAspectRatio = value;
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,28 +312,28 @@ namespace Coffee.UIExtensions
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
m_EffectArea.GetPositionFactor (i, rect, vertex.position, isText, isTMPro, out x, out y);
|
||||
m_EffectArea.GetPositionFactor(i, rect, vertex.position, isText, isTMPro, out x, out y);
|
||||
|
||||
vertex.uv0 = new Vector2(
|
||||
Packer.ToFloat(vertex.uv0.x, vertex.uv0.y),
|
||||
Packer.ToFloat(x, y, normalizedIndex)
|
||||
);
|
||||
// if(!isTMPro)
|
||||
// {
|
||||
// vertex.uv0 = new Vector2(
|
||||
// Packer.ToFloat(vertex.uv0.x, vertex.uv0.y),
|
||||
// Packer.ToFloat(x, y, normalizedIndex)
|
||||
// );
|
||||
// }
|
||||
// #if UNITY_5_6_OR_NEWER
|
||||
// else
|
||||
// {
|
||||
// vertex.uv2 = new Vector2 (
|
||||
// Packer.ToFloat (x, y, normalizedIndex),
|
||||
// 0
|
||||
// );
|
||||
// }
|
||||
// #endif
|
||||
// if(!isTMPro)
|
||||
// {
|
||||
// vertex.uv0 = new Vector2(
|
||||
// Packer.ToFloat(vertex.uv0.x, vertex.uv0.y),
|
||||
// Packer.ToFloat(x, y, normalizedIndex)
|
||||
// );
|
||||
// }
|
||||
// #if UNITY_5_6_OR_NEWER
|
||||
// else
|
||||
// {
|
||||
// vertex.uv2 = new Vector2 (
|
||||
// Packer.ToFloat (x, y, normalizedIndex),
|
||||
// 0
|
||||
// );
|
||||
// }
|
||||
// #endif
|
||||
|
||||
vh.SetUIVertex(vertex, i);
|
||||
}
|
||||
@ -339,9 +341,9 @@ namespace Coffee.UIExtensions
|
||||
|
||||
protected override void SetDirty()
|
||||
{
|
||||
foreach(var m in materials)
|
||||
foreach (var m in materials)
|
||||
{
|
||||
ptex.RegisterMaterial (m);
|
||||
ptex.RegisterMaterial(m);
|
||||
}
|
||||
ptex.SetData(this, 0, m_EffectFactor); // param1.x : location
|
||||
ptex.SetData(this, 1, m_Width); // param1.y : width
|
||||
@ -385,7 +387,7 @@ namespace Coffee.UIExtensions
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable ();
|
||||
base.OnDisable();
|
||||
MaterialCache.Unregister(_materialCache);
|
||||
_materialCache = null;
|
||||
_player.OnDisable();
|
||||
@ -406,7 +408,7 @@ namespace Coffee.UIExtensions
|
||||
return MaterialResolver.GetOrGenerateMaterialVariant(Shader.Find(shaderName), m_ColorMode);
|
||||
}
|
||||
|
||||
#pragma warning disable 0612
|
||||
#pragma warning disable 0612
|
||||
protected override void UpgradeIfNeeded()
|
||||
{
|
||||
// Upgrade for v3.0.0
|
||||
@ -419,7 +421,7 @@ namespace Coffee.UIExtensions
|
||||
_player.updateMode = m_UpdateMode;
|
||||
}
|
||||
}
|
||||
#pragma warning restore 0612
|
||||
#pragma warning restore 0612
|
||||
#endif
|
||||
|
||||
//################################
|
||||
@ -427,6 +429,6 @@ namespace Coffee.UIExtensions
|
||||
//################################
|
||||
MaterialCache _materialCache = null;
|
||||
|
||||
EffectPlayer _player{ get { return m_Player ?? (m_Player = new EffectPlayer()); } }
|
||||
EffectPlayer _player { get { return m_Player ?? (m_Player = new EffectPlayer()); } }
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using UnityEngine.UI;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
@ -55,22 +54,29 @@ namespace Coffee.UIExtensions
|
||||
[Tooltip("Advanced blurring remove common artifacts in the blur effect for uGUI.")]
|
||||
[SerializeField] bool m_AdvancedBlur = false;
|
||||
|
||||
#pragma warning disable 0414
|
||||
[Obsolete][HideInInspector]
|
||||
#pragma warning disable 0414
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField][Range(0, 1)] float m_ShadowBlur = 1;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] ShadowStyle m_ShadowStyle;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] Color m_ShadowColor = Color.black;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] Vector2 m_EffectDistance = new Vector2(1f, -1f);
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] bool m_UseGraphicAlpha = true;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] Color m_EffectColor = Color.white;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] List<UIShadow.AdditionalShadow> m_AdditionalShadows = new List<UIShadow.AdditionalShadow>();
|
||||
#pragma warning restore 0414
|
||||
#pragma warning restore 0414
|
||||
|
||||
public enum BlurEx
|
||||
{
|
||||
@ -295,9 +301,9 @@ namespace Coffee.UIExtensions
|
||||
|
||||
if (isTMPro)
|
||||
{
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
vt.uv2 = uvMask;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -333,7 +339,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
foreach (var m in materials)
|
||||
{
|
||||
ptex.RegisterMaterial (m);
|
||||
ptex.RegisterMaterial(m);
|
||||
}
|
||||
ptex.SetData(this, 0, m_EffectFactor); // param.x : effect factor
|
||||
ptex.SetData(this, 1, m_ColorFactor); // param.y : color factor
|
||||
@ -354,7 +360,7 @@ namespace Coffee.UIExtensions
|
||||
return MaterialResolver.GetOrGenerateMaterialVariant(Shader.Find(shaderName), m_EffectMode, m_ColorMode, m_BlurMode, m_AdvancedBlur ? BlurEx.Ex : BlurEx.None);
|
||||
}
|
||||
|
||||
#pragma warning disable 0612
|
||||
#pragma warning disable 0612
|
||||
protected override void UpgradeIfNeeded()
|
||||
{
|
||||
// Upgrade for v3.0.0
|
||||
@ -438,7 +444,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 0612
|
||||
#pragma warning restore 0612
|
||||
#endif
|
||||
|
||||
//################################
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
@ -399,7 +399,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
#endif
|
||||
// Execute command buffer.
|
||||
canvas.rootCanvas.GetComponent<CanvasScaler> ().StartCoroutine (_CoUpdateTextureOnNextFrame ());
|
||||
canvas.rootCanvas.GetComponent<CanvasScaler>().StartCoroutine(_CoUpdateTextureOnNextFrame());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -523,7 +523,7 @@ namespace Coffee.UIExtensions
|
||||
if (obj)
|
||||
{
|
||||
obj.Release();
|
||||
RenderTexture.ReleaseTemporary (obj);
|
||||
RenderTexture.ReleaseTemporary(obj);
|
||||
obj = null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
@ -28,13 +26,13 @@ namespace Coffee.UIExtensions
|
||||
/// 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; SetVerticesDirty (); } }
|
||||
public bool horizontal { get { return this.m_Horizontal; } set { this.m_Horizontal = value; SetVerticesDirty(); } }
|
||||
|
||||
/// <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; SetVerticesDirty (); } }
|
||||
public bool vertical { get { return this.m_Veritical; } set { this.m_Veritical = value; SetVerticesDirty(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Call used to modify mesh.
|
||||
|
@ -374,7 +374,7 @@ namespace Coffee.UIExtensions
|
||||
m12 = dx * sin + dy * cos + center;
|
||||
}
|
||||
|
||||
public static Vector2 operator*(Matrix2x3 m, Vector2 v)
|
||||
public static Vector2 operator *(Matrix2x3 m, Vector2 v)
|
||||
{
|
||||
return new Vector2(
|
||||
(m.m00 * v.x) + (m.m01 * v.y) + m.m02,
|
||||
|
@ -1,5 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
@ -24,21 +23,21 @@ namespace Coffee.UIExtensions
|
||||
[Header("Target")]
|
||||
|
||||
[Tooltip("Target color to affect hsv shift.")]
|
||||
[SerializeField] [ColorUsage(false)] Color m_TargetColor = Color.red;
|
||||
[SerializeField][ColorUsage(false)] Color m_TargetColor = Color.red;
|
||||
|
||||
[Tooltip("Color range to affect hsv shift [0 ~ 1].")]
|
||||
[SerializeField] [Range(0, 1)] float m_Range = 0.1f;
|
||||
[SerializeField][Range(0, 1)] float m_Range = 0.1f;
|
||||
|
||||
[Header("Adjustment")]
|
||||
|
||||
[Tooltip("Hue shift [-0.5 ~ 0.5].")]
|
||||
[SerializeField] [Range(-0.5f, 0.5f)] float m_Hue;
|
||||
[SerializeField][Range(-0.5f, 0.5f)] float m_Hue;
|
||||
|
||||
[Tooltip("Saturation shift [-0.5 ~ 0.5].")]
|
||||
[SerializeField] [Range(-0.5f, 0.5f)] float m_Saturation;
|
||||
[SerializeField][Range(-0.5f, 0.5f)] float m_Saturation;
|
||||
|
||||
[Tooltip("Value shift [-0.5 ~ 0.5].")]
|
||||
[SerializeField] [Range(-0.5f, 0.5f)] float m_Value;
|
||||
[SerializeField][Range(-0.5f, 0.5f)] float m_Value;
|
||||
|
||||
|
||||
//################################
|
||||
@ -175,7 +174,7 @@ namespace Coffee.UIExtensions
|
||||
|
||||
foreach (var m in materials)
|
||||
{
|
||||
ptex.RegisterMaterial (m);
|
||||
ptex.RegisterMaterial(m);
|
||||
}
|
||||
|
||||
ptex.SetData(this, 0, h); // param1.x : target hue
|
||||
|
@ -5,8 +5,6 @@ using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
@ -69,17 +67,18 @@ namespace Coffee.UIExtensions
|
||||
[Tooltip("Shadow effect style.")]
|
||||
[SerializeField] ShadowStyle m_Style = ShadowStyle.Shadow;
|
||||
|
||||
#pragma warning disable 0414
|
||||
[HideInInspector][System.Obsolete]
|
||||
#pragma warning disable 0414
|
||||
[HideInInspector]
|
||||
[System.Obsolete]
|
||||
[SerializeField] List<AdditionalShadow> m_AdditionalShadows = new List<AdditionalShadow>();
|
||||
#pragma warning restore 0414
|
||||
#pragma warning restore 0414
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private Color m_EffectColor = new Color (0f, 0f, 0f, 0.5f);
|
||||
private Color m_EffectColor = new Color(0f, 0f, 0f, 0.5f);
|
||||
|
||||
[SerializeField]
|
||||
private Vector2 m_EffectDistance = new Vector2 (1f, -1f);
|
||||
private Vector2 m_EffectDistance = new Vector2(1f, -1f);
|
||||
|
||||
[SerializeField]
|
||||
private bool m_UseGraphicAlpha = true;
|
||||
@ -93,7 +92,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
m_EffectColor = value;
|
||||
if (graphic != null)
|
||||
graphic.SetVerticesDirty ();
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +117,7 @@ namespace Coffee.UIExtensions
|
||||
m_EffectDistance = value;
|
||||
|
||||
if (graphic != null)
|
||||
graphic.SetVerticesDirty ();
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +128,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
m_UseGraphicAlpha = value;
|
||||
if (graphic != null)
|
||||
graphic.SetVerticesDirty ();
|
||||
graphic.SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +183,7 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// Gets the parameter texture.
|
||||
/// </summary>
|
||||
public ParameterTexture ptex{ get; private set; }
|
||||
public ParameterTexture ptex { get; private set; }
|
||||
|
||||
int _graphicVertexCount;
|
||||
static readonly List<UIShadow> tmpShadows = new List<UIShadow>();
|
||||
@ -200,12 +199,12 @@ namespace Coffee.UIExtensions
|
||||
ptex.Register(this);
|
||||
}
|
||||
|
||||
#if TMP_PRESENT
|
||||
#if TMP_PRESENT
|
||||
if (isTMPro)
|
||||
{
|
||||
textMeshPro.onCullStateChanged.AddListener (OnCullStateChanged);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
@ -220,15 +219,15 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate ()
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate()
|
||||
{
|
||||
effectDistance = m_EffectDistance;
|
||||
base.OnValidate ();
|
||||
base.OnValidate();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TMP_PRESENT
|
||||
#if TMP_PRESENT
|
||||
protected void OnCullStateChanged (bool state)
|
||||
{
|
||||
SetVerticesDirty ();
|
||||
@ -249,7 +248,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
base.LateUpdate ();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the mesh.
|
||||
@ -433,7 +432,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
|
||||
|
||||
#pragma warning disable 0612
|
||||
#pragma warning disable 0612
|
||||
void UpgradeIfNeeded()
|
||||
{
|
||||
if (0 < m_AdditionalShadows.Count)
|
||||
@ -455,7 +454,7 @@ namespace Coffee.UIExtensions
|
||||
m_AdditionalShadows = null;
|
||||
}
|
||||
}
|
||||
#pragma warning restore 0612
|
||||
#pragma warning restore 0612
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
@ -31,13 +26,13 @@ namespace Coffee.UIExtensions
|
||||
//################################
|
||||
[Tooltip("Location for shiny effect.")]
|
||||
[FormerlySerializedAs("m_Location")]
|
||||
[SerializeField] [Range(0, 1)] float m_EffectFactor = 0;
|
||||
[SerializeField][Range(0, 1)] float m_EffectFactor = 0;
|
||||
|
||||
[Tooltip("Width for shiny effect.")]
|
||||
[SerializeField] [Range(0, 1)] float m_Width = 0.25f;
|
||||
[SerializeField][Range(0, 1)] float m_Width = 0.25f;
|
||||
|
||||
[Tooltip("Rotation for shiny effect.")]
|
||||
[SerializeField] [Range(-180, 180)] float m_Rotation;
|
||||
[SerializeField][Range(-180, 180)] float m_Rotation;
|
||||
|
||||
[Tooltip("Softness for shiny effect.")]
|
||||
[SerializeField][Range(0.01f, 1)] float m_Softness = 1f;
|
||||
@ -56,18 +51,23 @@ namespace Coffee.UIExtensions
|
||||
|
||||
[SerializeField] EffectPlayer m_Player;
|
||||
|
||||
#pragma warning disable 0414
|
||||
[Obsolete][HideInInspector]
|
||||
#pragma warning disable 0414
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] bool m_Play = false;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] bool m_Loop = false;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField][Range(0.1f, 10)] float m_Duration = 1;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField][Range(0, 10)] float m_LoopDelay = 1;
|
||||
[Obsolete][HideInInspector]
|
||||
[Obsolete]
|
||||
[HideInInspector]
|
||||
[SerializeField] AnimatorUpdateMode m_UpdateMode = AnimatorUpdateMode.Normal;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning restore 0414
|
||||
|
||||
|
||||
//################################
|
||||
@ -224,7 +224,7 @@ namespace Coffee.UIExtensions
|
||||
if (!Mathf.Approximately(m_Rotation, value))
|
||||
{
|
||||
m_Rotation = _lastRotation = value;
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ namespace Coffee.UIExtensions
|
||||
if (m_EffectArea != value)
|
||||
{
|
||||
m_EffectArea = value;
|
||||
SetVerticesDirty ();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// Play shinning on enable.
|
||||
/// </summary>
|
||||
[System.Obsolete ("Use Play/Stop method instead")]
|
||||
[System.Obsolete("Use Play/Stop method instead")]
|
||||
public bool play { get { return _player.play; } set { _player.play = value; } }
|
||||
|
||||
/// <summary>
|
||||
@ -308,7 +308,7 @@ namespace Coffee.UIExtensions
|
||||
return MaterialResolver.GetOrGenerateMaterialVariant(Shader.Find(shaderName));
|
||||
}
|
||||
|
||||
#pragma warning disable 0612
|
||||
#pragma warning disable 0612
|
||||
protected override void UpgradeIfNeeded()
|
||||
{
|
||||
// Upgrade for v3.0.0
|
||||
@ -321,7 +321,7 @@ namespace Coffee.UIExtensions
|
||||
_player.updateMode = m_UpdateMode;
|
||||
}
|
||||
}
|
||||
#pragma warning restore 0612
|
||||
#pragma warning restore 0612
|
||||
|
||||
#endif
|
||||
|
||||
@ -337,7 +337,7 @@ namespace Coffee.UIExtensions
|
||||
float normalizedIndex = ptex.GetNormalizedIndex(this);
|
||||
|
||||
// rect.
|
||||
Rect rect = m_EffectArea.GetEffectArea (vh, rectTransform.rect);
|
||||
Rect rect = m_EffectArea.GetEffectArea(vh, rectTransform.rect);
|
||||
|
||||
// rotation.
|
||||
float rad = m_Rotation * Mathf.Deg2Rad;
|
||||
@ -352,11 +352,11 @@ namespace Coffee.UIExtensions
|
||||
for (int i = 0; i < vh.currentVertCount; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
m_EffectArea.GetNormalizedFactor (i, localMatrix, vertex.position, isText, out nomalizedPos);
|
||||
m_EffectArea.GetNormalizedFactor(i, localMatrix, vertex.position, isText, out nomalizedPos);
|
||||
|
||||
vertex.uv0 = new Vector2 (
|
||||
Packer.ToFloat (vertex.uv0.x, vertex.uv0.y),
|
||||
Packer.ToFloat (nomalizedPos.y, normalizedIndex)
|
||||
vertex.uv0 = new Vector2(
|
||||
Packer.ToFloat(vertex.uv0.x, vertex.uv0.y),
|
||||
Packer.ToFloat(nomalizedPos.y, normalizedIndex)
|
||||
);
|
||||
|
||||
vh.SetUIVertex(vertex, i);
|
||||
@ -383,7 +383,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
foreach (var m in materials)
|
||||
{
|
||||
ptex.RegisterMaterial (m);
|
||||
ptex.RegisterMaterial(m);
|
||||
}
|
||||
ptex.SetData(this, 0, m_EffectFactor); // param1.x : location
|
||||
ptex.SetData(this, 1, m_Width); // param1.y : width
|
||||
@ -403,6 +403,6 @@ namespace Coffee.UIExtensions
|
||||
//################################
|
||||
float _lastRotation;
|
||||
|
||||
EffectPlayer _player{ get { return m_Player ?? (m_Player = new EffectPlayer()); } }
|
||||
EffectPlayer _player { get { return m_Player ?? (m_Player = new EffectPlayer()); } }
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
@ -47,13 +46,13 @@ namespace Coffee.UIExtensions
|
||||
[SerializeField] bool m_KeepAspectRatio;
|
||||
|
||||
[Tooltip("Dissolve edge width.")]
|
||||
[SerializeField] [Range(0, 1)] float m_DissolveWidth = 0.5f;
|
||||
[SerializeField][Range(0, 1)] float m_DissolveWidth = 0.5f;
|
||||
|
||||
[Tooltip("Dissolve edge softness.")]
|
||||
[SerializeField] [Range(0, 1)] float m_DissolveSoftness = 0.5f;
|
||||
[SerializeField][Range(0, 1)] float m_DissolveSoftness = 0.5f;
|
||||
|
||||
[Tooltip("Dissolve edge color.")]
|
||||
[SerializeField] [ColorUsage(false)] Color m_DissolveColor = new Color(0.0f, 0.25f, 1.0f);
|
||||
[SerializeField][ColorUsage(false)] Color m_DissolveColor = new Color(0.0f, 0.25f, 1.0f);
|
||||
|
||||
[Tooltip("Disable graphic's raycast target on hidden.")]
|
||||
[SerializeField] bool m_PassRayOnHidden;
|
||||
@ -263,12 +262,12 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
|
||||
bool isText = isTMPro || graphic is Text;
|
||||
float normalizedIndex = ptex.GetNormalizedIndex (this);
|
||||
float normalizedIndex = ptex.GetNormalizedIndex(this);
|
||||
|
||||
// rect.
|
||||
var tex = transitionTexture;
|
||||
var aspectRatio = m_KeepAspectRatio && tex ? ((float)tex.width) / tex.height : -1;
|
||||
Rect rect = m_EffectArea.GetEffectArea (vh, rectTransform.rect, aspectRatio);
|
||||
Rect rect = m_EffectArea.GetEffectArea(vh, rectTransform.rect, aspectRatio);
|
||||
|
||||
// Set prameters to vertex.
|
||||
UIVertex vertex = default(UIVertex);
|
||||
@ -277,11 +276,11 @@ namespace Coffee.UIExtensions
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vertex, i);
|
||||
m_EffectArea.GetPositionFactor (i, rect, vertex.position, isText, isTMPro, out x, out y);
|
||||
m_EffectArea.GetPositionFactor(i, rect, vertex.position, isText, isTMPro, out x, out y);
|
||||
|
||||
vertex.uv0 = new Vector2 (
|
||||
Packer.ToFloat (vertex.uv0.x, vertex.uv0.y),
|
||||
Packer.ToFloat (x, y, normalizedIndex)
|
||||
vertex.uv0 = new Vector2(
|
||||
Packer.ToFloat(vertex.uv0.x, vertex.uv0.y),
|
||||
Packer.ToFloat(x, y, normalizedIndex)
|
||||
);
|
||||
vh.SetUIVertex(vertex, i);
|
||||
}
|
||||
@ -306,7 +305,7 @@ namespace Coffee.UIExtensions
|
||||
/// </summary>
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable ();
|
||||
base.OnDisable();
|
||||
MaterialCache.Unregister(_materialCache);
|
||||
_materialCache = null;
|
||||
_player.OnDisable();
|
||||
@ -316,7 +315,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
foreach (var m in materials)
|
||||
{
|
||||
ptex.RegisterMaterial (m);
|
||||
ptex.RegisterMaterial(m);
|
||||
}
|
||||
ptex.SetData(this, 0, m_EffectFactor); // param1.x : effect factor
|
||||
if (m_EffectMode == EffectMode.Dissolve)
|
||||
@ -351,6 +350,6 @@ namespace Coffee.UIExtensions
|
||||
//################################
|
||||
MaterialCache _materialCache = null;
|
||||
|
||||
EffectPlayer _player{ get { return m_Player ?? (m_Player = new EffectPlayer()); } }
|
||||
EffectPlayer _player { get { return m_Player ?? (m_Player = new EffectPlayer()); } }
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Created: 2018/07/13
|
||||
|
||||
#if true // MODULE_MARKER
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
@ -50,11 +49,12 @@ namespace DG.Tweening
|
||||
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
|
||||
public static TweenerCore<float, float, FloatOptions> DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration)
|
||||
{
|
||||
TweenerCore<float, float, FloatOptions> t = DOTween.To(()=> {
|
||||
TweenerCore<float, float, FloatOptions> t = DOTween.To(() =>
|
||||
{
|
||||
float currVal;
|
||||
target.GetFloat(floatName, out currVal);
|
||||
return currVal;
|
||||
}, x=> target.SetFloat(floatName, x), endValue, duration);
|
||||
}, x => target.SetFloat(floatName, x), endValue, duration);
|
||||
t.SetTarget(target);
|
||||
return t;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using UnityEngine;
|
||||
|
||||
#if false || EPO_DOTWEEN // MODULE_MARKER
|
||||
#if false || EPO_DOTWEEN // MODULE_MARKER
|
||||
|
||||
using EPOOutline;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Created: 2018/07/13
|
||||
|
||||
#if true // MODULE_MARKER
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Plugins;
|
||||
@ -116,8 +115,10 @@ namespace DG.Tweening
|
||||
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
|
||||
).Join(yTween)
|
||||
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||
yTween.OnUpdate(() => {
|
||||
if (!offsetYSet) {
|
||||
yTween.OnUpdate(() =>
|
||||
{
|
||||
if (!offsetYSet)
|
||||
{
|
||||
offsetYSet = true;
|
||||
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Created: 2018/07/13
|
||||
|
||||
#if true // MODULE_MARKER
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins;
|
||||
using DG.Tweening.Plugins.Core.PathCore;
|
||||
@ -87,8 +86,10 @@ namespace DG.Tweening
|
||||
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
||||
).Join(yTween)
|
||||
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||
yTween.OnUpdate(() => {
|
||||
if (!offsetYSet) {
|
||||
yTween.OnUpdate(() =>
|
||||
{
|
||||
if (!offsetYSet)
|
||||
{
|
||||
offsetYSet = true;
|
||||
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
||||
}
|
||||
|
@ -2,10 +2,9 @@
|
||||
// Created: 2018/07/13
|
||||
|
||||
#if true // MODULE_MARKER
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable 1591
|
||||
namespace DG.Tweening
|
||||
@ -45,9 +44,11 @@ namespace DG.Tweening
|
||||
Sequence s = DOTween.Sequence();
|
||||
GradientColorKey[] colors = gradient.colorKeys;
|
||||
int len = colors.Length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
GradientColorKey c = colors[i];
|
||||
if (i == 0 && c.time <= 0) {
|
||||
if (i == 0 && c.time <= 0)
|
||||
{
|
||||
target.color = c.color;
|
||||
continue;
|
||||
}
|
||||
@ -75,7 +76,8 @@ namespace DG.Tweening
|
||||
{
|
||||
endValue = endValue - target.color;
|
||||
Color to = new Color(0, 0, 0, 0);
|
||||
return DOTween.To(() => to, x => {
|
||||
return DOTween.To(() => to, x =>
|
||||
{
|
||||
Color diff = x - to;
|
||||
to = x;
|
||||
target.color += diff;
|
||||
|
@ -3,14 +3,13 @@
|
||||
|
||||
#if true // MODULE_MARKER
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Plugins;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using System.Globalization;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Outline = UnityEngine.UI.Outline;
|
||||
using Text = UnityEngine.UI.Text;
|
||||
|
||||
@ -102,9 +101,11 @@ namespace DG.Tweening
|
||||
Sequence s = DOTween.Sequence();
|
||||
GradientColorKey[] colors = gradient.colorKeys;
|
||||
int len = colors.Length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
GradientColorKey c = colors[i];
|
||||
if (i == 0 && c.time <= 0) {
|
||||
if (i == 0 && c.time <= 0)
|
||||
{
|
||||
target.color = c.color;
|
||||
continue;
|
||||
}
|
||||
@ -127,7 +128,8 @@ namespace DG.Tweening
|
||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||
{
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => {
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x =>
|
||||
{
|
||||
target.flexibleWidth = x.x;
|
||||
target.flexibleHeight = x.y;
|
||||
}, endValue, duration);
|
||||
@ -141,7 +143,8 @@ namespace DG.Tweening
|
||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||
{
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => {
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x =>
|
||||
{
|
||||
target.minWidth = x.x;
|
||||
target.minHeight = x.y;
|
||||
}, endValue, duration);
|
||||
@ -155,7 +158,8 @@ namespace DG.Tweening
|
||||
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
|
||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false)
|
||||
{
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => {
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x =>
|
||||
{
|
||||
target.preferredWidth = x.x;
|
||||
target.preferredHeight = x.y;
|
||||
}, endValue, duration);
|
||||
@ -404,13 +408,15 @@ namespace DG.Tweening
|
||||
Tween yTween = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
|
||||
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
|
||||
.SetLoops(numJumps * 2, LoopType.Yoyo)
|
||||
.OnStart(()=> startPosY = target.anchoredPosition.y);
|
||||
.OnStart(() => startPosY = target.anchoredPosition.y);
|
||||
s.Append(DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue.x, 0), duration)
|
||||
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
|
||||
).Join(yTween)
|
||||
.SetTarget(target).SetEase(DOTween.defaultEaseType);
|
||||
s.OnUpdate(() => {
|
||||
if (!offsetYSet) {
|
||||
s.OnUpdate(() =>
|
||||
{
|
||||
if (!offsetYSet)
|
||||
{
|
||||
offsetYSet = true;
|
||||
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
|
||||
}
|
||||
@ -434,7 +440,8 @@ namespace DG.Tweening
|
||||
public static Tweener DONormalizedPos(this ScrollRect target, Vector2 endValue, float duration, bool snapping = false)
|
||||
{
|
||||
return DOTween.To(() => new Vector2(target.horizontalNormalizedPosition, target.verticalNormalizedPosition),
|
||||
x => {
|
||||
x =>
|
||||
{
|
||||
target.horizontalNormalizedPosition = x.x;
|
||||
target.verticalNormalizedPosition = x.y;
|
||||
}, endValue, duration)
|
||||
@ -498,10 +505,12 @@ namespace DG.Tweening
|
||||
/// <param name="culture">The <see cref="CultureInfo"/> to use (InvariantCulture if NULL)</param>
|
||||
public static TweenerCore<int, int, NoOptions> DOCounter(
|
||||
this Text target, int fromValue, int endValue, float duration, bool addThousandsSeparator = true, CultureInfo culture = null
|
||||
){
|
||||
)
|
||||
{
|
||||
int v = fromValue;
|
||||
CultureInfo cInfo = !addThousandsSeparator ? null : culture ?? CultureInfo.InvariantCulture;
|
||||
TweenerCore<int, int, NoOptions> t = DOTween.To(() => v, x => {
|
||||
TweenerCore<int, int, NoOptions> t = DOTween.To(() => v, x =>
|
||||
{
|
||||
v = x;
|
||||
target.text = addThousandsSeparator
|
||||
? v.ToString("N0", cInfo)
|
||||
@ -532,7 +541,8 @@ namespace DG.Tweening
|
||||
/// Leave it to NULL (default) to use default ones</param>
|
||||
public static TweenerCore<string, string, StringOptions> DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
|
||||
{
|
||||
if (endValue == null) {
|
||||
if (endValue == null)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogWarning("You can't pass a NULL string to DOText: an empty string will be used instead to avoid errors");
|
||||
endValue = "";
|
||||
}
|
||||
@ -557,7 +567,8 @@ namespace DG.Tweening
|
||||
{
|
||||
endValue = endValue - target.color;
|
||||
Color to = new Color(0, 0, 0, 0);
|
||||
return DOTween.To(() => to, x => {
|
||||
return DOTween.To(() => to, x =>
|
||||
{
|
||||
Color diff = x - to;
|
||||
to = x;
|
||||
target.color += diff;
|
||||
@ -578,7 +589,8 @@ namespace DG.Tweening
|
||||
{
|
||||
endValue = endValue - target.color;
|
||||
Color to = new Color(0, 0, 0, 0);
|
||||
return DOTween.To(() => to, x => {
|
||||
return DOTween.To(() => to, x =>
|
||||
{
|
||||
Color diff = x - to;
|
||||
to = x;
|
||||
target.color += diff;
|
||||
@ -599,7 +611,8 @@ namespace DG.Tweening
|
||||
{
|
||||
endValue = endValue - target.color;
|
||||
Color to = new Color(0, 0, 0, 0);
|
||||
return DOTween.To(() => to, x => {
|
||||
return DOTween.To(() => to, x =>
|
||||
{
|
||||
Color diff = x - to;
|
||||
to = x;
|
||||
target.color += diff;
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Author: Daniele Giardini - http://www.demigiant.com
|
||||
// Created: 2018/07/13
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
//#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0)
|
||||
//using Task = System.Threading.Tasks.Task;
|
||||
//#endif
|
||||
@ -29,9 +28,11 @@ namespace DG.Tweening
|
||||
Sequence s = DOTween.Sequence();
|
||||
GradientColorKey[] colors = gradient.colorKeys;
|
||||
int len = colors.Length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
GradientColorKey c = colors[i];
|
||||
if (i == 0 && c.time <= 0) {
|
||||
if (i == 0 && c.time <= 0)
|
||||
{
|
||||
target.color = c.color;
|
||||
continue;
|
||||
}
|
||||
@ -54,9 +55,11 @@ namespace DG.Tweening
|
||||
Sequence s = DOTween.Sequence();
|
||||
GradientColorKey[] colors = gradient.colorKeys;
|
||||
int len = colors.Length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
GradientColorKey c = colors[i];
|
||||
if (i == 0 && c.time <= 0) {
|
||||
if (i == 0 && c.time <= 0)
|
||||
{
|
||||
target.SetColor(property, c.color);
|
||||
continue;
|
||||
}
|
||||
@ -80,7 +83,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static CustomYieldInstruction WaitForCompletion(this Tween t, bool returnCustomYieldInstruction)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return null;
|
||||
}
|
||||
@ -94,7 +98,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static CustomYieldInstruction WaitForRewind(this Tween t, bool returnCustomYieldInstruction)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return null;
|
||||
}
|
||||
@ -108,7 +113,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static CustomYieldInstruction WaitForKill(this Tween t, bool returnCustomYieldInstruction)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return null;
|
||||
}
|
||||
@ -123,7 +129,8 @@ namespace DG.Tweening
|
||||
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
|
||||
public static CustomYieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops, bool returnCustomYieldInstruction)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return null;
|
||||
}
|
||||
@ -139,7 +146,8 @@ namespace DG.Tweening
|
||||
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
|
||||
public static CustomYieldInstruction WaitForPosition(this Tween t, float position, bool returnCustomYieldInstruction)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return null;
|
||||
}
|
||||
@ -154,7 +162,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static CustomYieldInstruction WaitForStart(this Tween t, bool returnCustomYieldInstruction)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return null;
|
||||
}
|
||||
@ -175,7 +184,8 @@ namespace DG.Tweening
|
||||
/// <param name="duration">The duration of the tween</param>
|
||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOOffset(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||
{
|
||||
if (!target.HasProperty(propertyID)) {
|
||||
if (!target.HasProperty(propertyID))
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||
return null;
|
||||
}
|
||||
@ -191,7 +201,8 @@ namespace DG.Tweening
|
||||
/// <param name="duration">The duration of the tween</param>
|
||||
public static TweenerCore<Vector2, Vector2, VectorOptions> DOTiling(this Material target, Vector2 endValue, int propertyID, float duration)
|
||||
{
|
||||
if (!target.HasProperty(propertyID)) {
|
||||
if (!target.HasProperty(propertyID))
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID);
|
||||
return null;
|
||||
}
|
||||
@ -215,7 +226,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static async System.Threading.Tasks.Task AsyncWaitForCompletion(this Tween t)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return;
|
||||
}
|
||||
@ -229,7 +241,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static async System.Threading.Tasks.Task AsyncWaitForRewind(this Tween t)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return;
|
||||
}
|
||||
@ -243,7 +256,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static async System.Threading.Tasks.Task AsyncWaitForKill(this Tween t)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return;
|
||||
}
|
||||
@ -258,7 +272,8 @@ namespace DG.Tweening
|
||||
/// <param name="elapsedLoops">Elapsed loops to wait for</param>
|
||||
public static async System.Threading.Tasks.Task AsyncWaitForElapsedLoops(this Tween t, int elapsedLoops)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return;
|
||||
}
|
||||
@ -274,7 +289,8 @@ namespace DG.Tweening
|
||||
/// <param name="position">Position (loops included, delays excluded) to wait for</param>
|
||||
public static async System.Threading.Tasks.Task AsyncWaitForPosition(this Tween t, float position)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return;
|
||||
}
|
||||
@ -288,7 +304,8 @@ namespace DG.Tweening
|
||||
/// </summary>
|
||||
public static async System.Threading.Tasks.Task AsyncWaitForStart(this Tween t)
|
||||
{
|
||||
if (!t.active) {
|
||||
if (!t.active)
|
||||
{
|
||||
if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t);
|
||||
return;
|
||||
}
|
||||
@ -312,9 +329,13 @@ namespace DG.Tweening
|
||||
{
|
||||
public class WaitForCompletion : CustomYieldInstruction
|
||||
{
|
||||
public override bool keepWaiting { get {
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return t.active && !t.IsComplete();
|
||||
}}
|
||||
}
|
||||
}
|
||||
readonly Tween t;
|
||||
public WaitForCompletion(Tween tween)
|
||||
{
|
||||
@ -324,9 +345,13 @@ namespace DG.Tweening
|
||||
|
||||
public class WaitForRewind : CustomYieldInstruction
|
||||
{
|
||||
public override bool keepWaiting { get {
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0);
|
||||
}}
|
||||
}
|
||||
}
|
||||
readonly Tween t;
|
||||
public WaitForRewind(Tween tween)
|
||||
{
|
||||
@ -336,9 +361,13 @@ namespace DG.Tweening
|
||||
|
||||
public class WaitForKill : CustomYieldInstruction
|
||||
{
|
||||
public override bool keepWaiting { get {
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return t.active;
|
||||
}}
|
||||
}
|
||||
}
|
||||
readonly Tween t;
|
||||
public WaitForKill(Tween tween)
|
||||
{
|
||||
@ -348,9 +377,13 @@ namespace DG.Tweening
|
||||
|
||||
public class WaitForElapsedLoops : CustomYieldInstruction
|
||||
{
|
||||
public override bool keepWaiting { get {
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return t.active && t.CompletedLoops() < elapsedLoops;
|
||||
}}
|
||||
}
|
||||
}
|
||||
readonly Tween t;
|
||||
readonly int elapsedLoops;
|
||||
public WaitForElapsedLoops(Tween tween, int elapsedLoops)
|
||||
@ -362,9 +395,13 @@ namespace DG.Tweening
|
||||
|
||||
public class WaitForPosition : CustomYieldInstruction
|
||||
{
|
||||
public override bool keepWaiting { get {
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return t.active && t.position * (t.CompletedLoops() + 1) < position;
|
||||
}}
|
||||
}
|
||||
}
|
||||
readonly Tween t;
|
||||
readonly float position;
|
||||
public WaitForPosition(Tween tween, float position)
|
||||
@ -376,9 +413,13 @@ namespace DG.Tweening
|
||||
|
||||
public class WaitForStart : CustomYieldInstruction
|
||||
{
|
||||
public override bool keepWaiting { get {
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return t.active && !t.playedOnce;
|
||||
}}
|
||||
}
|
||||
}
|
||||
readonly Tween t;
|
||||
public WaitForStart(Tween tween)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Author: Daniele Giardini - http://www.demigiant.com
|
||||
// Created: 2018/07/13
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Core.PathCore;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable 1591
|
||||
namespace DG.Tweening
|
||||
@ -69,7 +69,7 @@ namespace DG.Tweening
|
||||
// Fires OnApplicationPause in DOTweenComponent even when Editor is paused (otherwise it's only fired at runtime)
|
||||
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1
|
||||
static void PlaymodeStateChanged()
|
||||
#else
|
||||
#else
|
||||
static void PlaymodeStateChanged(UnityEditor.PlayModeStateChange state)
|
||||
#endif
|
||||
{
|
||||
@ -128,13 +128,16 @@ namespace DG.Tweening
|
||||
#endif
|
||||
public static TweenerCore<Vector3, Path, PathOptions> CreateDOTweenPathTween(
|
||||
MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode
|
||||
){
|
||||
)
|
||||
{
|
||||
TweenerCore<Vector3, Path, PathOptions> t = null;
|
||||
bool rBodyFoundAndTweened = false;
|
||||
#if true // PHYSICS_MARKER
|
||||
if (tweenRigidbody) {
|
||||
if (tweenRigidbody)
|
||||
{
|
||||
Rigidbody rBody = target.GetComponent<Rigidbody>();
|
||||
if (rBody != null) {
|
||||
if (rBody != null)
|
||||
{
|
||||
rBodyFoundAndTweened = true;
|
||||
t = isLocal
|
||||
? rBody.DOLocalPath(path, duration, pathMode)
|
||||
@ -143,9 +146,11 @@ namespace DG.Tweening
|
||||
}
|
||||
#endif
|
||||
#if true // PHYSICS2D_MARKER
|
||||
if (!rBodyFoundAndTweened && tweenRigidbody) {
|
||||
if (!rBodyFoundAndTweened && tweenRigidbody)
|
||||
{
|
||||
Rigidbody2D rBody2D = target.GetComponent<Rigidbody2D>();
|
||||
if (rBody2D != null) {
|
||||
if (rBody2D != null)
|
||||
{
|
||||
rBodyFoundAndTweened = true;
|
||||
t = isLocal
|
||||
? rBody2D.DOLocalPath(path, duration, pathMode)
|
||||
@ -153,7 +158,8 @@ namespace DG.Tweening
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!rBodyFoundAndTweened) {
|
||||
if (!rBodyFoundAndTweened)
|
||||
{
|
||||
t = isLocal
|
||||
? target.transform.DOLocalPath(path, duration, pathMode)
|
||||
: target.transform.DOPath(path, duration, pathMode);
|
||||
|
Binary file not shown.
@ -1,86 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1818bd4d6ed568f4f98c1750b011c967
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 0
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 0
|
||||
Exclude Win64: 0
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
104
AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/Disable.anim
Normal file
104
AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/Disable.anim
Normal file
@ -0,0 +1,104 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Disable
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Alpha
|
||||
path:
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 1574349066
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 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: 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:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Alpha
|
||||
path:
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25f1c28c99920124189b7173731c38b5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,57 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1101 &-6499513247890378152
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: active
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: -2169522966389634846}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.1
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.875
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1102 &-2169522966389634846
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Disable
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 8949275168816232509}
|
||||
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_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 25f1c28c99920124189b7173731c38b5, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8,7 +60,19 @@ AnimatorController:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SelectBorder
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorParameters:
|
||||
- m_Name: active
|
||||
m_Type: 4
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
- m_Name: reactive
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
@ -33,7 +97,10 @@ AnimatorStateMachine:
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 5956899137579874003}
|
||||
m_Position: {x: 340, y: 100, z: 0}
|
||||
m_Position: {x: 380, y: 70, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -2169522966389634846}
|
||||
m_Position: {x: 350, y: 200, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
@ -44,6 +111,31 @@ AnimatorStateMachine:
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: 5956899137579874003}
|
||||
--- !u!1101 &1182501105974621518
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: reactive
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 5956899137579874003}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.875
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1102 &5956899137579874003
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
@ -51,10 +143,12 @@ AnimatorState:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DEFAULT
|
||||
m_Name: Enable
|
||||
m_Speed: 1.6
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_Transitions:
|
||||
- {fileID: -6499513247890378152}
|
||||
- {fileID: 1182501105974621518}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@ -70,3 +164,28 @@ AnimatorState:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &8949275168816232509
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: active
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 5956899137579874003}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.1
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
|
@ -1,7 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public static class EventInvoker
|
||||
|
@ -26,7 +26,22 @@ namespace AxibugEmuOnline.Client
|
||||
where t.DeclaringType.IsSubclassOf(typeof(FilterEffect))
|
||||
orderby t.MetadataToken
|
||||
select t);
|
||||
m_editableParamList = parameters.Select(p => new EditableParamerter(p.Name, (ParameterOverride)p.GetValue(this))).ToList();
|
||||
|
||||
m_editableParamList = new List<EditableParamerter>();
|
||||
foreach (var param in parameters)
|
||||
{
|
||||
var paramObj = (ParameterOverride)param.GetValue(this);
|
||||
var rangeAtt = param.GetCustomAttribute<RangeAttribute>();
|
||||
float min = 0;
|
||||
float max = 10;
|
||||
if (rangeAtt != null)
|
||||
{
|
||||
min = rangeAtt.min; max = rangeAtt.max;
|
||||
}
|
||||
|
||||
var editableParam = new EditableParamerter(param.Name, paramObj, min, max);
|
||||
m_editableParamList.Add(editableParam);
|
||||
}
|
||||
}
|
||||
|
||||
public class EditableParamerter
|
||||
@ -42,9 +57,13 @@ namespace AxibugEmuOnline.Client
|
||||
set
|
||||
{
|
||||
valueFieldInfo.SetValue(m_paramObject, value);
|
||||
m_paramObject.overrideState = true;
|
||||
}
|
||||
}
|
||||
public EditableParamerter(string name, ParameterOverride paramObject)
|
||||
public object MinValue { get; private set; }
|
||||
public object MaxValue { get; private set; }
|
||||
|
||||
public EditableParamerter(string name, ParameterOverride paramObject, object minValue, object maxValue)
|
||||
{
|
||||
m_paramObject = paramObject;
|
||||
Name = name;
|
||||
@ -60,18 +79,16 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
ValueType = typeof(object);
|
||||
}
|
||||
|
||||
MinValue = minValue;
|
||||
MaxValue = maxValue;
|
||||
}
|
||||
|
||||
public void ResetToDefault() => m_paramObject.overrideState = false;
|
||||
|
||||
public string Serilized()
|
||||
{
|
||||
return JsonUtility.ToJson(Value);
|
||||
}
|
||||
|
||||
public void Apply(string json)
|
||||
public void Apply(object overrideValue)
|
||||
{
|
||||
var overrideValue = JsonUtility.FromJson(json, ValueType);
|
||||
Value = overrideValue;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using AxibugEmuOnline.Client;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public abstract class CommandChanger : IKeyMapperChanger
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ using AxibugEmuOnline.Client.Common;
|
||||
using AxibugEmuOnline.Client.Event;
|
||||
using AxibugEmuOnline.Client.Network;
|
||||
using AxibugProtobuf;
|
||||
using System;
|
||||
|
||||
namespace AxibugEmuOnline.Client.Manager
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Event;
|
||||
using MyNes.Core;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client.Manager
|
||||
@ -74,7 +72,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
|
||||
public void ResetGame()
|
||||
{
|
||||
if(m_emuCore.IsNull()) return;
|
||||
if (m_emuCore.IsNull()) return;
|
||||
|
||||
m_emuCore.DoReset();
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
/// <param name="reqData"></param>
|
||||
void RecvLeavnRoom(byte[] reqData)
|
||||
{
|
||||
App.log.Debug("加入房间成功");
|
||||
App.log.Debug("离开房间成功");
|
||||
Protobuf_Room_Leave_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Leave_RESP>(reqData);
|
||||
ReleaseRePlay();
|
||||
mineRoomMiniInfo = null;
|
||||
@ -374,6 +374,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
byte[] decompressRawData = Helper.DecompressByteArray(msg.LoadStateRaw.ToByteArray());
|
||||
App.log.Info($"收到即时存档数据 解压后;{decompressRawData.Length}");
|
||||
RawData = decompressRawData;
|
||||
ReleaseRePlay();
|
||||
}
|
||||
Eventer.Instance.PostEvent(EEvent.OnRoomWaitStepChange, WaitStep);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using DG.Tweening;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -95,7 +95,8 @@ namespace AxibugEmuOnline.Client
|
||||
filter = Filters.FirstOrDefault(f => f.Name == value.filterName);
|
||||
if (filter != null)
|
||||
{
|
||||
preset = filter.Presets.FirstOrDefault(p => p.Name == value.filterName);
|
||||
string presetName = value.presetName;
|
||||
preset = filter.Presets.FirstOrDefault(p => p.Name == presetName);
|
||||
}
|
||||
|
||||
return (filter, preset);
|
||||
@ -127,9 +128,9 @@ namespace AxibugEmuOnline.Client
|
||||
else Presets = loadedPresets.presets;
|
||||
}
|
||||
|
||||
private void savePresets()
|
||||
public void SavePresets()
|
||||
{
|
||||
var json = JsonUtility.ToJson(new FilterPresetList { presets = Presets });
|
||||
var json = JsonUtility.ToJson(new FilterPresetList(Presets));
|
||||
PlayerPrefs.SetString($"Filter_{Name}_PresetList", json);
|
||||
}
|
||||
|
||||
@ -142,7 +143,7 @@ namespace AxibugEmuOnline.Client
|
||||
newPreset = new FilterPreset(presetName);
|
||||
Presets.Add(newPreset);
|
||||
|
||||
savePresets();
|
||||
SavePresets();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -150,7 +151,7 @@ namespace AxibugEmuOnline.Client
|
||||
public void RemovePreset(FilterPreset preset)
|
||||
{
|
||||
if (!Presets.Remove(preset)) return;
|
||||
savePresets();
|
||||
SavePresets();
|
||||
|
||||
EventInvoker.RaiseFilterPresetRemoved(this, preset);
|
||||
}
|
||||
@ -167,11 +168,11 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
foreach (var param in Paramerters)
|
||||
{
|
||||
var json = preset.GetParamValueJson(param.Name);
|
||||
if (string.IsNullOrEmpty(json))
|
||||
var value = preset.GetParamValue(param.Name, param.ValueType);
|
||||
if (value == null)
|
||||
param.ResetToDefault();
|
||||
else
|
||||
param.Apply(json);
|
||||
param.Apply(value);
|
||||
}
|
||||
|
||||
}
|
||||
@ -183,6 +184,15 @@ namespace AxibugEmuOnline.Client
|
||||
private class FilterPresetList
|
||||
{
|
||||
public List<FilterPreset> presets;
|
||||
|
||||
public FilterPresetList(List<FilterPreset> presets)
|
||||
{
|
||||
this.presets = presets;
|
||||
foreach (var preset in presets)
|
||||
{
|
||||
preset.ReadyForJson();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@ -202,6 +212,14 @@ namespace AxibugEmuOnline.Client
|
||||
Name = presetName;
|
||||
}
|
||||
|
||||
public void ReadyForJson()
|
||||
{
|
||||
prepareCache();
|
||||
|
||||
m_paramName = m_paramName2ValueJson.Keys.ToList();
|
||||
m_valueJson = m_paramName2ValueJson.Values.ToList();
|
||||
}
|
||||
|
||||
public string GetParamValueJson(string paramName)
|
||||
{
|
||||
prepareCache();
|
||||
@ -210,6 +228,43 @@ namespace AxibugEmuOnline.Client
|
||||
return value;
|
||||
}
|
||||
|
||||
public object GetParamValue(string paramName, Type valueType)
|
||||
{
|
||||
var rawStr = GetParamValueJson(paramName);
|
||||
if (rawStr == null) return null;
|
||||
|
||||
if (valueType == typeof(float))
|
||||
{
|
||||
float.TryParse(rawStr, out var floatVal);
|
||||
return floatVal;
|
||||
}
|
||||
else if (valueType.IsEnum)
|
||||
{
|
||||
var names = Enum.GetNames(valueType);
|
||||
var values = Enum.GetValues(valueType);
|
||||
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
{
|
||||
if (names[i].Equals(rawStr))
|
||||
{
|
||||
return values.GetValue(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.log.Error($"尚未支持的滤镜参数类型{valueType}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParamValue(string paramName, Type valueType, object value)
|
||||
{
|
||||
prepareCache();
|
||||
m_paramName2ValueJson[paramName] = value.ToString();
|
||||
}
|
||||
|
||||
private void prepareCache()
|
||||
{
|
||||
if (m_cacheReady) return;
|
||||
|
@ -5,8 +5,6 @@ using AxibugEmuOnline.Client.Network;
|
||||
using AxibugProtobuf;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine.EventSystems;
|
||||
using static AxibugEmuOnline.Client.ClientCore.RomDB;
|
||||
|
||||
namespace AxibugEmuOnline.Client.Manager
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ namespace AxibugEmuOnline.Client
|
||||
int step = channels;
|
||||
|
||||
if (NesEmu == null || NesEmu.NesCore == null) return;
|
||||
if (NesEmu.IsPause) return;
|
||||
|
||||
ProcessSound(NesEmu.NesCore, (uint)(data.Length / channels));
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using VirtualNes.Core;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
|
@ -21,7 +21,9 @@ namespace AxibugEmuOnline.Client
|
||||
//音频驱动(这里是Unity接收模拟器音频数据的并播放出来的实现)
|
||||
public AudioProvider AudioProvider;
|
||||
//是否暂停
|
||||
public bool m_bPause;
|
||||
private bool m_bPause;
|
||||
/// <summary> 是否暂停 </summary>
|
||||
public bool IsPause => m_bPause;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
@ -2,24 +2,20 @@
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NesEmulator_Screen
|
||||
m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
@ -63,7 +59,6 @@ Material:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
@ -92,4 +87,3 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
|
@ -1,11 +1,8 @@
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using VirtualNes.Core;
|
||||
using static UnityEngine.UI.CanvasScaler;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ using HaoYueNet.ClientNetworkNet.Standard2;
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AxibugEmuOnline.Client.Network
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
@ -88,12 +89,16 @@ namespace AxibugEmuOnline.Client
|
||||
private Filter m_filter;
|
||||
private FilterPreset m_preset;
|
||||
private OptionUI_MenuItem m_ui;
|
||||
private List<OptionMenu> m_menu;
|
||||
|
||||
public Opt_Presets(Filter filter, FilterPreset preset) : base(preset.Name, null)
|
||||
{
|
||||
m_filter = filter;
|
||||
m_preset = preset;
|
||||
|
||||
m_menu = new List<OptionMenu>();
|
||||
m_menu.Add(new Opt_Delete(m_filter, m_preset));
|
||||
foreach (var p in m_filter.Paramerters) m_menu.Add(new Opt_ParamEditor(m_filter, p, m_preset));
|
||||
}
|
||||
|
||||
public override void OnShow(OptionUI_MenuItem ui)
|
||||
@ -122,7 +127,37 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected override List<OptionMenu> GetOptionMenus()
|
||||
{
|
||||
return new List<OptionMenu> { new Opt_Delete(m_filter, m_preset) };
|
||||
return m_menu;
|
||||
}
|
||||
|
||||
public class Opt_ParamEditor : ValueSetMenu
|
||||
{
|
||||
private Filter m_filter;
|
||||
private FilterEffect.EditableParamerter m_param;
|
||||
private FilterPreset m_preset;
|
||||
|
||||
public Opt_ParamEditor(Filter filter, FilterEffect.EditableParamerter editParam, FilterPreset preset)
|
||||
: base(editParam.Name)
|
||||
{
|
||||
m_filter = filter;
|
||||
m_param = editParam;
|
||||
m_preset = preset;
|
||||
}
|
||||
|
||||
public override Type ValueType => m_param.ValueType;
|
||||
|
||||
public override object ValueRaw => m_preset.GetParamValue(m_param.Name, ValueType) ?? m_param.Value;
|
||||
|
||||
public override void OnValueChanged(object newValue)
|
||||
{
|
||||
m_preset.SetParamValue(m_param.Name, ValueType, newValue);
|
||||
m_filter.SavePresets();
|
||||
m_param.Apply(newValue);
|
||||
}
|
||||
|
||||
public override object Min => m_param.MinValue;
|
||||
|
||||
public override object Max => m_param.MaxValue;
|
||||
}
|
||||
|
||||
public class Opt_Delete : ExecuteMenu
|
||||
@ -141,6 +176,8 @@ namespace AxibugEmuOnline.Client
|
||||
m_filter.RemovePreset(m_preset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
|
@ -38,7 +38,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
m_stepPerformer = new StepPerformer(this);
|
||||
|
||||
//menus.Add(new InGameUI_FilterSetting(this));
|
||||
menus.Add(new InGameUI_FilterSetting(this));
|
||||
menus.Add(new InGameUI_Reset(this));
|
||||
menus.Add(new InGameUI_SaveState(this));
|
||||
menus.Add(new InGameUI_LoadState(this));
|
||||
|
@ -0,0 +1,62 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static AxibugEmuOnline.Client.FilterManager;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class InGameUI_FilterSetting : ExpandMenu
|
||||
{
|
||||
private InGameUI m_gameUI;
|
||||
|
||||
public InGameUI_FilterSetting(InGameUI gameUI) : base("Â˾µ", null)
|
||||
{
|
||||
m_gameUI = gameUI;
|
||||
}
|
||||
|
||||
protected override List<OptionMenu> GetOptionMenus()
|
||||
{
|
||||
return App.filter.Filters.Select(f => new FilterMenu(m_gameUI.RomFile, f) as OptionMenu).ToList();
|
||||
}
|
||||
|
||||
public class FilterMenu : ExpandMenu
|
||||
{
|
||||
private Filter m_filter;
|
||||
private List<OptionMenu> m_presetsMenuItems;
|
||||
|
||||
public FilterMenu(RomFile rom, Filter filter) : base(filter.Name, null)
|
||||
{
|
||||
m_filter = filter;
|
||||
m_presetsMenuItems = new List<OptionMenu> { new FilterPresetMenu(rom, m_filter, m_filter.DefaultPreset) };
|
||||
m_presetsMenuItems.AddRange(m_filter.Presets.Select(preset => new FilterPresetMenu(rom, m_filter, preset)));
|
||||
}
|
||||
|
||||
protected override List<OptionMenu> GetOptionMenus()
|
||||
{
|
||||
return m_presetsMenuItems;
|
||||
}
|
||||
}
|
||||
|
||||
public class FilterPresetMenu : ExecuteMenu
|
||||
{
|
||||
private FilterPreset m_preset;
|
||||
private RomFile m_rom;
|
||||
private Filter m_filter;
|
||||
|
||||
public FilterPresetMenu(RomFile rom, Filter filter, FilterPreset preset) : base(preset.Name, null)
|
||||
{
|
||||
m_preset = preset;
|
||||
m_rom = rom;
|
||||
m_filter = filter;
|
||||
}
|
||||
|
||||
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
||||
{
|
||||
m_filter.ApplyPreset(m_preset);
|
||||
App.filter.EnableFilter(m_filter);
|
||||
|
||||
App.filter.SetupFilter(m_rom, m_filter, m_preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6c80949e93f37f42a1af843fa9d77fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +1,4 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
|
@ -1,8 +1,5 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
@ -16,6 +15,7 @@ namespace AxibugEmuOnline.Client
|
||||
[Space]
|
||||
[Header("模板")]
|
||||
[SerializeField] OptionUI_ExecuteItem TEMPLATE_EXECUTEITEM;
|
||||
[SerializeField] OptionUI_ValueEditItem TEMPLATE_VALUEEDITITEM;
|
||||
|
||||
private OptionUI m_child;
|
||||
private OptionUI m_parent;
|
||||
@ -65,12 +65,15 @@ namespace AxibugEmuOnline.Client
|
||||
protected override void Awake()
|
||||
{
|
||||
TEMPLATE_EXECUTEITEM.gameObject.SetActiveEx(false);
|
||||
TEMPLATE_VALUEEDITITEM.gameObject.SetActiveEx(false);
|
||||
|
||||
SelectBorder.gameObject.SetActiveEx(false);
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
SelectBorder.Active = Enable;
|
||||
UpdateMenuState();
|
||||
|
||||
base.Update();
|
||||
@ -177,6 +180,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
var itemUIRect = optionUI_MenuItem.transform as RectTransform;
|
||||
SelectBorder.Target = itemUIRect;
|
||||
SelectBorder.RefreshPosition();
|
||||
|
||||
if (!m_bPoped)
|
||||
{
|
||||
@ -268,15 +272,19 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
if (menuData is ExecuteMenu executeMenu)
|
||||
{
|
||||
var menuUI = GameObject.Instantiate(TEMPLATE_EXECUTEITEM.gameObject, TEMPLATE_EXECUTEITEM.transform.parent).GetComponent<OptionUI_ExecuteItem>();
|
||||
var menuUI = Instantiate(TEMPLATE_EXECUTEITEM.gameObject, TEMPLATE_EXECUTEITEM.transform.parent).GetComponent<OptionUI_ExecuteItem>();
|
||||
menuUI.gameObject.SetActive(true);
|
||||
menuUI.SetData(this, executeMenu);
|
||||
m_runtimeMenuItems.Add(menuUI);
|
||||
}
|
||||
else
|
||||
else if (menuData is ValueSetMenu valueSetMenu)
|
||||
{
|
||||
throw new NotImplementedException($"暂不支持的菜单类型{menuData.GetType().Name}");
|
||||
var menuUI = Instantiate(TEMPLATE_VALUEEDITITEM.gameObject, TEMPLATE_VALUEEDITITEM.transform.parent).GetComponent<OptionUI_ValueEditItem>();
|
||||
menuUI.gameObject.SetActive(true);
|
||||
menuUI.SetData(this, valueSetMenu);
|
||||
m_runtimeMenuItems.Add(menuUI);
|
||||
}
|
||||
else throw new NotImplementedException($"暂不支持的菜单类型{menuData.GetType().Name}");
|
||||
}
|
||||
|
||||
private void ReleaseRuntimeMenus()
|
||||
@ -304,10 +312,23 @@ namespace AxibugEmuOnline.Client
|
||||
Hide();
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemLeft()
|
||||
{
|
||||
var executer = m_runtimeMenuItems[SelectIndex];
|
||||
if (executer != null)
|
||||
{
|
||||
executer.OnLeft();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemRight()
|
||||
{
|
||||
var executer = m_runtimeMenuItems[SelectIndex];
|
||||
if (!executer.IsExpandMenu) return;
|
||||
if (!executer.IsExpandMenu)
|
||||
{
|
||||
executer.OnRight();
|
||||
return;
|
||||
}
|
||||
|
||||
OnCmdEnter();
|
||||
}
|
||||
@ -383,25 +404,6 @@ namespace AxibugEmuOnline.Client
|
||||
protected abstract List<OptionMenu> GetOptionMenus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 带有值类型显示和编辑的菜单
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class ValueSetMenu<T> : ValueSetMenu
|
||||
{
|
||||
public sealed override Type ValueType => typeof(T);
|
||||
|
||||
public T Value { get; private set; }
|
||||
|
||||
public sealed override object ValueRaw => Value;
|
||||
|
||||
public sealed override void OnValueChanged(object newValue)
|
||||
{
|
||||
Value = (T)newValue;
|
||||
}
|
||||
protected ValueSetMenu(string name) : base(name) { }
|
||||
}
|
||||
|
||||
/// <summary> 不要直接继承这个类 </summary>
|
||||
public abstract class OptionMenu
|
||||
{
|
||||
@ -420,7 +422,9 @@ namespace AxibugEmuOnline.Client
|
||||
public virtual void OnShow(OptionUI_MenuItem ui) { }
|
||||
public virtual void OnHide() { }
|
||||
}
|
||||
/// <summary> 不要直接继承这个类 </summary>
|
||||
/// <summary>
|
||||
/// 带有值类型显示和编辑的菜单
|
||||
/// </summary>
|
||||
public abstract class ValueSetMenu : OptionMenu
|
||||
{
|
||||
public ValueSetMenu(string name) : base(name) { }
|
||||
@ -428,7 +432,7 @@ namespace AxibugEmuOnline.Client
|
||||
public abstract Type ValueType { get; }
|
||||
public abstract object ValueRaw { get; }
|
||||
public abstract void OnValueChanged(object newValue);
|
||||
public abstract object Min { get; }
|
||||
public abstract object Max { get; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ namespace AxibugEmuOnline.Client
|
||||
protected abstract void OnSetData(OptionMenu menuData);
|
||||
|
||||
public abstract void OnExecute(OptionUI optionUI, ref bool cancelHide);
|
||||
public virtual void OnLeft() { }
|
||||
public virtual void OnRight() { }
|
||||
public abstract void OnFocus();
|
||||
public virtual void OnHide() { }
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class OptionUI_ValueEditItem : OptionUI_MenuItem<ValueSetMenu>
|
||||
{
|
||||
[SerializeField]
|
||||
OptionUI_ValueEditItem_FloatEdit com_floatEdit;
|
||||
[SerializeField]
|
||||
OptionUI_ValueEditItem_EnumEdit com_enumEdit;
|
||||
|
||||
IValueEditControl m_currentCom;
|
||||
|
||||
protected override void OnSetData(OptionMenu menuData)
|
||||
{
|
||||
com_floatEdit.gameObject.SetActive(false);
|
||||
com_enumEdit.gameObject.SetActive(false);
|
||||
|
||||
if (menuData is ValueSetMenu valueMenu)
|
||||
{
|
||||
if (valueMenu.ValueType == typeof(float))
|
||||
{
|
||||
m_currentCom = com_floatEdit;
|
||||
}
|
||||
else if (valueMenu.ValueType.IsEnum)
|
||||
{
|
||||
m_currentCom = com_enumEdit;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.log.Error($"ÉÐδ֧³ÖµÄÊý¾ÝÀàÐÍ:{valueMenu.ValueType}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_currentCom.gameObject.SetActiveEx(true);
|
||||
m_currentCom.SetData(valueMenu);
|
||||
}
|
||||
|
||||
base.OnSetData(menuData);
|
||||
}
|
||||
|
||||
public override void OnExecute(OptionUI optionUI, ref bool cancelHide)
|
||||
{
|
||||
cancelHide = true;
|
||||
m_currentCom?.OnExecute();
|
||||
}
|
||||
|
||||
public override void OnLeft()
|
||||
{
|
||||
m_currentCom?.OnLeft();
|
||||
}
|
||||
|
||||
public override void OnRight()
|
||||
{
|
||||
m_currentCom?.OnRight();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IValueEditControl
|
||||
{
|
||||
void SetData(ValueSetMenu valueMenu);
|
||||
GameObject gameObject { get; }
|
||||
void OnLeft();
|
||||
void OnRight();
|
||||
void OnExecute();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deae682aaf23cab458cba1b12cd3a1f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class OptionUI_ValueEditItem_EnumEdit : MonoBehaviour, IValueEditControl
|
||||
{
|
||||
[SerializeField]
|
||||
Text txt_value;
|
||||
|
||||
private ValueSetMenu m_valueMenu;
|
||||
private List<Enum> m_enumValues = new List<Enum>();
|
||||
private int m_valueIndex;
|
||||
|
||||
public void SetData(ValueSetMenu valueMenu)
|
||||
{
|
||||
m_valueMenu = valueMenu;
|
||||
txt_value.text = valueMenu.ValueRaw.ToString();
|
||||
|
||||
foreach (Enum enumValue in Enum.GetValues(valueMenu.ValueType))
|
||||
{
|
||||
m_enumValues.Add(enumValue);
|
||||
}
|
||||
m_valueIndex = m_enumValues.IndexOf((Enum)valueMenu.ValueRaw);
|
||||
}
|
||||
|
||||
public void OnLeft()
|
||||
{
|
||||
m_valueIndex--;
|
||||
|
||||
if (m_valueIndex < 0) m_valueIndex = m_enumValues.Count - 1;
|
||||
|
||||
var value = m_enumValues[m_valueIndex];
|
||||
txt_value.text = value.ToString();
|
||||
m_valueMenu.OnValueChanged(value);
|
||||
}
|
||||
|
||||
public void OnRight()
|
||||
{
|
||||
m_valueIndex++;
|
||||
|
||||
if (m_valueIndex >= m_enumValues.Count) m_valueIndex = 0;
|
||||
|
||||
var value = m_enumValues[m_valueIndex];
|
||||
txt_value.text = value.ToString();
|
||||
m_valueMenu.OnValueChanged(value);
|
||||
}
|
||||
|
||||
public void OnExecute()
|
||||
{
|
||||
OnRight();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef1018f09e7c5b049b75128ee308d372
|
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class OptionUI_ValueEditItem_FloatEdit : MonoBehaviour, IValueEditControl
|
||||
{
|
||||
[SerializeField]
|
||||
Slider slider;
|
||||
[SerializeField]
|
||||
Text txt_value;
|
||||
|
||||
float m_step;
|
||||
private ValueSetMenu m_valueMenu;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
slider.onValueChanged.AddListener(OnSliderValueChanged);
|
||||
}
|
||||
|
||||
private void OnSliderValueChanged(float value)
|
||||
{
|
||||
txt_value.text = $"{value:.00}";
|
||||
m_valueMenu.OnValueChanged(value);
|
||||
}
|
||||
|
||||
public void SetData(ValueSetMenu valueMenu)
|
||||
{
|
||||
m_valueMenu = valueMenu;
|
||||
slider.minValue = (float)valueMenu.Min;
|
||||
slider.maxValue = (float)valueMenu.Max;
|
||||
slider.value = (float)valueMenu.ValueRaw;
|
||||
m_step = (slider.maxValue - slider.minValue) * 0.05f;
|
||||
}
|
||||
|
||||
public void OnLeft()
|
||||
{
|
||||
var newValue = Mathf.Clamp(slider.value - m_step, slider.minValue, slider.maxValue);
|
||||
slider.value = newValue;
|
||||
}
|
||||
|
||||
public void OnRight()
|
||||
{
|
||||
var newValue = Mathf.Clamp(slider.value + m_step, slider.minValue, slider.maxValue);
|
||||
slider.value = newValue;
|
||||
}
|
||||
|
||||
public void OnExecute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c9e9868e38e8ea44a0dad03b987cd73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,6 +1,4 @@
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
|
@ -2,7 +2,6 @@ using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Event;
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using AxibugProtobuf;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using DG.Tweening;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
@ -7,6 +7,8 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class Selector : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Animator animator;
|
||||
private RectTransform m_rect => transform as RectTransform;
|
||||
|
||||
private RectTransform m_target;
|
||||
@ -21,15 +23,13 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
m_target = value;
|
||||
|
||||
//重置选择游标的动画
|
||||
gameObject.SetActive(false);
|
||||
gameObject.SetActive(true);
|
||||
|
||||
var itemUIRect = m_target.transform as RectTransform;
|
||||
m_rect.pivot = itemUIRect.pivot;
|
||||
m_rect.sizeDelta = itemUIRect.rect.size;
|
||||
m_rect.SetAsLastSibling();
|
||||
|
||||
animator.SetTrigger("reactive");
|
||||
|
||||
if (m_trackTween != null)
|
||||
{
|
||||
m_trackTween.Kill();
|
||||
@ -40,15 +40,34 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
private bool m_active;
|
||||
public bool Active
|
||||
{
|
||||
if (m_trackTween != null)
|
||||
get => m_active;
|
||||
set
|
||||
{
|
||||
m_trackTween.endValue = Target.position;
|
||||
}
|
||||
if (Target == null) return;
|
||||
if (m_active == value) return;
|
||||
m_active = value;
|
||||
|
||||
animator.SetBool("active", value);
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshPosition()
|
||||
{
|
||||
if (Target != null)
|
||||
{
|
||||
m_rect.position = Target.position;
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (m_trackTween != null && m_trackTween.endValue != Target.position)
|
||||
{
|
||||
m_trackTween.ChangeEndValue(Target.position, true);
|
||||
}
|
||||
if (Target == null) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugProtobuf;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@ -42,7 +41,7 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
if (s_RomFileCahcesInRoomInfo.TryGetValue(roomInfo.GameRomID, out RomFile romFile))
|
||||
{
|
||||
callback.Invoke(roomInfo,romFile);
|
||||
callback.Invoke(roomInfo, romFile);
|
||||
return;
|
||||
}
|
||||
switch (platform)
|
||||
@ -54,7 +53,7 @@ namespace AxibugEmuOnline.Client
|
||||
romFile.SetWebData(romWebData);
|
||||
s_RomFileCahcesInRoomInfo[roomInfo.GameRomID] = romFile;
|
||||
|
||||
callback.Invoke(roomInfo,romFile);
|
||||
callback.Invoke(roomInfo, romFile);
|
||||
}));
|
||||
break;
|
||||
}
|
||||
|
@ -10,5 +10,5 @@
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
"noEngineReferences": true
|
||||
}
|
@ -8,7 +8,4 @@ EditorBuildSettings:
|
||||
- enabled: 1
|
||||
path: Assets/Scene/AxibugEmuOnline.Client.unity
|
||||
guid: eb0c18a619175384d95147898a43054b
|
||||
- enabled: 0
|
||||
path: Assets/Scene/Emu_NES.unity
|
||||
guid: 3dba71db67877594a9b5b77059205ec8
|
||||
m_configObjects: {}
|
||||
|
Loading…
Reference in New Issue
Block a user