This commit is contained in:
2025-06-25 14:41:15 +09:00
parent 0f94e89de7
commit b899ba6acd
7 changed files with 34 additions and 19 deletions

View File

@@ -34,6 +34,7 @@ namespace Octopus.Simulator
var logicUIManager = FindAnyObjectByType<LogicUIManager>();
logicUIManager.onLogicItemSelected += SetConnectedDataItem;
logicUIManager.onLogicItemDeSelected += UnsetConnectedDataItem;
FindAnyObjectByType<Panel_PlacedObject>().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<RectTransform>().rect.height+ contentSpacing;
SetRectHeight(itemHeight);

View File

@@ -14,7 +14,7 @@ namespace Octopus.Simulator
TMP_Dropdown dropdown;
string mappingkey="";
public Action<string> onPlacedObjectSelected;
public Action<SimulationModel> 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);
});
}

View File

@@ -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<int> updatedIds;
}
[Serializable]

View File

@@ -13,8 +13,8 @@ public class SimulationModelConveyor : SimulationModel
Vector3 startPosition;
Vector3 endPosition;
ConcurrentQueue<JObject> 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<GameObject>(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<SimulationModelStore>();
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<SimulationModelStore>();
moveTargetCargo = null;
storemodel.StoreProduct(storedCargo);
storedCargo = null;
}

View File

@@ -416,10 +416,11 @@ public class SimulationModelMove : SimulationModel
}
if (wrapclass._event.Contains(eventMove))
{
var moveData_Move = JsonConvert.DeserializeObject<MoveDataClass_Move_Moving>(wrapclass.data.ToString());
elapsedTime = 0;
arrivalTime = moveData_Move.time;
originalPos = transform.position;
prevPos = transform.position;
var moveData_Move = JsonConvert.DeserializeObject<MoveDataClass_Move_Moving>(wrapclass.data.ToString());
if (moveData_Move.input.queues != null && moveData_Move.input.queues.Count >= 1)
{

View File

@@ -132,6 +132,7 @@ namespace UVC.Networks
switch(result)
{
case UnityWebRequest.Result.Success:
return true;
case UnityWebRequest.Result.ConnectionError:

View File

@@ -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)