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.
130 lines
6.7 KiB
130 lines
6.7 KiB
4 years ago
|
using AX.MessageSystem;
|
||
|
using AX.NetworkSystem;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class ExtinguishantSelectPanel : MonoBehaviour {
|
||
|
|
||
|
private ButtonRecordByAC waterbutton;
|
||
|
private ButtonRecordByAC foambutton;
|
||
|
public GameObject SelectFireman;
|
||
|
private Transform laywaterPanel;
|
||
|
// Use this for initialization
|
||
|
void Start() {
|
||
|
waterbutton = transform.Find("WaterButton").GetComponent<ButtonRecordByAC>();
|
||
|
foambutton = transform.Find("FoamButton").GetComponent<ButtonRecordByAC>();
|
||
|
waterbutton.OutInterFaceButton = waterbuttonClick;
|
||
|
foambutton.OutInterFaceButton = foambuttonClick;
|
||
|
laywaterPanel = transform.parent.Find("LayWaterPanel");
|
||
|
|
||
|
}
|
||
|
|
||
|
private void foambuttonClick()
|
||
|
{
|
||
|
if (SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource)
|
||
|
{
|
||
|
WaterSource ws = SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<WaterSource>();
|
||
|
float remain = SelectFireman.GetComponent<FireManControl>().CheckFoamRemain();
|
||
|
if (!(remain==100||remain>0))
|
||
|
{
|
||
|
LoadPromptWin.Instance.LoadTextPromptWindow("泡沫量不足",1f);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
SelectFireman.GetComponent<FireManControl>().workType = FireManSkills.SprayWater;
|
||
|
SelectFireman.GetComponent<AgentController>().pathFindEnable = true;
|
||
|
SelectFireman.GetComponent<FireManControl>().SetLay(true);
|
||
|
SelectFireman.GetComponent<FireManControl>().SetParticleType(SprayParticleType.Froth);
|
||
|
SelectFireman.GetComponent<LayWaterHose>().StartSprayingLay();
|
||
|
laywaterPanel.gameObject.SetActive(true);
|
||
|
//FindObjectOfType<LayWaterPanel>().SetShowEnable();
|
||
|
SkillTollPanel.Instance.GetComponent<LayWaterPanel>().SetShowEnable();
|
||
|
|
||
|
|
||
|
MessageDispatcher.SendMessage("SPRAY_WATER", new flowchangeinfo() { IsAdd = true, ChangObjId = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID });
|
||
|
|
||
|
////消防员工作状态同步
|
||
|
//FiremanWorktypeChangeSyncData worksync = new FiremanWorktypeChangeSyncData();
|
||
|
//worksync.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
//worksync.worktype = FireManSkills.SprayWater;
|
||
|
//worksync.gameObjID = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
//worksync.UserID = SelectFireman.GetComponent<BaseGameObjInfo>().UserID;
|
||
|
//worksync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType;
|
||
|
//NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "FIREMAN_WORKTYPECHANGE_SYNC", worksync);
|
||
|
|
||
|
|
||
|
//if (SelectFireman.GetComponent<FireManWaterHoseManager>())
|
||
|
//{
|
||
|
// var arg = new HoseConnectOrDelectData();
|
||
|
// arg.StartId = SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
// arg.EndId = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
// arg.HoseId = SelectFireman.GetComponent<FireManWaterHoseManager>().WaterLineConnent.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
// arg.Isconnect = true;
|
||
|
// MessageDispatcher.SendMessage("HOSE_CONNECT_OR_DELECT", arg);
|
||
|
//}
|
||
|
|
||
|
//出水同步
|
||
|
SpraySyncData spraysync = new SpraySyncData();
|
||
|
spraysync.spraytype = SprayParticleType.Froth;
|
||
|
spraysync.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
spraysync.size = 0.95f;
|
||
|
spraysync.IsOn = true;
|
||
|
spraysync.gameObjID = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
spraysync.UserID = SelectFireman.GetComponent<BaseGameObjInfo>().UserID;
|
||
|
spraysync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType;
|
||
|
NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "SPRAY_WATER_SYNC", spraysync);
|
||
|
gameObject.SetActive(false);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
private void waterbuttonClick()
|
||
|
{
|
||
|
SelectFireman.GetComponent<FireManControl>().workType = FireManSkills.SprayWater;
|
||
|
SelectFireman.GetComponent<AgentController>().pathFindEnable = true;
|
||
|
SelectFireman.GetComponent<FireManControl>().SetLay(true);
|
||
|
SelectFireman.GetComponent<FireManControl>().SetParticleType(SprayParticleType.WaterStraight);
|
||
|
SelectFireman.GetComponent<LayWaterHose>().StartSprayingLay();
|
||
|
//FindObjectOfType<LayWaterPanel>().SetShowEnable();
|
||
|
SkillTollPanel.Instance.GetComponent<LayWaterPanel>().SetShowEnable();
|
||
|
laywaterPanel.gameObject.SetActive(true);
|
||
|
|
||
|
MessageDispatcher.SendMessage("SPRAY_WATER", new flowchangeinfo() { IsAdd = true, ChangObjId = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID });
|
||
|
|
||
|
//FireManSkillPanelController.Instance.GetComponent<LayWaterPanel>().SelectSparyObj = SelectFireman;
|
||
|
FireManSkillPanelController.Instance.GetComponent<LayWaterPanel>().GetComponent<LayWaterPanel>().SetShowEnable();
|
||
|
////工作状态同步
|
||
|
//FiremanWorktypeChangeSyncData worksync = new FiremanWorktypeChangeSyncData();
|
||
|
//worksync.worktype = FireManSkills.SprayWater;
|
||
|
//worksync.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
//worksync.gameObjID = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
//worksync.UserID = SelectFireman.GetComponent<BaseGameObjInfo>().UserID;
|
||
|
//worksync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType;
|
||
|
//NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "FIREMAN_WORKTYPECHANGE_SYNC", worksync);
|
||
|
//出水同步
|
||
|
|
||
|
//if (SelectFireman.GetComponent<FireManWaterHoseManager>())
|
||
|
//{
|
||
|
// var arg = new HoseConnectOrDelectData();
|
||
|
// arg.StartId = SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
// arg.EndId = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
// arg.HoseId = SelectFireman.GetComponent<FireManWaterHoseManager>().WaterLineConnent.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
// arg.Isconnect = true;
|
||
|
// MessageDispatcher.SendMessage("HOSE_CONNECT_OR_DELECT", arg);
|
||
|
//}
|
||
|
SpraySyncData spraysync = new SpraySyncData();
|
||
|
spraysync.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
spraysync.spraytype = SprayParticleType.WaterStraight;
|
||
|
spraysync.size = 0.2f;
|
||
|
spraysync.IsOn = true;
|
||
|
spraysync.gameObjID = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
spraysync.UserID = SelectFireman.GetComponent<BaseGameObjInfo>().UserID;
|
||
|
spraysync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType;
|
||
|
NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "SPRAY_WATER_SYNC", spraysync);
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
|
||
|
}
|