Cute_demon_attacks/meng_yao/Assets/script/A_Fight/charainfoPanel.cs
2025-01-02 18:05:20 +08:00

95 lines
2.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Threading.Tasks;
using DG.Tweening;
public class charainfoPanel : Base
{
[Header("以上是父类的,以下是自己的:动画面板")]public GameObject _panel;
[Header("关闭按钮")] public Button closeBtn;
[Header("关闭的面板")] public GameObject _closePanel;
[Header("萌妖")]
public Text LeveText;
public Text NameText;
public Text InfoText;
public Text AttackText;
public Text AttackFanweiText;
public Text AttackCD;
[Header(("敌人"))] public List<Text> textList = new List<Text>();
public Image HpImage;
public int Id=-1;//信息id 0为当前为萌妖 1为敌人
public Role role;//当前显示的角色
public virtual void Start()
{
//await PanelminTobig(_panel);
PanelminTobig(_panel);
//closeBtn.onClick.AddListener(() => {
// Destroy(_closePanel);
//});
}
public virtual void PanelminTobig(GameObject _panel)
{
_panel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
_panel.transform.DOScale(1f, 0.5f);
}
/// <summary>
///
/// </summary>
/// <param name="LeveText">等级</param>
/// <param name="NameText">名字</param>
/// <param name="InfoText">信息</param>
/// <param name="AttackText">攻击力</param>
/// <param name="AttackFanweiText">攻击范围</param>
/// <param name="AttackCD">攻击cd</param>
public void UpDateShow(string LeveText, string NameText, string InfoText, string AttackText, string AttackFanweiText,string AttackCD)
{
Id = 0;
this.LeveText.text= "Lv."+LeveText;
this.NameText.text= NameText;
this.InfoText.text= InfoText;
this.AttackText.text = AttackText;
this.AttackFanweiText.text= AttackFanweiText;
this.AttackCD.text= "<color=#00FF00>"+ AttackCD+"</color>";
}
/// <summary>
///
/// </summary>
/// <param name="eveText">等级</param>
/// <param name="name">名字</param>
/// <param name="def">防御力</param>
/// <param name="speed">速度</param>
/// <param name="shanghai">伤害</param>
/// <param name="info">信息</param>
/// <param name="hp">血量</param>
/// <param name="maxHp">最大血量</param>
public void UpDateShow(string eveText,string name,string def,string speed,string shanghai,string info,float hp,float maxHp)
{
Id = 1;
textList[0].text = "lv." + eveText;
textList[1].text = name;
textList[2].text = def;
textList[3].text = speed;
textList[4].text = shanghai;
textList[5].text = info;
textList[6].text = hp+"/"+maxHp;
HpImage.fillAmount = hp/ maxHp;
}
}