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.
142 lines
6.4 KiB
142 lines
6.4 KiB
4 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using AX.Network.Protocols;
|
||
|
using UnityEngine;
|
||
|
using AX.Serialization;
|
||
|
using AX.NetworkSystem;
|
||
|
using UnityEngine.SceneManagement;
|
||
|
|
||
|
public class COMMANDCENTER_VEHICLETRANSFER_SYNC : NetworkMessageBehaviour
|
||
|
{
|
||
|
protected override void Execute(BinaryMessage message)
|
||
|
{
|
||
|
var info = message.Body.Deserialize<KeyValuePair<PoliceCallData, List<KeyValuePair<FireCarEngine, int>>>>();
|
||
|
|
||
|
// if (SceneManager.GetActiveScene().name == "RoomWaiting")//房间等待收到派车指令
|
||
|
if (transform.Find("RoomWaiting").gameObject.activeInHierarchy &&
|
||
|
!transform.Find("Police").gameObject.activeInHierarchy)
|
||
|
{
|
||
|
GameSettings.othersSettings.CarList = info.Value;
|
||
|
|
||
|
GameSettings.disasterSetting.policeCallData = info.Key;
|
||
|
foreach (UserData u in CurrentUserInfo.room.UserList)
|
||
|
{
|
||
|
if (u.Org.Id == CurrentUserInfo.organization.Id && u.Role == Role.中队指挥)
|
||
|
{
|
||
|
int time = 0;
|
||
|
foreach (var item in info.Key.ArriveTimeList)
|
||
|
{
|
||
|
if (item.Key == CurrentUserInfo.mySelf.Id)
|
||
|
{
|
||
|
time = item.Value;
|
||
|
}
|
||
|
}
|
||
|
info.Key.ArriveTimeList.Add(new KeyValuePair<long, int>(u.UserInfo.Id, time));
|
||
|
|
||
|
//按中队、车类型组织车辆数据(string:组织机构;List<KeyValuePair<FireCarEngine, int>:某类型车有多少辆)
|
||
|
NetworkManager.Default.SendAsync("THE_POWER_PRESENT_SYNC", new KeyValuePair<string, List<KeyValuePair<FireCarEngine, int>>>
|
||
|
(CurrentUserInfo.organization.ToString(), info.Value));
|
||
|
}
|
||
|
if (u.Org.ParentId == CurrentUserInfo.organization.Id && u.Role == Role.战斗班长)
|
||
|
// 战斗班长随中队一起
|
||
|
{
|
||
|
//将通报指令转发给战斗班长同时添加战斗班长到场时间
|
||
|
int time = 0;
|
||
|
foreach (var item in info.Key.ArriveTimeList)
|
||
|
{
|
||
|
if (item.Key == CurrentUserInfo.mySelf.Id)
|
||
|
{
|
||
|
time = item.Value;
|
||
|
}
|
||
|
}
|
||
|
info.Key.ArriveTimeList.Add(new KeyValuePair<long, int>(u.UserInfo.Id, time));
|
||
|
NetworkManager.Default.SendAsync("COMMANDCENTER_FIRENOTIFY_SYNC", new KeyValuePair<long, PoliceCallData>
|
||
|
(u.UserInfo.Id, info.Key));
|
||
|
}
|
||
|
}
|
||
|
transform.Find("RoomWaiting").gameObject.SetActive(false);
|
||
|
transform.Find("Police").gameObject.SetActive(true);
|
||
|
UIManager.GetView<ChatPanel>().ShowPoliceSize();
|
||
|
//SceneManager.LoadScene("Police");
|
||
|
}
|
||
|
//else if (SceneManager.GetActiveScene().name == "Police")//接警过程中收到派车指令
|
||
|
else if (!transform.Find("RoomWaiting").gameObject.activeInHierarchy &&
|
||
|
transform.Find("Police").gameObject.activeInHierarchy)
|
||
|
{
|
||
|
foreach (var item in info.Value)
|
||
|
{
|
||
|
GameSettings.othersSettings.CarList.Add(item);
|
||
|
}
|
||
|
//刷新车辆显示列表
|
||
|
if (GetComponent<CarMoveManager>())
|
||
|
{
|
||
|
List<KeyValuePair<FireCarEngine, int>> CarList = new List<KeyValuePair<FireCarEngine, int>>();
|
||
|
if (GameSettings.othersSettings.CarList.Count > 0)
|
||
|
{
|
||
|
foreach (var car in GameSettings.othersSettings.CarList)
|
||
|
{
|
||
|
CarList.Add(car);
|
||
|
}
|
||
|
}
|
||
|
GetComponent<CarMoveManager>().PowerMsg.CarMsgShow(CarList);
|
||
|
}
|
||
|
//UIManager.GetView<ChatPanel>().ShowPoliceSize();
|
||
|
}
|
||
|
else if (!transform.Find("RoomWaiting").gameObject.activeInHierarchy &&
|
||
|
!transform.Find("Police").gameObject.activeInHierarchy)//主场景收到派车指令
|
||
|
{
|
||
|
if (CurrentUserInfo.role == Role.中队指挥)
|
||
|
{
|
||
|
//按中队、车类型组织车辆数据(string:组织机构;List<KeyValuePair<FireCarEngine, int>:某类型车有多少辆)
|
||
|
NetworkManager.Default.SendAsync("THE_POWER_PRESENT_SYNC", new KeyValuePair<string, List<KeyValuePair<FireCarEngine, int>>>(CurrentUserInfo.organization.ToString(), info.Value));
|
||
|
}
|
||
|
//集结区车辆列表增加新调派的车辆处理
|
||
|
//如果有集结区
|
||
|
if (GameObject.Find("P_AllParent/P_Tools/P_StayingArea").GetComponent<CloneStayingAreaTool>()
|
||
|
&& GameObject.Find("P_AllParent/P_Tools/P_StayingArea").transform.childCount > 0)
|
||
|
{
|
||
|
CloneStayingAreaTool StagingArea = GameObject.Find("P_AllParent/P_Tools/P_StayingArea").GetComponent<CloneStayingAreaTool>();
|
||
|
List<FireCarEngine> NewCarList = new List<FireCarEngine>();
|
||
|
foreach (var item in info.Value)
|
||
|
{
|
||
|
GameSettings.othersSettings.CarList.Add(item);
|
||
|
|
||
|
for (int i = 0; i < item.Value; i++)
|
||
|
{
|
||
|
NewCarList.Add(item.Key);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
StagingArea.ReceiveNewCars(NewCarList);
|
||
|
}
|
||
|
else
|
||
|
{//没有集结区只需将车辆列表更新
|
||
|
foreach (var item in info.Value)
|
||
|
{
|
||
|
GameSettings.othersSettings.CarList.Add(item);
|
||
|
}
|
||
|
|
||
|
CloneStayingAreaTool StagingArea = GameObject.Find("P_AllParent/P_Tools/P_StayingArea").GetComponent<CloneStayingAreaTool>();
|
||
|
if (StagingArea.isGetedCars)
|
||
|
{
|
||
|
List<FireCarEngine> NewCarList = new List<FireCarEngine>();
|
||
|
foreach (var item in info.Value)
|
||
|
{
|
||
|
//GameSettings.othersSettings.CarList.Add(item);
|
||
|
|
||
|
for (int i = 0; i < item.Value; i++)
|
||
|
{
|
||
|
NewCarList.Add(item.Key);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
StagingArea.ReceiveNewCars(NewCarList);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
//UIManager.GetView<ChatPanel>().ShowPoliceSize();
|
||
|
}
|
||
|
}
|
||
|
}
|