132 lines
3.5 KiB
C#
132 lines
3.5 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using GCGame.Table;
|
|||
|
using UnityEngine.UI;
|
|||
|
/// <summary>
|
|||
|
/// 双人坐骑控制
|
|||
|
/// </summary>
|
|||
|
public class DoubleMountControl : MonoBehaviour {
|
|||
|
private static DoubleMountControl m_Instance = null;
|
|||
|
public static DoubleMountControl Instance()
|
|||
|
{
|
|||
|
return m_Instance;
|
|||
|
}
|
|||
|
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
m_Instance = this;
|
|||
|
}
|
|||
|
|
|||
|
public GameObject DoubleRideBtnBg;
|
|||
|
public GameObject driverBtn;
|
|||
|
public GameObject passengerBtn;
|
|||
|
|
|||
|
private int DoubleState;
|
|||
|
// Use this for initialization
|
|||
|
void Start () {
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update () {
|
|||
|
//int zuoQiID = GameManager.gameManager.PlayerDataPool.m_objMountParam.AdvanceMountId;
|
|||
|
//if (zuoQiID > 0 )//&& driverBtn.isActiveAndEnabled == false)
|
|||
|
//{
|
|||
|
// Tab_MountBase mountBase = TableManager.GetMountBaseByID(zuoQiID, 0);
|
|||
|
// if (mountBase.DoubleRiding == 0 )
|
|||
|
// {
|
|||
|
|
|||
|
// if (DoubleRideBtnBg.isActiveAndEnabled == true)
|
|||
|
// {
|
|||
|
// DoubleRideBtnBg.gameObject.SetActive(false);
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// else if (mountBase.DoubleRiding == 1 )
|
|||
|
// {
|
|||
|
|
|||
|
// if (DoubleRideBtnBg.isActiveAndEnabled == false)
|
|||
|
// {
|
|||
|
// DoubleRideBtnBg.gameObject.SetActive(true);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// //// 判断身份 司机 VS 乘客
|
|||
|
// //if (driverBtn.isActiveAndEnabled == false)
|
|||
|
// //{
|
|||
|
// // driverBtn.gameObject.SetActive(true);
|
|||
|
// //}
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
//}
|
|||
|
//else if (zuoQiID < 0)
|
|||
|
//{
|
|||
|
// if (DoubleRideBtnBg.isActiveAndEnabled == true)
|
|||
|
// {
|
|||
|
// DoubleRideBtnBg.gameObject.SetActive(false);
|
|||
|
// }
|
|||
|
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public string panelName = "DoubleMountInvitePanel";
|
|||
|
/// <summary>
|
|||
|
/// 点击双人骑乘按钮
|
|||
|
/// </summary>
|
|||
|
public void OnClickDriverBtn()
|
|||
|
{
|
|||
|
//UIManager.ShowUI(UIInfo.DoubleMount);
|
|||
|
LuaUIManager.Instance.ShowLuaUI(panelName);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 乘客取消骑乘双人坐骑
|
|||
|
/// </summary>
|
|||
|
public void passengerCancelMount()
|
|||
|
{
|
|||
|
//CG_DOUBLEMOUNT_PASSENGER_UNMOUNT packet = (CG_DOUBLEMOUNT_PASSENGER_UNMOUNT)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_NEAR_LIST);
|
|||
|
//packet.flag = 1;
|
|||
|
//packet.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取骑乘数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="data"></param>
|
|||
|
public void GetMountData(GC_MOUNT_DATA data)
|
|||
|
{
|
|||
|
DoubleState = 1;//data.State; //...
|
|||
|
|
|||
|
int zuoQiID = GameManager.gameManager.PlayerDataPool.m_objMountParam.AdvanceMountId;
|
|||
|
if (zuoQiID > 0)
|
|||
|
{
|
|||
|
if (DoubleState == 0)
|
|||
|
{
|
|||
|
DoubleRideBtnBg.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
if (DoubleState > 0)
|
|||
|
{
|
|||
|
DoubleRideBtnBg.gameObject.SetActive(true);
|
|||
|
if (DoubleState == 2)
|
|||
|
{
|
|||
|
passengerBtn.gameObject.SetActive(true);
|
|||
|
}
|
|||
|
if (DoubleState == 1)
|
|||
|
{
|
|||
|
passengerBtn.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
DoubleRideBtnBg.gameObject.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|