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.
753 lines
27 KiB
753 lines
27 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using System.Linq; |
|
using UnityEngine.UI; |
|
using AX.NetworkSystem; |
|
|
|
/// <summary> |
|
/// 指挥中心调派人数数据类(演习模式) |
|
/// </summary> |
|
public class CommandFiremanNumSyncData |
|
{ |
|
public UserData selectUserData; |
|
public int num; |
|
} |
|
public class PowerTransferController : MonoBehaviour |
|
{ |
|
public GameObject SelectOne; |
|
public GameObject SelectTwo; |
|
public DropDownRecordByAC SelectDrop; |
|
public Transform ScrollOneParent; |
|
public Transform ScrollTwoParent; |
|
public GameObject ScrollItemPrefab; |
|
public Transform PowerItemParent; |
|
public Transform PowerItemParent1; |
|
public List<FireCarEngine> AllCarMessage; |
|
public GameObject PowerItemPrefab; |
|
public InputField PeoPleNumInput; |
|
public ButtonRecordByAC SureBtn; |
|
public GameObject Shows; |
|
public Text ShowsTitle; |
|
|
|
private List<Organization> BindList; |
|
private List<Organization> AllOrgDataList; |
|
private bool IsTwo; |
|
private Dictionary<int, Dropdown.OptionData> DropDownDic; |
|
private Dictionary<int, Toggle> ToggleDic; |
|
private ToggleGroup Tgroup; |
|
private List<FireCarEngine> BindCarList; |
|
private List<FireCarEngine> BindCarList1; |
|
private UserData NowSelectUser; |
|
|
|
public GameObject Error; |
|
|
|
public GameObject Caption; |
|
public GameObject ShowScroll; |
|
public GameObject Caption1; |
|
public GameObject ShowScroll1; |
|
public GameObject PeopleNum; |
|
public GameObject InputFieldPeopleNum; |
|
|
|
private int shuiGuanCheNum; |
|
private int paoMoCheNum; |
|
private int gaoPenCheCheNum; |
|
private int yunTiCheNum; |
|
private int juGaoCheNum; |
|
private int paiYanCheNum; |
|
private int qiangXianCheNum; |
|
private int zhaoMingCheNum; |
|
private int qiChaiCheNum; |
|
private int gongQiCheNum; |
|
private int poChaiCheNum; |
|
|
|
public GameObject hintWin; |
|
private List<FireCarEngine> SelectCars1 = new List<FireCarEngine>(); |
|
private List<int> CarsNum1 = new List<int>(); |
|
|
|
void Bind() |
|
{ |
|
Tgroup = GetComponent<ToggleGroup>(); |
|
if (IsTwo) |
|
{ |
|
SelectTwo.gameObject.SetActive(true); |
|
SelectOne.gameObject.SetActive(false); |
|
} |
|
else |
|
{ |
|
SelectTwo.gameObject.SetActive(false); |
|
SelectOne.gameObject.SetActive(true); |
|
List<UserData> dataList = new List<UserData>(); |
|
foreach (var item in CurrentUserInfo.room.UserList) |
|
{ |
|
if (GetParentOrgId(item.Org.ParentId) == CurrentUserInfo.organization.Id |
|
&& item.Role == Role.中队指挥) |
|
{ |
|
dataList.Add(item); |
|
} |
|
} |
|
SelectScrollBind(dataList); |
|
} |
|
SureBtn.OutInterFaceButton = SureBtnClick; |
|
} |
|
|
|
private void SureBtnClick() |
|
{ |
|
if (GameSettings.othersSettings.mode == Mode.manoeuvre) |
|
{ |
|
List<FireCarEngine> ActiveCars = new List<FireCarEngine>(); |
|
List<FireCarEngine> SelectCars = new List<FireCarEngine>(); |
|
|
|
if (PeoPleNumInput.text == null || PeoPleNumInput.text == "") |
|
{ |
|
//提示需要输入调派人数 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "请输入调派人数"; |
|
return; |
|
} |
|
else |
|
{ |
|
int result = int.Parse(PeoPleNumInput.text); |
|
if (result <= 0) |
|
{//提示请输入正整数 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "请输入正整数"; |
|
return; |
|
} |
|
} |
|
|
|
int num = int.Parse(PeoPleNumInput.text); |
|
int minnum, maxnum = 0, persons = 0; |
|
|
|
if (CurrentUserInfo.role == Role.总队指挥中心) |
|
{ |
|
foreach (Transform child in ScrollTwoParent) |
|
{ |
|
if (child.GetComponent<Toggle>().isOn) |
|
{ |
|
persons = child.GetComponent<DetachmentPersons>().Persons; |
|
} |
|
} |
|
} |
|
|
|
if (CurrentUserInfo.role == Role.支队指挥中心) |
|
{ |
|
foreach (Transform child in ScrollOneParent) |
|
{ |
|
if (child.GetComponent<Toggle>().isOn) |
|
{ |
|
persons = child.GetComponent<DetachmentPersons>().Persons; |
|
} |
|
} |
|
} |
|
|
|
if (num > persons) |
|
{ |
|
//提示调派人数大于此中队的总人数 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "调派人数大于中队总人数"; |
|
return; |
|
} |
|
|
|
foreach (FireCarEngine f in BindCarList) |
|
{ |
|
if (f.IsActive == 1) |
|
{ |
|
ActiveCars.Add(f); |
|
} |
|
} |
|
if (ActiveCars.Count <= 0) |
|
{ |
|
//提示没有可用的车辆调派 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "该中队没有可用的车辆调派"; |
|
return; |
|
} |
|
|
|
foreach (Transform t in PowerItemParent) |
|
{ |
|
if (t.GetComponent<PowerTransferItem>().ControlToggle.isOn) |
|
{ |
|
SelectCars.Add(t.GetComponent<PowerTransferItem>().MyData); |
|
} |
|
} |
|
if (SelectCars.Count == 0) |
|
{ |
|
//提示没有选择要调派的车辆 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "请选择要调派的车辆"; |
|
return; |
|
} |
|
|
|
foreach (Transform t in PowerItemParent) |
|
{ |
|
if (t.GetComponent<PowerTransferItem>().ControlToggle.isOn) |
|
{ |
|
maxnum += int.Parse(t.GetComponent<PowerTransferItem>().MyData.PassengerCapacity.ToString()); |
|
} |
|
} |
|
if (num > maxnum) |
|
{ |
|
//提示调派人数大于可载总人数 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "调派人数大于可载总人数"; |
|
return; |
|
} |
|
|
|
minnum = SelectCars.Count; |
|
if (minnum > num) |
|
{ |
|
//提示调派人数少于车辆辆数 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "调派人数少于调派的车辆数"; |
|
return; |
|
} |
|
|
|
//动态分配人数 |
|
int[] PersonNum = new int[SelectCars.Count]; |
|
while (num > 0) |
|
{ |
|
for (int i = 0; i < SelectCars.Count; i++) |
|
{ |
|
if (num > 0 && PersonNum[i] < SelectCars[i].PassengerCapacity) |
|
{ |
|
PersonNum[i] += 1; |
|
num--; |
|
} |
|
} |
|
} |
|
List<KeyValuePair<FireCarEngine, int>> tempPowers = new List<KeyValuePair<FireCarEngine, int>>(); |
|
for (int i = 0; i < SelectCars.Count; i++) |
|
{ |
|
SelectCars[i].PassengerCapacity = PersonNum[i]; |
|
|
|
tempPowers.Add(new KeyValuePair<FireCarEngine, int>(SelectCars[i], 1)); |
|
} |
|
|
|
List<KeyValuePair<FireCarEngine, int>> powers = new List<KeyValuePair<FireCarEngine, int>>(); |
|
var GroupResult = from FireCarEngine in tempPowers group FireCarEngine by FireCarEngine.Key.Type; |
|
foreach (IGrouping<int, KeyValuePair<FireCarEngine, int>> item in GroupResult) |
|
{ |
|
powers.Add(new KeyValuePair<FireCarEngine, int>(item.ToList()[0].Key, item.Count())); |
|
} |
|
//foreach (var item in powers) |
|
//{ |
|
// for (int i = 0; i < item.Value; i++) |
|
// { |
|
|
|
// } |
|
//} |
|
|
|
//发给各个客户端调派人数,下车跟作战部署用 |
|
NetworkManager.Default.SendAsync("COMMANDCENTER_FIREMANNUM_SYNC", |
|
new CommandFiremanNumSyncData() { selectUserData = NowSelectUser, num = int.Parse(PeoPleNumInput.text) }); |
|
|
|
//先通报灾情 |
|
NetworkManager.Default.SendAsync("COMMANDCENTER_VEHICLETRANSFER_SYNC", |
|
new KeyValuePair<long, KeyValuePair<PoliceCallData, List<KeyValuePair<FireCarEngine, int>>>>(NowSelectUser.UserInfo.Id, |
|
new KeyValuePair<PoliceCallData, List<KeyValuePair<FireCarEngine, int>>>(GameSettings.disasterSetting.policeCallData, powers) |
|
)); |
|
|
|
//发送给房间内各个客服端调派车辆数据,作战部署力量列表用 |
|
NetworkManager.Default.SendAsync("FIREDEPLOY_ENGINES_SYNC", |
|
new KeyValuePair<string, List<KeyValuePair<FireCarEngine, int>>>(NowSelectUser.Org.DisplayName, powers)); |
|
|
|
|
|
//合理分配人数给中队派车(出警界面刷出车辆信息开始计时) |
|
|
|
//禁用已经调派车辆 |
|
foreach (var item in SelectCars) |
|
{ |
|
foreach (var c in AllCarMessage) |
|
{ |
|
if (c.Id == item.Id) |
|
{ |
|
c.IsActive = 0; |
|
break; |
|
} |
|
} |
|
} |
|
//刷新显示 |
|
foreach (var item in SelectCars) |
|
{ |
|
foreach (Transform t in PowerItemParent) |
|
{ |
|
if (t.GetComponent<PowerTransferItem>().MyData.Id == item.Id) |
|
{ |
|
t.GetComponent<PowerTransferItem>().Bind(item); |
|
} |
|
} |
|
} |
|
StartCoroutine(WaitBtnEnable()); |
|
} |
|
|
|
if (GameSettings.othersSettings.mode == Mode.Practice) |
|
{ |
|
SelectCars1.Clear(); |
|
CarsNum1.Clear(); |
|
|
|
foreach (Transform t in PowerItemParent1) |
|
{ |
|
if (t.GetComponent<PowerTransferItem>().ControlToggle.isOn) |
|
{ |
|
SelectCars1.Add(t.GetComponent<PowerTransferItem>().MyData); |
|
int result; |
|
if (int.TryParse(t.Find("PoliceCallNum").GetComponent<InputField>().text, out result)) |
|
{ |
|
CarsNum1.Add(int.Parse(t.Find("PoliceCallNum").GetComponent<InputField>().text)); |
|
} |
|
} |
|
} |
|
if (SelectCars1.Count == 0) |
|
{ |
|
//提示没有选择要调派的车辆 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "请选择要调派的车辆"; |
|
return; |
|
} |
|
|
|
bool flag = false; |
|
foreach (Transform t in PowerItemParent1) |
|
{ |
|
if (t.GetComponent<PowerTransferItem>().ControlToggle.isOn) |
|
{ |
|
if (t.Find("PoliceCallNum").GetComponent<InputField>().text == "") |
|
{ |
|
flag = true; |
|
break; |
|
} |
|
} |
|
} |
|
|
|
if (flag) |
|
{ |
|
//提示没有选择要调派的车辆 |
|
Error.SetActive(true); |
|
Error.GetComponent<Text>().text = "选择的车辆有未输入调派数量的项"; |
|
return; |
|
} |
|
|
|
bool flag1 = false; |
|
foreach (Transform t in PowerItemParent1) |
|
{ |
|
if (t.GetComponent<PowerTransferItem>().ControlToggle.isOn) |
|
{ |
|
int inputCount = int.Parse(t.Find("PoliceCallNum").GetComponent<InputField>().text); |
|
int activeCount = int.Parse(t.Find("ActiveCars").GetComponent<Text>().text); |
|
if (inputCount > activeCount) |
|
{ |
|
flag1 = true; |
|
break; |
|
} |
|
} |
|
} |
|
|
|
if (flag1) |
|
{ |
|
hintWin.SetActive(true); |
|
} |
|
else |
|
{ |
|
Sure(); |
|
} |
|
} |
|
} |
|
|
|
public void Sure() |
|
{ |
|
List<KeyValuePair<FireCarEngine, int>> powers = new List<KeyValuePair<FireCarEngine, int>>(); |
|
for (int i = 0; i < SelectCars1.Count; i++) |
|
{ |
|
powers.Add(new KeyValuePair<FireCarEngine, int>(SelectCars1[i], CarsNum1[i])); |
|
} |
|
//先通报灾情 |
|
//合理分配人数给中队派车(出警界面刷出车辆信息开始计时) |
|
NetworkManager.Default.SendAsync("COMMANDCENTER_VEHICLETRANSFER_SYNC", |
|
new KeyValuePair<long, KeyValuePair<PoliceCallData, List<KeyValuePair<FireCarEngine, int>>>>(NowSelectUser.UserInfo.Id, |
|
new KeyValuePair<PoliceCallData, List<KeyValuePair<FireCarEngine, int>>>(GameSettings.disasterSetting.policeCallData, powers) |
|
)); |
|
|
|
hintWin.SetActive(false); |
|
|
|
//发送给房间内各个客服端调派车辆数据,作战部署力量列表用 |
|
NetworkManager.Default.SendAsync("FIREDEPLOY_ENGINES_SYNC", |
|
new KeyValuePair<string, List<KeyValuePair<FireCarEngine, int>>>(NowSelectUser.Org.DisplayName, powers)); |
|
StartCoroutine(WaitBtnEnable()); |
|
} |
|
IEnumerator WaitBtnEnable() |
|
{ |
|
SureBtn.GetComponent<Button>().interactable = false; |
|
LoadPromptWin.Instance.LoadTextPromptWindow("调派完成", 1f); |
|
yield return new WaitForSeconds(1f); |
|
SureBtn.GetComponent<Button>().interactable = true; |
|
} |
|
public void Cancel() |
|
{ |
|
hintWin.SetActive(false); |
|
} |
|
|
|
public void SelectDropBind(List<Organization> DataList) |
|
{ |
|
AllOrgDataList = DataList; |
|
BindList = new List<Organization>(); |
|
if (CurrentUserInfo.role == Role.支队指挥中心) |
|
{ |
|
Bind(); |
|
return; |
|
} |
|
IsTwo = true; |
|
Organization org = new Organization(); |
|
foreach (UserData data in CurrentUserInfo.room.UserList) |
|
{ |
|
if (data.Role == Role.中队指挥) |
|
{ |
|
int ParentId = GetParentOrgId(data.Org.ParentId); |
|
foreach (var item in AllOrgDataList) |
|
{ |
|
if (item.Id == ParentId) |
|
{ |
|
org = item; |
|
break; |
|
} |
|
} |
|
if (org != null && !BindList.Contains(org)) |
|
{ |
|
BindList.Add(org); |
|
} |
|
} |
|
} |
|
DropDownDic = new Dictionary<int, Dropdown.OptionData>(); |
|
SelectDrop.GetComponent<Dropdown>().ClearOptions(); |
|
Dropdown.OptionData tempData; |
|
tempData = new Dropdown.OptionData(); |
|
tempData.text = "选择单位"; |
|
SelectDrop.GetComponent<Dropdown>().options.Add(tempData); |
|
for (int i = 0; i < BindList.Count; i++) |
|
{ |
|
tempData = new Dropdown.OptionData(); |
|
tempData.text = BindList[i].DisplayName; |
|
SelectDrop.GetComponent<Dropdown>().options.Add(tempData); |
|
|
|
DropDownDic.Add(BindList[i].Id, tempData); |
|
} |
|
SelectDrop.GetComponent<Dropdown>().value = 0; |
|
SelectDrop.GetComponent<Dropdown>().captionText.text = SelectDrop.GetComponent<Dropdown>().options[0].text; |
|
SelectDrop.GetComponent<DropDownRecordByAC>().OutInterFaceDropDown = SelectDropValueChange; |
|
Bind(); |
|
} |
|
private void SelectDropValueChange(int value) |
|
{ |
|
int id = GetIdByOptionData(DropDownDic, SelectDrop.GetComponent<Dropdown>().options[value]); |
|
//List<UserData> dataList = CurrentUserInfo.room.UserList.Where(t => GetParentOrgId(t.Org.ParentId) == id).ToList(); |
|
List<UserData> dataList = new List<UserData>(); |
|
foreach (var item in CurrentUserInfo.room.UserList) |
|
{ |
|
if (GetParentOrgId(item.Org.ParentId) == id |
|
&& item.Role == Role.中队指挥) |
|
{ |
|
dataList.Add(item); |
|
} |
|
} |
|
SelectScrollBind(dataList); |
|
} |
|
private void SelectScrollBind(List<UserData> DataList) |
|
{ |
|
if (IsTwo) |
|
{ |
|
foreach (Transform t in ScrollTwoParent) |
|
{ |
|
Destroy(t.gameObject); |
|
} |
|
if (DataList.Count <= 0) |
|
return; |
|
foreach (UserData u in DataList) |
|
{ |
|
GameObject g = Instantiate(ScrollItemPrefab, ScrollTwoParent); |
|
|
|
g.GetComponent<DetachmentPersons>().Persons = GetOrgPersons(u.Org.Id); |
|
|
|
g.GetComponent<ToggleRecordByAC>().OutInterFaceToggle = (bool ok) => |
|
{ ShowSelectPower(ok, g.GetComponent<Toggle>()); }; |
|
g.GetComponent<Toggle>().group = Tgroup; |
|
g.GetComponent<NoticeItem>().Bind(u); |
|
} |
|
} |
|
else |
|
{ |
|
if (ScrollOneParent.childCount > 0) |
|
foreach (Transform t in ScrollOneParent) |
|
{ |
|
Destroy(t.gameObject); |
|
} |
|
if (DataList.Count <= 0) |
|
return; |
|
foreach (UserData u in DataList) |
|
{ |
|
GameObject g = Instantiate(ScrollItemPrefab, ScrollOneParent); |
|
|
|
g.GetComponent<DetachmentPersons>().Persons = GetOrgPersons(u.Org.Id); |
|
|
|
g.GetComponent<ToggleRecordByAC>().OutInterFaceToggle = (bool ok) => |
|
{ ShowSelectPower(ok, g.GetComponent<Toggle>()); }; |
|
g.GetComponent<Toggle>().group = Tgroup; |
|
g.GetComponent<NoticeItem>().Bind(u); |
|
} |
|
} |
|
} |
|
|
|
private void ShowSelectPower(bool ok, Toggle toggle) |
|
{ |
|
int id = toggle.GetComponent<NoticeItem>().UData.Org.Id; |
|
if (ok) |
|
{ |
|
ShowsTitle.text = toggle.GetComponent<NoticeItem>().UData.Org.DisplayName; |
|
if (PowerItemParent.childCount > 0) |
|
foreach (Transform t in PowerItemParent) |
|
{ |
|
Destroy(t.gameObject); |
|
} |
|
NowSelectUser = toggle.GetComponent<NoticeItem>().UData; |
|
|
|
if (!Shows.gameObject.activeSelf) |
|
Shows.gameObject.SetActive(true); |
|
|
|
//获取当前中队消防力量 |
|
BindCarList = new List<FireCarEngine>(); |
|
foreach (var item in AllCarMessage) |
|
{ |
|
if (item.OrganizationId == id) |
|
{ |
|
BindCarList.Add(item); |
|
} |
|
} |
|
|
|
if (GameSettings.othersSettings.mode == Mode.manoeuvre) |
|
{ |
|
foreach (FireCarEngine f in BindCarList) |
|
{ |
|
GameObject g = Instantiate(PowerItemPrefab, PowerItemParent); |
|
g.GetComponent<PowerTransferItem>().Bind(f); |
|
} |
|
} |
|
|
|
if (GameSettings.othersSettings.mode == Mode.Practice) |
|
{ |
|
Caption.SetActive(false); |
|
ShowScroll.SetActive(false); |
|
Caption1.SetActive(true); |
|
ShowScroll1.SetActive(true); |
|
PeopleNum.SetActive(false); |
|
InputFieldPeopleNum.SetActive(false); |
|
|
|
GetCarTypeCounts(); |
|
|
|
foreach (Transform child in PowerItemParent1.transform) |
|
{ |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "水罐车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = shuiGuanCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(0, "水罐车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "泡沫车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = paoMoCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(1, "泡沫车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "高喷车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = gaoPenCheCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(4, "高喷车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "云梯车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = yunTiCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(5, "云梯车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "举高车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = juGaoCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(3, "举高车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "排烟车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = paiYanCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(6, "排烟车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "抢险车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = qiangXianCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(7, "抢险车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "照明车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = zhaoMingCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(9, "照明车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "器材车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = qiChaiCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(8, "器材车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "供气车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = gongQiCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(12, "供气车", child); |
|
} |
|
if (child.GetComponent<PowerTransferItem>().CarType.text == "破拆车") |
|
{ |
|
child.GetComponent<PowerTransferItem>().State.text = poChaiCheNum.ToString(); |
|
child.GetComponent<PowerTransferItem>().MyData = GetCarData(19, "破拆车", child); |
|
} |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
if (GameSettings.othersSettings.mode == Mode.manoeuvre) |
|
{ |
|
if (!Tgroup.AnyTogglesOn()) |
|
{ |
|
foreach (Transform t in PowerItemParent) |
|
{ |
|
Destroy(t.gameObject); |
|
} |
|
NowSelectUser = null; |
|
if (Shows.gameObject.activeSelf) |
|
Shows.gameObject.SetActive(false); |
|
} |
|
} |
|
|
|
if (GameSettings.othersSettings.mode == Mode.Practice) |
|
{ |
|
if (!Tgroup.AnyTogglesOn()) |
|
{ |
|
NowSelectUser = null; |
|
if (Shows.gameObject.activeSelf) |
|
Shows.gameObject.SetActive(false); |
|
} |
|
} |
|
} |
|
} |
|
|
|
private int GetIdByOptionData(Dictionary<int, Dropdown.OptionData> Dic, Dropdown.OptionData selected) |
|
{ |
|
foreach (var item in Dic) |
|
{ |
|
if (item.Value == selected) |
|
{ |
|
return item.Key; |
|
} |
|
} |
|
|
|
return -1; |
|
} |
|
private int GetParentOrgId(int orgId) |
|
{ |
|
foreach (var item in AllOrgDataList) |
|
{ |
|
if (item.Id == orgId) |
|
{ |
|
return item.ParentId; |
|
} |
|
} |
|
|
|
return -1; |
|
} |
|
|
|
private int GetOrgPersons(int orgId) |
|
{ |
|
foreach (var item in AllOrgDataList) |
|
{ |
|
if (item.Id == orgId) |
|
{ |
|
return item.PersonCount; |
|
} |
|
} |
|
|
|
return -1; |
|
} |
|
|
|
private void GetCarTypeCounts() |
|
{ |
|
shuiGuanCheNum = 0; |
|
paoMoCheNum = 0; |
|
gaoPenCheCheNum = 0; |
|
yunTiCheNum = 0; |
|
juGaoCheNum = 0; |
|
paiYanCheNum = 0; |
|
qiangXianCheNum = 0; |
|
zhaoMingCheNum = 0; |
|
qiChaiCheNum = 0; |
|
gongQiCheNum = 0; |
|
poChaiCheNum = 0; |
|
|
|
foreach (FireCarEngine f in BindCarList) |
|
{ |
|
if (f.IsActive == 1) |
|
{ |
|
if (f.Type == 0) |
|
{ |
|
shuiGuanCheNum++; |
|
} |
|
if (f.Type == 1) |
|
{ |
|
paoMoCheNum++; |
|
} |
|
if (f.Type == 4) |
|
{ |
|
gaoPenCheCheNum++; |
|
} |
|
if (f.Type == 5) |
|
{ |
|
yunTiCheNum++; |
|
} |
|
if (f.Type == 3) |
|
{ |
|
juGaoCheNum++; |
|
} |
|
if (f.Type == 6) |
|
{ |
|
paiYanCheNum++; |
|
} |
|
if (f.Type == 7) |
|
{ |
|
qiangXianCheNum++; |
|
} |
|
if (f.Type == 9) |
|
{ |
|
zhaoMingCheNum++; |
|
} |
|
if (f.Type == 8) |
|
{ |
|
qiChaiCheNum++; |
|
} |
|
if (f.Type == 12) |
|
{ |
|
gongQiCheNum++; |
|
} |
|
if (f.Type == 19) |
|
{ |
|
poChaiCheNum++; |
|
} |
|
} |
|
} |
|
} |
|
|
|
private FireCarEngine GetCarData(int carType, string carTypeName, Transform child) |
|
{ |
|
FireCarEngine fireCarengine = new FireCarEngine(); |
|
fireCarengine.Type = carType; |
|
fireCarengine.TypeName = carTypeName; |
|
fireCarengine.PassengerCapacity = int.Parse(child.GetComponent<PowerTransferItem>().PeoPleNum.text.ToString()); |
|
fireCarengine.WaterAmount = int.Parse(child.GetComponent<PowerTransferItem>().WaterNum.text.ToString()); |
|
fireCarengine.FoamAmount = int.Parse(child.GetComponent<PowerTransferItem>().FoamNum.text.ToString()); |
|
fireCarengine.DryPowderAmount = int.Parse(child.GetComponent<PowerTransferItem>().DryPowderNum.text.ToString()); |
|
fireCarengine.Height = int.Parse(child.GetComponent<PowerTransferItem>().Height.text.ToString()); |
|
fireCarengine.IsActive = 1; |
|
fireCarengine.OrganizationId = CurrentUserInfo.organization.Id; |
|
fireCarengine.OrganizationName = CurrentUserInfo.organization.DisplayName; |
|
|
|
return fireCarengine; |
|
} |
|
}
|
|
|