This commit is contained in:
2025-07-14 17:50:13 +09:00
parent e92778f77b
commit 6aa4a7978b
11 changed files with 170 additions and 24 deletions

View File

@@ -4614,6 +4614,24 @@ Light:
m_CorrespondingSourceObject: {fileID: 1377996960358852691, guid: 6d159c66df8395a40b6e819f4ef72a95, type: 3} m_CorrespondingSourceObject: {fileID: 1377996960358852691, guid: 6d159c66df8395a40b6e819f4ef72a95, type: 3}
m_PrefabInstance: {fileID: 28956631} m_PrefabInstance: {fileID: 28956631}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &493625739 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6518512601816170710, guid: 6c1ed824d30fe8848957d865919227a0, type: 3}
m_PrefabInstance: {fileID: 594906197750746389}
m_PrefabAsset: {fileID: 0}
--- !u!114 &493625742
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 493625739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9846aa51eb7528b429862cfda7772b02, type: 3}
m_Name:
m_EditorClassIdentifier:
product: {fileID: 3554305899873773484, guid: a0607d71a04b3f4459be2d9646fcb429, type: 3}
--- !u!1 &499325871 --- !u!1 &499325871
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -4737,8 +4755,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1900070398} m_TargetGraphic: {fileID: 1900070398}
m_HandleRect: {fileID: 1900070397} m_HandleRect: {fileID: 1900070397}
m_Direction: 0 m_Direction: 0
m_Value: -0.000006283008 m_Value: 0
m_Size: 0.94925356 m_Size: 0.94925374
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
@@ -7652,7 +7670,10 @@ PrefabInstance:
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 6518512601816170710, guid: 6c1ed824d30fe8848957d865919227a0, type: 3}
insertIndex: -1
addedObject: {fileID: 493625742}
m_SourcePrefab: {fileID: 100100000, guid: 6c1ed824d30fe8848957d865919227a0, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 6c1ed824d30fe8848957d865919227a0, type: 3}
--- !u!224 &683822271461456720 --- !u!224 &683822271461456720
RectTransform: RectTransform:
@@ -10150,7 +10171,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2430122421531363926} m_TargetGraphic: {fileID: 2430122421531363926}
m_HandleRect: {fileID: 1792930014543576916} m_HandleRect: {fileID: 1792930014543576916}
m_Direction: 2 m_Direction: 2
m_Value: 1 m_Value: 0
m_Size: 1 m_Size: 1
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
@@ -10375,7 +10396,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3}
propertyPath: m_AnchoredPosition.x propertyPath: m_AnchoredPosition.x
value: -1033.998 value: -1017.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y

View File

@@ -73,6 +73,7 @@ MonoBehaviour:
logic: logic:
project: project:
analyses: analyses:
ProjectTitle:
--- !u!114 &6191105916327120908 --- !u!114 &6191105916327120908
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -137,6 +138,7 @@ MonoBehaviour:
text: {fileID: 0} text: {fileID: 0}
projectMenuButton: {fileID: 0} projectMenuButton: {fileID: 0}
menuPanel: {fileID: 0} menuPanel: {fileID: 0}
projectSaveButton: {fileID: 0}
--- !u!114 &5971518917654927081 --- !u!114 &5971518917654927081
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -224,6 +226,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 3645010147275428242} - component: {fileID: 3645010147275428242}
- component: {fileID: 6796491313723832443} - component: {fileID: 6796491313723832443}
- component: {fileID: 351461855981719754}
m_Layer: 0 m_Layer: 0
m_Name: ObjectManager m_Name: ObjectManager
m_TagString: Untagged m_TagString: Untagged
@@ -258,3 +261,16 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 44cad9a110d6f044d92cc97cf9538ce7, type: 3} m_Script: {fileID: 11500000, guid: 44cad9a110d6f044d92cc97cf9538ce7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &351461855981719754
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6518512601816170710}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9846aa51eb7528b429862cfda7772b02, type: 3}
m_Name:
m_EditorClassIdentifier:
product: {fileID: 3554305899873773484, guid: a0607d71a04b3f4459be2d9646fcb429, type: 3}

View File

@@ -0,0 +1,19 @@
using UnityEngine;
public class ProductManager : MonoBehaviour
{
public static ProductManager Instance;
[SerializeField]
GameObject product;
private void Awake()
{
Instance = this;
}
public GameObject SpawnProduct()
{
GameObject box = Instantiate(product);
return box;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9846aa51eb7528b429862cfda7772b02

View File

@@ -210,7 +210,7 @@ public class SimulationModelConveyor : SimulationModel
if (moveTargetCargo == null) if (moveTargetCargo == null)
{ {
moveTargetCargo = storeModel.GetProduct(); moveTargetCargo = ProductManager.Instance.SpawnProduct();
storedCargo = moveTargetCargo; storedCargo = moveTargetCargo;
moveTargetCargo.transform.position = startPosition; moveTargetCargo.transform.position = startPosition;
@@ -228,7 +228,7 @@ public class SimulationModelConveyor : SimulationModel
if (moveTargetCargo == null) if (moveTargetCargo == null)
{ {
moveTargetCargo = storeModel.GetProduct(); moveTargetCargo = ProductManager.Instance.SpawnProduct();
storedCargo = moveTargetCargo; storedCargo = moveTargetCargo;
moveTargetCargo.transform.position = startPosition; moveTargetCargo.transform.position = startPosition;
@@ -250,7 +250,8 @@ public class SimulationModelConveyor : SimulationModel
SimulationModelStore storemodel = model.GetComponent<SimulationModelStore>(); SimulationModelStore storemodel = model.GetComponent<SimulationModelStore>();
moveTargetCargo = null; moveTargetCargo = null;
storemodel.StoreProduct(storedCargo); //storemodel.StoreProduct(storedCargo);
Destroy(storedCargo);
storedCargo = null; storedCargo = null;
} }
@@ -266,7 +267,8 @@ public class SimulationModelConveyor : SimulationModel
SimulationModelStore storemodel = model.GetComponent<SimulationModelStore>(); SimulationModelStore storemodel = model.GetComponent<SimulationModelStore>();
moveTargetCargo = null; moveTargetCargo = null;
storemodel.StoreProduct(storedCargo); //storemodel.StoreProduct(storedCargo);
Destroy(storedCargo);
storedCargo = null; storedCargo = null;
} }
} }

View File

@@ -394,7 +394,7 @@ public class SimulationModelMove : SimulationModel
for (int i = 0; i < moveData_loading.loaded_count; i++) for (int i = 0; i < moveData_loading.loaded_count; i++)
{ {
GameObject product = null; GameObject product = null;
product = storeModel.GetProduct(); product = ProductManager.Instance.SpawnProduct();
if (product != null) if (product != null)
{ {
product.transform.parent = productPos; product.transform.parent = productPos;
@@ -412,7 +412,7 @@ public class SimulationModelMove : SimulationModel
for (int i = 0; i < moveData_loading.loaded_count; i++) for (int i = 0; i < moveData_loading.loaded_count; i++)
{ {
GameObject product = null; GameObject product = null;
product = storeModel.GetProduct(); product = ProductManager.Instance.SpawnProduct();
if (product != null) if (product != null)
{ {
product.transform.parent = productPos; product.transform.parent = productPos;
@@ -491,8 +491,9 @@ public class SimulationModelMove : SimulationModel
if (listProducts.Count > 0) if (listProducts.Count > 0)
{ {
GameObject product = listProducts[0]; GameObject product = listProducts[0];
storeModel.StoreProduct(product); //storeModel.StoreProduct(product);
listProducts.Remove(product); listProducts.Remove(product);
Destroy(product);
} }
else else
{ {

View File

@@ -290,7 +290,7 @@ public class SimulationModelProcess : SimulationModel
for (int i = 0; i < loadCount; i++) for (int i = 0; i < loadCount; i++)
{ {
GameObject product = null; GameObject product = null;
product = storeModel.GetProduct(); product = ProductManager.Instance.SpawnProduct();
product.transform.parent = productPos; product.transform.parent = productPos;
product.transform.localPosition = Vector3.zero; product.transform.localPosition = Vector3.zero;
@@ -310,7 +310,7 @@ public class SimulationModelProcess : SimulationModel
for (int i = 0; i < loadCount; i++) for (int i = 0; i < loadCount; i++)
{ {
GameObject product = null; GameObject product = null;
product = storeModel.GetProduct(); product = ProductManager.Instance.SpawnProduct();
product.transform.parent = productPos; product.transform.parent = productPos;
product.transform.localPosition = Vector3.zero; product.transform.localPosition = Vector3.zero;
@@ -339,8 +339,9 @@ public class SimulationModelProcess : SimulationModel
if (listProducts.Count > 0) if (listProducts.Count > 0)
{ {
GameObject product = listProducts[0]; GameObject product = listProducts[0];
storeModel.StoreProduct(product); //storeModel.StoreProduct(product);
listProducts.Remove(product); listProducts.Remove(product);
Destroy(product);
} }
else else
{ {
@@ -360,8 +361,9 @@ public class SimulationModelProcess : SimulationModel
if (listProducts.Count > 0) if (listProducts.Count > 0)
{ {
GameObject product = listProducts[0]; GameObject product = listProducts[0];
storeModel.StoreProduct(product); //storeModel.StoreProduct(product);
listProducts.Remove(product); listProducts.Remove(product);
Destroy(product);
} }
else else
{ {
@@ -381,8 +383,9 @@ public class SimulationModelProcess : SimulationModel
if (listProducts.Count > 0) if (listProducts.Count > 0)
{ {
GameObject product = listProducts[0]; GameObject product = listProducts[0];
storeModel.StoreProduct(product); //storeModel.StoreProduct(product);
listProducts.Remove(product); listProducts.Remove(product);
Destroy(product);
} }
else else
{ {

View File

@@ -154,7 +154,7 @@ public class SimulationModelSink : SimulationModel
while (storeModel.storedProducts.Count > queueCapacity) while (storeModel.storedProducts.Count > queueCapacity)
{ {
Destroy(storeModel.GetProduct()); //Destroy(storeModel.GetProduct());
totalShipped++; totalShipped++;
} }
} }
@@ -168,7 +168,7 @@ public class SimulationModelSink : SimulationModel
while (storeModel.storedProducts.Count > queueCapacity) while (storeModel.storedProducts.Count > queueCapacity)
{ {
Destroy(storeModel.GetProduct()); //Destroy(storeModel.GetProduct());
totalShipped++; totalShipped++;
} }
} }

View File

@@ -103,7 +103,8 @@ public class SimulationModelSource : SimulationModel
SimulationModelStore storeModel = model.GetComponent<SimulationModelStore>(); SimulationModelStore storeModel = model.GetComponent<SimulationModelStore>();
storeModel.maxCapacity = queueCapacity; storeModel.maxCapacity = queueCapacity;
storeModel.storeType = storeType; storeModel.storeType = storeType;
storeModel.StoreProduct(product); //storeModel.StoreProduct(product);
Destroy(product);
} }
} }
else if (wrapclass._event.Contains(eventStoreProduct)) else if (wrapclass._event.Contains(eventStoreProduct))
@@ -127,7 +128,8 @@ public class SimulationModelSource : SimulationModel
{ {
SimulationModelStore storeModel = model.GetComponent<SimulationModelStore>(); SimulationModelStore storeModel = model.GetComponent<SimulationModelStore>();
storeModel.maxCapacity = queueCapacity; storeModel.maxCapacity = queueCapacity;
storeModel.StoreProduct(product); //storeModel.StoreProduct(product);
Destroy(product);
} }
} }
} }

View File

@@ -2,6 +2,30 @@ using UnityEngine;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using RTG; using RTG;
using Octopus.Simulator.Networks;
using Newtonsoft.Json;
using System.Collections;
public class StoreStatusUpdateData
{
public StoreStatusUpdateDatastatistics statistics;
}
public class StoreStatusUpdateDatastatistics
{
public int current_length;
}
public class QueueStatusUpdateData
{
public QueueStatusUpdateDatastatistics statistics;
}
public class QueueStatusUpdateDatastatistics
{
public int current_length;
}
public class SimulationModelStore : SimulationModel public class SimulationModelStore : SimulationModel
{ {
public List<Transform> storePositions = new List<Transform>(); public List<Transform> storePositions = new List<Transform>();
@@ -9,6 +33,11 @@ public class SimulationModelStore : SimulationModel
public List<GameObject> storedProducts = new List<GameObject>(); public List<GameObject> storedProducts = new List<GameObject>();
public string storeType = "fifo"; public string storeType = "fifo";
public List<Transform> transporterPositions = new List<Transform>(); public List<Transform> transporterPositions = new List<Transform>();
private void Awake()
{
maxCapacity = storePositions.Count;
}
public void StoreProduct(GameObject product) public void StoreProduct(GameObject product)
{ {
product.transform.parent = transform; product.transform.parent = transform;
@@ -52,8 +81,59 @@ public class SimulationModelStore : SimulationModel
return transporterPositions[UnityEngine.Random.Range(0, transporterPositions.Count)]; return transporterPositions[UnityEngine.Random.Range(0, transporterPositions.Count)];
} }
void AdjustStore(StoreStatusUpdateData Store)
{
Debug.Log(Store.statistics.current_length);
storedProducts.Clear();
GameObject product = ProductManager.Instance.SpawnProduct();
product.transform.parent = transform;
for (int i = 0; i < Store.statistics.current_length; i++)
{
if(i>= storePositions.Count)
{
break;
}
Transform storePos = storePositions[i];
if (storePos.childCount == 0)
{
product.transform.parent = storePos;
}
}
}
void QueueStore(QueueStatusUpdateData Queue)
{
Debug.Log(Queue.statistics.current_length);
storedProducts.Clear();
GameObject product = ProductManager.Instance.SpawnProduct();
product.transform.parent = transform;
for (int i = 0; i < Queue.statistics.current_length; i++)
{
if (i >= storePositions.Count)
{
break ;
}
Transform storePos = storePositions[i];
if (storePos.childCount == 0)
{
product.transform.parent = storePos;
}
}
}
public override void GetData(string data) public override void GetData(string data)
{ {
throw new System.NotImplementedException(); var wrapclass = JsonConvert.DeserializeObject<SimulationDefaultJson>(data);
switch (wrapclass._event)
{
case "store_status_update":
AdjustStore(JsonConvert.DeserializeObject<StoreStatusUpdateData>(wrapclass.data.ToString()));
break;
case "queue_status_update":
QueueStore(JsonConvert.DeserializeObject<QueueStatusUpdateData>(wrapclass.data.ToString()));
break;
default:
break;
}
} }
} }

View File

@@ -17,9 +17,9 @@ namespace Octopus.Simulator.Networks
onParameterRecived += FindAnyObjectByType<ProjectDataManager>().RequestInfo; onParameterRecived += FindAnyObjectByType<ProjectDataManager>().RequestInfo;
onParameterRecived += FindAnyObjectByType<LogicDataManager>().RequestInfo; onParameterRecived += FindAnyObjectByType<LogicDataManager>().RequestInfo;
#if UNITY_EDITOR #if UNITY_EDITOR
config.projectId = "40"; config.projectId = "37";
//config.simulationId = "15"; //config.simulationId = "15";
config.logicId = "45"; config.logicId = "42";
WebParameters.config = config; WebParameters.config = config;
onParameterRecived?.Invoke(); onParameterRecived?.Invoke();
#else #else