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.
544 lines
28 KiB
544 lines
28 KiB
8 months ago
|
using AX.ImageViewer;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using UniRx;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
|
||
|
public class NodeController : MonoBehaviour
|
||
|
{
|
||
|
public Toggle LoadToggle;
|
||
|
public Button SaveButton;
|
||
|
public Button ImageButton;
|
||
|
public Button DeleteButton;
|
||
|
public OpenImage OpenImageFile;
|
||
|
public string ImageUrl;
|
||
|
public Sprite defaultSprite;
|
||
|
|
||
|
//public PlanController planController;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
//保存节点
|
||
|
SaveButton.OnClickAsObservable()
|
||
|
.Subscribe(_ =>
|
||
|
{
|
||
|
SaveNode();
|
||
|
MessageBox.Show($"{PowerManager.Instance.PlanName}-{name} 保存成功!",Color.white,3f);
|
||
|
}).AddTo(gameObject);
|
||
|
|
||
|
//加载节点
|
||
|
LoadToggle.onValueChanged.AddListener((bool value) =>
|
||
|
{
|
||
|
LoadValueChanged(value);
|
||
|
ImageButton.interactable = value;
|
||
|
SaveButton.interactable = value;
|
||
|
ImageButton.GetComponent<Image>().raycastTarget = value;
|
||
|
|
||
|
});
|
||
|
|
||
|
//删除节点
|
||
|
DeleteButton.OnClickAsObservable()
|
||
|
.Subscribe(_ => MessageBox.Show($"确认删除 {PowerManager.Instance.PlanName}-{name}?", Color.white, DeleteNode)).AddTo(gameObject);
|
||
|
//插入图片
|
||
|
OpenImageFile.OnLoadTextureFinished = texture =>
|
||
|
{
|
||
|
UploadImage(texture);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
private void UploadImage(Texture2D texture)
|
||
|
{
|
||
|
HttpManager.Instance.PostImage($"{Uri.EscapeDataString(PowerManager.Instance.PlanName)}{Uri.EscapeDataString(name)}.jpg", texture, a =>
|
||
|
{
|
||
|
ImageUrl = a?.ObjectName;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
private void LoadValueChanged(bool value)
|
||
|
{
|
||
|
if (value)
|
||
|
{
|
||
|
PowerManager.Instance.ClearAll();
|
||
|
LoadNode();
|
||
|
}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
PowerManager.Instance.ClearAll();
|
||
|
ImageViewer.Instance.Hide();
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void LoadNode()
|
||
|
{
|
||
|
var planName = PowerManager.Instance.planController.name;
|
||
|
var nodeName = name;
|
||
|
var plan =UIManager.Instance.GetView<DisposalPlanPanel>().Plans.Find(a => a.Name == planName);
|
||
|
var node = plan.Nodes.Find(n => n.Name == nodeName);
|
||
|
HttpManager.Instance.GetFile<NodeFile>(node.Id, actionResult =>
|
||
|
{
|
||
|
Debug.Log(actionResult);
|
||
|
//摄影机
|
||
|
AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().target.localPosition = actionResult.PivotPos;
|
||
|
AssetManager.Instance.MainCamera.transform.localPosition = actionResult.MainCamera.Position;
|
||
|
AssetManager.Instance.MainCamera.transform.localEulerAngles = actionResult.MainCamera.Rotation;
|
||
|
AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().distance = actionResult.MainCamera.Distance;
|
||
|
AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().x = actionResult.MainCamera.XY.x;
|
||
|
AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().y = actionResult.MainCamera.XY.y;
|
||
|
//按钮名称
|
||
|
ImageButton.gameObject.name = actionResult.ImageButtonName;
|
||
|
//楼层
|
||
|
int i = 0;
|
||
|
foreach (var item in actionResult.Floors)
|
||
|
{
|
||
|
if (AssetManager.Instance.Floors[i].gameObject.name == item.Id)
|
||
|
{
|
||
|
AssetManager.Instance.Floors[i].GetComponent<Toggle>().isOn = item.IsOn;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
|
||
|
if (!string.IsNullOrEmpty(actionResult.ImageUrl))
|
||
|
{
|
||
|
HttpManager.Instance.GetImage(actionResult.ImageUrl, texture =>
|
||
|
{
|
||
|
ImageViewer.Load(texture);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//powers
|
||
|
SpawnPowers(actionResult.Powers);
|
||
|
|
||
|
});
|
||
|
}
|
||
|
|
||
|
private async void SpawnPowers(List<PowerNode> Powers)
|
||
|
{
|
||
|
foreach(var item in Powers)
|
||
|
{
|
||
|
//yield return new WaitForSeconds(0.01f);
|
||
|
//GameObject power = Instantiate(AssetManager.Instance.Powers.Find(p => p.name == item.Id)) as GameObject;
|
||
|
GameObject power;
|
||
|
if (item.Name.Contains("Fire") || item.Name.Contains("Smoke"))
|
||
|
{
|
||
|
var prefab = AssetManager.Instance.powerEffacts.Find(go => go.name == item.Id);
|
||
|
power = Instantiate(prefab) as GameObject;
|
||
|
}
|
||
|
else
|
||
|
power = await PowerPool.Instance.GetPower(item.Id, Vector3.zero, Quaternion.identity, null);
|
||
|
|
||
|
power.name = item.Name;
|
||
|
if (item.Parent.Contains("|"))
|
||
|
{
|
||
|
GameObject PowerGroup = GameObject.Find(item.Parent);
|
||
|
string[] m_parents = item.Parent.Split('|');
|
||
|
if (PowerGroup == null)
|
||
|
{
|
||
|
PowerGroup = new GameObject();
|
||
|
PowerGroup.transform.parent = PowerManager.Instance.transform.Find(m_parents[0]);
|
||
|
PowerGroup.name = item.Parent;
|
||
|
}
|
||
|
|
||
|
power.transform.parent = PowerGroup.transform;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
power.transform.parent = PowerManager.Instance.transform.Find(item.Parent);
|
||
|
}
|
||
|
power.transform.localPosition = item.Position;
|
||
|
power.transform.localRotation = Quaternion.Euler(item.Rotation);
|
||
|
power.transform.localScale = item.Scale;
|
||
|
power.SetActive(item.isActive);
|
||
|
SelectionManager.Instance.Sets.Add(power);
|
||
|
|
||
|
if (power.transform.Find("Info/Task"))
|
||
|
power.transform.Find("Info/Task").GetComponent<TextMesh>().text = item.Attribute.Task;
|
||
|
if (power.transform.Find("Info/Name"))
|
||
|
power.transform.Find("Info/Name").GetComponent<TextMesh>().text = item.Attribute.Name;
|
||
|
if (item.Attribute != null)
|
||
|
power.GetComponent<PowerController>().Remarks = item.Attribute.Remarks;
|
||
|
|
||
|
//消防员
|
||
|
if (power.GetComponent<FiremanController>())
|
||
|
{
|
||
|
power.GetComponent<HoseController>().speed = item.Hose.HoseValue;
|
||
|
power.GetComponent<FiremanController>().waterGun.transform.localRotation = Quaternion.Euler(item.Hose.HoseRotation);
|
||
|
}
|
||
|
#region 车辆控制
|
||
|
|
||
|
//水罐车、泡沫车、超高层供水车
|
||
|
if (power.GetComponent<ShuiGuanCheController>())
|
||
|
{
|
||
|
power.GetComponent<HoseController>().speed = item.Hose.HoseValue;
|
||
|
power.GetComponent<ShuiGuanCheController>().waterGun.transform.localRotation = Quaternion.Euler(item.Hose.HoseRotation);
|
||
|
}
|
||
|
//照明车
|
||
|
if (power.GetComponent<ZhaoMingCheController>())
|
||
|
{
|
||
|
power.GetComponent<ZhaoMingCheController>().Arm.transform.localRotation = Quaternion.Euler(item.ZhaoMingChe.ArmRotation);
|
||
|
power.GetComponent<ZhaoMingCheController>().Light.transform.localRotation = Quaternion.Euler(item.ZhaoMingChe.LightRotation);
|
||
|
}
|
||
|
//高喷车
|
||
|
if (power.GetComponent<GaoPenCheController>())
|
||
|
{
|
||
|
power.GetComponent<GaoPenCheController>().isInit = false;
|
||
|
var animator = power.GetComponent<Animator>();
|
||
|
|
||
|
power.GetComponent<HoseController>().speed = item.Truck.HoseValue;
|
||
|
power.GetComponent<GaoPenCheController>().part1.transform.localPosition = item.Truck.Part1Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part1.transform.localRotation = Quaternion.Euler(item.Truck.Part1Rot);
|
||
|
power.GetComponent<GaoPenCheController>().part2.transform.localPosition = item.Truck.Part2Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part2.transform.localRotation = Quaternion.Euler(item.Truck.Part2Rot);
|
||
|
power.GetComponent<GaoPenCheController>().part3.transform.localPosition = item.Truck.Part3Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part3.transform.localRotation = Quaternion.Euler(item.Truck.Part3Rot);
|
||
|
power.GetComponent<GaoPenCheController>().part4.transform.localPosition = item.Truck.Part4Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part4.transform.localRotation = Quaternion.Euler(item.Truck.Part4Rot);
|
||
|
power.GetComponent<GaoPenCheController>().part5.transform.localPosition = item.Truck.Part5Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part5.transform.localRotation = Quaternion.Euler(item.Truck.Part5Rot);
|
||
|
power.GetComponent<GaoPenCheController>().part6.transform.localPosition = item.Truck.Part6Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part6.transform.localRotation = Quaternion.Euler(item.Truck.Part6Rot);
|
||
|
power.GetComponent<GaoPenCheController>().part7.transform.localPosition = item.Truck.Part7Pos;
|
||
|
power.GetComponent<GaoPenCheController>().part7.transform.localRotation = Quaternion.Euler(item.Truck.Part7Rot);
|
||
|
power.GetComponent<GaoPenCheController>().waterGun.transform.localPosition = item.Truck.Part8Pos;
|
||
|
power.GetComponent<GaoPenCheController>().waterGun.transform.localRotation = Quaternion.Euler(item.Truck.Part8Rot);
|
||
|
}
|
||
|
//登高平台车
|
||
|
if (power.GetComponent<DengGaoPingTaiCheController>())
|
||
|
{
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().isInit = false;
|
||
|
|
||
|
power.GetComponent<HoseController>().speed = item.Truck.HoseValue;
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part1.transform.localPosition = item.Truck.Part1Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part1.transform.localRotation = Quaternion.Euler(item.Truck.Part1Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part2.transform.localPosition = item.Truck.Part2Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part2.transform.localRotation = Quaternion.Euler(item.Truck.Part2Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part3.transform.localPosition = item.Truck.Part3Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part3.transform.localRotation = Quaternion.Euler(item.Truck.Part3Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part4.transform.localPosition = item.Truck.Part4Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part4.transform.localRotation = Quaternion.Euler(item.Truck.Part4Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part5.transform.localPosition = item.Truck.Part5Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part5.transform.localRotation = Quaternion.Euler(item.Truck.Part5Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part6.transform.localPosition = item.Truck.Part6Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part6.transform.localRotation = Quaternion.Euler(item.Truck.Part6Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part7.transform.localPosition = item.Truck.Part7Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().part7.transform.localRotation = Quaternion.Euler(item.Truck.Part7Rot);
|
||
|
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().waterGun.transform.localPosition = item.Truck.Part8Pos;
|
||
|
power.GetComponent<DengGaoPingTaiCheController>().waterGun.transform.localRotation = Quaternion.Euler(item.Truck.Part8Rot);
|
||
|
}
|
||
|
//云梯车
|
||
|
if (power.GetComponent<YunTiCheController>())
|
||
|
{
|
||
|
power.GetComponent<YunTiCheController>().isInit = false;
|
||
|
|
||
|
var animator = power.GetComponent<Animator>();
|
||
|
|
||
|
power.GetComponent<HoseController>().speed = item.Truck.HoseValue;
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part1.transform.localPosition = item.Truck.Part1Pos;
|
||
|
power.GetComponent<YunTiCheController>().part1.transform.localRotation = Quaternion.Euler(item.Truck.Part1Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part2.transform.localPosition = item.Truck.Part2Pos;
|
||
|
power.GetComponent<YunTiCheController>().part2.transform.localRotation = Quaternion.Euler(item.Truck.Part2Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part3.transform.localPosition = item.Truck.Part3Pos;
|
||
|
power.GetComponent<YunTiCheController>().part3.transform.localRotation = Quaternion.Euler(item.Truck.Part3Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part4.transform.localPosition = item.Truck.Part4Pos;
|
||
|
power.GetComponent<YunTiCheController>().part4.transform.localRotation = Quaternion.Euler(item.Truck.Part4Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part5.transform.localPosition = item.Truck.Part5Pos;
|
||
|
power.GetComponent<YunTiCheController>().part5.transform.localRotation = Quaternion.Euler(item.Truck.Part5Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part6.transform.localPosition = item.Truck.Part6Pos;
|
||
|
power.GetComponent<YunTiCheController>().part6.transform.localRotation = Quaternion.Euler(item.Truck.Part6Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part7.transform.localPosition = item.Truck.Part7Pos;
|
||
|
power.GetComponent<YunTiCheController>().part7.transform.localRotation = Quaternion.Euler(item.Truck.Part7Rot);
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().part8.transform.localPosition = item.Truck.Part8Pos;
|
||
|
power.GetComponent<YunTiCheController>().part8.transform.localRotation = Quaternion.Euler(item.Truck.Part8Rot);
|
||
|
|
||
|
|
||
|
power.GetComponent<YunTiCheController>().waterGun.transform.localPosition = item.Truck.Part9Pos;
|
||
|
power.GetComponent<YunTiCheController>().waterGun.transform.localRotation = Quaternion.Euler(item.Truck.Part9Rot);
|
||
|
}
|
||
|
#endregion
|
||
|
//区域设定
|
||
|
if (item.Id == "QuYuSheDing"|| item.Id == "JiJieQu")
|
||
|
{
|
||
|
power.GetComponent<MeshFilter>().mesh.vertices = item.Vertices.MeshVertices.ToArray();
|
||
|
power.GetComponent<MeshFilter>().mesh.RecalculateNormals();
|
||
|
power.GetComponent<MeshCollider>().sharedMesh = power.GetComponent<MeshFilter>().mesh;
|
||
|
}
|
||
|
//6米拉梯
|
||
|
if (power.GetComponent<Ladder6Controller>())
|
||
|
{
|
||
|
power.GetComponent<Ladder6Controller>().ladder_6Up.transform.localPosition = item.Ladder.Position1;
|
||
|
}
|
||
|
//15米拉梯
|
||
|
if (power.GetComponent<Ladder15Controller>())
|
||
|
{
|
||
|
power.GetComponent<Ladder15Controller>().ladder_15Up1.transform.localPosition = item.Ladder.Position1;
|
||
|
power.GetComponent<Ladder15Controller>().ladder_15Up2.transform.localPosition = item.Ladder.Position2;
|
||
|
}
|
||
|
//水炮
|
||
|
if (power.GetComponent<WaterMonitorController>())
|
||
|
{
|
||
|
|
||
|
power.GetComponent<HoseController>().speed = item.Hose.HoseValue;
|
||
|
power.GetComponent<WaterMonitorController>().waterGun.transform.localRotation = Quaternion.Euler(item.Hose.HoseRotation);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public void SaveNode()
|
||
|
{
|
||
|
NodeFile nodeFile = new NodeFile
|
||
|
{
|
||
|
PivotPos = AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().target.transform.localPosition,
|
||
|
MainCamera = new CameraData
|
||
|
{
|
||
|
Position = AssetManager.Instance.MainCamera.transform.localPosition,
|
||
|
Rotation = AssetManager.Instance.MainCamera.transform.localRotation.eulerAngles,
|
||
|
Distance = AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().distance,
|
||
|
XY = new Vector2(AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().x, AssetManager.Instance.MainCamera.GetComponent<CameraOrbit>().y),
|
||
|
},
|
||
|
|
||
|
ImageUrl = ImageUrl,
|
||
|
ImageButtonName = ImageButton.gameObject.name,
|
||
|
//楼层开关
|
||
|
Floors = new List<FloorNode>()
|
||
|
|
||
|
};
|
||
|
|
||
|
foreach (var floor in AssetManager.Instance.Floors)
|
||
|
{
|
||
|
var temp = new FloorNode()
|
||
|
{
|
||
|
Id = floor.gameObject.name,
|
||
|
IsOn = floor.GetComponent<Toggle>().isOn
|
||
|
};
|
||
|
nodeFile.Floors.Add(temp);
|
||
|
}
|
||
|
//power
|
||
|
nodeFile.Powers = new List<PowerNode>();
|
||
|
foreach (GameObject Power in SelectionManager.Instance.Sets)
|
||
|
{
|
||
|
PowerNode powerNode = new PowerNode
|
||
|
{
|
||
|
Name = Power.name,
|
||
|
Id = Power.GetComponent<PowerController>().PrefabName,
|
||
|
Parent = Power.transform.parent.name,
|
||
|
Position = Power.transform.localPosition,
|
||
|
Rotation = Power.transform.localRotation.eulerAngles,
|
||
|
Scale = Power.transform.localScale,
|
||
|
isActive = Power.activeSelf
|
||
|
|
||
|
};
|
||
|
nodeFile.Powers.Add(powerNode);
|
||
|
|
||
|
if (Power.GetComponent<PowerController>().taskType != TaskType.none)
|
||
|
{
|
||
|
powerNode.Attribute = new AttributeNode();
|
||
|
if (Power.transform.Find("Info/Name"))
|
||
|
powerNode.Attribute.Name = Power.transform.Find("Info/Name").GetComponent<TextMesh>().text;
|
||
|
if (Power.transform.Find("Info/Task"))
|
||
|
powerNode.Attribute.Task = Power.transform.Find("Info/Task").GetComponent<TextMesh>().text;
|
||
|
powerNode.Attribute.Remarks = Power.GetComponent<PowerController>().Remarks;
|
||
|
}
|
||
|
|
||
|
//六种消防员
|
||
|
if (Power.GetComponent<FiremanController>())
|
||
|
{
|
||
|
powerNode.Hose = new HoseNode
|
||
|
{
|
||
|
HoseValue = Power.GetComponent<HoseController>().speed,
|
||
|
HoseRotation = Power.GetComponent<FiremanController>().waterGun.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
}
|
||
|
#region 车辆控制
|
||
|
//水罐车、泡沫车、超高层供水车
|
||
|
if (Power.GetComponent<ShuiGuanCheController>())
|
||
|
{
|
||
|
powerNode.Hose = new HoseNode
|
||
|
{
|
||
|
HoseValue = Power.GetComponent<HoseController>().speed,
|
||
|
HoseRotation = Power.GetComponent<ShuiGuanCheController>().waterGun.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
}
|
||
|
//照明车
|
||
|
if (Power.GetComponent<ZhaoMingCheController>())
|
||
|
{
|
||
|
powerNode.ZhaoMingChe = new ZhaoMingCheNode
|
||
|
{
|
||
|
ArmRotation = Power.GetComponent<ZhaoMingCheController>().Arm.transform.localRotation.eulerAngles,
|
||
|
LightRotation = Power.GetComponent<ZhaoMingCheController>().Light.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
}
|
||
|
//高喷车
|
||
|
if (Power.GetComponent<GaoPenCheController>())
|
||
|
{
|
||
|
powerNode.Truck = new TruckNode
|
||
|
{
|
||
|
HoseValue = Power.GetComponent<HoseController>().speed,
|
||
|
Part1Pos = Power.GetComponent<GaoPenCheController>().part1.transform.localPosition,
|
||
|
Part2Pos = Power.GetComponent<GaoPenCheController>().part2.transform.localPosition,
|
||
|
Part3Pos = Power.GetComponent<GaoPenCheController>().part3.transform.localPosition,
|
||
|
Part4Pos = Power.GetComponent<GaoPenCheController>().part4.transform.localPosition,
|
||
|
Part5Pos = Power.GetComponent<GaoPenCheController>().part5.transform.localPosition,
|
||
|
Part6Pos = Power.GetComponent<GaoPenCheController>().part6.transform.localPosition,
|
||
|
Part7Pos = Power.GetComponent<GaoPenCheController>().part7.transform.localPosition,
|
||
|
Part8Pos = Power.GetComponent<GaoPenCheController>().waterGun.transform.localPosition,
|
||
|
Part1Rot = Power.GetComponent<GaoPenCheController>().part1.transform.localRotation.eulerAngles,
|
||
|
Part2Rot = Power.GetComponent<GaoPenCheController>().part2.transform.localRotation.eulerAngles,
|
||
|
Part3Rot = Power.GetComponent<GaoPenCheController>().part3.transform.localRotation.eulerAngles,
|
||
|
Part4Rot = Power.GetComponent<GaoPenCheController>().part4.transform.localRotation.eulerAngles,
|
||
|
Part5Rot = Power.GetComponent<GaoPenCheController>().part5.transform.localRotation.eulerAngles,
|
||
|
Part6Rot = Power.GetComponent<GaoPenCheController>().part6.transform.localRotation.eulerAngles,
|
||
|
Part7Rot = Power.GetComponent<GaoPenCheController>().part7.transform.localRotation.eulerAngles,
|
||
|
Part8Rot = Power.GetComponent<GaoPenCheController>().waterGun.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
|
||
|
}
|
||
|
//登高平台车
|
||
|
if (Power.GetComponent<DengGaoPingTaiCheController>())
|
||
|
{
|
||
|
powerNode.Truck = new TruckNode
|
||
|
{
|
||
|
HoseValue = Power.GetComponent<HoseController>().speed,
|
||
|
Part1Pos = Power.GetComponent<DengGaoPingTaiCheController>().part1.transform.localPosition,
|
||
|
Part2Pos = Power.GetComponent<DengGaoPingTaiCheController>().part2.transform.localPosition,
|
||
|
Part3Pos = Power.GetComponent<DengGaoPingTaiCheController>().part3.transform.localPosition,
|
||
|
Part4Pos = Power.GetComponent<DengGaoPingTaiCheController>().part4.transform.localPosition,
|
||
|
Part5Pos = Power.GetComponent<DengGaoPingTaiCheController>().part5.transform.localPosition,
|
||
|
Part6Pos = Power.GetComponent<DengGaoPingTaiCheController>().part6.transform.localPosition,
|
||
|
Part7Pos = Power.GetComponent<DengGaoPingTaiCheController>().part7.transform.localPosition,
|
||
|
Part8Pos = Power.GetComponent<DengGaoPingTaiCheController>().waterGun.transform.localPosition,
|
||
|
|
||
|
|
||
|
Part1Rot = Power.GetComponent<DengGaoPingTaiCheController>().part1.transform.localRotation.eulerAngles,
|
||
|
Part2Rot = Power.GetComponent<DengGaoPingTaiCheController>().part2.transform.localRotation.eulerAngles,
|
||
|
Part3Rot = Power.GetComponent<DengGaoPingTaiCheController>().part3.transform.localRotation.eulerAngles,
|
||
|
Part4Rot = Power.GetComponent<DengGaoPingTaiCheController>().part4.transform.localRotation.eulerAngles,
|
||
|
Part5Rot = Power.GetComponent<DengGaoPingTaiCheController>().part5.transform.localRotation.eulerAngles,
|
||
|
Part6Rot = Power.GetComponent<DengGaoPingTaiCheController>().part6.transform.localRotation.eulerAngles,
|
||
|
Part7Rot = Power.GetComponent<DengGaoPingTaiCheController>().part7.transform.localRotation.eulerAngles,
|
||
|
Part8Rot = Power.GetComponent<DengGaoPingTaiCheController>().waterGun.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
}
|
||
|
//云梯车
|
||
|
if (Power.GetComponent<YunTiCheController>())
|
||
|
{
|
||
|
powerNode.Truck = new TruckNode
|
||
|
{
|
||
|
HoseValue = Power.GetComponent<HoseController>().speed,
|
||
|
Part1Pos = Power.GetComponent<YunTiCheController>().part1.transform.localPosition,
|
||
|
Part2Pos = Power.GetComponent<YunTiCheController>().part2.transform.localPosition,
|
||
|
Part3Pos = Power.GetComponent<YunTiCheController>().part3.transform.localPosition,
|
||
|
Part4Pos = Power.GetComponent<YunTiCheController>().part4.transform.localPosition,
|
||
|
Part5Pos = Power.GetComponent<YunTiCheController>().part5.transform.localPosition,
|
||
|
Part6Pos = Power.GetComponent<YunTiCheController>().part6.transform.localPosition,
|
||
|
Part7Pos = Power.GetComponent<YunTiCheController>().part7.transform.localPosition,
|
||
|
Part8Pos = Power.GetComponent<YunTiCheController>().part8.transform.localPosition,
|
||
|
Part9Pos = Power.GetComponent<YunTiCheController>().waterGun.transform.localPosition,
|
||
|
|
||
|
|
||
|
Part1Rot = Power.GetComponent<YunTiCheController>().part1.transform.localRotation.eulerAngles,
|
||
|
Part2Rot = Power.GetComponent<YunTiCheController>().part2.transform.localRotation.eulerAngles,
|
||
|
Part3Rot = Power.GetComponent<YunTiCheController>().part3.transform.localRotation.eulerAngles,
|
||
|
Part4Rot = Power.GetComponent<YunTiCheController>().part4.transform.localRotation.eulerAngles,
|
||
|
Part5Rot = Power.GetComponent<YunTiCheController>().part5.transform.localRotation.eulerAngles,
|
||
|
Part6Rot = Power.GetComponent<YunTiCheController>().part6.transform.localRotation.eulerAngles,
|
||
|
Part7Rot = Power.GetComponent<YunTiCheController>().part7.transform.localRotation.eulerAngles,
|
||
|
Part8Rot = Power.GetComponent<YunTiCheController>().part8.transform.localRotation.eulerAngles,
|
||
|
Part9Rot = Power.GetComponent<YunTiCheController>().waterGun.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
//区域设定
|
||
|
if (Power.GetComponent<PowerController>().PrefabName == "QuYuSheDing"|| Power.GetComponent<PowerController>().PrefabName == "JiJieQu")
|
||
|
{
|
||
|
powerNode.Vertices = new VerticesNode
|
||
|
{
|
||
|
MeshVertices = new List<Vector3>()
|
||
|
};
|
||
|
foreach (Vector3 point in Power.GetComponent<MeshFilter>().mesh.vertices)
|
||
|
{
|
||
|
powerNode.Vertices.MeshVertices.Add(point);
|
||
|
}
|
||
|
}
|
||
|
//水炮
|
||
|
if (Power.GetComponent<PowerController>().PrefabName == "ShuiPao")
|
||
|
{
|
||
|
powerNode.Hose = new HoseNode()
|
||
|
{
|
||
|
HoseValue = Power.GetComponent<HoseController>().speed,
|
||
|
HoseRotation = Power.GetComponent<WaterMonitorController>().waterGun.transform.localRotation.eulerAngles
|
||
|
};
|
||
|
}
|
||
|
//6米拉梯
|
||
|
if (Power.GetComponent<Ladder6Controller>())
|
||
|
{
|
||
|
powerNode.Ladder = new LadderNode()
|
||
|
{
|
||
|
Position1 = Power.GetComponent<Ladder6Controller>().ladder_6Up.transform.localPosition
|
||
|
};
|
||
|
}
|
||
|
//15米拉梯
|
||
|
if (Power.GetComponent<Ladder15Controller>())
|
||
|
{
|
||
|
powerNode.Ladder = new LadderNode()
|
||
|
{
|
||
|
Position1 = Power.GetComponent<Ladder15Controller>().ladder_15Up1.transform.localPosition,
|
||
|
Position2 = Power.GetComponent<Ladder15Controller>().ladder_15Up2.transform.localPosition
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var planName = PowerManager.Instance.planController.name;
|
||
|
var nodeName = name;
|
||
|
var fileName = $"{planName}-{nodeName}.nodeFile";
|
||
|
|
||
|
HttpManager.Instance.PostFile(fileName, nodeFile, actionResult =>
|
||
|
{
|
||
|
var plan = UIManager.Instance.GetView<DisposalPlanPanel>().Plans.Find(a => a.Name == planName);
|
||
|
var node = plan.Nodes.Find(n => n.Name == nodeName);
|
||
|
node.Id = actionResult.ObjectName;
|
||
|
UIManager.Instance.GetView<DisposalPlanPanel>().SavePlanList();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
private void DeleteNode()
|
||
|
{
|
||
|
var temp = UIManager.Instance.GetView<DisposalPlanPanel>().Plans.Find(a => a.Name == PowerManager.Instance.PlanName);
|
||
|
var tempNode = temp.Nodes.Find(b => b.Name == name);
|
||
|
temp.Nodes.Remove(tempNode);
|
||
|
UIManager.Instance.GetView<DisposalPlanPanel>().SavePlanList();
|
||
|
Destroy(this.gameObject);
|
||
|
}
|
||
|
|
||
|
public void ClearImage()
|
||
|
{
|
||
|
|
||
|
OpenImageFile.GetComponent<Button>().image.sprite = defaultSprite;
|
||
|
ImageUrl = string.Empty;
|
||
|
SaveNode();
|
||
|
}
|
||
|
}
|