|
|
|
using AX.MessageSystem;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 流量改变信息,有物体出水时改变其连接的水源的流量
|
|
|
|
/// </summary>
|
|
|
|
public class flowchangeinfo
|
|
|
|
{
|
|
|
|
public bool IsAdd;
|
|
|
|
public long ChangObjId;
|
|
|
|
}
|
|
|
|
public class SkillTollPanel : MonoBehaviour
|
|
|
|
{
|
|
|
|
//消防员技能
|
|
|
|
private Transform skillTitle;
|
|
|
|
private Transform skillScrollView;
|
|
|
|
//车辆技能
|
|
|
|
private Transform carSkillTitle;
|
|
|
|
private Transform carScrollView;
|
|
|
|
//固定水泡技能
|
|
|
|
private Transform FixedWaterTitle;
|
|
|
|
private Transform FixedWaterScrollView;
|
|
|
|
//移动水泡技能
|
|
|
|
private Transform MoveWaterTitle;
|
|
|
|
private Transform MoveWaterScrollView;
|
|
|
|
//暴风雪炮技能
|
|
|
|
private Transform SnowPaoTitle;
|
|
|
|
private Transform SnowPaoScrollView;
|
|
|
|
//灭火机器人技能
|
|
|
|
private Transform FireRobotTitle;
|
|
|
|
private Transform FireRobotScrollView;
|
|
|
|
//水幕水带技能
|
|
|
|
private Transform WaterCurtainHoseTitle;
|
|
|
|
private Transform WaterCurtainHoseScrollview;
|
|
|
|
|
|
|
|
public GameObject SelectObj;
|
|
|
|
private static SkillTollPanel instance;
|
|
|
|
|
|
|
|
public static SkillTollPanel Instance
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
skillTitle = transform.Find("SkillTitle");
|
|
|
|
carSkillTitle = transform.Find("CarSkillTitle");
|
|
|
|
skillScrollView = transform.Find("SkillScrollView");
|
|
|
|
carScrollView = transform.Find("CarScrollView");
|
|
|
|
FixedWaterTitle = transform.Find("FixedPaoTitle");
|
|
|
|
FixedWaterScrollView = transform.Find("FixedPaoScrollView");
|
|
|
|
MoveWaterTitle = transform.Find("MovePaoTitle");
|
|
|
|
MoveWaterScrollView = transform.Find("MovePaoScrollView");
|
|
|
|
SnowPaoTitle = transform.Find("SnowPaoTitle");
|
|
|
|
SnowPaoScrollView = transform.Find("SnowPaoScrollView");
|
|
|
|
FireRobotTitle = transform.Find("FireRobotTitle");
|
|
|
|
FireRobotScrollView = transform.Find("FireRobotScrollView");
|
|
|
|
WaterCurtainHoseTitle = transform.Find("WaterCurtainHoseTitle");
|
|
|
|
WaterCurtainHoseScrollview = transform.Find("WaterCurtainHoseScrollview");
|
|
|
|
|
|
|
|
MessageDispatcher.AddListener("DelectExpendTool", DelectSetPanel);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 删除有技能面板的物体时隐藏对应UI
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
private void DelectSetPanel(IMessage obj)
|
|
|
|
{
|
|
|
|
GameObject delect = (GameObject)obj.Data;
|
|
|
|
if (SelectObj==delect)
|
|
|
|
{
|
|
|
|
//移动水泡
|
|
|
|
if (SelectObj.GetComponent<BaseGameObjInfo>().gameObjType == CloneObjType.WaterCannon)
|
|
|
|
{
|
|
|
|
SetPanelHide(MoveWaterTitle, MoveWaterScrollView);
|
|
|
|
}
|
|
|
|
//雪炮
|
|
|
|
else if (SelectObj.GetComponent<BaseGameObjInfo>().gameObjType == CloneObjType.SnowCannon)
|
|
|
|
{
|
|
|
|
SetPanelHide(SnowPaoTitle, SnowPaoScrollView);
|
|
|
|
}
|
|
|
|
//机器人
|
|
|
|
else if (SelectObj.GetComponent<BaseGameObjInfo>().gameObjType == CloneObjType.FirefightingRobot)
|
|
|
|
{
|
|
|
|
SetPanelHide(FireRobotTitle, FireRobotScrollView);
|
|
|
|
}
|
|
|
|
//水幕水带
|
|
|
|
else if (SelectObj.GetComponent<BaseGameObjInfo>().gameObjType==CloneObjType.WaterCurtainHose)
|
|
|
|
|
|
|
|
{
|
|
|
|
SetPanelHide(WaterCurtainHoseTitle, WaterCurtainHoseScrollview);
|
|
|
|
}
|
|
|
|
SelectObj = null;
|
|
|
|
MoveWaterConnonSkillPanelController.Instance.selectMoveWaterConnon = null;
|
|
|
|
SnowConnonSkillPanelController.Instance.SelectSnowConnon = null;
|
|
|
|
FireRobotSkillPanelController.Instance.SelectRobot = null;
|
|
|
|
WaterCurtainHoseSkillPanelController.Instance.SelectWaterCurtainHose = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 控制技能栏显示
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="HitObj"></param>
|
|
|
|
public void SetShowSkillPanel(GameObject HitObj)
|
|
|
|
{
|
|
|
|
SelectObj = HitObj;
|
|
|
|
if (HitObj.GetComponent<TruckMessage>() || HitObj.GetComponent<FireManControl>()
|
|
|
|
|| HitObj.GetComponent<GuDingShuiPaoControl>()
|
|
|
|
|| HitObj.GetComponent<WaterConnonController>()||
|
|
|
|
HitObj.GetComponent<SnowConnonController>()||
|
|
|
|
HitObj.GetComponent<FireRobotController>())
|
|
|
|
{
|
|
|
|
//如果选择物体时消防员/车/水炮
|
|
|
|
GetComponent<LayWaterPanel>().SelectSparyObj = SelectObj;
|
|
|
|
}
|
|
|
|
if (HitObj.GetComponent<TruckMessage>())
|
|
|
|
{//车辆
|
|
|
|
SetpanelShow(carSkillTitle, carScrollView);
|
|
|
|
TruckSkillPanelController.GetInstance.SkillBind(HitObj.GetComponent<TruckMessage>());
|
|
|
|
}
|
|
|
|
else if (HitObj.GetComponent<FireManControl>())
|
|
|
|
{//消防员
|
|
|
|
SetpanelShow(skillTitle, skillScrollView);
|
|
|
|
FireManSkillPanelController.Instance.SetSkillSelectFireman(SelectObj);
|
|
|
|
}
|
|
|
|
else if (HitObj.GetComponent<GuDingShuiPaoControl>())
|
|
|
|
{//固定水泡
|
|
|
|
SetpanelShow(FixedWaterTitle, FixedWaterScrollView);
|
|
|
|
FixWaterConnonSkillPanelController.Instance.SetFixedWaterConnon(SelectObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (HitObj.GetComponent<WaterConnonController>())
|
|
|
|
{//移动水炮
|
|
|
|
SetpanelShow(MoveWaterTitle, MoveWaterScrollView);
|
|
|
|
MoveWaterConnonSkillPanelController.Instance.SetMoveWaterConnon(SelectObj);
|
|
|
|
}
|
|
|
|
else if (HitObj.GetComponent<SnowConnonController>())
|
|
|
|
{//暴风雪炮
|
|
|
|
SetpanelShow(SnowPaoTitle, SnowPaoScrollView);
|
|
|
|
SnowConnonSkillPanelController.Instance.SetSnowConnon(SelectObj);
|
|
|
|
}
|
|
|
|
else if (HitObj.GetComponent<FireRobotController>())
|
|
|
|
{//灭火机器人
|
|
|
|
SetpanelShow(FireRobotTitle, FireRobotScrollView);
|
|
|
|
FireRobotSkillPanelController.Instance.SelectFireRobot(SelectObj);
|
|
|
|
}
|
|
|
|
else if (HitObj.GetComponent<BaseGameObjInfo>().gameObjType==CloneObjType.WaterCurtainHose)
|
|
|
|
{//水幕水带
|
|
|
|
SetpanelShow(WaterCurtainHoseTitle, WaterCurtainHoseScrollview);
|
|
|
|
WaterCurtainHoseSkillPanelController.Instance.SetWaterCurtainHosen(SelectObj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetpanelShow(carSkillTitle, carScrollView);
|
|
|
|
if (carSkillTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
carSkillTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (carScrollView.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
SetAllSkillFalse(carScrollView);
|
|
|
|
carScrollView.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
//if (skillTitle.gameObject.activeInHierarchy)
|
|
|
|
//{
|
|
|
|
// skillTitle.gameObject.SetActive(false);
|
|
|
|
//}
|
|
|
|
//if (skillScrollView.gameObject.activeInHierarchy)
|
|
|
|
//{
|
|
|
|
// SetAllSkillFalse(skillScrollView);
|
|
|
|
// skillScrollView.gameObject.SetActive(false);
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 隐藏当前技能面板
|
|
|
|
/// </summary>
|
|
|
|
public void SetSkillPanelHide()
|
|
|
|
{
|
|
|
|
if (carSkillTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
//carSkillTitle.GetComponent<Toggle>().isOn = false;
|
|
|
|
carScrollView.GetComponent<RectTransform>().sizeDelta = new Vector2(carScrollView.GetComponent<RectTransform>().sizeDelta.x, 0);
|
|
|
|
SetAllSkillFalse(carScrollView);
|
|
|
|
carScrollView.gameObject.SetActive(false);
|
|
|
|
carSkillTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (skillTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
//skillTitle.GetComponent<Toggle>().isOn = false;
|
|
|
|
skillScrollView.GetComponent<RectTransform>().sizeDelta = new Vector2(skillScrollView.GetComponent<RectTransform>().sizeDelta.x, 0);
|
|
|
|
SetAllSkillFalse(skillScrollView);
|
|
|
|
skillScrollView.gameObject.SetActive(false);
|
|
|
|
skillTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (FixedWaterTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
FixedWaterScrollView.GetComponent<RectTransform>().sizeDelta = new Vector2(FixedWaterScrollView.GetComponent<RectTransform>().sizeDelta.x,0);
|
|
|
|
SetAllSkillFalse(FixedWaterScrollView);
|
|
|
|
FixedWaterScrollView.gameObject.SetActive(false);
|
|
|
|
FixedWaterTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (MoveWaterTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
MoveWaterScrollView.GetComponent<RectTransform>().sizeDelta = new Vector2(MoveWaterScrollView.GetComponent<RectTransform>().sizeDelta.x, 0);
|
|
|
|
SetAllSkillFalse(MoveWaterScrollView);
|
|
|
|
MoveWaterScrollView.gameObject.SetActive(false);
|
|
|
|
MoveWaterTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (SnowPaoTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
SnowPaoScrollView.GetComponent<RectTransform>().sizeDelta = new Vector2(SnowPaoScrollView.GetComponent<RectTransform>().sizeDelta.x, 0);
|
|
|
|
SetAllSkillFalse(SnowPaoScrollView);
|
|
|
|
SnowPaoScrollView.gameObject.SetActive(false);
|
|
|
|
SnowPaoTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (FireRobotTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
FireRobotScrollView.GetComponent<RectTransform>().sizeDelta = new Vector2(FireRobotScrollView.GetComponent<RectTransform>().sizeDelta.x, 0);
|
|
|
|
SetAllSkillFalse(FireRobotScrollView);
|
|
|
|
FireRobotScrollView.gameObject.SetActive(false);
|
|
|
|
FireRobotTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (WaterCurtainHoseTitle.gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
WaterCurtainHoseScrollview.GetComponent<RectTransform>().sizeDelta = new Vector2(WaterCurtainHoseScrollview.GetComponent<RectTransform>().sizeDelta.x, 0);
|
|
|
|
SetAllSkillFalse(WaterCurtainHoseScrollview);
|
|
|
|
WaterCurtainHoseScrollview.gameObject.SetActive(false);
|
|
|
|
WaterCurtainHoseTitle.gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
if (GameObject.Find("LayWaterPanel"))
|
|
|
|
{
|
|
|
|
GameObject.Find("LayWaterPanel").SetActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 重置inputmanage里的信息
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="Parent"></param>
|
|
|
|
public void SetAllSkillFalse(Transform Parent)
|
|
|
|
{
|
|
|
|
//Toggle[] all = Parent.GetComponentsInChildren<Toggle>();
|
|
|
|
//for (int i = 0; i < all.Length; i++)
|
|
|
|
//{
|
|
|
|
// if (all[i].isOn)
|
|
|
|
// {
|
|
|
|
// all[i].isOn = false;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//if(Parent.GetComponentInChildren<IsCloneSkill>(true))
|
|
|
|
//{
|
|
|
|
// Parent.GetComponentInChildren<IsCloneSkill>().GetComponent<Toggle>().isOn = false;
|
|
|
|
//}
|
|
|
|
if (InputManager.cloneObjType != CloneObjType.None)
|
|
|
|
{
|
|
|
|
InputManager.cloneObjType = CloneObjType.None;
|
|
|
|
}
|
|
|
|
if (InputManager.skill)
|
|
|
|
{
|
|
|
|
InputManager.skill = false;
|
|
|
|
}
|
|
|
|
///注释掉自动举臂
|
|
|
|
//if (InputManager.AutoArm)
|
|
|
|
//{
|
|
|
|
// InputManager.AutoArm = false;
|
|
|
|
// CursorManager.GetInstance.SetNormal();
|
|
|
|
//}
|
|
|
|
if (InputManager.IsGuidance)
|
|
|
|
{
|
|
|
|
InputManager.IsGuidance = false;
|
|
|
|
}
|
|
|
|
if (InputManager.GuidanceList.Count>0)
|
|
|
|
{
|
|
|
|
InputManager.GuidanceList.Clear();
|
|
|
|
Transform p_Hitpoint = GameObject.Find("P_AllParent/P_Hitpoint").transform;
|
|
|
|
for (int i = 0; i < p_Hitpoint.childCount; i++)
|
|
|
|
{
|
|
|
|
Destroy(p_Hitpoint.GetChild(i).gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (InputManager.isTagSearchRoom)
|
|
|
|
{
|
|
|
|
InputManager.isTagSearchRoom = false;
|
|
|
|
}
|
|
|
|
InputManager.tagSearchRoomPoint = Vector3.zero;
|
|
|
|
}
|
|
|
|
private void SetpanelShow(Transform title,Transform scroll)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < transform.childCount; i++)
|
|
|
|
{
|
|
|
|
if (title==transform.GetChild(i))
|
|
|
|
{
|
|
|
|
title.gameObject.SetActive(true);
|
|
|
|
scroll.gameObject.SetActive(true);
|
|
|
|
title.gameObject.GetComponent<Toggle>().isOn = true;
|
|
|
|
scroll.GetComponent<RectTransform>().sizeDelta = new Vector2(scroll.GetComponent<RectTransform>().sizeDelta.x, title.GetComponent<Hideshow>().height);
|
|
|
|
}
|
|
|
|
if (transform.GetChild(i)!=title&&transform.GetChild(i)!=scroll)
|
|
|
|
{
|
|
|
|
if (transform.GetChild(i).name.Contains("Toll"))
|
|
|
|
{
|
|
|
|
//transform.GetChild(i).GetComponent<Toggle>().isOn = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (transform.GetChild(i).GetComponent<ScrollRect>())
|
|
|
|
{
|
|
|
|
SetAllSkillFalse(transform.GetChild(i));
|
|
|
|
}
|
|
|
|
transform.GetChild(i).gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void SetPanelHide(Transform title,Transform scroll)
|
|
|
|
{
|
|
|
|
title.GetComponent<Toggle>().isOn = false;
|
|
|
|
title.gameObject.SetActive(false);
|
|
|
|
scroll.gameObject.SetActive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|