fix conv
This commit is contained in:
@@ -9,7 +9,7 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6630605483932097968}
|
||||
- component: {fileID: 5171047144740992173}
|
||||
- component: {fileID: -8728010719361298920}
|
||||
m_Layer: 0
|
||||
m_Name: AssemblyLine
|
||||
m_TagString: Untagged
|
||||
@@ -31,9 +31,12 @@ Transform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2351775973713354599}
|
||||
- {fileID: 150297742223292913}
|
||||
- {fileID: 5944348266847543735}
|
||||
- {fileID: 2251514371132152866}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5171047144740992173
|
||||
--- !u!114 &-8728010719361298920
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -46,9 +49,71 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
modelName: AssemblyLine
|
||||
modelType: Move
|
||||
modelType: Conveyor
|
||||
modelID:
|
||||
nodeID:
|
||||
--- !u!1 &2840629559553155426
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5944348266847543735}
|
||||
m_Layer: 0
|
||||
m_Name: startPosition
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5944348266847543735
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2840629559553155426}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -1.781, y: 1.24, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6630605483932097968}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &7132286700177672932
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2251514371132152866}
|
||||
m_Layer: 0
|
||||
m_Name: endPosition
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2251514371132152866
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7132286700177672932}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 1.762, y: 1.24, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6630605483932097968}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1510943800273267816
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -63,7 +128,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
value: -1.275
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
@@ -111,3 +176,65 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
m_PrefabInstance: {fileID: 1510943800273267816}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &3909453952984632062
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 6630605483932097968}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3656036082104082164, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: SM_AssemblyLine01 (1)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 1.16
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
--- !u!4 &150297742223292913 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 3770881403112551183, guid: 69e0d0d3b9856f540a0447f967fce8d9, type: 3}
|
||||
m_PrefabInstance: {fileID: 3909453952984632062}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f50ce1ac65401334c86e29646a5d9e9a
|
||||
guid: 99c413344ba89024c93c3be296b85fcf
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@@ -18,6 +18,7 @@ public class SimulationModelConveyor : SimulationModel
|
||||
int transportTime;
|
||||
float elapseTime;
|
||||
string inputQueueID;
|
||||
string inputStoreID;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
@@ -78,7 +79,19 @@ public class SimulationModelConveyor : SimulationModel
|
||||
//var tmpModel = Resources.Load<GameObject>(string.Format("{0}/{1}", resourcePath, "Box_Pallet"));
|
||||
//targetCargo = Instantiate(tmpModel);
|
||||
|
||||
SimulationModel model = DataManager.I.GetModel(inputQueueID);
|
||||
|
||||
|
||||
SimulationModel model = new SimulationModel();
|
||||
|
||||
if (!string.IsNullOrEmpty(inputQueueID))
|
||||
{
|
||||
model = DataManager.I.GetModel(inputQueueID);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(inputStoreID))
|
||||
{
|
||||
model = DataManager.I.GetModel(inputStoreID);
|
||||
}
|
||||
|
||||
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||
|
||||
if ( targetCargo == null)
|
||||
@@ -102,15 +115,24 @@ public class SimulationModelConveyor : SimulationModel
|
||||
|
||||
if ( rawData.Contains("conveyor_started"))
|
||||
{
|
||||
string[] transportTimeparseKey = { "data", "move_time" };
|
||||
|
||||
|
||||
|
||||
ConveyorStartedEventMessage startDataMessage
|
||||
= JsonConvert.DeserializeObject<ConveyorStartedEventMessage>(rawData);
|
||||
|
||||
Debug.Log(startDataMessage.Data.InputQueues.ToString() + this.name);
|
||||
|
||||
transportTime = (int)startDataMessage.Data.MoveTime;
|
||||
|
||||
if ( startDataMessage.Data.InputQueues.Count != 0)
|
||||
{
|
||||
inputQueueID = startDataMessage.Data.InputQueues[0].Queue;
|
||||
}
|
||||
|
||||
if ( startDataMessage.Data.InputStores.Count != 0)
|
||||
{
|
||||
inputStoreID = startDataMessage.Data.InputStores[0].Queue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -415,6 +437,9 @@ public class ConveyorStartedData
|
||||
[JsonProperty("input_queues")]
|
||||
public List<InputQueue>? InputQueues { get; set; }
|
||||
|
||||
[JsonProperty("input_stores")]
|
||||
public List<InputQueue>? InputStores { get; set; }
|
||||
|
||||
[JsonProperty("output_queue")]
|
||||
public string? OutputQueue { get; set; }
|
||||
|
||||
@@ -439,6 +464,17 @@ public class InputQueue
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class InputStore
|
||||
{
|
||||
[JsonProperty("store")]
|
||||
public string? Queue { get; set; }
|
||||
|
||||
[JsonProperty("required_items")]
|
||||
public int? RequiredItems { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class ConveyorLoadingEventMessage
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public class MQTTDataBase : MonoBehaviour
|
||||
|
||||
public void AddDict(string key, string value)
|
||||
{
|
||||
//Debug.Log("#### : " + key + " : " + value);
|
||||
Debug.Log("#### : " + key + " : " + value);
|
||||
JObject json = JObject.Parse(value);
|
||||
var queue = mqttData.GetOrAdd(key, _ => new ConcurrentQueue<JObject>());
|
||||
queue.Enqueue(json);
|
||||
|
||||
@@ -18,6 +18,93 @@ public class SaveLoadmanager : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if ( Input.GetKey(KeyCode.K))
|
||||
{
|
||||
Onclick_Save_Local();
|
||||
}
|
||||
|
||||
if ( Input.GetKey(KeyCode.L))
|
||||
{
|
||||
Onclick_Load_Local();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Onclick_Save_Local()
|
||||
{
|
||||
var path = StandaloneFileBrowser.SaveFilePanel("Save Layout", "", "", "");
|
||||
var simulationModels = FindObjectsByType<SimulationModel>(FindObjectsSortMode.None);
|
||||
|
||||
List<SimulationModelInfo> saveInfos = new List<SimulationModelInfo>();
|
||||
|
||||
|
||||
foreach (var item in simulationModels)
|
||||
{
|
||||
var tmpSimulationModelInfo = new SimulationModelInfo();
|
||||
|
||||
tmpSimulationModelInfo.prefabName = item.gameObject.name.Replace("(Clone)", "");
|
||||
tmpSimulationModelInfo.modelName = item.modelName;
|
||||
tmpSimulationModelInfo.modelType = item.modelType;
|
||||
tmpSimulationModelInfo.modelID = item.modelID;
|
||||
tmpSimulationModelInfo.nodeID = item.nodeID;
|
||||
tmpSimulationModelInfo.position = item.transform.position.ToString();
|
||||
tmpSimulationModelInfo.rotation = item.transform.rotation.ToString();
|
||||
tmpSimulationModelInfo.scale = item.transform.localScale.ToString();
|
||||
|
||||
saveInfos.Add(tmpSimulationModelInfo);
|
||||
}
|
||||
|
||||
string jsonObject = JsonConvert.SerializeObject(saveInfos, Formatting.Indented);
|
||||
|
||||
FileStream fileStream = new FileStream(string.Format("{0}.json", path), FileMode.Create);
|
||||
|
||||
byte[] buffer = Encoding.UTF8.GetBytes(jsonObject);
|
||||
fileStream.Write(buffer, 0, buffer.Length);
|
||||
fileStream.Close();
|
||||
|
||||
}
|
||||
|
||||
public void Onclick_Load_Local()
|
||||
{
|
||||
var path = StandaloneFileBrowser.OpenFilePanel("Open Layout", "", "", false);
|
||||
|
||||
FileStream fileStream = new FileStream(string.Format("{0}", path), FileMode.Open);
|
||||
byte[] data = new byte[fileStream.Length];
|
||||
fileStream.Read(data, 0, data.Length);
|
||||
fileStream.Close();
|
||||
|
||||
string jsonData = Encoding.UTF8.GetString(data);
|
||||
|
||||
List<SimulationModelInfo> loadInfos = new List<SimulationModelInfo>();
|
||||
|
||||
loadInfos = JsonConvert.DeserializeObject<List<SimulationModelInfo>>(jsonData);
|
||||
|
||||
|
||||
string resourcePath = "Models";
|
||||
|
||||
Dictionary<string, SimulationModel> loadModels = new Dictionary<string, SimulationModel>();
|
||||
|
||||
foreach (var item in loadInfos)
|
||||
{
|
||||
|
||||
var simulationModel = Resources.Load<GameObject>(string.Format("{0}/{1}", resourcePath, item.prefabName));
|
||||
var spawnItem = Instantiate(simulationModel).GetComponent<SimulationModel>();
|
||||
|
||||
spawnItem.modelName = item.modelName;
|
||||
spawnItem.modelType = item.modelType;
|
||||
spawnItem.modelID = item.modelID;
|
||||
spawnItem.nodeID = item.nodeID;
|
||||
|
||||
spawnItem.gameObject.transform.position = ParseVector3(item.position);
|
||||
spawnItem.gameObject.transform.localScale = ParseVector3(item.scale);
|
||||
spawnItem.gameObject.transform.rotation = ParseQuaternion(item.rotation);
|
||||
|
||||
if (!string.IsNullOrEmpty(item.nodeID))
|
||||
loadModels.Add(item.nodeID, spawnItem);
|
||||
}
|
||||
|
||||
LogicMappingDataBase.LoadDataBase(loadModels);
|
||||
}
|
||||
|
||||
public void Onclick_Save()
|
||||
|
||||
Reference in New Issue
Block a user