96 lines
3.2 KiB
C#
96 lines
3.2 KiB
C#
using Games.GlobeDefine;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public struct PvpRoleInfoStruct
|
|
{
|
|
public string name;
|
|
public int profession;
|
|
public int segmentLevel;
|
|
public long roleGuid;
|
|
public bool isMaster;
|
|
public bool isShowKickIcon;
|
|
public bool isHaveInfo;
|
|
public int Index;
|
|
public long leaderGuid;
|
|
public int curHp;
|
|
public int maxHp;
|
|
public int roleLevel;
|
|
public PvpRoleInfoStruct(string _name, int _profession, int _segmentLevel, bool _isMaster, bool _isShowkick, long _roleGuid, bool _IsHaveInfo, int _Index, long _LeaderGuid, int _CurHp, int _MaxHp, int _roleLevel)
|
|
{
|
|
name = _name;
|
|
profession = _profession;
|
|
segmentLevel = _segmentLevel;
|
|
isMaster = _isMaster;
|
|
isShowKickIcon = _isShowkick;
|
|
roleGuid = _roleGuid;
|
|
isHaveInfo = _IsHaveInfo;
|
|
Index = _Index;
|
|
leaderGuid = _LeaderGuid;
|
|
curHp = _CurHp;
|
|
maxHp = _MaxHp;
|
|
roleLevel = _roleLevel;
|
|
}
|
|
}
|
|
|
|
public class PvpRoomRoleItem : UIItemBase {
|
|
private PvpRoleInfoStruct _RoleInfo;
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show(hash);
|
|
|
|
_RoleInfo = (PvpRoleInfoStruct)hash["InitObj"];
|
|
|
|
_KickIcon.SetActive(_RoleInfo.isShowKickIcon);
|
|
//_ExitBtn.SetActive((ulong)_RoleInfo.roleGuid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid);
|
|
LoadAssetBundle.Instance.SetImageSprite(_HeadIcon, GCGame.Utils.GetProfessionSpriteName(_RoleInfo.profession) /*GameManager.gameManager.PlayerDataPool.pvpIfo.GetPvpHeadIcon(_RoleInfo.profession)*/);
|
|
_Segment.text = GameManager.gameManager.PlayerDataPool.pvpIfo.GetSegmentLevelDesc(_RoleInfo.segmentLevel);
|
|
_CurHpSliderText.text = _RoleInfo.curHp + "/" + _RoleInfo.maxHp;
|
|
_CurHpSlider.value = (float)_RoleInfo.curHp / (float)_RoleInfo.maxHp;
|
|
_Name.text = _RoleInfo.name;
|
|
_roleLevel.text = _RoleInfo.roleLevel + "";
|
|
}
|
|
public Image _HeadIcon;
|
|
public Text _Segment;
|
|
public Text _Name;
|
|
public Text _CurHpSliderText;
|
|
public Slider _CurHpSlider;
|
|
public GameObject _KickIcon;
|
|
// public GameObject _ExitBtn;
|
|
public Text _roleLevel;
|
|
public void OnInvateBtn()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid != (ulong)_RoleInfo.leaderGuid)
|
|
{
|
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{82041}"));
|
|
return;
|
|
}
|
|
|
|
UIManager.ShowUI(UIInfo.PvpInvateRoot);
|
|
}
|
|
|
|
public void OnKickBtn()
|
|
{
|
|
if(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid != (ulong)_RoleInfo.leaderGuid)
|
|
{
|
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{82041}"));
|
|
return;
|
|
}
|
|
|
|
ReqHonorBattlefieldMatchKickMember req = new ReqHonorBattlefieldMatchKickMember();
|
|
req.Guid = _RoleInfo.roleGuid;
|
|
req.SendMsg();
|
|
}
|
|
|
|
public void OnExitBtn()
|
|
{
|
|
ReqHonorBattlefieldMatchLeaveRoom req = new ReqHonorBattlefieldMatchLeaveRoom();
|
|
req.Flag = 1;
|
|
req.SendMsg();
|
|
|
|
//UIManager.CloseUI(UIInfo.PvpRoomPanel);
|
|
}
|
|
}
|