175 lines
5.6 KiB
C#
175 lines
5.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UnmannedAerialVehicleUI : MonoBehaviour
|
|
{
|
|
public static UnmannedAerialVehicleUI Instance;
|
|
/// <summary>
|
|
/// 选中的无人机编队
|
|
/// </summary>
|
|
public UnmannedAerialVehicleManage unmannedAerialVehicleManage;
|
|
|
|
/// <summary>
|
|
/// 待机按钮
|
|
/// </summary>
|
|
public Button btnTheOpportuneMoment;
|
|
/// <summary>
|
|
/// 警戒按钮
|
|
/// </summary>
|
|
public Button btnBeOnTheAlertAgainst;
|
|
/// <summary>
|
|
/// 攻击目标
|
|
/// </summary>
|
|
public Button btnAttack;
|
|
/// <summary>
|
|
/// 航线设置
|
|
/// </summary>
|
|
public Button btnRouteSettings;
|
|
/// <summary>
|
|
/// 自身频段设置
|
|
/// </summary>
|
|
public Button btnFrequencyBand;
|
|
/// <summary>
|
|
/// 侦测频段设置
|
|
/// </summary>
|
|
public Button btnSurveillanceFrequencyBand;
|
|
|
|
|
|
public void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
btnFrequencyBand.onClick.AddListener(() => {
|
|
if (unmannedAerialVehicleManage)
|
|
{
|
|
GameManager.Instance.GetWRJParameter();
|
|
unmannedAerialVehicleManage.FrequencyBand.SetActive(true);
|
|
}
|
|
});
|
|
btnSurveillanceFrequencyBand.onClick.AddListener(() => {
|
|
if (unmannedAerialVehicleManage)
|
|
{
|
|
GameManager.Instance.GetWRJParameter();
|
|
unmannedAerialVehicleManage.SurveillanceFrequencyBand.SetActive(true);
|
|
}
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 切换无人机阵型
|
|
/// </summary>
|
|
/// <param name="number"></param>
|
|
public void AddFormation(int number)
|
|
{
|
|
if (unmannedAerialVehicleManage)
|
|
{
|
|
unmannedAerialVehicleManage.Formation(number);
|
|
}
|
|
}
|
|
public void ShowButton()
|
|
{
|
|
if (unmannedAerialVehicleManage)
|
|
{
|
|
GameManager.Instance.GetWRJParameter();
|
|
switch (unmannedAerialVehicleManage.wrjModel)
|
|
{
|
|
case WRJModel.光学无人机:
|
|
btnTheOpportuneMoment.gameObject.SetActive(true);
|
|
btnBeOnTheAlertAgainst.gameObject.SetActive(true);
|
|
btnAttack.gameObject.SetActive(true);
|
|
btnRouteSettings.gameObject.SetActive(true);
|
|
if (!GlobalFlag.isStartRehearsing)
|
|
{
|
|
btnFrequencyBand.gameObject.SetActive(true);
|
|
btnSurveillanceFrequencyBand.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
btnFrequencyBand.gameObject.SetActive(false);
|
|
btnSurveillanceFrequencyBand.gameObject.SetActive(false);
|
|
}
|
|
|
|
break;
|
|
case WRJModel.电子侦察无人机:
|
|
btnTheOpportuneMoment.gameObject.SetActive(true);
|
|
btnBeOnTheAlertAgainst.gameObject.SetActive(true);
|
|
btnAttack.gameObject.SetActive(true);
|
|
btnRouteSettings.gameObject.SetActive(true);
|
|
if (!GlobalFlag.isStartRehearsing)
|
|
{
|
|
btnFrequencyBand.gameObject.SetActive(true);
|
|
btnSurveillanceFrequencyBand.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
btnFrequencyBand.gameObject.SetActive(false);
|
|
btnSurveillanceFrequencyBand.gameObject.SetActive(false);
|
|
}
|
|
break;
|
|
case WRJModel.自杀式无人机:
|
|
btnTheOpportuneMoment.gameObject.SetActive(true);
|
|
btnBeOnTheAlertAgainst.gameObject.SetActive(true);
|
|
btnAttack.gameObject.SetActive(true);
|
|
btnRouteSettings.gameObject.SetActive(true);
|
|
if (!GlobalFlag.isStartRehearsing)
|
|
{
|
|
btnFrequencyBand.gameObject.SetActive(true);
|
|
btnSurveillanceFrequencyBand.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
btnFrequencyBand.gameObject.SetActive(false);
|
|
btnSurveillanceFrequencyBand.gameObject.SetActive(false);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 航线设置
|
|
/// </summary>
|
|
public void GetRouteSettings(bool isOpen)
|
|
{
|
|
if (unmannedAerialVehicleManage)
|
|
{
|
|
if (isOpen)
|
|
{
|
|
unmannedAerialVehicleManage.RouteSettings();
|
|
if (unmannedAerialVehicleManage.airRoute)
|
|
unmannedAerialVehicleManage.airRoute.transform.localScale = Vector3.one;
|
|
}
|
|
else
|
|
{
|
|
unmannedAerialVehicleManage.TurnOffCourseSettings();
|
|
if (unmannedAerialVehicleManage.airRoute)
|
|
unmannedAerialVehicleManage.airRoute.transform.localScale = Vector3.zero;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void SwitchModelScale(float scale)
|
|
{
|
|
transform.localScale = new Vector3(scale, scale, scale);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 切换无人机模式
|
|
/// </summary>
|
|
/// <param name="patternCut"></param>
|
|
public void GetModeSwitch(int patternCut)
|
|
{
|
|
if (unmannedAerialVehicleManage)
|
|
{
|
|
unmannedAerialVehicleManage.modeSwitch(patternCut);
|
|
}
|
|
}
|
|
}
|