You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
4.0 KiB

2 years ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class GameModeWindow : WindowBase
{
[HideInInspector]
public List<string> BuShuOKlist = new List<string>();
public int AllBuShuIndex;
[Header("窗口控件")]
public GameObject tangFangWnd;
public GameObject huapoWnd,zhangAiWnd,shiGuWnd;
public GameObject UACWnd;
public GameObject publicUIWnd;
[Header("交互UI")]
public Button xunjianBtn;
public Button UACViewBtn;
public Button UACheckBtn;
[Header("场景控件")]
public GameObject tafangScene;
public UAVRescue.UAVController UAV;
public Camera mainCamera;
public Camera UAVCamera;
public GameObject miniMap;
public Slider imgAnlySlider;
private bool isCheckView = false;
private bool canCheckImg = false;
public override void Init()
{
base.Init();
xunjianBtn.onClick.AddListener(() => { EnterXunJian(); });
UACViewBtn.onClick.AddListener(EnterUACViewMode);
UACheckBtn.onClick.AddListener(EnterUACCheckMode);
}
public void AddBushuInfo(string AearName)
{
if (!BuShuOKlist.Contains(AearName))
{
BuShuOKlist.Add(AearName);
}
}
public bool CheckBushuState()
{
if (BuShuOKlist.Count < AllBuShuIndex)
{
int num = AllBuShuIndex - BuShuOKlist.Count;
GameRoot.Instance.AddTipQueue("目前已部署"+BuShuOKlist.Count+"处区域,还需部署"+num+"处区域");
return false;
}
else
{
return true;
}
}
public void SetTaFangModeActive(bool b)
{
if (b)
{
tafangScene.gameObject.SetActive(true);
tangFangWnd.SetActive(true);
}
else {
}
}
private void Update()
{
CheckImageInCheckMode();
}
public void EnterXunJian()
{
UAV.enabled = true;
isCheckView = false;
mainCamera.gameObject.SetActive(false);
UAVCamera.gameObject.SetActive(true);
miniMap.gameObject.SetActive(true);
GameRoot.Instance.menuWindow.gameObject.SetActive(false);
xunjianBtn.gameObject.SetActive(false);
UACWnd.SetActive(true);
}
public void EnterUACViewMode()
{
if (!isCheckView) return;
isCheckView = false;
UACheckBtn.image.color = Color.white;
UACViewBtn.image.color = Color.green;
}
public void EnterUACCheckMode()
{
if (isCheckView) return;
isCheckView = true;
UACheckBtn.image.color = Color.green;
UACViewBtn.image.color = Color.white;
}
private void CheckImageInCheckMode()
{
if (!isCheckView) return;
if (Input.GetMouseButtonDown(0)&& !EventSystem.current.IsPointerOverGameObject())
{
imgAnlySlider.transform.parent.gameObject.SetActive(true);
canCheckImg = true;
UAV.canControl = false;
}
else if (Input.GetMouseButtonUp(0))
{
imgAnlySlider.transform.parent.gameObject.SetActive(false);
canCheckImg = false;
imgAnlySlider.value = 0;
UAV.canControl = true;
}
if (Input.GetMouseButton(0)&&canCheckImg)
{
if (imgAnlySlider.value >= 1)
{
//提示是否有异常
if (UAV.isChecked)
{
}
else
{
GameRoot.Instance.AddTipQueue("此区域未分析出异常");
imgAnlySlider.transform.parent.gameObject.SetActive(false);
canCheckImg = false;
imgAnlySlider.value = 0;
UAV.canControl = true;
}
}
else
{
imgAnlySlider.value += 0.25f * Time.deltaTime;
}
}
}
}