using Games.GlobeDefine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DoubleRideInvite : MonoBehaviour {

    private TeamInfo _TeamInfo;
    public Button _BtnApply;

    // Use this for initialization
    void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}
    private void OnEnable()
    {
        _BtnApply.interactable = false;
    }
    public void OnClickInviteBtn()
    {
        // 发送邀请
        //状态   1死亡 2战斗
        int state = GameManager.gameManager.PlayerDataPool.GetPropInt(PropID.PropertyID.STATE);
        Debug.LogError("发送邀请"+ state);

        if (Singleton<ObjManager>.GetInstance() == null)
        {
            return;
        }
        if (_TeamInfo.Guid == GlobeVar.INVALID_GUID || _TeamInfo.Guid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid)
        {
            Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{1930}");
            return;
        }

        //if (Singleton<ObjManager>.GetInstance().MainPlayer)
        //{
        //    Singleton<ObjManager>.GetInstance().MainPlayer.SendNoticMsg(false, "#{3170}");
        //}
        CG_REQ_TEAM_INVITE packet = (CG_REQ_TEAM_INVITE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_TEAM_INVITE);
        packet.SetGuid(_TeamInfo.Guid);
        packet.SendPacket();

        _BtnApply.interactable = false;
    }
}