84 lines
1.9 KiB
C#
84 lines
1.9 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.GlobeDefine;
|
|
|
|
public class DoubleMountInfoItem : UIItemBase
|
|
{
|
|
/// <summary>
|
|
/// 头像
|
|
/// </summary>
|
|
public Image _CapterIcon;
|
|
/// <summary>
|
|
/// 名字
|
|
/// </summary>
|
|
public Text _CapterName;
|
|
/// <summary>
|
|
/// 邀请按钮
|
|
/// </summary>
|
|
public Button _BtnApply;
|
|
|
|
|
|
/// <summary>
|
|
/// 骑乘
|
|
/// </summary>
|
|
private MountTeam _MountTeam;
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
var MountTeam = (MountTeam)hash["InitObj"];
|
|
InitMountTeam(MountTeam);
|
|
}
|
|
|
|
private void InitMountTeam(MountTeam MountTeam)
|
|
{
|
|
if (MountTeam == null)
|
|
return;
|
|
|
|
_MountTeam = MountTeam;
|
|
//头像
|
|
LoadAssetBundle.Instance.SetImageSprite(_CapterIcon, GCGame.Utils.GetProfessionSpriteName(_MountTeam.Profession));
|
|
//玩家名
|
|
_CapterName.text = _MountTeam.Name;
|
|
|
|
//激活邀请按钮
|
|
_BtnApply.interactable = true;
|
|
}
|
|
|
|
// Use this for initialization
|
|
void Start () { }
|
|
|
|
// Update is called once per frame
|
|
void Update () { }
|
|
|
|
|
|
/// <summary>
|
|
/// 发起邀请请求 TODO
|
|
/// </summary>
|
|
public void OnBtnInvate()
|
|
{
|
|
|
|
//如果非玩家,则无效
|
|
if (GlobeVar.INVALID_GUID == _MountTeam.Guid)
|
|
{
|
|
return;
|
|
}
|
|
//如果目标是自己也不发送
|
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == _MountTeam.Guid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
//发送邀请
|
|
CG_DOUBLEMOUNT_INVITE packet = (CG_DOUBLEMOUNT_INVITE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_DOUBLEMOUNT_INVITE);
|
|
packet.BeInvitedId = _MountTeam.Guid;
|
|
packet.SendPacket();
|
|
|
|
//禁用邀请按钮
|
|
_BtnApply.interactable = false;
|
|
}
|
|
}
|