Compare commits

...

2 Commits

Author SHA1 Message Date
YangHua 593b8d179e 融合 2023-08-30 18:33:35 +08:00
YangHua 94544e834a 修改暂存逻辑 2023-08-30 18:31:26 +08:00
6 changed files with 111 additions and 23 deletions

View File

@ -19,6 +19,8 @@ public class DeviceManager : MonoBehaviour
public Transform dragControllerContent;
public UPosManger uposManger;
public GameObject stagingPanel;
public Transform stagingParent;
// Use this for initialization
@ -26,7 +28,7 @@ public class DeviceManager : MonoBehaviour
private void Start()
{
editorMenu.gameObject.SetActive(false);
SwitchStagingPanel();
SwitchStagingPanel(null);
}
public void SetDeviceItem(DeviceItem deviceItem)
@ -41,25 +43,49 @@ public class DeviceManager : MonoBehaviour
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, pos, null, out uiLocalPos);
editorMenu.transform.localPosition = uiLocalPos;
editorMenu.saveBtn.onClick.RemoveAllListeners();
//SwitchHighLight(di);
editorMenu.saveBtn.onClick.AddListener(() =>
{
DragController dc = Instantiate(dragController, dragControllerContent);
dc.oriObjectPrefab = dtPrefab;
dc.oriObjectPrefab = di.GetComponent<DragTest1>();
dc.isSaveMode = true;
uposManger.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
Destroy(di.gameObject);
//Destroy(di.gameObject);
di.transform.SetParent(stagingParent);
di.transform.localPosition = Vector3.zero;
di.gameObject.SetActive(false);
deviceItems.Remove(di);
editorMenu.gameObject.SetActive(false);
SwitchStagingPanel();
SwitchStagingPanel(null);
});
}
public void SwitchStagingPanel()
public void SwitchHighLight(DeviceItem di)
{
Debug.Log("dragControllerContent.childCount=="+ dragControllerContent.childCount);
if (dragControllerContent.childCount > 0)
stagingPanel.SetActive(true);
else if (dragControllerContent.childCount == 0)
stagingPanel.SetActive(false);
for (int i = 0; i < deviceItems.Count; i++)
{
deviceItems[i].GetComponent<HighLight_VR>().ShutDownHighlight();
}
di.GetComponent<HighLight_VR>().Highlight();
}
public void SwitchStagingPanel(GameObject staginDragClone)
{
if (staginDragClone != null)
Destroy(staginDragClone);
StopAllCoroutines();
StartCoroutine(WaitCloseStaginPanel());
}
private IEnumerator WaitCloseStaginPanel()
{
yield return new WaitForSeconds(0.1f);
Debug.Log("dragControllerContent.childCount==" + dragControllerContent.childCount);
if (dragControllerContent.childCount > 0)
stagingPanel.SetActive(true);
else
stagingPanel.SetActive(false);
}
}

View File

@ -51,7 +51,13 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
}
public void OnBeginDrag(PointerEventData eventData)
{
targetObject = Instantiate(oriObjectPrefab);
if (!isSaveMode)
targetObject = Instantiate(oriObjectPrefab);
else
{
targetObject = oriObjectPrefab;
targetObject.gameObject.SetActive(true);
}
//currentDevice = targetObject.GetComponent<DragTest1>();
targetObject.transform.eulerAngles = oriObjectPrefab.transform.eulerAngles;
targetObject.transform.localScale = oriObjectPrefab.transform.lossyScale;
@ -87,23 +93,39 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
if (targetObject == null) return;
if (currentUPosItem == null)
{
Destroy(targetObject.gameObject);
if (!isSaveMode)
Destroy(targetObject.gameObject);
else
targetObject.gameObject.SetActive(false);
return;
}
if (currentUPosItem.isOccupied)
{
Destroy(targetObject.gameObject);
if (!isSaveMode)
Destroy(targetObject.gameObject);
else
targetObject.gameObject.SetActive(false);
return;
}
int index = uPosManger.CountUPos(targetObject.volume, currentUPosItem.ID);
//Debug.Log("index-------------" + index);
if (!CountUPos(targetObject, index))
Destroy(targetObject.gameObject);
{
if (isSaveMode)
{
targetObject.gameObject.SetActive(false);
}
else
{
Destroy(targetObject.gameObject);
}
}
else
{
if (isSaveMode)
{
Destroy(this.gameObject);
deviceManager.SwitchStagingPanel(this.gameObject);
}
}
}
@ -121,7 +143,14 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
dt.transform.localPosition = new Vector3(0.25f, 0, -0.045f * dt.volume + 0.0225f);
uPosManger.SetCurrentUPosIsOccupied(index, dt.volume, true);
DeviceItem di = dt.gameObject.AddComponent<DeviceItem>();
DeviceItem di;
if (dt.gameObject.GetComponent<DeviceItem>() == null)
di = dt.gameObject.AddComponent<DeviceItem>();
else
di = dt.GetComponent<DeviceItem>();
if (di.gameObject.GetComponent<HighLight_VR>() == null)
di.gameObject.AddComponent<HighLight_VR>();
di.Init(deviceManager, index, dt.volume, oriObjectPrefab);
deviceManager.SetDeviceItem(di);
return true;
@ -141,7 +170,7 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
target.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition + new Vector3(0, 0, 2));
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hitInfo;
if (Physics.Raycast(ray, out hitInfo,100, 1 << 10))
if (Physics.Raycast(ray, out hitInfo, 100, 1 << 10))
{
if (hitInfo.collider != null && hitInfo.collider.GetComponent<UPosItem>())
{

View File

@ -110679,6 +110679,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
@ -173920,6 +173921,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1725712530
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1725712531}
m_Layer: 0
m_Name: Stagin
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1725712531
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1725712530}
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: 0}
m_RootOrder: 33
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1726352922 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3359295667672319804, guid: c8f09218a803c944e84c2336104ca2f9, type: 3}
@ -184463,6 +184495,7 @@ MonoBehaviour:
dragControllerContent: {fileID: 155917792}
uposManger: {fileID: 0}
stagingPanel: {fileID: 803679558}
stagingParent: {fileID: 1725712531}
--- !u!1 &1816534963
GameObject:
m_ObjectHideFlags: 0

View File

@ -645,7 +645,7 @@ public class ClickEvent : MonoBehaviour
Array.ForEach(cabine.GetComponentsInChildren<PortQuery>(), (itme) =>
{
itme.hight.SetActive(false);
itme.hight.
});
ExtendedFlycam.Inst.CameraRtDisable();
GameManager.Inst.nowDeviceID = null;

View File

@ -28,8 +28,8 @@
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.ide.visualstudio": "2.0.14",
"com.unity.ide.rider": "3.0.13",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.rider": "3.0.15",
"com.unity.ide.vscode": "1.2.5",
"com.unity.editorcoroutines": "1.0.0",
"com.unity.performance.profile-analyzer": "1.1.1",
@ -77,7 +77,7 @@
"url": "https://packages.unity.cn"
},
"com.unity.services.core": {
"version": "1.3.1",
"version": "1.4.2",
"depth": 1,
"source": "registry",
"dependencies": {

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.2f1c1
m_EditorVersionWithRevision: 2021.3.2f1c1 (7ac240095d88)
m_EditorVersion: 2021.3.10f1c2
m_EditorVersionWithRevision: 2021.3.10f1c2 (5a059dbcdda5)