Compare commits
2 Commits
a00e2a713b
...
593b8d179e
Author | SHA1 | Date |
---|---|---|
|
593b8d179e | |
|
94544e834a |
|
@ -19,6 +19,8 @@ public class DeviceManager : MonoBehaviour
|
||||||
public Transform dragControllerContent;
|
public Transform dragControllerContent;
|
||||||
public UPosManger uposManger;
|
public UPosManger uposManger;
|
||||||
public GameObject stagingPanel;
|
public GameObject stagingPanel;
|
||||||
|
|
||||||
|
public Transform stagingParent;
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +28,7 @@ public class DeviceManager : MonoBehaviour
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
editorMenu.gameObject.SetActive(false);
|
editorMenu.gameObject.SetActive(false);
|
||||||
SwitchStagingPanel();
|
SwitchStagingPanel(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDeviceItem(DeviceItem deviceItem)
|
public void SetDeviceItem(DeviceItem deviceItem)
|
||||||
|
@ -41,25 +43,49 @@ public class DeviceManager : MonoBehaviour
|
||||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, pos, null, out uiLocalPos);
|
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, pos, null, out uiLocalPos);
|
||||||
editorMenu.transform.localPosition = uiLocalPos;
|
editorMenu.transform.localPosition = uiLocalPos;
|
||||||
editorMenu.saveBtn.onClick.RemoveAllListeners();
|
editorMenu.saveBtn.onClick.RemoveAllListeners();
|
||||||
|
//SwitchHighLight(di);
|
||||||
editorMenu.saveBtn.onClick.AddListener(() =>
|
editorMenu.saveBtn.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
DragController dc = Instantiate(dragController, dragControllerContent);
|
DragController dc = Instantiate(dragController, dragControllerContent);
|
||||||
dc.oriObjectPrefab = dtPrefab;
|
dc.oriObjectPrefab = di.GetComponent<DragTest1>();
|
||||||
dc.isSaveMode = true;
|
dc.isSaveMode = true;
|
||||||
uposManger.SetCurrentUPosIsOccupied(di.startIndex, di.volume, false);
|
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);
|
editorMenu.gameObject.SetActive(false);
|
||||||
SwitchStagingPanel();
|
SwitchStagingPanel(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SwitchStagingPanel()
|
public void SwitchHighLight(DeviceItem di)
|
||||||
{
|
{
|
||||||
Debug.Log("dragControllerContent.childCount=="+ dragControllerContent.childCount);
|
for (int i = 0; i < deviceItems.Count; i++)
|
||||||
if (dragControllerContent.childCount > 0)
|
{
|
||||||
stagingPanel.SetActive(true);
|
deviceItems[i].GetComponent<HighLight_VR>().ShutDownHighlight();
|
||||||
else if (dragControllerContent.childCount == 0)
|
}
|
||||||
stagingPanel.SetActive(false);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,13 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
}
|
}
|
||||||
public void OnBeginDrag(PointerEventData eventData)
|
public void OnBeginDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
targetObject = Instantiate(oriObjectPrefab);
|
if (!isSaveMode)
|
||||||
|
targetObject = Instantiate(oriObjectPrefab);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetObject = oriObjectPrefab;
|
||||||
|
targetObject.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
//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;
|
||||||
|
@ -87,23 +93,39 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
|
||||||
if (targetObject == null) return;
|
if (targetObject == null) return;
|
||||||
if (currentUPosItem == null)
|
if (currentUPosItem == null)
|
||||||
{
|
{
|
||||||
Destroy(targetObject.gameObject);
|
if (!isSaveMode)
|
||||||
|
Destroy(targetObject.gameObject);
|
||||||
|
else
|
||||||
|
targetObject.gameObject.SetActive(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentUPosItem.isOccupied)
|
if (currentUPosItem.isOccupied)
|
||||||
{
|
{
|
||||||
Destroy(targetObject.gameObject);
|
if (!isSaveMode)
|
||||||
|
Destroy(targetObject.gameObject);
|
||||||
|
else
|
||||||
|
targetObject.gameObject.SetActive(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int index = uPosManger.CountUPos(targetObject.volume, currentUPosItem.ID);
|
int index = uPosManger.CountUPos(targetObject.volume, currentUPosItem.ID);
|
||||||
//Debug.Log("index-------------" + index);
|
//Debug.Log("index-------------" + index);
|
||||||
if (!CountUPos(targetObject, index))
|
if (!CountUPos(targetObject, index))
|
||||||
Destroy(targetObject.gameObject);
|
{
|
||||||
|
if (isSaveMode)
|
||||||
|
{
|
||||||
|
targetObject.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(targetObject.gameObject);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isSaveMode)
|
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);
|
dt.transform.localPosition = new Vector3(0.25f, 0, -0.045f * dt.volume + 0.0225f);
|
||||||
uPosManger.SetCurrentUPosIsOccupied(index, dt.volume, true);
|
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);
|
di.Init(deviceManager, index, dt.volume, oriObjectPrefab);
|
||||||
deviceManager.SetDeviceItem(di);
|
deviceManager.SetDeviceItem(di);
|
||||||
return true;
|
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));
|
target.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition + new Vector3(0, 0, 2));
|
||||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||||
RaycastHit hitInfo;
|
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>())
|
if (hitInfo.collider != null && hitInfo.collider.GetComponent<UPosItem>())
|
||||||
{
|
{
|
||||||
|
|
|
@ -110679,6 +110679,7 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
m_SendPointerHoverToParent: 1
|
||||||
m_HorizontalAxis: Horizontal
|
m_HorizontalAxis: Horizontal
|
||||||
m_VerticalAxis: Vertical
|
m_VerticalAxis: Vertical
|
||||||
m_SubmitButton: Submit
|
m_SubmitButton: Submit
|
||||||
|
@ -173920,6 +173921,37 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 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
|
--- !u!1 &1726352922 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_CorrespondingSourceObject: {fileID: 3359295667672319804, guid: c8f09218a803c944e84c2336104ca2f9, type: 3}
|
m_CorrespondingSourceObject: {fileID: 3359295667672319804, guid: c8f09218a803c944e84c2336104ca2f9, type: 3}
|
||||||
|
@ -184463,6 +184495,7 @@ MonoBehaviour:
|
||||||
dragControllerContent: {fileID: 155917792}
|
dragControllerContent: {fileID: 155917792}
|
||||||
uposManger: {fileID: 0}
|
uposManger: {fileID: 0}
|
||||||
stagingPanel: {fileID: 803679558}
|
stagingPanel: {fileID: 803679558}
|
||||||
|
stagingParent: {fileID: 1725712531}
|
||||||
--- !u!1 &1816534963
|
--- !u!1 &1816534963
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -645,7 +645,7 @@ public class ClickEvent : MonoBehaviour
|
||||||
Array.ForEach(cabine.GetComponentsInChildren<PortQuery>(), (itme) =>
|
Array.ForEach(cabine.GetComponentsInChildren<PortQuery>(), (itme) =>
|
||||||
{
|
{
|
||||||
itme.hight.SetActive(false);
|
itme.hight.SetActive(false);
|
||||||
itme.hight.
|
|
||||||
});
|
});
|
||||||
ExtendedFlycam.Inst.CameraRtDisable();
|
ExtendedFlycam.Inst.CameraRtDisable();
|
||||||
GameManager.Inst.nowDeviceID = null;
|
GameManager.Inst.nowDeviceID = null;
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "builtin",
|
"source": "builtin",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ide.visualstudio": "2.0.14",
|
"com.unity.ide.visualstudio": "2.0.16",
|
||||||
"com.unity.ide.rider": "3.0.13",
|
"com.unity.ide.rider": "3.0.15",
|
||||||
"com.unity.ide.vscode": "1.2.5",
|
"com.unity.ide.vscode": "1.2.5",
|
||||||
"com.unity.editorcoroutines": "1.0.0",
|
"com.unity.editorcoroutines": "1.0.0",
|
||||||
"com.unity.performance.profile-analyzer": "1.1.1",
|
"com.unity.performance.profile-analyzer": "1.1.1",
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
"url": "https://packages.unity.cn"
|
"url": "https://packages.unity.cn"
|
||||||
},
|
},
|
||||||
"com.unity.services.core": {
|
"com.unity.services.core": {
|
||||||
"version": "1.3.1",
|
"version": "1.4.2",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
m_EditorVersion: 2021.3.2f1c1
|
m_EditorVersion: 2021.3.10f1c2
|
||||||
m_EditorVersionWithRevision: 2021.3.2f1c1 (7ac240095d88)
|
m_EditorVersionWithRevision: 2021.3.10f1c2 (5a059dbcdda5)
|
||||||
|
|
Loading…
Reference in New Issue