This commit is contained in:
高国正 2023-08-29 23:40:33 +08:00
parent fb04a76d7a
commit de0a1a5c88
12 changed files with 11118 additions and 223 deletions

View File

@ -61,7 +61,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: c123eb6606afccb49b2a88ffaccb6e2c, type: 2}
- {fileID: 2100000, guid: fcefe2506f20ff0418fd3958a81f483d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,15 @@ using UnityEngine;
public class FloorController : MonoBehaviour
{
public static FloorController Inst;
public Material floor_mat_normal;
public Material floor_mat_transparent;
public List<MeshRenderer> floors = new List<MeshRenderer>();
// Start is called before the first frame update
private void Awake()
{
Inst = this;
}
void Start()
{

View File

@ -24,6 +24,7 @@ public class UIToCabinet : MonoBehaviour
{
GameManager.Inst.power_close();
rongLaing.SetActive(false);
FloorController.Inst.FloorNormal();
for (int i = 0; i < GameManager.Inst.pop_ups.Count; i++)
{
GameManager.Inst.pop_ups[i].SetActive(false);
@ -137,6 +138,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_接地网":
{
FloorController.Inst.FloorTransparent();
init(Menu.M_数字孪生_接地网);
ExtendedFlycam.Inst.QuanJing();
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_接地网);

View File

@ -40,6 +40,9 @@ public class GameManager : MonoBehaviour
[Header("当前设备ID")] public string nowDeviceID;
[Header("当前点击设备")] public GameObject nowDevice;
[Header("上一个设备ID")] public string lastDeviceID;
[Header("上一个点击设备")] public GameObject lastDevice;
[Header("设备------------------------查询接口")] public DeviceQuery.Root root_AllDevice;
///// <summary>
@ -1366,8 +1369,7 @@ public class GameManager : MonoBehaviour
{
if (D.openFlag == "0")
{
//关
hight.SetActive(false);
//关
power_close(Cabinets_go[i], "前门");
}
else if (D.openFlag == "1")
@ -1389,10 +1391,6 @@ public class GameManager : MonoBehaviour
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
power_open(Cabinets_go[i], "前门");
}
else
{
hight.SetActive(false);
}
//var door = Array.Find(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
//{
// return item.name.Contains("Object");
@ -1407,7 +1405,6 @@ public class GameManager : MonoBehaviour
if (D.backDoorFlag == "0")
{
//关
hight.SetActive(false);
power_close(Cabinets_go[i], "后门");
}
else if (D.backDoorFlag == "1")
@ -1429,12 +1426,12 @@ public class GameManager : MonoBehaviour
hight.GetComponent<Renderer>().material = Resources.Load<Material>("Materials/3Tou");
power_open(Cabinets_go[i], "后门");
}
else
{
hight.SetActive(false);
}
}
}
if (D.backDoorFlag == "0" && D.openFlag == "0")
hight.SetActive(false);
}
}
@ -1445,12 +1442,12 @@ public class GameManager : MonoBehaviour
{
for (int i = 0; i < Cabinets_go.Count; i++)
{
var door = Array.FindAll(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
{
return item.name.Contains("Object");
});
//var door = Array.FindAll(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
//{
// return item.name.Contains("Object");
//});
if (door.Length == 4 && Cabinets_go[i].name == "R71")
if (/*door.Length == 4 && */Cabinets_go[i].name == "R71")
{
//Cabinets_go[i].transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.zero);
//Cabinets_go[i].transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.zero);
@ -1460,7 +1457,7 @@ public class GameManager : MonoBehaviour
Cabinets_go[i].transform.GetChild(2).DOLocalRotate(Vector3.zero, 2);
Cabinets_go[i].transform.GetChild(3).DOLocalRotate(Vector3.zero, 2);
}
else if (door.Length == 2)
else /*if (door.Length == 2)*/
{
//door.transform.localRotation = Quaternion.Euler(Vector3.zero);
Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
@ -1478,12 +1475,12 @@ public class GameManager : MonoBehaviour
{
for (int i = 0; i < Cabinets_go.Count; i++)
{
var door = Array.FindAll(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
{
return item.name.Contains("Object");
});
//var door = Array.FindAll(Cabinets_go[i].transform.GetComponentsInChildren<Renderer>(), item =>
//{
// return item.name.Contains("Object");
//});
if (door.Length == 4 && Cabinets_go[i].name == "R71")
if (/*door.Length == 4 && */Cabinets_go[i].name == "R71")
{
//Cabinets_go[i].transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.forward * -90);
//Cabinets_go[i].transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.forward * 90);
@ -1491,9 +1488,12 @@ public class GameManager : MonoBehaviour
Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
Cabinets_go[i].transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
}
else if (door.Length == 2) { }
else /*if (door.Length == 2)*/
{
//door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
//door.transform.DOLocalRotate(Vector3.forward * -90, 2f);
Cabinets_go[i].transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
}
}
CloseHighlight();
}
@ -1504,13 +1504,13 @@ public class GameManager : MonoBehaviour
/// <param name="cabinet"></param>
public void power_open(GameObject cabinet, string type)
{
var door = Array.FindAll(cabinet.GetComponentsInChildren<Renderer>(), item =>
{
return item.name.Contains("Object");
});
//var door = Array.FindAll(cabinet.GetComponentsInChildren<Renderer>(), item =>
//{
// return item.name.Contains("Object");
//});
if (type == "前门")
{
if (door.Length == 4 && cabinet.name == "R71")
if (/*door.Length == 4 && */cabinet.name == "R71")
{
//cabinet.transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.forward * -90);
//cabinet.transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.forward * 90);
@ -1518,31 +1518,31 @@ public class GameManager : MonoBehaviour
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
}
else if (door.Length == 2)
else /*if (door.Length == 2)*/
//door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
}
else if (type == "后门")
{
if (door.Length == 4 && cabinet.name == "R71")
if (/*door.Length == 4 && */cabinet.name == "R71")
{
cabinet.transform.GetChild(2).DOLocalRotate(Vector3.forward * -90, 2f);
cabinet.transform.GetChild(3).DOLocalRotate(Vector3.forward * 90, 2f);
}
else if (door.Length == 2)
else /*if (door.Length == 2)*/
//door.transform.localRotation = Quaternion.Euler(Vector3.forward * -90);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * -90, 2f);
}
else if (type == "全开")
{
if (door.Length == 4 && cabinet.name == "R71")
if (/*door.Length == 4 && */cabinet.name == "R71")
{
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * 90, 2f);
cabinet.transform.GetChild(2).DOLocalRotate(Vector3.forward * -90, 2f);
cabinet.transform.GetChild(3).DOLocalRotate(Vector3.forward * 90, 2f);
}
else if (door.Length == 2)
else /*if (door.Length == 2)*/
{
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.forward * -90, 2f);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.forward * -90, 2f);
@ -1557,13 +1557,13 @@ public class GameManager : MonoBehaviour
/// <param name="cabinet"></param>
public void power_close(GameObject cabinet, string type)
{
var door = Array.FindAll(cabinet.GetComponentsInChildren<Renderer>(), item =>
{
return item.name.Contains("Object");
});
//var door = Array.FindAll(cabinet.GetComponentsInChildren<Renderer>(), item =>
//{
// return item.name.Contains("Object");
//});
if (type == "前门")
{
if (door.Length == 4 && cabinet.name == "R71")
if (/*door.Length == 4 && */cabinet.name == "R71")
{
//cabinet.transform.GetChild(0).localRotation = Quaternion.Euler(Vector3.zero);
//cabinet.transform.GetChild(1).localRotation = Quaternion.Euler(Vector3.zero);
@ -1571,24 +1571,34 @@ public class GameManager : MonoBehaviour
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
}
else if (door.Length == 2)
else/* (door.Length == 2)*/
//door.transform.localRotation = Quaternion.Euler(Vector3.zero);
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
}
else if (type == "后门")
{
if (door.Length == 4 && cabinet.name == "R71")
if (/*door.Length == 4 && */cabinet.name == "R71")
{
cabinet.transform.GetChild(2).DOLocalRotate(Vector3.zero, 2);
cabinet.transform.GetChild(3).DOLocalRotate(Vector3.zero, 2);
}
else if (door.Length == 2)
else /*if (door.Length == 2)*/
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
}
else if (type == "全关")
{
for (int i = 0; i < door.Length; i++)
door[i].transform.DOLocalRotate(Vector3.zero, 2);
if (cabinet.name == "R71")
{
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
cabinet.transform.GetChild(2).DOLocalRotate(Vector3.zero, 2);
cabinet.transform.GetChild(3).DOLocalRotate(Vector3.zero, 2);
}
else
{
cabinet.transform.GetChild(0).DOLocalRotate(Vector3.zero, 2);
cabinet.transform.GetChild(1).DOLocalRotate(Vector3.zero, 2);
}
}
}
@ -1835,6 +1845,15 @@ public class GameManager : MonoBehaviour
Application.ExternalCall("OnSceneLoaded", "三维加载完成");
//三维场景加载时显示地图
isLoading = true;
if (CabinetUIManager.Instance.current_menu == Menu.M_数字孪生_线缆连接_配置)
{
for (int i = 0; i < TmsPorts_go.Count; i++)
{
if (FindParent(TmsPorts_go[i], IsDesiredParent).activeSelf)
TmsPorts_go[i].GetComponent<PortQuery>().hight.SetActive(true);
}
}
}

View File

@ -1,6 +1,7 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@ -407,45 +408,51 @@ public class TOOL : MonoBehaviour
});
}
//public void DSA(){
// try
// {
// try
// {
// renderer = item.Find(item.name).GetComponent<Renderer>();
// }
// catch (Exception)
// {
// renderer = item.GetComponent<Renderer>();
// }
// if (renderer != null)
// {
// var initrot = item.rotation;
// item.rotation = Quaternion.identity;
// var bounds = renderer.bounds;
// var a = item.gameObject.AddComponent<BoxCollider>();
// a.isTrigger = false;
// a.center = bounds.center - item.transform.position;
// //a.center = new Vector3(
// // a.center.x * AdjustColliderSize(10, 10, 10).x,
// // a.center.y * AdjustColliderSize(10, 10, 10).y,
// // a.center.z * AdjustColliderSize(10, 10, 10).z);
// a.size = bounds.size;
// //a.size = new Vector3(
// // a.size.x * AdjustColliderSize(10, 10, 10).x,
// // a.size.y * AdjustColliderSize(10, 10, 10).y,
// // a.size.z * AdjustColliderSize(10, 10, 10).z);
// //a.transform.rotation = item.rotation; //重置其旋转为默认值
[ContextMenu("板卡预制体加检测器")]
public void DSA()
{
var a = Array.FindAll(transform.GetComponentsInChildren<PortQuery>(), (item) =>
{
return true;
}).ToList();
// item.rotation = initrot;
// }
// }
// catch (Exception e)
// {
// Debug.Log(item);
// continue;
// }
foreach (var item in a)
{
Renderer renderer = item.transform.parent.GetComponent<Renderer>();
if (renderer != null)
{
var initrot = item.transform.parent.transform.rotation;
item.transform.parent.transform.rotation = Quaternion.Euler(Vector3.zero);
item.transform.parent.transform.rotation = Quaternion.identity;
var bounds = renderer.bounds;
if (item.transform.parent.gameObject.GetComponent<BoxCollider>())
{
if (!item.transform.parent.GetComponent<ClickEvent>())
{
item.transform.parent.gameObject.AddComponent<ClickEvent>();
item.transform.parent.gameObject.layer = 13;
}
continue;
}
var aa = item.transform.parent.gameObject.AddComponent<BoxCollider>();
aa.isTrigger = false;
aa.center = bounds.center - item.transform.parent.transform.position;
aa.size = bounds.size;
item.transform.parent.transform.rotation = initrot;
}
if (!item.transform.parent.GetComponent<ClickEvent>())
{
item.transform.parent.gameObject.AddComponent<ClickEvent>();
item.transform.parent.gameObject.layer = 13;
}
}
}
//}
}

View File

@ -140,7 +140,7 @@ public class AddDevice : MonoBehaviour
if (URlreturn != null && URlreturn.message == "操作成功")
{
yield return StartCoroutine(Succeed());
GameManager.Inst.lastDeviceID = URlreturn.data;
Array.ForEach(GameManager.Inst.pop_ups.ToArray(), (itme) =>
{
itme.gameObject.SetActive(false);

View File

@ -37,7 +37,9 @@ public class AddPort : MonoBehaviour
public Dropdown conPort;
public Dropdown remark;
public InputField cableName;
public Dropdown cableGroupName;
MapperConfiguration config;
IMapper mapper;
@ -93,11 +95,11 @@ public class AddPort : MonoBehaviour
conPort.options.Clear();
remark.options.Clear();
cableGroupName.options.Clear();
foreach (var item in LineQuery.Inst.keyValues.Keys)
{
Dropdown.OptionData optionData = new Dropdown.OptionData(item);
remark.options.Add(optionData);
cableGroupName.options.Add(optionData);
}
//deviceId.options.Clear();
@ -146,7 +148,7 @@ public class AddPort : MonoBehaviour
if (URlreturn != null && URlreturn.message == "操作成功")
{
yield return StartCoroutine(Succeed());
GameManager.Inst.lastDeviceID = URlreturn.data;
Array.ForEach(GameManager.Inst.pop_ups.ToArray(), (itme) =>
{
itme.gameObject.SetActive(false);
@ -215,11 +217,14 @@ public class AddPort : MonoBehaviour
mybody.status = status.value.ToString();
mybody.conDevice = conDevice.options[conDevice.value].text;
mybody.conDevice = conDevice.captionText.text;
mybody.conPort = conPort.captionText.text;
mybody.remark = remark.captionText.text;
mybody.cableName = cableName.text;
if (!string.IsNullOrEmpty(conDevice.captionText.text) && !string.IsNullOrEmpty(conPort.captionText.text))
mybody.cableGroupName = cableGroupName.captionText.text;
}
catch (Exception e)
{

View File

@ -36,9 +36,9 @@ public class RedactPort : MonoBehaviour
/// </summary>
public InputField portName;
/// <summary>
/// 线缆名称
/// 线缆名称
/// </summary>
public Dropdown remark;
public Dropdown cableGroupName;
///// <summary>
///// 所属设备
///// </summary>
@ -60,6 +60,8 @@ public class RedactPort : MonoBehaviour
/// </summary>
public Dropdown conPort;
public InputField cableName;
MapperConfiguration config;
IMapper mapper;
private void OnEnable()
@ -95,7 +97,8 @@ public class RedactPort : MonoBehaviour
port.text = mybody.port;
portCode.text = mybody.portCode;
portName.text = mybody.portName;
remark.captionText.text = mybody.remark;
cableGroupName.captionText.text = mybody.cableGroupName;
cableName.text = mybody.cableName;
//deviceId.text = mybody.deviceId;
portModel.text = mybody.portModel;
status.value = string.IsNullOrEmpty(mybody.status) ? 2 : Convert.ToInt32(mybody.status);
@ -159,7 +162,7 @@ public class RedactPort : MonoBehaviour
foreach (var item in LineQuery.Inst.keyValues.Keys)
{
Dropdown.OptionData optionData = new Dropdown.OptionData(item);
remark.options.Add(optionData);
cableGroupName.options.Add(optionData);
}
}
@ -270,12 +273,12 @@ public class RedactPort : MonoBehaviour
mybody.portCode = portCode.text;
mybody.portName = portName.text;
if (!string.IsNullOrEmpty(conDevice.captionText.text) && !string.IsNullOrEmpty(conPort.captionText.text))
mybody.remark = remark.captionText.text;
mybody.cableGroupName = cableGroupName.captionText.text;
//mybody.deviceId = deviceId.text;
mybody.portModel = portModel.text;
mybody.status = status.value.ToString();
mybody.conDevice = conDevice.options[conDevice.value].text;
mybody.conPort = conPort.options[conPort.value].text;
mybody.conDevice = conDevice.captionText.text;
mybody.conPort = conPort.captionText.text;
}
catch (Exception e)
{

View File

@ -89,7 +89,7 @@ public class ClickEvent : MonoBehaviour
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && GameManager.Inst.magnifyState)
{
@ -97,6 +97,8 @@ public class ClickEvent : MonoBehaviour
{
if (hit.collider.gameObject == gameObject)
{
GameManager.Inst.nowDevice = null;
GameManager.Inst.nowDeviceID = null;
Debug.Log("点击到配置" + gameObject.name);
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(false);
@ -110,6 +112,10 @@ public class ClickEvent : MonoBehaviour
{
if (string.IsNullOrEmpty(d.deviceList.id))
{
GameManager.Inst.lastDevice = gameObject;
GameManager.Inst.lastDeviceID = null;
GameManager.Inst.nowDevice = gameObject;
@ -117,6 +123,10 @@ public class ClickEvent : MonoBehaviour
}
else
{
GameManager.Inst.lastDevice = gameObject;
GameManager.Inst.lastDeviceID = d.deviceList.id;
GameManager.Inst.nowDeviceID = d.deviceList.id;
GameManager.Inst.nowDevice = gameObject;
@ -132,6 +142,8 @@ public class ClickEvent : MonoBehaviour
{
if (hit.collider.gameObject == gameObject)
{
GameManager.Inst.nowDevice = null;
GameManager.Inst.nowDeviceID = null;
Debug.Log("点击到配置" + gameObject.name);
PatternChoose.Inst.transform.Find("设备类/设备配置").gameObject.SetActive(false);
PatternChoose.Inst.transform.Find("设备类/设备新增").gameObject.SetActive(false);
@ -142,22 +154,68 @@ public class ClickEvent : MonoBehaviour
var p = gameObject.GetComponent<PortQuery>();
if (p)
{
MeshRenderer renderer = p.hight.GetComponent<MeshRenderer>();
Material[] materials = renderer.materials;
Material[] newMaterials = materials.Clone() as Material[];
if (string.IsNullOrEmpty(p.portList.id))
{
if (GameManager.Inst.nowDevice && GameManager.Inst.nowDevice.GetComponent<PortQuery>())
GameManager.Inst.nowDevice.GetComponent<PortQuery>().hight.SetActive(false);
if (GameManager.Inst.lastDevice)
{
if (GameManager.Inst.lastDevice != gameObject && GameManager.Inst.lastDevice.GetComponent<PortQuery>())
{
MeshRenderer renderer1 = GameManager.Inst.lastDevice.GetComponent<PortQuery>().hight.GetComponent<MeshRenderer>();
Material[] materials1 = renderer1.materials;
Material[] newMaterials1 = materials1.Clone() as Material[];
newMaterials1[0] = Resources.Load<Material>("Materials/4Tou");
renderer1.materials = newMaterials;
}
//GameManager.Inst.lastDevice.GetComponent<PortQuery>().hight.GetComponent<Renderer>().materials[0] = Resources.Load<Material>("Materials/4Tou");
}
GameManager.Inst.lastDevice = gameObject;
GameManager.Inst.lastDeviceID = null;
GameManager.Inst.nowDevice = gameObject;
p.hight.SetActive(true);
newMaterials[0] = Resources.Load<Material>("Materials/1Tou");
renderer.materials = newMaterials;
//p.hight.GetComponent<Renderer>().materials[0] = Resources.Load<Material>("Materials/1Tou");
PatternChoose.Inst.transform.Find("端口类/端口新增").gameObject.SetActive(true);//√
}
else
{
if (GameManager.Inst.nowDevice && GameManager.Inst.nowDevice.GetComponent<PortQuery>())
GameManager.Inst.nowDevice.GetComponent<PortQuery>().hight.SetActive(false);
if (GameManager.Inst.lastDevice)
{
if (GameManager.Inst.lastDevice != gameObject && GameManager.Inst.lastDevice.GetComponent<PortQuery>())
{
MeshRenderer renderer1 = GameManager.Inst.lastDevice.GetComponent<PortQuery>().hight.GetComponent<MeshRenderer>();
Material[] materials1 = renderer1.materials;
Material[] newMaterials1 = materials1.Clone() as Material[];
newMaterials1[0] = Resources.Load<Material>("Materials/4Tou");
renderer1.materials = newMaterials;
}
//GameManager.Inst.lastDevice.GetComponent<PortQuery>().hight.GetComponent<Renderer>().materials[0] = Resources.Load<Material>("Materials/4Tou");
}
GameManager.Inst.lastDevice = gameObject;
GameManager.Inst.lastDeviceID = p.portList.id;
GameManager.Inst.nowDeviceID = p.portList.id;
GameManager.Inst.nowDevice = gameObject;
p.hight.SetActive(true);
newMaterials[0] = Resources.Load<Material>("Materials/1Tou");
renderer.materials = newMaterials;
//p.hight.GetComponent<Renderer>().materials[0] = Resources.Load<Material>("Materials/1Tou");
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(true);//√
}
}
@ -507,7 +565,18 @@ public class ClickEvent : MonoBehaviour
/// </summary>
public void Zoomin(GameObject cabine)
{
if (Menu.M_数字孪生_线缆连接_配置 == CabinetUIManager.Instance.current_menu)
{
Array.ForEach(cabine.GetComponentsInChildren<PortQuery>(), (itme) =>
{
itme.hight.GetComponent<Renderer>().materials[0] = Resources.Load<Material>("Materials/4Tou");
itme.hight.SetActive(true);
});
}
ExtendedFlycam.Inst.CameraRtDisable();
CameraMgr.Instance.StoreTarget();
//ExtendedFlycam.Inst.init_mainCamera_rot();
// 物体被点击
Debug.Log("放大点击到" + gameObject.name);
@ -538,16 +607,18 @@ public class ClickEvent : MonoBehaviour
Camera.main.transform.DORotateQuaternion(targetRotation, 1f).OnComplete(() =>
{
//更新相机初始旋转角度
ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
if (cabine && cabine.transform.Find("门把手").GetComponentInChildren<Door>())
{
var door = cabine.transform.Find("门把手").GetComponentInChildren<Door>();
if (door.TextMeshProUGUI.text == "关门") return;
GameManager.Inst.power_open(cabine, "前门");
door.TextMeshProUGUI.text = "关门";
door.isopen = !door.isopen;
}
//ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
CameraMgr.Instance.GotoView(cabine.transform, 2, targetRotation);
ExtendedFlycam.Inst.CameraRtEnable();
});
if (cabine && cabine.transform.Find("门把手") && cabine.transform.Find("门把手").GetComponentInChildren<Door>())
{
var door = cabine.transform.Find("门把手").GetComponentInChildren<Door>();
if (door.TextMeshProUGUI.text == "关门") return;
GameManager.Inst.power_open(cabine, "全开");
door.TextMeshProUGUI.text = "关门";
door.isopen = !door.isopen;
}
}
/// <summary>
@ -556,6 +627,10 @@ public class ClickEvent : MonoBehaviour
/// <param name="hit"></param>
public void Zoomout(GameObject cabine)
{
Array.ForEach(cabine.GetComponentsInChildren<PortQuery>(), (itme) =>
{
itme.hight.SetActive(false);
});
ExtendedFlycam.Inst.CameraRtDisable();
GameManager.Inst.nowDeviceID = null;
My_magnifyState = false;
@ -568,16 +643,18 @@ public class ClickEvent : MonoBehaviour
Camera.main.transform.DORotateQuaternion(Quaternion.Euler(TransparentGlowManage.Inst.MainCamera_rot), 1f).OnComplete(() =>
{
//更新相机初始旋转角度
//ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
if (cabine && cabine.transform.Find("门把手").GetComponentInChildren<Door>())
{
var door = cabine.transform.Find("门把手").GetComponentInChildren<Door>();
if (door.TextMeshProUGUI.text == "开门") return;
GameManager.Inst.power_close(cabine, "前门");
door.TextMeshProUGUI.text = "开门";
door.isopen = !door.isopen;
}
//ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
CameraMgr.Instance.ResumeView();
ExtendedFlycam.Inst.CameraRtEnable();
});
if (cabine && cabine.transform.Find("门把手") && cabine.transform.Find("门把手").GetComponentInChildren<Door>())
{
var door = cabine.transform.Find("门把手").GetComponentInChildren<Door>();
if (door.TextMeshProUGUI.text == "开门") return;
GameManager.Inst.power_close(cabine, "全关");
door.TextMeshProUGUI.text = "开门";
door.isopen = !door.isopen;
}
}
}
}

View File

@ -54,14 +54,14 @@ public class Door : MonoBehaviour, IPointerClickHandler
public void doorOpen()
{
GameManager.Inst.power_open(cabinet,"Ç°ÃÅ");
GameManager.Inst.power_open(cabinet,"全开");
TextMeshProUGUI.text = "关门";
isopen = !isopen;
}
public void doorClose()
{
GameManager.Inst.power_close(cabinet, "Ç°ÃÅ");
GameManager.Inst.power_close(cabinet, "全关");
TextMeshProUGUI.text = "开门";
isopen = !isopen;
}

View File

@ -20,7 +20,7 @@ TagManager:
- "U\u4F4D"
- "\u7AEF\u53E3"
- "\u623F\u95F4\u9876\u90E8"
-
- "\u677F\u5361"
-
-
-