mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 06:57:12 +08:00
(client) feat:健康给予,路径优化,结算界面,商店界面 (#60)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using Base;
|
||||
using Data;
|
||||
using Managers;
|
||||
using TMPro;
|
||||
@@ -8,16 +7,16 @@ using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class SkillTreeNodeInformationUI:UIBase
|
||||
public class SkillTreeNodeInformationUI : MonoBehaviour
|
||||
{
|
||||
public TMP_Text label;
|
||||
public TMP_Text description;
|
||||
public TMP_Text coin;
|
||||
public Button purchaseButton;
|
||||
|
||||
|
||||
public SkillTreeNodeUI currentLink;
|
||||
public SkillTreeDef SkillTreeDef => currentLink.SkillTreeDefine;
|
||||
|
||||
|
||||
public bool CanUnlock
|
||||
{
|
||||
get
|
||||
@@ -28,11 +27,11 @@ namespace UI
|
||||
return parent.All(p => SkillTreeManager.Instance.IsSkillTreeUnlocked(p.defName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Init(SkillTreeNodeUI nodeUI)
|
||||
{
|
||||
currentLink = nodeUI;
|
||||
|
||||
|
||||
label.text = SkillTreeDef.label;
|
||||
description.text = SkillTreeDef.description;
|
||||
coin.text = $"{SkillTreeDef.cost}/{Program.Instance.CoinCount}";
|
||||
@@ -47,16 +46,21 @@ namespace UI
|
||||
purchaseButton.interactable = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Purchase()
|
||||
{
|
||||
SkillTreeManager.Instance.UnlockSkillTree(SkillTreeDef.defName);
|
||||
if(SkillTreeDef.cost <= Program.Instance.CoinCount)
|
||||
{
|
||||
SkillTreeManager.Instance.UnlockSkillTree(SkillTreeDef.defName);
|
||||
Program.Instance.CoinCount -= SkillTreeDef.cost;
|
||||
}
|
||||
OnHide();
|
||||
currentLink.Refresh();
|
||||
}
|
||||
|
||||
public void OnHide()
|
||||
{
|
||||
UIInputControl.Instance.Hide(this);
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user