继续
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Character;
|
||||
using Lean.Pool;
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
@@ -23,7 +24,8 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
HUD_CharacterBuffIcon buffIcon = LeanPool.Spawn(buffIconPrefab, buffContainer).GetComponent<HUD_CharacterBuffIcon>();
|
||||
buffIcon.Initialize(buff);
|
||||
buffIcons.Add(buffIcon);
|
||||
buffIcons.AddByPriority(buffIcon);
|
||||
buffIcon.transform.SetSiblingIndex(buffIcons.IndexOf(buffIcon));
|
||||
UpdateHud();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Character;
|
||||
using DG.Tweening;
|
||||
using Lean.Pool;
|
||||
using SLSFramework.General;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
{
|
||||
public class HUD_CharacterBuffIcon : HUD_BaseIcon
|
||||
public class HUD_CharacterBuffIcon : HUD_BaseIcon, IPrioritized
|
||||
{
|
||||
public int Priority { get; set; }
|
||||
|
||||
public CharacterBuffBase buff;
|
||||
|
||||
public Image buffTypeBackground;
|
||||
public Image mainIcon;
|
||||
|
||||
public Sprite positive;
|
||||
public Sprite negative;
|
||||
public Sprite neutral;
|
||||
|
||||
public Sprite focusing;
|
||||
|
||||
public void Initialize(CharacterBuffBase buff)
|
||||
{
|
||||
this.buff = buff;
|
||||
this.Priority = buff.Priority;
|
||||
buff.iconSubmodule.buffIcon = this;
|
||||
|
||||
icon.sprite = buff.iconSubmodule.icon;
|
||||
|
||||
PlayApplyAnimation();
|
||||
UpdateIcon();
|
||||
}
|
||||
|
||||
public void PlayApplyAnimation()
|
||||
{
|
||||
Image spreadImage = LeanPool.Spawn(mainIcon.gameObject, rectTransform).GetComponent<Image>();
|
||||
spreadImage.sprite = buff.iconSubmodule.icon;
|
||||
spreadImage.rectTransform.localScale = Vector3.zero;
|
||||
spreadImage.color = Color.white;
|
||||
spreadImage.DOColor(new Color(1f, 1f, 1f, 0f), 1.1f).SetEase(Ease.Linear).Play();
|
||||
spreadImage.rectTransform.DOScale(5f, 1.2f).SetEase(Ease.OutQuad).OnComplete(() =>
|
||||
{
|
||||
LeanPool.Despawn(spreadImage.gameObject);
|
||||
}).Play();
|
||||
}
|
||||
|
||||
public void PlayHintAnimation()
|
||||
{
|
||||
mainIcon.rectTransform.DOScale(1.25f, 0.2f).SetLoops(2, LoopType.Yoyo).SetEase(Ease.OutQuad).Play();
|
||||
}
|
||||
|
||||
public override void UpdateIcon()
|
||||
{
|
||||
@@ -54,6 +79,7 @@ namespace Continentis.MainGame.UI
|
||||
BuffType.Positive => positive,
|
||||
BuffType.Negative => negative,
|
||||
BuffType.Neutral => neutral,
|
||||
BuffType.Focusing => focusing,
|
||||
_ => buffTypeBackground.sprite
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user