From b899ba6acda7015b44583d8e9d144474f93092ad Mon Sep 17 00:00:00 2001 From: UVCLimHun Date: Wed, 25 Jun 2025 14:41:15 +0900 Subject: [PATCH] bugfix --- .../LH/LogicData/Panel_ConnectedObject.cs | 16 +++++++++++++--- .../WorkSpace/LH/LogicData/Panel_PlacedObject.cs | 15 +++++++++------ Assets/WorkSpace/LH/ProjectInfo.cs | 2 ++ .../LH/Simulation/SimulationModelConveyor.cs | 13 +++++-------- .../LH/Simulation/SimulationModelMove.cs | 3 ++- Assets/WorkSpace/LH/Web/WebManager.cs | 1 + Assets/WorkSpace/LWJ/SaveLoadmanager.cs | 3 ++- 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Assets/WorkSpace/LH/LogicData/Panel_ConnectedObject.cs b/Assets/WorkSpace/LH/LogicData/Panel_ConnectedObject.cs index 48633c87..3c3b366c 100644 --- a/Assets/WorkSpace/LH/LogicData/Panel_ConnectedObject.cs +++ b/Assets/WorkSpace/LH/LogicData/Panel_ConnectedObject.cs @@ -34,6 +34,7 @@ namespace Octopus.Simulator var logicUIManager = FindAnyObjectByType(); logicUIManager.onLogicItemSelected += SetConnectedDataItem; logicUIManager.onLogicItemDeSelected += UnsetConnectedDataItem; + FindAnyObjectByType().onPlacedObjectSelected += SetConnectedDataItem; gameObject.SetActive(false); } @@ -89,9 +90,18 @@ namespace Octopus.Simulator { gameObject.SetActive(true); ClearItem(); - dataMap["À̸§"] = go.name; - dataMap["À§Ä¡"] = go.transform.position.ToString(); - dataMap["ID"] = go.modelID; + if (go) + { + dataMap["À̸§"] = go.name; + dataMap["À§Ä¡"] = go.transform.position.ToString(); + dataMap["ID"] = go.modelID; + } + else + { + dataMap["À̸§"] = ""; + dataMap["À§Ä¡"] = ""; + dataMap["ID"] = ""; + } float itemHeight = logicItem.GetComponent().rect.height+ contentSpacing; SetRectHeight(itemHeight); diff --git a/Assets/WorkSpace/LH/LogicData/Panel_PlacedObject.cs b/Assets/WorkSpace/LH/LogicData/Panel_PlacedObject.cs index 02a93910..79d1e6f3 100644 --- a/Assets/WorkSpace/LH/LogicData/Panel_PlacedObject.cs +++ b/Assets/WorkSpace/LH/LogicData/Panel_PlacedObject.cs @@ -14,7 +14,7 @@ namespace Octopus.Simulator TMP_Dropdown dropdown; string mappingkey=""; - public Action onPlacedObjectSelected; + public Action onPlacedObjectSelected; // Start is called once before the first execution of Update after the MonoBehaviour is created void Awake() { @@ -74,17 +74,18 @@ namespace Octopus.Simulator dropdown.onValueChanged.RemoveAllListeners(); dropdown.onValueChanged.AddListener(idx => { + SimulationModel selectedModel; if (idx == 0) { + selectedModel = null; LogicMappingDataBase.SetMapping(mappingKey, null); } else { - var selectedModel = models[idx-1]; + selectedModel = models[idx-1]; LogicMappingDataBase.SetMapping(mappingKey, selectedModel); - Debug.Log(mappingKey); } - onPlacedObjectSelected?.Invoke(mappingKey); + onPlacedObjectSelected?.Invoke(selectedModel); }); } @@ -129,17 +130,19 @@ namespace Octopus.Simulator dropdown.onValueChanged.RemoveAllListeners(); dropdown.onValueChanged.AddListener(idx => { + SimulationModel selectedModel; if (idx == 0) { LogicMappingDataBase.SetMapping(mappingkey, null); + selectedModel = null; } else { - var selectedModel = models[idx - 1]; + selectedModel = models[idx - 1]; LogicMappingDataBase.SetMapping(mappingkey, selectedModel); Debug.Log(mappingkey); } - onPlacedObjectSelected?.Invoke(mappingkey); + onPlacedObjectSelected?.Invoke(selectedModel); }); } diff --git a/Assets/WorkSpace/LH/ProjectInfo.cs b/Assets/WorkSpace/LH/ProjectInfo.cs index a8b98746..4c2016e2 100644 --- a/Assets/WorkSpace/LH/ProjectInfo.cs +++ b/Assets/WorkSpace/LH/ProjectInfo.cs @@ -1,5 +1,6 @@ using UnityEngine; using System; +using System.Collections.Generic; namespace Octopus.Simulator.Networks @@ -23,6 +24,7 @@ namespace Octopus.Simulator.Networks public class WebModelReturnData { public int insertedId; + public List updatedIds; } [Serializable] diff --git a/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs index 891f7e09..330a4fd5 100644 --- a/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs @@ -13,8 +13,8 @@ public class SimulationModelConveyor : SimulationModel Vector3 startPosition; Vector3 endPosition; ConcurrentQueue dataQueue; - GameObject moveTargetCargo; - GameObject storedCargo; + public GameObject moveTargetCargo; + public GameObject storedCargo; int transportTime; float elapseTime; string inputQueueID; @@ -202,14 +202,9 @@ public class SimulationModelConveyor : SimulationModel if (wrapclass._event.Contains("conveyor_loading")) { - //targetCargo = Instantiate(this.gameObject); - //var resourcePath = "Models"; - //var tmpModel = Resources.Load(string.Format("{0}/{1}", resourcePath, "Box_Pallet")); - //targetCargo = Instantiate(tmpModel); + SimulationModel model; - Debug.Log($"queue{inputQueueID}"); - Debug.Log($"store{inputStoreID}"); if (!string.IsNullOrEmpty(inputQueueID)) { model = DataManager.I.GetModel(inputQueueID); @@ -249,6 +244,7 @@ public class SimulationModelConveyor : SimulationModel SimulationModel model = DataManager.I.GetModel(destinationID); SimulationModelStore storemodel = model.GetComponent(); + moveTargetCargo = null; storemodel.StoreProduct(storedCargo); storedCargo = null; } @@ -264,6 +260,7 @@ public class SimulationModelConveyor : SimulationModel SimulationModel model = DataManager.I.GetModel(destinationID); SimulationModelStore storemodel = model.GetComponent(); + moveTargetCargo = null; storemodel.StoreProduct(storedCargo); storedCargo = null; } diff --git a/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs index 094e7002..25217286 100644 --- a/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs @@ -416,10 +416,11 @@ public class SimulationModelMove : SimulationModel } if (wrapclass._event.Contains(eventMove)) { + var moveData_Move = JsonConvert.DeserializeObject(wrapclass.data.ToString()); elapsedTime = 0; + arrivalTime = moveData_Move.time; originalPos = transform.position; prevPos = transform.position; - var moveData_Move = JsonConvert.DeserializeObject(wrapclass.data.ToString()); if (moveData_Move.input.queues != null && moveData_Move.input.queues.Count >= 1) { diff --git a/Assets/WorkSpace/LH/Web/WebManager.cs b/Assets/WorkSpace/LH/Web/WebManager.cs index 3c9d1f9c..8ba3df3f 100644 --- a/Assets/WorkSpace/LH/Web/WebManager.cs +++ b/Assets/WorkSpace/LH/Web/WebManager.cs @@ -132,6 +132,7 @@ namespace UVC.Networks switch(result) { case UnityWebRequest.Result.Success: + return true; case UnityWebRequest.Result.ConnectionError: diff --git a/Assets/WorkSpace/LWJ/SaveLoadmanager.cs b/Assets/WorkSpace/LWJ/SaveLoadmanager.cs index 6aca1302..75d6c5c8 100644 --- a/Assets/WorkSpace/LWJ/SaveLoadmanager.cs +++ b/Assets/WorkSpace/LWJ/SaveLoadmanager.cs @@ -175,7 +175,8 @@ namespace Octopus.Simulator.Networks public void ModelCallback(WebModelReturnData response) { - WebParameters.config.modelId = response.insertedId.ToString(); + //WebParameters.config.modelId = response.insertedId.ToString(); + WebParameters.config.modelId = response.updatedIds[0].ToString(); } public void Onclick_Load(string jsonData)