fix move model
This commit is contained in:
@@ -89,49 +89,20 @@ public class SimulationModelMove : SimulationModel
|
|||||||
string[] originalTimeKey = { "data", "original" };
|
string[] originalTimeKey = { "data", "original" };
|
||||||
string[] adjustedTimeKey = { "data", "adjusted" };
|
string[] adjustedTimeKey = { "data", "adjusted" };
|
||||||
string[] inputQueueKey = { "data", "input", "queues" };
|
string[] inputQueueKey = { "data", "input", "queues" };
|
||||||
|
string[] inputStoreKey = { "data", "input", "stores" };
|
||||||
string[] outputQueueKey = { "data", "output", "queue" };
|
string[] outputQueueKey = { "data", "output", "queue" };
|
||||||
string[] outputStoreKey = { "data", "output", "store" };
|
string[] outputStoreKey = { "data", "output", "store" };
|
||||||
string[] sourceQueueKey = { "data", "source_queues" };
|
string[] sourceQueueKey = { "data", "source_queues" };
|
||||||
string[] sourceStoreKey = { "data", "source_stores" };
|
string[] sourceStoreKey = { "data", "source_stores" };
|
||||||
string[] loadCountKey = { "data", "loaded_count" };
|
string[] loadCountKey = { "data", "loaded_count" };
|
||||||
string[] unloadQueueKey = { "data", "output_queue" };
|
string[] unloadQueueKey = { "data", "queue_name" };
|
||||||
|
string[] unloadStoreKey = { "data", "store_name" };
|
||||||
|
|
||||||
if (currentData.ContainsKey(eventKey))
|
if (currentData.ContainsKey(eventKey))
|
||||||
{
|
{
|
||||||
string value = currentData[eventKey].ToString();
|
string value = currentData[eventKey].ToString();
|
||||||
|
|
||||||
|
|
||||||
//if (value.Contains(eventMove))
|
|
||||||
//{
|
|
||||||
// Debug.Log("MoveeventIncomming");
|
|
||||||
|
|
||||||
// elapsedTime = 0;
|
|
||||||
// arrivalTime = GetJsonFloatValue(currentData, arrivalTimeKey);
|
|
||||||
// originalPos = transform.position;
|
|
||||||
// prevPos = transform.position;
|
|
||||||
// JArray originQueues = GetJsonArray(currentData, inputQueueKey);
|
|
||||||
// string arrivalQueue = GetJsonValue(currentData, outputQueueKey)?.ToString();
|
|
||||||
|
|
||||||
// if ( string.IsNullOrEmpty(arrivalQueue))
|
|
||||||
// {
|
|
||||||
// arrivalQueue = GetJsonValue(currentData, outputStoreKey)?.ToString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (originQueues != null && originQueues.HasValues)
|
|
||||||
// {
|
|
||||||
// string queueID = originQueues[0].ToString();
|
|
||||||
// SimulationModel model = DataManager.I.GetModel(queueID);
|
|
||||||
// SimulationModelStore storeModel = (SimulationModelStore)model;
|
|
||||||
// origin = storeModel.GetTransporterPosition();
|
|
||||||
// }
|
|
||||||
// if (arrivalQueue != null)
|
|
||||||
// {
|
|
||||||
// SimulationModel model = DataManager.I.GetModel(arrivalQueue);
|
|
||||||
// SimulationModelStore storeModel = (SimulationModelStore)model;
|
|
||||||
// destination = storeModel.GetTransporterPosition();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (value.Contains(eventLoading))
|
if (value.Contains(eventLoading))
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
@@ -174,6 +145,7 @@ public class SimulationModelMove : SimulationModel
|
|||||||
product.transform.parent = productPos;
|
product.transform.parent = productPos;
|
||||||
product.transform.localPosition = Vector3.zero;
|
product.transform.localPosition = Vector3.zero;
|
||||||
product.transform.localRotation = Quaternion.identity;
|
product.transform.localRotation = Quaternion.identity;
|
||||||
|
listProducts.Add(product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +158,10 @@ public class SimulationModelMove : SimulationModel
|
|||||||
originalPos = transform.position;
|
originalPos = transform.position;
|
||||||
prevPos = transform.position;
|
prevPos = transform.position;
|
||||||
JArray originQueues = GetJsonArray(currentData, inputQueueKey);
|
JArray originQueues = GetJsonArray(currentData, inputQueueKey);
|
||||||
|
JArray originStores = GetJsonArray(currentData, inputStoreKey);
|
||||||
string arrivalQueue = GetJsonValue(currentData, outputQueueKey)?.ToString();
|
string arrivalQueue = GetJsonValue(currentData, outputQueueKey)?.ToString();
|
||||||
|
string arrivalStore = GetJsonValue(currentData, outputStoreKey)?.ToString();
|
||||||
|
|
||||||
if (originQueues != null && originQueues.HasValues)
|
if (originQueues != null && originQueues.HasValues)
|
||||||
{
|
{
|
||||||
string queueID = originQueues[0].ToString();
|
string queueID = originQueues[0].ToString();
|
||||||
@@ -194,20 +169,52 @@ public class SimulationModelMove : SimulationModel
|
|||||||
SimulationModelStore storeModel = (SimulationModelStore)model;
|
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||||
origin = storeModel.GetTransporterPosition();
|
origin = storeModel.GetTransporterPosition();
|
||||||
}
|
}
|
||||||
if (arrivalQueue != null)
|
else if ( originStores != null&& originStores.HasValues)
|
||||||
|
{
|
||||||
|
string storeID = originStores[0].ToString();
|
||||||
|
SimulationModel model = DataManager.I.GetModel(storeID);
|
||||||
|
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||||
|
origin = storeModel.GetTransporterPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(arrivalQueue))
|
||||||
{
|
{
|
||||||
SimulationModel model = DataManager.I.GetModel(arrivalQueue);
|
SimulationModel model = DataManager.I.GetModel(arrivalQueue);
|
||||||
SimulationModelStore storeModel = (SimulationModelStore)model;
|
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||||
destination = storeModel.GetTransporterPosition();
|
destination = storeModel.GetTransporterPosition();
|
||||||
}
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(arrivalStore))
|
||||||
|
{
|
||||||
|
SimulationModel model = DataManager.I.GetModel(arrivalStore);
|
||||||
|
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||||
|
destination = storeModel.GetTransporterPosition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (value.Contains(eventUnloading))
|
else if (value.Contains(eventUnloading))
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
string queueID = GetJsonValue(currentData, unloadQueueKey)?.ToString();
|
string targetID = "";
|
||||||
SimulationModel model = DataManager.I.GetModel(queueID);
|
|
||||||
|
if ( value.Contains("unloading_store"))
|
||||||
|
{
|
||||||
|
targetID = GetJsonValue(currentData, unloadStoreKey)?.ToString();
|
||||||
|
}
|
||||||
|
else if ( value.Contains("unloading_queue"))
|
||||||
|
{
|
||||||
|
targetID = GetJsonValue(currentData, unloadQueueKey)?.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string[] tmpValue = { "data", "output_queue" };
|
||||||
|
|
||||||
|
targetID = GetJsonValue(currentData, tmpValue)?.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
SimulationModel model = new SimulationModel();
|
||||||
|
model = DataManager.I.GetModel(targetID);
|
||||||
SimulationModelStore storeModel = (SimulationModelStore)model;
|
SimulationModelStore storeModel = (SimulationModelStore)model;
|
||||||
|
|
||||||
if (listProducts.Count > 0)
|
if (listProducts.Count > 0)
|
||||||
{
|
{
|
||||||
GameObject product = listProducts[0];
|
GameObject product = listProducts[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user