修改删除按钮的逻辑

This commit is contained in:
YangHua 2023-09-05 23:00:42 +08:00
parent d56ce9cd4d
commit 4ec73edeb0
5 changed files with 67 additions and 4 deletions

View File

@ -370,6 +370,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1809810455016100285} - component: {fileID: 1809810455016100285}
- component: {fileID: 5015601091524974045} - component: {fileID: 5015601091524974045}
- component: {fileID: -6911259714475533231}
m_Layer: 8 m_Layer: 8
m_Name: 6 1 m_Name: 6 1
m_TagString: Untagged m_TagString: Untagged
@ -412,6 +413,25 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
volume: 3 volume: 3
selfIcon: {fileID: 0}
--- !u!114 &-6911259714475533231
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1321364116395625223}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 65c073f1f8dbbe64da03bf56cea22ae7, type: 3}
m_Name:
m_EditorClassIdentifier:
isTransparentGlow: 0
meshRenderers: []
materials: []
empty: []
TransparentGlow_Shader: {fileID: 4800000, guid: 132fbf2263a23854080e8a5c3cec824c, type: 3}
TransparentGlow_Shader_half: {fileID: 0}
--- !u!1 &1749544084727868767 --- !u!1 &1749544084727868767
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1336,6 +1356,7 @@ MonoBehaviour:
conDeviceName: conDeviceName:
rackType: rackType:
openFlag: openFlag:
backDoorFlag:
modelNum: modelNum:
occupyNum: occupyNum:
residueNum: residueNum:
@ -1865,6 +1886,7 @@ MonoBehaviour:
conDeviceName: conDeviceName:
rackType: rackType:
openFlag: openFlag:
backDoorFlag:
modelNum: modelNum:
occupyNum: occupyNum:
residueNum: residueNum:
@ -2794,6 +2816,7 @@ MonoBehaviour:
conDeviceName: conDeviceName:
rackType: rackType:
openFlag: openFlag:
backDoorFlag:
modelNum: modelNum:
occupyNum: occupyNum:
residueNum: residueNum:
@ -3047,6 +3070,7 @@ MonoBehaviour:
conDeviceName: conDeviceName:
rackType: rackType:
openFlag: openFlag:
backDoorFlag:
modelNum: modelNum:
occupyNum: occupyNum:
residueNum: residueNum:

View File

@ -59,6 +59,7 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
targetObject = oriObjectPrefab; targetObject = oriObjectPrefab;
targetObject.gameObject.SetActive(true); targetObject.gameObject.SetActive(true);
} }
targetObject.GetComponent<TransparentGlow>().F1();
//currentDevice = targetObject.GetComponent<DragTest1>(); //currentDevice = targetObject.GetComponent<DragTest1>();
targetObject.transform.eulerAngles = oriObjectPrefab.transform.eulerAngles; targetObject.transform.eulerAngles = oriObjectPrefab.transform.eulerAngles;
targetObject.transform.localScale = oriObjectPrefab.transform.lossyScale; targetObject.transform.localScale = oriObjectPrefab.transform.lossyScale;
@ -86,6 +87,7 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
{ {
GameManager.Inst.MoveParentAndChildren(targetObject.transform, new Vector3(-0.25f, 0, 0)); GameManager.Inst.MoveParentAndChildren(targetObject.transform, new Vector3(-0.25f, 0, 0));
} }
targetObject.GetComponent<TransparentGlow>().F2();
currentUPosItem = null; currentUPosItem = null;
targetObject = null; targetObject = null;

View File

@ -19,7 +19,7 @@ public class UPosItem : MonoBehaviour
public int ID; public int ID;
public SpriteRenderer instruct; public SpriteRenderer instruct;
public UPosManger uPosManager;
[ContextMenu("Set")] [ContextMenu("Set")]
public void SetValue() public void SetValue()
{ {
@ -31,6 +31,7 @@ public class UPosItem : MonoBehaviour
private void Start() private void Start()
{ {
ID = int.Parse(gameObject.name); ID = int.Parse(gameObject.name);
uPosManager = transform.parent.GetComponent<UPosManger>();
} }
/// <summary> /// <summary>

View File

@ -71,7 +71,12 @@ public class UPosManger : MonoBehaviour
//return startIndex + count - 1; //return startIndex + count - 1;
} }
/// <summary>
/// 控制当前机位下的设备所占U位状态
/// </summary>
/// <param name="startIndex"></param>
/// <param name="count"></param>
/// <param name="isEnabel"></param>
public void SetCurrentUPosIsOccupied(int startIndex, int count, bool isEnabel) public void SetCurrentUPosIsOccupied(int startIndex, int count, bool isEnabel)
{ {
//Debug.Log("startIndex-------------" + startIndex); //Debug.Log("startIndex-------------" + startIndex);

View File

@ -167,6 +167,37 @@ public class GameManager : MonoBehaviour
} }
} }
}); });
/////---------------新加------------------------
//editorMenu.editorBtn.onClick.AddListener(() =>
//{
// if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && nowDevice != null)
// {
// if (nowDevice.GetComponent<DeviceQuery>() == null) return;
// if (string.IsNullOrEmpty(nowDeviceID))
// {
// DeviceItem di = nowDevice.GetComponent<DeviceItem>();
// UPosItem upi = nowDevice.transform.parent.GetComponent<UPosItem>();
// upi.uPosManager.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
// DestroyImmediate(nowDevice);
// }
// else
// {
// var delete = PatternChoose.Inst.transform.Find("设备类").GetComponent<DeleteDevice>();
// //DeleteDevice delete = new DeleteDevice();
// delete.mybody.ids.Add(nowDeviceID);
// StartCoroutine(delete.SaveJsonCoroutine((x) =>
// {
// DeviceItem di = nowDevice.GetComponent<DeviceItem>();
// UPosItem upi = nowDevice.transform.parent.GetComponent<UPosItem>();
// upi.uPosManager.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
// DestroyImmediate(nowDevice);
// }));
// }
// }
// editorMenu.gameObject.SetActive(false);
//});
/////---------------新加------------------------
editorMenu.deleteBtn.onClick.AddListener(() => editorMenu.deleteBtn.onClick.AddListener(() =>
{ {