| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Friday, December 21, 2018 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | { |
| | | |
| | | public class RoleInformation : MonoBehaviour
|
| | | { |
| | | [SerializeField] Image m_Head;//英雄头像 |
| | | [SerializeField] Text m_LVText;//角色等级 |
| | | [SerializeField] Image m_Shield;//护盾 |
| | | [SerializeField] Text m_NameInformationText;//角色信息 |
| | | [SerializeField] Slider m_HPSlider;//血条 |
| | | [SerializeField] Text m_HpNumber;//血量 |
| | | [SerializeField] Button m_BuffButton;//Buff
|
| | | public Button BuffButton
|
| | | {
|
| | | get { return m_BuffButton; }
|
| | | set { m_BuffButton = value; }
|
| | | } |
| | | public void SetHeroHead(int _jobID, int _ReincarnationLv)//关于人物头像的赋值
|
| | | {
|
| | | m_Head.SetSprite(GeneralDefine.GetJobHeadPortrait(_jobID, _ReincarnationLv));
|
| | | } |
| | | public void SetHeroLvAndName(int Lv, string Name, string ServiceName)//设置等级和角色名称
|
| | | {
|
| | | m_LVText.text = Lv.ToString();
|
| | | m_NameInformationText.text = ServiceName + Name;
|
| | | } |
| | | public void SetShieldNumber(int Max, int Now)//设置角色护盾属性值
|
| | | {
|
| | | if (Max != 0)
|
| | | {
|
| | | float fillAmount = (float)Math.Round((double)Now / Max, 2, MidpointRounding.AwayFromZero);
|
| | | m_Shield.fillAmount = fillAmount;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Shield.fillAmount = 0;
|
| | | }
|
| | | } |
| | | |
| | | public void SetHeroHP(int MaxHp, int NowHp)//设置角色Hp值
|
| | | {
|
| | | m_HpNumber.text = NowHp.ToString() + "/" + MaxHp.ToString();
|
| | | if (MaxHp > 0)
|
| | | {
|
| | | m_HPSlider.value = (float)Math.Round((float)NowHp / MaxHp, 2, MidpointRounding.AwayFromZero);//血条的初始化
|
| | | }
|
| | | else
|
| | | {
|
| | | m_HPSlider.value = 1f;
|
| | | }
|
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |