This commit is contained in:
lwj
2025-05-29 11:36:41 +09:00
parent 01106d7256
commit e86848aa0e
5 changed files with 262 additions and 12 deletions

View File

@@ -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;
inputQueueID = startDataMessage.Data.InputQueues[0].Queue;
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
{