更新
This commit is contained in:
@@ -1,10 +1,41 @@
|
||||
using ChocDino.UIFX;
|
||||
using Cielonos.MainGame.Inventory;
|
||||
using DG.Tweening;
|
||||
using SLSFramework.UI;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cielonos.UI
|
||||
{
|
||||
public class MainWeaponDisplayer : UIElementBase
|
||||
{
|
||||
|
||||
public Image rectIcon;
|
||||
public TMP_Text weaponNameText;
|
||||
public Image frame;
|
||||
private Sequence frameOutlineSequence;
|
||||
|
||||
public void Initialize(Sprite icon, string weaponName)
|
||||
{
|
||||
rectIcon.sprite = icon;
|
||||
weaponNameText.text = weaponName;
|
||||
}
|
||||
|
||||
public void SetFrameOutline(float totalDuration, Color color = default, float intensity = 2f)
|
||||
{
|
||||
color = color == default ? Color.cyan : color;
|
||||
Color hdrColor = color * Mathf.Pow(2f, intensity);
|
||||
GlowFilter glowFilter = frame.GetComponent<GlowFilter>();
|
||||
glowFilter.Color = hdrColor;
|
||||
float fadeDuration = Mathf.Clamp(totalDuration / 2f, 0.2f, totalDuration);
|
||||
float stayDuration = totalDuration - fadeDuration;
|
||||
float strengthPeak = 0.5f;
|
||||
frameOutlineSequence?.Kill(true);
|
||||
frameOutlineSequence = DOTween.Sequence();
|
||||
frameOutlineSequence.Append(DOTween.To(() => glowFilter.Strength, x => glowFilter.Strength = x, strengthPeak, fadeDuration).SetEase(Ease.OutQuad));
|
||||
frameOutlineSequence.AppendInterval(stayDuration);
|
||||
frameOutlineSequence.Append(DOTween.To(() => glowFilter.Strength, x => glowFilter.Strength = x, 0f, fadeDuration).SetEase(Ease.InQuad));
|
||||
frameOutlineSequence.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Cielonos.MainGame.Inventory;
|
||||
using SLSFramework.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cielonos.UI
|
||||
@@ -8,8 +9,9 @@ namespace Cielonos.UI
|
||||
public class MainWeaponFunctionIcon : UIElementBase
|
||||
{
|
||||
public RuntimeFunctionUnit functionUnit;
|
||||
public Image timerFillImage;
|
||||
[FormerlySerializedAs("timerFillImage")] public Image frame;
|
||||
public Image iconImage;
|
||||
public Image timer;
|
||||
|
||||
public void Initialize(RuntimeFunctionUnit functionUnit)
|
||||
{
|
||||
@@ -30,7 +32,7 @@ namespace Cielonos.UI
|
||||
fillAmount = 1f - functionUnit.currentCooldown / functionUnit.maxCooldown;
|
||||
}
|
||||
|
||||
timerFillImage.fillAmount = fillAmount;
|
||||
frame.fillAmount = fillAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,9 @@ namespace Cielonos.UI
|
||||
public void Initialize(MainWeaponBase mainWeapon)
|
||||
{
|
||||
this.mainWeapon = mainWeapon;
|
||||
Sprite rectIcon = mainWeapon.contentData.rectIcon;
|
||||
string weaponName = mainWeapon.contentData.className;
|
||||
displayer.Initialize(rectIcon, weaponName);
|
||||
|
||||
ClearIcons();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user