Browse Source

同步高层修改

出水同步时,其他客户端报错。原因为关闭出水时调用了结束管线铺设的方法,这个方法里重置了水源信息,同步的客户端再次出水时因为没有调用出水按钮的方法,没有重新赋值出水信息,找不到水源信息了。
铺设管线结束后,不管走到哪都可以出水。修改为结束铺设后,5米内可以自动连接之前放下的管线出水
develop
曹衍涛 5 years ago
parent
commit
f36710447e
  1. 4
      Assets/Scripts/Common/ChatSystem/FireSiteInfo/FireInfoToggle.cs
  2. 44
      Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/Associated/CloneWaterHoseLines.cs
  3. 40
      Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/Associated/FireManWaterHoseManager.cs
  4. 2
      Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/LayWaterHose/LAY_WATER_HOSE_SYNC.cs
  5. 106
      Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/LayWaterHose/LayWaterHose.cs
  6. 35
      Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/SprayWater/ExtinguishantSelectPanel.cs
  7. 7
      Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/SprayWater/SPRAY_WATER_SYNC.cs
  8. 25
      Assets/Scripts/DongYouLiQing/BaseCommander/SkillPanel/FireManSkillPanelController.cs

4
Assets/Scripts/Common/ChatSystem/FireSiteInfo/FireInfoToggle.cs

@ -14,8 +14,8 @@ public class FireInfoToggle : BaseToggle
} }
public override void OnDisable() public override void OnDisable()
{ {
//base.OnDisable(); base.OnDisable();
//MessageDispatcher.RemoveListener("CloseFireInfoPanel", CancelToggle); MessageDispatcher.RemoveListener("CloseFireInfoPanel", CancelToggle);
} }
public override void OnDestroy() public override void OnDestroy()
{ {

44
Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/Associated/CloneWaterHoseLines.cs

@ -256,29 +256,7 @@ public class CloneWaterHoseLines : CloneBase
//设置楼层属性 //设置楼层属性
Setattribute(data.gameObjID, parentgameobj); Setattribute(data.gameObjID, parentgameobj);
if (endHitGameobj.GetComponent<FireManControl>() ||
endHitGameobj.GetComponent<WaterConnonController>() ||
endHitGameobj.GetComponent<SnowConnonController>() ||
endHitGameobj.GetComponent<FireRobotController>() ||
endHitGameobj.GetComponent<TruckMessage>() ||
startHitGameobj.GetComponent<WaterSource>())
{
if (endHitGameobj.GetComponent<FireManControl>() ||
endHitGameobj.GetComponent<WaterConnonController>() ||
endHitGameobj.GetComponent<SnowConnonController>() ||
endHitGameobj.GetComponent<FireRobotController>() ||
endHitGameobj.GetComponent<TruckMessage>())
{
LoadPromptWin.Instance.LoadTextPromptWindow("连接成功",1f);
}
var arg = new HoseConnectOrDelectData();
arg.StartId = startHitGameobj.GetComponent<BaseGameObjInfo>().gameObjID;
arg.EndId = endHitGameobj.GetComponent<BaseGameObjInfo>().gameObjID;
arg.HoseId = parentgameobj.GetComponent<BaseGameObjInfo>().gameObjID;
arg.Isconnect = true;
MessageDispatcher.SendMessage("HOSE_CONNECT_OR_DELECT", arg);
}
//connentFireMan(); //connentFireMan();
//connentWaterCannon(); //connentWaterCannon();
@ -310,7 +288,29 @@ public class CloneWaterHoseLines : CloneBase
//同步 //同步
CloneInfoSync(endPoint); CloneInfoSync(endPoint);
if (endHitGameobj.GetComponent<FireManControl>() ||
endHitGameobj.GetComponent<WaterConnonController>() ||
endHitGameobj.GetComponent<SnowConnonController>() ||
endHitGameobj.GetComponent<FireRobotController>() ||
endHitGameobj.GetComponent<TruckMessage>() ||
startHitGameobj.GetComponent<WaterSource>())
{
if (endHitGameobj.GetComponent<FireManControl>() ||
endHitGameobj.GetComponent<WaterConnonController>() ||
endHitGameobj.GetComponent<SnowConnonController>() ||
endHitGameobj.GetComponent<FireRobotController>() ||
endHitGameobj.GetComponent<TruckMessage>())
{
LoadPromptWin.Instance.LoadTextPromptWindow("连接成功", 1f);
}
var arg = new HoseConnectOrDelectData();
arg.StartId = startHitGameobj.GetComponent<BaseGameObjInfo>().gameObjID;
arg.EndId = endHitGameobj.GetComponent<BaseGameObjInfo>().gameObjID;
arg.HoseId = parentgameobj.GetComponent<BaseGameObjInfo>().gameObjID;
arg.Isconnect = true;
MessageDispatcher.SendMessage("HOSE_CONNECT_OR_DELECT", arg);
}
//如果连接到消防车、消防员或者水源上,重置信息,准备另画一条水带 //如果连接到消防车、消防员或者水源上,重置信息,准备另画一条水带
if (endHitGameobj.GetComponent<WaterSource>() || if (endHitGameobj.GetComponent<WaterSource>() ||
endHitGameobj.GetComponent<FireManControl>() || endHitGameobj.GetComponent<FireManControl>() ||

40
Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/Associated/FireManWaterHoseManager.cs

@ -85,7 +85,7 @@ public class FireManWaterHoseManager : MonoBehaviour
} }
public void OnEnable() public void Awake()
{ {
MessageDispatcher.AddListener("WATERHOSEEXPEND", HoseExpend); MessageDispatcher.AddListener("WATERHOSEEXPEND", HoseExpend);
MessageDispatcher.AddListener("PACK_OR_TACK_HOSE_COMMAND", PackOrTackHose); MessageDispatcher.AddListener("PACK_OR_TACK_HOSE_COMMAND", PackOrTackHose);
@ -324,6 +324,12 @@ public class FireManWaterHoseManager : MonoBehaviour
FireManSkillPanelController.Instance.LayWaterHoseToggle.GetComponent<Toggle>().isOn = true; FireManSkillPanelController.Instance.LayWaterHoseToggle.GetComponent<Toggle>().isOn = true;
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true;
} }
//var arg = new HoseConnectOrDelectData();
//arg.StartId = hosemsg.WaterSource.GetComponent<BaseGameObjInfo>().gameObjID;
//arg.EndId = GetComponent<BaseGameObjInfo>().gameObjID;
//arg.HoseId = hosemsg.ConnectWaterHose.GetComponent<BaseGameObjInfo>().gameObjID;
//arg.Isconnect = true;
//MessageDispatcher.SendMessage("HOSE_CONNECT_OR_DELECT", arg);
} }
else else
{ {
@ -530,27 +536,31 @@ public class FireManWaterHoseManager : MonoBehaviour
/// <param name="connectsource">是否有水源</param> /// <param name="connectsource">是否有水源</param>
/// <param name="water"></param> /// <param name="water"></param>
/// <param name="foam"></param> /// <param name="foam"></param>
public void ResetWaterSourceConnectInfo(bool connectsource, bool water, bool foam, GameObject watersource, GameObject connecthose) public void ResetWaterSourceConnectInfo(bool connectsource, bool water, bool foam, GameObject watersource, GameObject connecthose, bool issync = false)
{ {
IsConnentWaterSource = connectsource; if (issync == false)
hasWaterConnect = water;
hasFoamConnect = foam;
ConnentSource = watersource;
WaterLineConnent = connecthose;
if (connecthose != null)
{ {
IsConnentWaterLine = true; IsConnentWaterSource = connectsource;
} hasWaterConnect = water;
if (connectsource) hasFoamConnect = foam;
{ ConnentSource = watersource;
if (FireManSkillPanelController.Instance) WaterLineConnent = connecthose;
if (connecthose != null)
{
IsConnentWaterLine = true;
}
if (connectsource)
{ {
if (SelectedObjs.selectedObj == gameObject) if (FireManSkillPanelController.Instance)
{ {
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; if (SelectedObjs.selectedObj == gameObject)
{
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true;
}
} }
} }
} }
} }
/// <summary> /// <summary>
/// 重置连接水带信息 /// 重置连接水带信息

2
Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/LayWaterHose/LAY_WATER_HOSE_SYNC.cs

@ -78,7 +78,7 @@ public class LAY_WATER_HOSE_SYNC : NetworkMessageBehaviour
} }
else else
{ {
GetComponent<LayWaterHose>().EndLay(); GetComponent<LayWaterHose>().EndLay(true);
} }
} }
} }

106
Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/LayWaterHose/LayWaterHose.cs

@ -60,10 +60,10 @@ public class LayWaterHose : MonoBehaviour
/// <summary> /// <summary>
/// 如果是本客户端 /// 如果是本客户端
/// </summary> /// </summary>
public bool IsselfCurrent=true; public bool IsselfCurrent = true;
private int creatnum = 1; private int creatnum = 1;
// private bool setInitpoint; // private bool setInitpoint;
// public float LastLenght; // public float LastLenght;
//private float LastLayLenght; //private float LastLayLenght;
// Use this for initialization // Use this for initialization
void Start() void Start()
@ -323,7 +323,7 @@ public class LayWaterHose : MonoBehaviour
/// <summary> /// <summary>
/// 开始铺设水带 /// 开始铺设水带
/// </summary> /// </summary>
public void StartLay() public void StartLay(bool issync = false)
{ {
agent.SetDestination(transform.position); agent.SetDestination(transform.position);
//if (GetComponent<FireManWaterHoseManager>().OverLenght > 0) //if (GetComponent<FireManWaterHoseManager>().OverLenght > 0)
@ -349,7 +349,7 @@ public class LayWaterHose : MonoBehaviour
} }
//ParentLayHose = EntitiesManager.Instance.CreateObj(ParentLayHosePrefabs, Vector3.zero, //ParentLayHose = EntitiesManager.Instance.CreateObj(ParentLayHosePrefabs, Vector3.zero,
// WaterHoses.transform, EntitiesManager.Instance.CreateObjID(CurrentUserInfo.mySelf.Id)); // Instantiate(ParentLayHosePrefabs, WaterHoses.transform); // WaterHoses.transform, EntitiesManager.Instance.CreateObjID(CurrentUserInfo.mySelf.Id)); // Instantiate(ParentLayHosePrefabs, WaterHoses.transform);
ParentLayHose=Instantiate(ParentLayHosePrefabs, WaterHoses.transform); ParentLayHose = Instantiate(ParentLayHosePrefabs, WaterHoses.transform);
//ParentLayHose.GetComponent<BaseGameObjInfo>().gameObjID = EntitiesManager.Instance.CreateObjID(CurrentUserInfo.mySelf.Id); //ParentLayHose.GetComponent<BaseGameObjInfo>().gameObjID = EntitiesManager.Instance.CreateObjID(CurrentUserInfo.mySelf.Id);
ParentLayHose.name = "LayWaterHose" + creatnum; ParentLayHose.name = "LayWaterHose" + creatnum;
creatnum++; creatnum++;
@ -377,18 +377,25 @@ public class LayWaterHose : MonoBehaviour
//更新消防员水源信息 //更新消防员水源信息
if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null) if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null)
{ {
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo if (issync == false)
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose);
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance)
{ {
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose);
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance)
{
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true;
}
} }
} }
else else
{ {
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null); if (issync == false)
{
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null);
}
} }
flag = true; flag = true;
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFireman = gameObject; ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFireman = gameObject;
@ -441,7 +448,7 @@ public class LayWaterHose : MonoBehaviour
/// <summary> /// <summary>
/// 消防员喷水、泡沫时铺设水带 /// 消防员喷水、泡沫时铺设水带
/// </summary> /// </summary>
public void StartSprayingLay() public void StartSprayingLay(bool issync = false)
{ {
agent.SetDestination(transform.position); agent.SetDestination(transform.position);
if (!GetComponent<AgentController>().pathFindEnable) if (!GetComponent<AgentController>().pathFindEnable)
@ -459,10 +466,14 @@ public class LayWaterHose : MonoBehaviour
{ {
if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null) if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null)
{ {
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo if (issync == false)
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, {
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); (true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose);
}
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance)
{ {
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true;
@ -470,7 +481,10 @@ public class LayWaterHose : MonoBehaviour
} }
else else
{ {
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null); if (issync == false)
{
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo(false, false, false, null, null);
}
} }
//GetComponent<FireManWaterHoseManager>().WaterHoseLenghtRemain = //GetComponent<FireManWaterHoseManager>().WaterHoseLenghtRemain =
// GetComponent<FireManWaterHoseManager>().NowRemainWaterHose * 20 + ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().RemainLenght;//+ GetComponent<FireManWaterHoseManager>().OverLenght; // GetComponent<FireManWaterHoseManager>().NowRemainWaterHose * 20 + ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().RemainLenght;//+ GetComponent<FireManWaterHoseManager>().OverLenght;
@ -497,7 +511,7 @@ public class LayWaterHose : MonoBehaviour
/// <summary> /// <summary>
/// 结束铺设,放下水带 /// 结束铺设,放下水带
/// </summary> /// </summary>
public void EndLay() public void EndLay(bool issync = false, bool isstoplayskill = true)
{ {
//endlay(); //endlay();
if (flag) if (flag)
@ -505,7 +519,7 @@ public class LayWaterHose : MonoBehaviour
flag = false; flag = false;
agent.SetDestination(transform.position); //停止移动 agent.SetDestination(transform.position); //停止移动
SetLayHoseInfo(); SetLayHoseInfo(issync, isstoplayskill);
//lengthDic.Clear();//清空本次绘制存储的线 //lengthDic.Clear();//清空本次绘制存储的线
//IsTackUp = false; //IsTackUp = false;
//TackHose = null; //TackHose = null;
@ -521,9 +535,9 @@ public class LayWaterHose : MonoBehaviour
/// <summary> /// <summary>
/// 结束铺设时设置该铺设管线信息 /// 结束铺设时设置该铺设管线信息
/// </summary> /// </summary>
void SetLayHoseInfo() void SetLayHoseInfo(bool issync = false, bool isstoplayskill = true)
{ {
// LastLenght = GetSelfConsumedLength() - ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght; // LastLenght = GetSelfConsumedLength() - ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght;
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght = GetSelfConsumedLength(); ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().LineLenght = GetSelfConsumedLength();
@ -546,12 +560,39 @@ public class LayWaterHose : MonoBehaviour
{ {
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().BindWaterSource(false, false, null, null); ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().BindWaterSource(false, false, null, null);
} }
if (GetComponent<FireManControl>().workType==FireManSkills.SprayFoam|| if (GetComponent<FireManControl>().workType == FireManSkills.SprayFoam ||
GetComponent<FireManControl>().workType == FireManSkills.SprayWater) GetComponent<FireManControl>().workType == FireManSkills.SprayWater)
{ {
GetComponent<AgentController>().pathFindEnable = false; GetComponent<AgentController>().pathFindEnable = false;
} }
// StartCoroutine(closespraytoggle());
//if (!(endPoint != Vector3.zero && Vector3.Distance(transform.position, endPoint) < 5))
//{
// if (FireManSkillPanelController.Instance)
// {
// FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false;
// FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = false;
// }
//}
if (issync == false)
{
GetComponent<FireManWaterHoseManager>().Resert(); GetComponent<FireManWaterHoseManager>().Resert();
}
}
IEnumerator closespraytoggle()
{
yield return new WaitForSeconds(0.2f);
if (GetComponent<FireManControl>().WorkType != FireManSkills.SprayFoam &&
GetComponent<FireManControl>().WorkType != FireManSkills.SprayWater ||
!FireManSkillPanelController.Instance.extinguishantSelect.gameObject.activeSelf)
{
//if (FireManSkillPanelController.Instance)
{
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().isOn = false;
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = false;
}
}
} }
/// <summary> /// <summary>
/// 收起水带 /// 收起水带
@ -719,7 +760,7 @@ public class LayWaterHose : MonoBehaviour
hose.transform.parent = WaterHoses.transform; hose.transform.parent = WaterHoses.transform;
hose.transform.forward = (shuiqiang.position - transform.position).normalized;//改变朝向 hose.transform.forward = (shuiqiang.position - transform.position).normalized;//改变朝向
float distance = Vector3.Distance(transform.position, shuiqiang.position); float distance = Vector3.Distance(transform.position, shuiqiang.position);
hose.transform.localScale = new Vector3(25,25, distance * 78);//延长线条,连接两点 hose.transform.localScale = new Vector3(25, 25, distance * 78);//延长线条,连接两点
} }
/// <summary> /// <summary>
@ -891,18 +932,27 @@ public class LayWaterHose : MonoBehaviour
} }
public void SetWaterInfoWhileSpray() public void SetWaterInfoWhileSpray()
{ {
if (ParentLayHose!=null&& ParentLayHose.GetComponent<ParentLayWaterHoseMsg>()!=null) if (ParentLayHose != null && ParentLayHose.GetComponent<ParentLayWaterHoseMsg>() != null)
{ {
if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null) if (ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource != null)
{ {
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo if ((endPoint != Vector3.zero && Vector3.Distance(transform.position, endPoint) < 5))
{
gameObject.GetComponent<FireManWaterHoseManager>().ResetWaterSourceConnectInfo
(true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater, (true, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWater,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectFoam, ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().WaterSource,
ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose); ParentLayHose.GetComponent<ParentLayWaterHoseMsg>().ConnectWaterHose);
if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance) if (/*FindObjectOfType<FireManSkillPanelController>()*/FireManSkillPanelController.Instance)
{
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true;
DrawByTimespan();
}
}
else
{ {
FireManSkillPanelController.Instance.SprayWater.GetComponent<Toggle>().interactable = true; LoadPromptWin.Instance.LoadTextPromptWindow("距离太远,无法自动拿起管线", 1f);
} }
} }
} }
} }

35
Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/SprayWater/ExtinguishantSelectPanel.cs

@ -5,31 +5,33 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class ExtinguishantSelectPanel : MonoBehaviour { public class ExtinguishantSelectPanel : MonoBehaviour
{
private ButtonRecordByAC waterbutton; private ButtonRecordByAC waterbutton;
private ButtonRecordByAC foambutton; private ButtonRecordByAC foambutton;
public GameObject SelectFireman; public GameObject SelectFireman;
private Transform laywaterPanel; private Transform laywaterPanel;
// Use this for initialization // Use this for initialization
void Start() { void Start()
{
waterbutton = transform.Find("WaterButton").GetComponent<ButtonRecordByAC>(); waterbutton = transform.Find("WaterButton").GetComponent<ButtonRecordByAC>();
foambutton = transform.Find("FoamButton").GetComponent<ButtonRecordByAC>(); foambutton = transform.Find("FoamButton").GetComponent<ButtonRecordByAC>();
waterbutton.OutInterFaceButton = waterbuttonClick; waterbutton.OutInterFaceButton = waterbuttonClick;
foambutton.OutInterFaceButton = foambuttonClick; foambutton.OutInterFaceButton = foambuttonClick;
laywaterPanel = transform.parent.Find("LayWaterPanel"); laywaterPanel = transform.parent.Find("LayWaterPanel");
} }
private void foambuttonClick() private void foambuttonClick()
{ {
if (SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource) if (SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource)
{ {
WaterSource ws = SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<WaterSource>(); WaterSource ws = SelectFireman.GetComponent<FireManWaterHoseManager>().ConnentSource.GetComponent<WaterSource>();
float remain = SelectFireman.GetComponent<FireManControl>().CheckFoamRemain(); float remain = SelectFireman.GetComponent<FireManControl>().CheckFoamRemain();
if (!(remain==100||remain>0)) if (!(remain == 100 || remain > 0))
{ {
LoadPromptWin.Instance.LoadTextPromptWindow("泡沫量不足",1f); LoadPromptWin.Instance.LoadTextPromptWindow("泡沫量不足", 1f);
} }
} }
@ -54,6 +56,17 @@ private void foambuttonClick()
//worksync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType; //worksync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType;
//NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "FIREMAN_WORKTYPECHANGE_SYNC", worksync); //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(); SpraySyncData spraysync = new SpraySyncData();
spraysync.spraytype = SprayParticleType.Froth; spraysync.spraytype = SprayParticleType.Froth;
@ -93,6 +106,16 @@ private void foambuttonClick()
//worksync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType; //worksync.gameObjType = SelectFireman.GetComponent<BaseGameObjInfo>().gameObjType;
//NetworkManager.Default.SendAsync(/*CurrentUserInfo.mySelf.Id,*/ "FIREMAN_WORKTYPECHANGE_SYNC", worksync); //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(); SpraySyncData spraysync = new SpraySyncData();
spraysync.SendUserID = CurrentUserInfo.mySelf.Id; spraysync.SendUserID = CurrentUserInfo.mySelf.Id;
spraysync.spraytype = SprayParticleType.WaterStraight; spraysync.spraytype = SprayParticleType.WaterStraight;

7
Assets/Scripts/DongYouLiQing/BaseCommander/FiremanSkill/SprayWater/SPRAY_WATER_SYNC.cs

@ -51,7 +51,7 @@ public class SPRAY_WATER_SYNC : NetworkMessageBehaviour
if (Sprayobj.GetComponent<FireManControl>()) if (Sprayobj.GetComponent<FireManControl>())
{ {
Sprayobj.GetComponent<LayWaterHose>().IsselfCurrent = false; Sprayobj.GetComponent<LayWaterHose>().IsselfCurrent = false;
Sprayobj.GetComponent<LayWaterHose>().EndLay(); Sprayobj.GetComponent<LayWaterHose>().EndLay(true);
Sprayobj.GetComponent<Animator>().SetBool("isInSitu", false); Sprayobj.GetComponent<Animator>().SetBool("isInSitu", false);
Hose.parent.gameObject.SetActive(false); Hose.parent.gameObject.SetActive(false);
} }
@ -61,7 +61,7 @@ public class SPRAY_WATER_SYNC : NetworkMessageBehaviour
Hose.gameObject.SetActive(false); Hose.gameObject.SetActive(false);
} }
//移动水泡 //移动水泡
if(Sprayobj.GetComponent<WaterConnonController>()) if (Sprayobj.GetComponent<WaterConnonController>())
{ {
for (int i = 0; i < Hose.childCount; i++) for (int i = 0; i < Hose.childCount; i++)
{ {
@ -104,9 +104,10 @@ public class SPRAY_WATER_SYNC : NetworkMessageBehaviour
if (sprayObj.GetComponent<FireManControl>()) if (sprayObj.GetComponent<FireManControl>())
{ {
sprayObj.GetComponent<LayWaterHose>().IsselfCurrent = false; sprayObj.GetComponent<LayWaterHose>().IsselfCurrent = false;
sprayObj.GetComponent<LayWaterHose>().StartSprayingLay(); sprayObj.GetComponent<LayWaterHose>().StartSprayingLay(true);
sprayObj.GetComponent<Animator>().SetBool("isInSitu", true); sprayObj.GetComponent<Animator>().SetBool("isInSitu", true);
Hose.parent.gameObject.SetActive(true); Hose.parent.gameObject.SetActive(true);
} }
if (sprayObj.GetComponent<TruckMessage>()) if (sprayObj.GetComponent<TruckMessage>())
{ {

25
Assets/Scripts/DongYouLiQing/BaseCommander/SkillPanel/FireManSkillPanelController.cs

@ -519,7 +519,7 @@ public class FireManSkillPanelController : MonoBehaviour
Guidance.GetComponent<Toggle>().isOn = true; Guidance.GetComponent<Toggle>().isOn = true;
return; return;
} }
if (InputManager.GuidanceList.Count<=0) if (InputManager.GuidanceList.Count <= 0)
{ {
LoadPromptWin.Instance.LoadTextPromptWindow("尚未设置引导路径,引导失败", 2f); LoadPromptWin.Instance.LoadTextPromptWindow("尚未设置引导路径,引导失败", 2f);
Guidance.GetComponent<Toggle>().isOn = true; Guidance.GetComponent<Toggle>().isOn = true;
@ -722,8 +722,13 @@ public class FireManSkillPanelController : MonoBehaviour
// LoadPromptWin.Instance.LoadTextPromptWindow("剩余水量不足", 1f); // LoadPromptWin.Instance.LoadTextPromptWindow("剩余水量不足", 1f);
// return; // return;
//} //}
if (SelectFireMan.GetComponent<FireManWaterHoseManager>().ConnentSource == null)
{
SprayWater.GetComponent<Toggle>().isOn = false;
return;
}
float remain = SelectFireMan.GetComponent<FireManControl>().CheckWaterRemain(SelectFireMan.GetComponent<FireManWaterHoseManager>().WaterSourceLine); float remain = SelectFireMan.GetComponent<FireManControl>().CheckWaterRemain(SelectFireMan.GetComponent<FireManWaterHoseManager>().WaterSourceLine);
if (!(remain>0||remain==-100)) if (!(remain > 0 || remain == -100))
{ {
LoadPromptWin.Instance.LoadTextPromptWindow("剩余水量不足", 1f); LoadPromptWin.Instance.LoadTextPromptWindow("剩余水量不足", 1f);
return; return;
@ -755,7 +760,14 @@ public class FireManSkillPanelController : MonoBehaviour
SelectFireMan.GetComponent<LayWaterHose>().StartSprayingLay(); SelectFireMan.GetComponent<LayWaterHose>().StartSprayingLay();
//连接水源流量设置 //连接水源流量设置
// MessageDispatcher.SendMessage("SPRAY_WATER", new flowchangeinfo() { IsAdd = true, ChangObjId = SelectFireMan.GetComponent<BaseGameObjInfo>().gameObjID }); // MessageDispatcher.SendMessage("SPRAY_WATER", new flowchangeinfo() { IsAdd = true, ChangObjId = SelectFireMan.GetComponent<BaseGameObjInfo>().gameObjID });
////同步水源信息
//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(); SpraySyncData spraysync = new SpraySyncData();
@ -783,10 +795,10 @@ public class FireManSkillPanelController : MonoBehaviour
SelectFireMan.GetComponent<FireManControl>().SetLay(value); SelectFireMan.GetComponent<FireManControl>().SetLay(value);
SelectFireMan.GetComponent<FireManControl>().DestoryPartical(); SelectFireMan.GetComponent<FireManControl>().DestoryPartical();
//这里面判断了能否寻路 //这里面判断了能否寻路
SelectFireMan.GetComponent<LayWaterHose>().EndLay(); SelectFireMan.GetComponent<LayWaterHose>().EndLay(false, false);
//SelectFireMan.GetComponent<FireManControl>().ParticleSize = 0; //SelectFireMan.GetComponent<FireManControl>().ParticleSize = 0;
//SelectFireMan.GetComponent<FireManControl>().SelectParticleType = SprayParticleType.WaterStraight; //SelectFireMan.GetComponent<FireManControl>().SelectParticleType = SprayParticleType.WaterStraight;
if (SelectFireMan.GetComponent<FireManControl>().Flow!=0) if (SelectFireMan.GetComponent<FireManControl>().Flow != 0)
{ {
SelectFireMan.GetComponent<FireManControl>().Flow = 0; SelectFireMan.GetComponent<FireManControl>().Flow = 0;
} }
@ -927,6 +939,7 @@ public class FireManSkillPanelController : MonoBehaviour
SelectFireMan.GetComponent<LayWaterHose>().EndLay(); SelectFireMan.GetComponent<LayWaterHose>().EndLay();
SelectFireMan.GetComponent<FireManControl>().workType = FireManSkills.None; SelectFireMan.GetComponent<FireManControl>().workType = FireManSkills.None;
LayerWaterHoseSyncData syncarg = new LayerWaterHoseSyncData(); LayerWaterHoseSyncData syncarg = new LayerWaterHoseSyncData();
syncarg.SendUserID = CurrentUserInfo.mySelf.Id; syncarg.SendUserID = CurrentUserInfo.mySelf.Id;
syncarg.IsBegin = false; syncarg.IsBegin = false;
@ -955,7 +968,7 @@ public class FireManSkillPanelController : MonoBehaviour
{ {
if (firemanskillcontant.GetChild(i).GetComponent<Toggle>()) if (firemanskillcontant.GetChild(i).GetComponent<Toggle>())
{ {
firemanskillcontant.GetChild(i).GetComponent<Toggle>().interactable = true ; firemanskillcontant.GetChild(i).GetComponent<Toggle>().interactable = true;
} }
} }
} }

Loading…
Cancel
Save