31 lines
917 B
C#
31 lines
917 B
C#
using System;
|
|
using CSNetwork.GPDataType;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BrewMonster.PerfectWorld.Scripts.UI
|
|
{
|
|
public class UIPlayer : MonoBehaviour
|
|
{
|
|
public Image healthImage;
|
|
// public TextMeshProUGUI healthText;
|
|
public CECHostPlayer hostplayer;
|
|
private void Start()
|
|
{
|
|
hostplayer = GetComponentInParent<CECHostPlayer>();
|
|
EventBus.SubscribeChannel<cmd_self_info_00>(hostplayer.m_PlayerInfo.cid,UpdateHostPlayerInfoUI);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
EventBus.UnsubscribeChannel<cmd_self_info_00>(hostplayer.m_PlayerInfo.cid,UpdateHostPlayerInfoUI);
|
|
}
|
|
|
|
private void UpdateHostPlayerInfoUI(cmd_self_info_00 obj)
|
|
{
|
|
//healthText.text = $"{obj.iHP}/{obj.iMaxHP}";
|
|
healthImage.fillAmount = (float)obj.iHP / obj.iMaxHP;
|
|
}
|
|
}
|
|
} |