少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//--------------------------------------------------------
//    [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] Image m_HPSlider;//血条 
        [SerializeField] Text m_HpNumber;//血量
        [SerializeField] Button m_BuffButton;//Buff
        [SerializeField] Text m_BuffNumber;//buff数量
        public Button BuffButton
        {
            get { return m_BuffButton; }
            set { m_BuffButton = value; }
        }
        public Text BuffNumber
        {
            get { return m_BuffNumber; }
            set { m_BuffNumber = value; }
        }
        public void SetHeroHead(int _jobID, int _ReincarnationLv)//关于人物头像的赋值
        {
            m_Head.SetSprite(GeneralDefine.GetJobHeadPortrait(_jobID, _ReincarnationLv));
        }
        public void SetHeroLvAndName(int Lv, string Name)//设置等级和角色名称
        {
            m_LVText.text = Lv.ToString();
            m_NameInformationText.text = 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.fillAmount = (float)Math.Round((float)NowHp / MaxHp, 2, MidpointRounding.AwayFromZero);//血条的初始化
            }
            else
            {
                m_HPSlider.fillAmount = 1f;
            }
        }
    }
 
}