颜色选择加入渐变
This commit is contained in:
parent
df32ff6a3a
commit
2c36f91725
@ -1,4 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using DG.Tweening;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
@ -60,6 +62,16 @@ namespace AxibugEmuOnline.Client
|
|||||||
ColorUtility.TryParseHtmlString(colorCodeStr2, out color2);
|
ColorUtility.TryParseHtmlString(colorCodeStr2, out color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static XMBColor Lerp(XMBColor start, XMBColor endColor, float t)
|
||||||
|
{
|
||||||
|
var result = new XMBColor();
|
||||||
|
result.Name = endColor.Name;
|
||||||
|
result.color1 = Color.Lerp(start.color1, endColor.color1, t);
|
||||||
|
result.color2 = Color.Lerp(start.color2, endColor.color2, t);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
int hash = 17;
|
int hash = 17;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.UI;
|
using AxibugEmuOnline.Client.UI;
|
||||||
|
using DG.Tweening;
|
||||||
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -66,9 +69,28 @@ namespace AxibugEmuOnline.Client
|
|||||||
ui.IconUI.GetMaterial().SetColor("_Color2", Color.color2);
|
ui.IconUI.GetMaterial().SetColor("_Color2", Color.color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static TweenerCore<float, float, FloatOptions> s_colorChangeTween;
|
||||||
public override void OnFocus()
|
public override void OnFocus()
|
||||||
{
|
{
|
||||||
App.settings.BgColor.CurrentColor = Color;
|
float progress = 0;
|
||||||
|
XMBColor start = App.settings.BgColor.CurrentColor;
|
||||||
|
XMBColor endColor = Color;
|
||||||
|
|
||||||
|
if (s_colorChangeTween != null)
|
||||||
|
{
|
||||||
|
s_colorChangeTween.Kill();
|
||||||
|
s_colorChangeTween = null;
|
||||||
|
}
|
||||||
|
s_colorChangeTween = DOTween.To(() => progress, (x) =>
|
||||||
|
{
|
||||||
|
progress = x;
|
||||||
|
var lerpColor = XMBColor.Lerp(start, endColor, x);
|
||||||
|
App.settings.BgColor.CurrentColor = lerpColor;
|
||||||
|
}, 1, 1f).SetEase(Ease.OutCubic);
|
||||||
|
s_colorChangeTween.onComplete = () =>
|
||||||
|
{
|
||||||
|
s_colorChangeTween = null;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExcute()
|
public override void OnExcute()
|
||||||
|
Loading…
Reference in New Issue
Block a user