Files
JJBB/Assets/Project/Script/GUI/PVP/PvpRoomListItem.cs

49 lines
1.5 KiB
C#
Raw Permalink Normal View History

2024-08-23 15:49:34 +08:00
using GCGame.Table;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PvpRoomListItem : UIItemBase {
public Image _HeadIcon;
public Text _RoomName;
public Text _Num;
public Text _SegmentLimit;
public int _RoomId = -1;
private bool IsNeedCode = false; //是否需要密码
public override void Show(Hashtable hash)
{
base.Show(hash);
HonorBattlefieldMatchRoomInfo info = (HonorBattlefieldMatchRoomInfo)hash["InitObj"];
_RoomId = info.Id;
LoadAssetBundle.Instance.SetImageSprite(_HeadIcon, GCGame.Utils.GetProfessionSpriteName(info.LeaderJob));
_RoomName.text = StrDictionary.GetClientDictionaryString("#{82043}", info.LeaderName, GameManager.gameManager.PlayerDataPool.pvpIfo.GetSegmentLevelDesc(info.LeaderSegment));
_Num.text = info.MemberCount + "/" + info.MemberCountMax;
IsNeedCode = info.IsNeedPassword == 1;
_SegmentLimit.text = GameManager.gameManager.PlayerDataPool.pvpIfo.GetSegmentGradeDesc(info.Segment);
}
public void OnPartInBtn()
{
if(IsNeedCode)
{
if (PvpRoomListPanel.Instance)
PvpRoomListPanel.Instance.ShowPassWordPanel(_RoomId);
}
else
{
ReqHonorBattlefieldMatchJoinRoom req = new ReqHonorBattlefieldMatchJoinRoom();
req.RoomId = _RoomId;
req.Password = "";
req.SendMsg();
}
}
}