Centralized tooltip placeholder descriptions
This commit is contained in:
parent
b7af95c232
commit
458da2371d
@ -14,8 +14,9 @@ public class TooltipManager : Singleton<TooltipManager>
|
||||
private bool _tooltipVisibility;
|
||||
public bool TooltipVisibility { get { return _tooltipVisibility; } }
|
||||
|
||||
public void ShowTooltip(string description, string hp, string dmg, string atkSpeed)
|
||||
public void ShowTooltip(UnitCard unitCard, string hp, string dmg, string atkSpeed)
|
||||
{
|
||||
string description = DescriptionManager(unitCard);
|
||||
_tooltipVisibility = true;
|
||||
_description = description;
|
||||
_hp = hp;
|
||||
@ -24,9 +25,23 @@ public class TooltipManager : Singleton<TooltipManager>
|
||||
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Invoke();
|
||||
}
|
||||
|
||||
internal void HideToolTip()
|
||||
public void HideToolTip()
|
||||
{
|
||||
_tooltipVisibility = false;
|
||||
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Invoke();
|
||||
}
|
||||
|
||||
private string DescriptionManager(UnitCard unitCard)
|
||||
{
|
||||
string tooltipDescription;
|
||||
if (unitCard?.TooltipString.Length > 0)
|
||||
{
|
||||
tooltipDescription = unitCard.TooltipString;
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipDescription = "Exemple de description d'unité pour " + unitCard.name.ToLower();
|
||||
}
|
||||
return tooltipDescription;
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,17 +85,8 @@ public class GameObjectPlacementButton : UnitPlacementButton
|
||||
|
||||
public override void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
Ally go = _prefab.GetComponent<Ally>();
|
||||
string tooltipDescription;
|
||||
if (_unitCardInformation?.TooltipString.Length > 0)
|
||||
{
|
||||
tooltipDescription = _unitCardInformation.TooltipString;
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipDescription = "Exemple de description d'unité pour " + _unitCardInformation.name.ToLower();
|
||||
}
|
||||
TooltipManager.Instance.ShowTooltip(tooltipDescription, go.Hp.ToString(), go.AttackDamage.ToString(), go.AttackInterval.ToString());
|
||||
Ally allyObj = _prefab.GetComponent<Ally>();
|
||||
TooltipManager.Instance.ShowTooltip(_unitCardInformation, allyObj.Hp.ToString(), allyObj.AttackDamage.ToString(), allyObj.AttackInterval.ToString());
|
||||
}
|
||||
|
||||
public override void OnPointerExit(PointerEventData eventData)
|
||||
|
||||
@ -4,6 +4,7 @@ using UnityEngine.EventSystems;
|
||||
public class TilePlacementButton : UnitPlacementButton
|
||||
{
|
||||
public LevelTile tile;
|
||||
const string NULL = "0";
|
||||
|
||||
protected override bool CanPlace()
|
||||
{
|
||||
@ -25,16 +26,7 @@ public class TilePlacementButton : UnitPlacementButton
|
||||
|
||||
public override void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
string tooltipDescription;
|
||||
if (_unitCardInformation?.TooltipString.Length > 0)
|
||||
{
|
||||
tooltipDescription = _unitCardInformation.TooltipString;
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipDescription = "Exemple de description de tuile pour " + _unitCardInformation.name.ToLower();
|
||||
}
|
||||
TooltipManager.Instance.ShowTooltip(tooltipDescription, "0", "0", "0");
|
||||
TooltipManager.Instance.ShowTooltip(_unitCardInformation, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
public override void OnPointerExit(PointerEventData eventData)
|
||||
|
||||
@ -96,17 +96,8 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPoin
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
Ally go = _prefab.GetComponent<Ally>();
|
||||
string tooltipDescription;
|
||||
if (_unitCardInformation.TooltipString.Length > 0)
|
||||
{
|
||||
tooltipDescription = _unitCardInformation.TooltipString;
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipDescription = "Exemple de description d'unité pour " + _unitCardInformation.name.ToLower();
|
||||
}
|
||||
TooltipManager.Instance.ShowTooltip(tooltipDescription, go.Hp.ToString(), go.AttackDamage.ToString(), go.AttackInterval.ToString());
|
||||
Ally allyObj = _prefab.GetComponent<Ally>();
|
||||
TooltipManager.Instance.ShowTooltip(_unitCardInformation, allyObj.Hp.ToString(), allyObj.AttackDamage.ToString(), allyObj.AttackInterval.ToString());
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user