This commit is contained in:
Afeijia 2023-08-30 17:16:59 +08:00
commit dfa81147e9
14 changed files with 175747 additions and 783 deletions

View File

@ -20,6 +20,9 @@ public class DeviceManager : MonoBehaviour
public UPosManger uposManger; public UPosManger uposManger;
public GameObject stagingPanel; public GameObject stagingPanel;
// Use this for initialization // Use this for initialization
private void Start() private void Start()
{ {
editorMenu.gameObject.SetActive(false); editorMenu.gameObject.SetActive(false);

View File

@ -25,6 +25,7 @@ public class UPosItem : MonoBehaviour
{ {
instruct = Instantiate(Resources.Load<SpriteRenderer>("Adam/Instruct"), transform); instruct = Instantiate(Resources.Load<SpriteRenderer>("Adam/Instruct"), transform);
//DestroyImmediate(transform.GetChild(0).gameObject); //DestroyImmediate(transform.GetChild(0).gameObject);
instruct.transform.localPosition = new Vector3(0.38f, 0.32f, 0.002f);
} }
private void Start() private void Start()

View File

@ -21,6 +21,16 @@ public class UPosManger : MonoBehaviour
SetCurrentUPosIsOccupied(0, uPosItems.Length - 1, false); SetCurrentUPosIsOccupied(0, uPosItems.Length - 1, false);
} }
[ContextMenu("SetUPosItem")]
public void SetUPosItem()
{
for (int i = 0; i < transform.childCount; i++)
{
//DestroyImmediate(transform.GetChild(i).gameObject.GetComponent<UPosItem>());
transform.GetChild(i).gameObject.GetComponent<UPosItem>().SetValue();
}
}
/// <summary> /// <summary>
/// 监视所有U位 /// 监视所有U位
/// </summary> /// </summary>

View File

@ -1,5 +1,85 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &1789168724
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1789168725}
- component: {fileID: 1789168727}
- component: {fileID: 1789168726}
m_Layer: 5
m_Name: Text (Legacy)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1789168725
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1789168724}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5977727790842883243}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -171.2973, y: 210.00952}
m_SizeDelta: {x: 104.487, y: 43.981}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1789168727
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1789168724}
m_CullTransparentMesh: 1
--- !u!114 &1789168726
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1789168724}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: f945cd23a57e99b46ac65684d5bb3be8, type: 3}
m_FontSize: 17
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u7EBF\u7F06\u7EC4"
--- !u!1 &5977727790324167057 --- !u!1 &5977727790324167057
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -32,7 +112,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 5977727790908149270} - {fileID: 5977727790908149270}
m_Father: {fileID: 5977727790842883243} m_Father: {fileID: 5977727790842883243}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
@ -110,7 +190,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 5977727791592261006} - {fileID: 5977727791592261006}
m_Father: {fileID: 5977727790842883243} m_Father: {fileID: 5977727790842883243}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
@ -202,7 +282,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &5977727790842883243 --- !u!224 &5977727790842883243
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -215,6 +295,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1789168725}
- {fileID: 5977727791705923583} - {fileID: 5977727791705923583}
- {fileID: 5977727791436101996} - {fileID: 5977727791436101996}
- {fileID: 5977727790324167058} - {fileID: 5977727790324167058}
@ -458,7 +539,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 5977727791117286455} - {fileID: 5977727791117286455}
m_Father: {fileID: 5977727790842883243} m_Father: {fileID: 5977727790842883243}
m_RootOrder: 1 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
@ -672,7 +753,7 @@ RectTransform:
- {fileID: 5977727791812832095} - {fileID: 5977727791812832095}
- {fileID: 5977727791749398742} - {fileID: 5977727791749398742}
m_Father: {fileID: 5977727790842883243} m_Father: {fileID: 5977727790842883243}
m_RootOrder: 0 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}

View File

@ -116,7 +116,7 @@ Material:
m_Colors: m_Colors:
- _BaseColor: {r: 0, g: 0.74509805, b: 1, a: 1} - _BaseColor: {r: 0, g: 0.74509805, b: 1, a: 1}
- _Color: {r: 0, g: 0.74509805, b: 1, a: 1} - _Color: {r: 0, g: 0.74509805, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 4.237095, b: 4.237095, a: 1} - _EmissionColor: {r: 0, g: 0.32599604, b: 0.32082152, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []
--- !u!114 &4586313418104410923 --- !u!114 &4586313418104410923

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ public class LineGroupManager : MonoBehaviour
{ {
add_line_group_button.onClick.AddListener(() => add_line_group_button.onClick.AddListener(() =>
{ {
LineQuery.Inst.StartCoroutine(LineQuery.Inst.getJsonCoroutine());
if (!string.IsNullOrWhiteSpace(line_group_name_inputfield.text)) if (!string.IsNullOrWhiteSpace(line_group_name_inputfield.text))
{ {
AddLineGroup(line_group_name_inputfield.text); AddLineGroup(line_group_name_inputfield.text);

View File

@ -25,6 +25,7 @@ public class UIToCabinet : MonoBehaviour
GameManager.Inst.power_close(); GameManager.Inst.power_close();
rongLaing.SetActive(false); rongLaing.SetActive(false);
FloorController.Inst.FloorNormal(); FloorController.Inst.FloorNormal();
CreateLine createLine = PatternChoose.Inst.transform.Find("ť­Ďß").GetComponent<CreateLine>();
for (int i = 0; i < GameManager.Inst.pop_ups.Count; i++) for (int i = 0; i < GameManager.Inst.pop_ups.Count; i++)
{ {
GameManager.Inst.pop_ups[i].SetActive(false); GameManager.Inst.pop_ups[i].SetActive(false);
@ -148,7 +149,7 @@ public class UIToCabinet : MonoBehaviour
{ {
init(Menu.M_数字孪生_线缆连接_展示); init(Menu.M_数字孪生_线缆连接_展示);
ExtendedFlycam.Inst.QuanJing(); ExtendedFlycam.Inst.QuanJing();
CreateLine createLine = PatternChoose.Inst.transform.Find("ť­Ďß").GetComponent<CreateLine>(); //CreateLine createLine = PatternChoose.Inst.transform.Find("ť­Ďß").GetComponent<CreateLine>();
createLine.OnMenuChanged(Menu.M_数字孪生_线缆连接_展示); createLine.OnMenuChanged(Menu.M_数字孪生_线缆连接_展示);
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_线缆连接_展示); CabinetUIManager.ChangeMenu(Menu.M_数字孪生_线缆连接_展示);
} }
@ -202,7 +203,7 @@ public class UIToCabinet : MonoBehaviour
{ {
init(Menu.M_数字孪生_线缆连接_展示); init(Menu.M_数字孪生_线缆连接_展示);
ExtendedFlycam.Inst.QuanJing(); ExtendedFlycam.Inst.QuanJing();
CreateLine createLine = PatternChoose.Inst.transform.Find("ť­Ďß").GetComponent<CreateLine>();
//PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.线缆_展示); //PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.线缆_展示);
createLine.OnMenuChanged(Menu.M_数字孪生_线缆连接_展示); createLine.OnMenuChanged(Menu.M_数字孪生_线缆连接_展示);
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_线缆连接_展示); CabinetUIManager.ChangeMenu(Menu.M_数字孪生_线缆连接_展示);
@ -225,6 +226,7 @@ public class UIToCabinet : MonoBehaviour
default: default:
break; break;
} }
createLine.deletxianLan(CabinetUIManager.Instance.current_menu);
} }
}); });
} }

View File

@ -542,13 +542,13 @@ public class GameManager : MonoBehaviour
go.transform.position = new Vector3(anchorPos.transform.position.x, anchorPos.transform.position.y + collider.bounds.size.y / 2, anchorPos.transform.position.z); go.transform.position = new Vector3(anchorPos.transform.position.x, anchorPos.transform.position.y + collider.bounds.size.y / 2, anchorPos.transform.position.z);
//go.transform.rotation = item.transform.Find("U位/" + U).rotation; //go.transform.rotation = item.transform.Find("U位/" + U).rotation;
go.name = Racks[i].id; go.name = Racks[i].id;
if (!go.GetComponent<ClickEvent>())
go.AddComponent<ClickEvent>();
DragController drag = gameObject.GetComponent<DeviceManager>().dragController.GetComponent<DragController>(); DragController drag = gameObject.GetComponent<DeviceManager>().dragController.GetComponent<DragController>();
drag.oriObjectPrefab = go.GetComponent<DragTest1>(); drag.oriObjectPrefab = go.GetComponent<DragTest1>();
drag.uPosManger = item.transform.Find("U位").GetComponent<UPosManger>(); drag.uPosManger = item.transform.Find("U位").GetComponent<UPosManger>();
//drag.CountUPos(drag.oriObjectPrefab, Convert.ToInt32(Racks[i].devicePosition) - 1); drag.CountUPos(drag.oriObjectPrefab, Convert.ToInt32(Racks[i].devicePosition) - 1);
//go.GetComponent<DragTest>().isplace = true;
go.transform.SetParent(item.transform.Find("U位/" + U)); go.transform.SetParent(item.transform.Find("U位/" + U));
//go.GetComponent<DragTest>().isplace = true; //go.GetComponent<DragTest>().isplace = true;
//Array.ForEach(go.transform.GetComponentsInChildren<DragTest>(), (item) => //Array.ForEach(go.transform.GetComponentsInChildren<DragTest>(), (item) =>
@ -1786,6 +1786,12 @@ public class GameManager : MonoBehaviour
return (d != null && d.deviceList.type == "1"); return (d != null && d.deviceList.type == "1");
} }
public bool IsFindParent_UPosManger(GameObject go)
{
UPosManger d = go.GetComponent<UPosManger>();
return (d != null);
}
// 读取地址 // 读取地址
public IEnumerator LoadAddress(Action<string> callback) public IEnumerator LoadAddress(Action<string> callback)
{ {

View File

@ -66,32 +66,32 @@ public class RedactPort : MonoBehaviour
IMapper mapper; IMapper mapper;
private void OnEnable() private void OnEnable()
{ {
config = new MapperConfiguration(cfg => //config = new MapperConfiguration(cfg =>
{ //{
cfg.CreateMap<RedactPort.Body, PortQuery.PortList>(); // cfg.CreateMap<RedactPort.Body, PortQuery.PortList>();
cfg.CreateMap<PortQuery.PortList, RedactPort.Body>(); // cfg.CreateMap<PortQuery.PortList, RedactPort.Body>();
}); //});
mapper = config.CreateMapper(); //mapper = config.CreateMapper();
try //try
{ //{
if (!string.IsNullOrEmpty(GameManager.Inst.nowDeviceID)) // if (!string.IsNullOrEmpty(GameManager.Inst.nowDeviceID))
{ // {
for (int i = 0; i < GameManager.Inst.TmsPorts.Count; i++) // for (int i = 0; i < GameManager.Inst.TmsPorts.Count; i++)
{ // {
if (GameManager.Inst.TmsPorts[i].id == GameManager.Inst.nowDeviceID) // if (GameManager.Inst.TmsPorts[i].id == GameManager.Inst.nowDeviceID)
{ // {
portlist = GameManager.Inst.TmsPorts[i]; // portlist = GameManager.Inst.TmsPorts[i];
break; // break;
} // }
} // }
mybody = mapper.Map<RedactPort.Body>(portlist); // mybody = mapper.Map<RedactPort.Body>(portlist);
} // }
} //}
catch (Exception e) //catch (Exception e)
{ //{
Debug.Log(e.StackTrace + "**********" + e.Message); // Debug.Log(e.StackTrace + "**********" + e.Message);
} //}
syncInfo();
#region #region
init(); init();
port.text = mybody.port; port.text = mybody.port;
@ -125,6 +125,72 @@ public class RedactPort : MonoBehaviour
#endregion #endregion
} }
/// <summary>
/// 同步信息
/// </summary>
public void syncInfo(string nowDeviceID)
{
mybody = new Body();
config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<RedactPort.Body, PortQuery.PortList>();
cfg.CreateMap<PortQuery.PortList, RedactPort.Body>();
});
mapper = config.CreateMapper();
try
{
if (!string.IsNullOrEmpty(GameManager.Inst.nowDeviceID))
{
for (int i = 0; i < GameManager.Inst.TmsPorts.Count; i++)
{
if (GameManager.Inst.TmsPorts[i].id == GameManager.Inst.nowDeviceID)
{
portlist = GameManager.Inst.TmsPorts[i];
break;
}
}
mybody = mapper.Map<RedactPort.Body>(portlist);
}
}
catch (Exception e)
{
Debug.Log(e.StackTrace + "**********" + e.Message);
}
}
/// <summary>
/// 同步信息
/// </summary>
public void syncInfo()
{
config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<RedactPort.Body, PortQuery.PortList>();
cfg.CreateMap<PortQuery.PortList, RedactPort.Body>();
});
mapper = config.CreateMapper();
try
{
if (!string.IsNullOrEmpty(GameManager.Inst.nowDeviceID))
{
for (int i = 0; i < GameManager.Inst.TmsPorts.Count; i++)
{
if (GameManager.Inst.TmsPorts[i].id == GameManager.Inst.nowDeviceID)
{
portlist = GameManager.Inst.TmsPorts[i];
break;
}
}
mybody = mapper.Map<RedactPort.Body>(portlist);
}
}
catch (Exception e)
{
Debug.Log(e.StackTrace + "**********" + e.Message);
}
}
/// <summary> /// <summary>
/// 获取端口的对联设备和对联端口选项 /// 获取端口的对联设备和对联端口选项
/// </summary> /// </summary>
@ -165,6 +231,7 @@ public class RedactPort : MonoBehaviour
conPort.options.Clear(); conPort.options.Clear();
conPort.AddOptions(conPort_list); conPort.AddOptions(conPort_list);
cableGroupName.options.Clear();
foreach (var item in LineQuery.Inst.keyValues.Keys) foreach (var item in LineQuery.Inst.keyValues.Keys)
{ {
Dropdown.OptionData optionData = new Dropdown.OptionData(item); Dropdown.OptionData optionData = new Dropdown.OptionData(item);
@ -202,9 +269,10 @@ public class RedactPort : MonoBehaviour
} }
} }
public IEnumerator Succeed() public IEnumerator Succeed(Action<string> callback = null)
{ {
yield return StartCoroutine(GameManager.Inst.Initialize()); yield return StartCoroutine(GameManager.Inst.Initialize());
callback?.Invoke("1");
} }
/// <summary> /// <summary>
@ -285,7 +353,7 @@ public class RedactPort : MonoBehaviour
mybody.status = status.value.ToString(); mybody.status = status.value.ToString();
mybody.conDevice = conDevice.captionText.text; mybody.conDevice = conDevice.captionText.text;
mybody.conPort = conPort.captionText.text; mybody.conPort = conPort.captionText.text;
mybody.cableName= cableName.text; mybody.cableName = cableName.text;
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -70,14 +70,9 @@ public class LineQuery : MonoBehaviour
} }
} }
} }
//else
//{
// keyValues.Clear();
//}
else else
{ {
string lineContentJson = "这是测试"; keyValues.Clear();
yield return StartCoroutine(SaveJsonCoroutine(lineContentJson));
} }
} }
else else
@ -210,6 +205,72 @@ public class LineQuery : MonoBehaviour
}) })
); );
} }
// 删除线缆
public IEnumerable deleteCableName(string cableGroupName, string CableName, Action<string> callback = null)
{
var xianlan = GameObject.Find("线缆").GetComponentsInChildren<LineInfor>();
var info = Array.Find(xianlan, (item) =>
{
return (item.cableGroupName == cableGroupName && item.cableName == CableName);
});
RedactPort redact = PatternChoose.Inst.transform.Find("端口类/端口配置").GetComponent<RedactPort>();
redact.syncInfo(info.lines[0].GetComponent<PortQuery>().portList.id);
redact.mybody.conDevice = null;
redact.mybody.conPort = null;
redact.mybody.conDeviceName = null;
redact.mybody.cableGroupName = null;
redact.mybody.cableName = null;
string newData = JsonConvert.SerializeObject(redact.mybody);
yield return StartCoroutine(
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_bj, GameManager.Inst.arguments.token, newData, (jsonResult) =>
{
try
{
redact.URlreturn = JsonConvert.DeserializeObject<RedactPort.Root>(jsonResult);
}
catch (Exception e)
{
Debug.Log("删除端口线缆名接口错误:" + e.Message);
}
if (redact.URlreturn != null && redact.URlreturn.message == "操作成功")
{
StartCoroutine(redact.Succeed());
Array.ForEach(GameManager.Inst.pop_ups.ToArray(), (itme) =>
{
itme.gameObject.SetActive(false);
});
}
}
));
}
#region JSON #region JSON
[System.Serializable] [System.Serializable]

View File

@ -108,6 +108,8 @@ public class ClickEvent : MonoBehaviour
GameManager.Inst.search_box.SetActive(false); GameManager.Inst.search_box.SetActive(false);
var d = gameObject.GetComponent<DeviceQuery>(); var d = gameObject.GetComponent<DeviceQuery>();
DragController drag = GameManager.Inst.gameObject.GetComponent<DeviceManager>().dragController.GetComponent<DragController>();
if (d) if (d)
{ {
if (string.IsNullOrEmpty(d.deviceList.id)) if (string.IsNullOrEmpty(d.deviceList.id))
@ -129,7 +131,16 @@ public class ClickEvent : MonoBehaviour
GameManager.Inst.nowDeviceID = d.deviceList.id; GameManager.Inst.nowDeviceID = d.deviceList.id;
GameManager.Inst.nowDevice = gameObject; GameManager.Inst.nowDevice = gameObject;
gameObject.GetComponent<DeviceItem>().OnselfClick();
if (drag)
{
drag.uPosManger = GameManager.Inst.FindParent(gameObject, GameManager.Inst.IsFindParent_UPosManger).GetComponent<UPosManger>();
GameManager.Inst.gameObject.GetComponent<DeviceManager>().uposManger = drag.uPosManger;
drag.oriObjectPrefab = gameObject.GetComponent<DragTest1>();
gameObject.GetComponent<DeviceItem>().OnselfClick();
}
//PatternChoose.Inst.transform.Find("É豸Àà/É豸ÅäÖÃ").gameObject.SetActive(true);//¡Ì //PatternChoose.Inst.transform.Find("É豸Àà/É豸ÅäÖÃ").gameObject.SetActive(true);//¡Ì
} }
} }

View File

@ -152,12 +152,15 @@ public class CreateLine : CabinetUIBase
lineRenderer.SetPositions(vector3s.ToArray()); lineRenderer.SetPositions(vector3s.ToArray());
var p = A.GetComponent<PortQuery>().portList;
go.transform.SetParent(xianLan); go.transform.SetParent(xianLan);
go.name = A.GetComponent<PortQuery>().portList.cableGroupName; go.name = p.cableGroupName;
go.SetActive(false); go.SetActive(false);
var l = go.AddComponent<LineInfor>(); var l = go.AddComponent<LineInfor>();
l.lines.Add(A); l.lines.Add(A);
l.lines.Add(B); l.lines.Add(B);
l.cableGroupName = p.cableGroupName;
l.cableName = p.cableName;
} }
/// <summary> /// <summary>
@ -220,12 +223,15 @@ public class CreateLine : CabinetUIBase
lineRenderer.SetPositions(vector3s.ToArray()); lineRenderer.SetPositions(vector3s.ToArray());
var p = A.GetComponent<PortQuery>().portList;
go.transform.SetParent(xianLan); go.transform.SetParent(xianLan);
go.name = A.GetComponent<PortQuery>().portList.cableGroupName; go.name = p.cableGroupName;
go.SetActive(false); go.SetActive(false);
var l = go.AddComponent<LineInfor>(); var l = go.AddComponent<LineInfor>();
l.lines.Add(A); l.lines.Add(A);
l.lines.Add(B); l.lines.Add(B);
l.cableGroupName = p.cableGroupName;
l.cableName = p.cableName;
} }
[ContextMenu("同行")] [ContextMenu("同行")]
@ -270,7 +276,7 @@ public class CreateLine : CabinetUIBase
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Log(e.Message+e.StackTrace); Debug.Log(e.Message + e.StackTrace);
} }
} }
@ -290,15 +296,21 @@ public class CreateLine : CabinetUIBase
} }
else else
{ {
Debug.Log(11); deletxianLan(menu);
for (int i = 0; i < xianLan.childCount; i++)
{
Destroy(xianLan.GetChild(i).gameObject);
}
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
{
GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F2();
}
} }
} }
public void deletxianLan(Menu menu)
{
if ((menu == Menu.M_数字孪生_线缆连接_展示))
return;
for (int i = xianLan.childCount - 1; i >= 0; i--)
{
DestroyImmediate(xianLan.GetChild(i).gameObject);
}
//for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
//{
// GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F2();
//}
}
} }

View File

@ -10,10 +10,12 @@ using UnityEngine.UI;
[Serializable] [Serializable]
public class LineInfor : MonoBehaviour public class LineInfor : MonoBehaviour
{ {
InputField t; InputField t;
[HideInInspector]public Root root; [HideInInspector] public Root root;
public List<Transform> lines=new List<Transform>(); public List<Transform> lines = new List<Transform>();
public string cableGroupName = "";
public string cableName = "";
private void Awake() private void Awake()
{ {