From 8e0bb1a5599d7f74175fba756301690f32ad7dc8 Mon Sep 17 00:00:00 2001 From: lwj Date: Tue, 24 Jun 2025 17:02:33 +0900 Subject: [PATCH] remove all corutine base restAPI call --- .../Scripts/RTGApp.cs | 1 + Assets/Scenes/Simulation_LibraryFix.unity | 586 ++++++++++-------- .../Sample/CanvasSampleOpenFileImage.cs | 5 +- .../Sample/CanvasSampleOpenFileText.cs | 5 +- .../CanvasSampleOpenFileTextMultiple.cs | 5 +- .../LH/LogicData/LogicDataManager.cs | 22 +- Assets/WorkSpace/LH/LogicInfo.cs | 352 +++++------ Assets/WorkSpace/LH/Panel_SimulationUI.cs | 167 +++-- Assets/WorkSpace/LH/ProjectDataManager.cs | 25 +- Assets/WorkSpace/LH/ProjectInfo.cs | 12 - Assets/WorkSpace/LH/Web/WebManager.cs | 115 ++-- Assets/WorkSpace/LWJ/SaveLoadmanager.cs | 47 +- 12 files changed, 729 insertions(+), 613 deletions(-) diff --git a/Assets/Runtime Transform Gizmos/Scripts/RTGApp.cs b/Assets/Runtime Transform Gizmos/Scripts/RTGApp.cs index 593c6101..1aacda94 100644 --- a/Assets/Runtime Transform Gizmos/Scripts/RTGApp.cs +++ b/Assets/Runtime Transform Gizmos/Scripts/RTGApp.cs @@ -191,6 +191,7 @@ namespace RTG foreach (var moduleType in allModuleTypes) { var allModulesInScene = MonoBehaviour.FindObjectsOfType(moduleType); + foreach(var module in allModulesInScene) { MonoBehaviour moduleMono = module as MonoBehaviour; diff --git a/Assets/Scenes/Simulation_LibraryFix.unity b/Assets/Scenes/Simulation_LibraryFix.unity index 9b9e23c5..9d15ea68 100644 --- a/Assets/Scenes/Simulation_LibraryFix.unity +++ b/Assets/Scenes/Simulation_LibraryFix.unity @@ -119,11 +119,6 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!224 &80690333 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - m_PrefabInstance: {fileID: 6579092525594939345} - m_PrefabAsset: {fileID: 0} --- !u!1 &80980154 GameObject: m_ObjectHideFlags: 0 @@ -4166,11 +4161,6 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6a9d8c08cbd13f3419d22b5bafd16c28, type: 3} ---- !u!224 &384003842 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 225909343286015538, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - m_PrefabInstance: {fileID: 6579092525594939345} - m_PrefabAsset: {fileID: 0} --- !u!1 &443563066 GameObject: m_ObjectHideFlags: 0 @@ -6251,8 +6241,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ff02e87168389f34ca05f3ccf9e830c8, type: 3} m_Name: m_EditorClassIdentifier: - spawnerIconWidth: 0 - spawnerIconHeight: 0 --- !u!114 &1157598132 MonoBehaviour: m_ObjectHideFlags: 0 @@ -6882,17 +6870,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1350516100} m_CullTransparentMesh: 1 ---- !u!114 &1351749705 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - m_PrefabInstance: {fileID: 6579092525594939345} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1407014991 GameObject: m_ObjectHideFlags: 0 @@ -7783,7 +7760,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2124509610} - - {fileID: 80690333} + - {fileID: 2063947988} - {fileID: 1216065598} - {fileID: 1821473417} - {fileID: 2078174713} @@ -7929,6 +7906,322 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_IsOn: 0 +--- !u!1001 &2063947987 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1916153470} + m_Modifications: + - target: {fileID: 31022855806739745, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_MovementType + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 588411198089990919, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 588411198089990919, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Value + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1073750513953127727, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Type + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1158579472109067453, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1158579472109067453, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1158579472109067453, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1158579472109067453, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2084682016205783184, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 0} + - target: {fileID: 2084682016205783184, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.a + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2222743492580726404, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Name + value: LogicDataWindow + objectReference: {fileID: 0} + - target: {fileID: 2222743492580726404, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2937901397465735005, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.a + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_SizeDelta.x + value: -327 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_SizeDelta.y + value: 350 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchoredPosition.x + value: -136.50012 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchoredPosition.y + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_SizeDelta.x + value: 2000 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_SizeDelta.y + value: 1000 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchoredPosition.x + value: -1068.1562 + objectReference: {fileID: 0} + - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchoredPosition.y + value: 402.65002 + objectReference: {fileID: 0} + - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.a + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.g + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.r + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5255566545530560444, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_SizeDelta.x + value: 1.5 + objectReference: {fileID: 0} + - target: {fileID: 5255566545530560444, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_SizeDelta.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5255566545530560444, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchoredPosition.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6285377767518673600, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 0} + - target: {fileID: 6285377767518673600, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Color.a + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6356363624364328470, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6356363624364328470, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6356363624364328470, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6940169657633229565, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Size + value: 0.35100004 + objectReference: {fileID: 0} + - target: {fileID: 6940169657633229565, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Value + value: 0.6499999 + objectReference: {fileID: 0} + - target: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Colors.m_SelectedColor.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Colors.m_SelectedColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_Colors.m_SelectedColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7982483741311374213, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7982483741311374213, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7982483741311374213, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2222743492580726404, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + insertIndex: -1 + addedObject: {fileID: 2063947992} + m_SourcePrefab: {fileID: 100100000, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} +--- !u!224 &2063947988 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + m_PrefabInstance: {fileID: 2063947987} + m_PrefabAsset: {fileID: 0} +--- !u!224 &2063947989 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 225909343286015538, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + m_PrefabInstance: {fileID: 2063947987} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2063947990 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + m_PrefabInstance: {fileID: 2063947987} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2063947991 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2222743492580726404, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} + m_PrefabInstance: {fileID: 2063947987} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2063947992 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2063947991} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: db23f43a626977e499745e70cceaae33, type: 3} + m_Name: + m_EditorClassIdentifier: + UIPrefabPath: UIPrefab + logicWindow: {fileID: 2063947991} + LogicPrefab: {fileID: 2210399282865539074, guid: 72314043a41090846a8c16ad04f3c028, type: 3} + LinePrefab: {fileID: 6254276411767355245, guid: c899c98324602eb4fbe900753508f64d, type: 3} + logicContent: {fileID: 2063947989} + backGround: {fileID: 2063947990} --- !u!224 &2078174713 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 4984763691913443583, guid: 91b280356e2a9674aac91102f2da87f8, type: 3} @@ -8120,11 +8413,11 @@ PrefabInstance: - target: {fileID: 6191105916327120908, guid: 6c1ed824d30fe8848957d865919227a0, type: 3} propertyPath: backGround value: - objectReference: {fileID: 1351749705} + objectReference: {fileID: 0} - target: {fileID: 6191105916327120908, guid: 6c1ed824d30fe8848957d865919227a0, type: 3} propertyPath: LogicWindow value: - objectReference: {fileID: 80690333} + objectReference: {fileID: 0} - target: {fileID: 6191105916327120908, guid: 6c1ed824d30fe8848957d865919227a0, type: 3} propertyPath: webReceiver value: @@ -8132,7 +8425,7 @@ PrefabInstance: - target: {fileID: 6191105916327120908, guid: 6c1ed824d30fe8848957d865919227a0, type: 3} propertyPath: LogicContent value: - objectReference: {fileID: 384003842} + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -8189,7 +8482,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 6474398473578022840} m_HandleRect: {fileID: 8000945978192851396} m_Direction: 2 - m_Value: 0 + m_Value: 1 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: @@ -8848,243 +9141,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!1001 &6579092525594939345 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1916153470} - m_Modifications: - - target: {fileID: 31022855806739745, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_MovementType - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 588411198089990919, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Size - value: 0.79725 - objectReference: {fileID: 0} - - target: {fileID: 588411198089990919, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Value - value: 0.7 - objectReference: {fileID: 0} - - target: {fileID: 1073750513953127727, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Type - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 2084682016205783184, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Sprite - value: - objectReference: {fileID: 0} - - target: {fileID: 2084682016205783184, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.a - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2222743492580726404, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Name - value: LogicDataWindow - objectReference: {fileID: 0} - - target: {fileID: 2937901397465735005, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.a - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMin.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_SizeDelta.x - value: -327 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_SizeDelta.y - value: 300 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchoredPosition.x - value: -136.5 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchoredPosition.y - value: 316 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3202402725712308353, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMin.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMin.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_SizeDelta.x - value: 2000 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_SizeDelta.y - value: 1000 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchoredPosition.x - value: -1081.1 - objectReference: {fileID: 0} - - target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchoredPosition.y - value: 395.15002 - objectReference: {fileID: 0} - - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.a - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.b - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.g - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4980370143534209375, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.r - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5255566545530560444, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_SizeDelta.x - value: 1.5 - objectReference: {fileID: 0} - - target: {fileID: 5255566545530560444, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_SizeDelta.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5255566545530560444, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchoredPosition.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6285377767518673600, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Sprite - value: - objectReference: {fileID: 0} - - target: {fileID: 6285377767518673600, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Color.a - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6356363624364328470, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6356363624364328470, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6356363624364328470, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6940169657633229565, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Size - value: 0.301 - objectReference: {fileID: 0} - - target: {fileID: 6940169657633229565, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Value - value: 0.65 - objectReference: {fileID: 0} - - target: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Colors.m_SelectedColor.b - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Colors.m_SelectedColor.g - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7672464725508683099, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_Colors.m_SelectedColor.r - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7982483741311374213, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7982483741311374213, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7982483741311374213, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3} --- !u!1 &6774851701291315266 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs index 4fb1351b..970cdd73 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs @@ -6,6 +6,7 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using SFB; +using UnityEngine.Networking; [RequireComponent(typeof(Button))] public class CanvasSampleOpenFileImage : MonoBehaviour, IPointerDownHandler { @@ -46,8 +47,8 @@ public class CanvasSampleOpenFileImage : MonoBehaviour, IPointerDownHandler { #endif private IEnumerator OutputRoutine(string url) { - var loader = new WWW(url); + UnityWebRequest loader = new UnityWebRequest(url); yield return loader; - output.texture = loader.texture; + //output.texture = loader.texture; } } \ No newline at end of file diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs index 39cb2f45..cfc5a954 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs @@ -6,6 +6,7 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using SFB; +using UnityEngine.Networking; [RequireComponent(typeof(Button))] public class CanvasSampleOpenFileText : MonoBehaviour, IPointerDownHandler { @@ -46,8 +47,8 @@ public class CanvasSampleOpenFileText : MonoBehaviour, IPointerDownHandler { #endif private IEnumerator OutputRoutine(string url) { - var loader = new WWW(url); + UnityWebRequest loader = new UnityWebRequest(url); yield return loader; - output.text = loader.text; + //output.text = loader.text; } } \ No newline at end of file diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs index 61b35b2d..d207aeec 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs @@ -6,6 +6,7 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using SFB; +using UnityEngine.Networking; [RequireComponent(typeof(Button))] public class CanvasSampleOpenFileTextMultiple : MonoBehaviour, IPointerDownHandler { @@ -53,9 +54,9 @@ public class CanvasSampleOpenFileTextMultiple : MonoBehaviour, IPointerDownHandl private IEnumerator OutputRoutine(string[] urlArr) { var outputText = ""; for (int i = 0; i < urlArr.Length; i++) { - var loader = new WWW(urlArr[i]); + UnityWebRequest loader = new UnityWebRequest(urlArr[i]); yield return loader; - outputText += loader.text; + // outputText += loader.text; } output.text = outputText; } diff --git a/Assets/WorkSpace/LH/LogicData/LogicDataManager.cs b/Assets/WorkSpace/LH/LogicData/LogicDataManager.cs index 0b224ba8..7d4a71d6 100644 --- a/Assets/WorkSpace/LH/LogicData/LogicDataManager.cs +++ b/Assets/WorkSpace/LH/LogicData/LogicDataManager.cs @@ -16,8 +16,6 @@ namespace Octopus.Simulator public event Action onLogicUpdated; - - // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { @@ -27,23 +25,16 @@ namespace Octopus.Simulator public void RequestInfo() { - WebManager.Instance.Request_Get($"{WebManager.Instance.apiConfig.logic}/{WebParameters.config.logicId}", (flag, value) => - { - if (flag) - { - var info = JsonConvert.DeserializeObject(value); - onLogicUpdated?.Invoke(info.data); - GetDataFromInfo(info.data); - } - }); - - WebManager.Instance.Reqeust_Get($"{WebManager.Instance.apiConfig.logic}/{WebParameters.config.logicId}",GetDataFromResponse); + var requestURL = $"{WebManager.Instance.apiConfig.logic}/{WebParameters.config.logicId}"; + WebManager.Instance.Reqeust(requestURL, RequestType.GET, GetDataFromInfo); } void GetDataFromInfo(LogicData Data) { + onLogicUpdated?.Invoke(Data); + currentData = Data; config = Data.webConfig; if (currentData.ModelFiles.Count >= 1) @@ -57,10 +48,5 @@ namespace Octopus.Simulator } } } - - void GetDataFromResponse(LogicInfo response) - { - Debug.Log(response.data.ToString()); - } } } \ No newline at end of file diff --git a/Assets/WorkSpace/LH/LogicInfo.cs b/Assets/WorkSpace/LH/LogicInfo.cs index eca69c15..d2ecfb2c 100644 --- a/Assets/WorkSpace/LH/LogicInfo.cs +++ b/Assets/WorkSpace/LH/LogicInfo.cs @@ -5,95 +5,81 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Octopus.Simulator.Networks; - +#nullable enable namespace Octopus.Simulator { [Serializable] - public class LogicInfo + public class Base { - public int? status=0; - public string code; - public string message; - public LogicData data = new LogicData(); - public Meta meta; - public string timestamp; - } - - [Serializable] - public class SimulatorPostClass - { - public int? status=0; - public string code; - public string message; - public SimulationData data = new SimulationData(); - public Meta meta; - public string timestamp; - } - - [Serializable] - public class SimulatorGetClass - { - public int? status=0; - public string code; - public string message; - public SimulatorGetData data = new SimulatorGetData(); - public Meta meta; - public string timestamp; + public int? status = 0; + public string? code; + public string? message; + public T? data; + public Meta? meta; + public string? timestamp; } [Serializable] public class SimulationData { - public string insertedId; + public int? insertedId; } [Serializable] public class SimulatorGetData { - public string simulationCode; + public string? simulationCode; + } + + [Serializable] + public class UpdatedSimulationsInfo + { + public int? updatedCount; + public List? updatedIds = new List(); } [Serializable] public class LogicData { - public int? id=0; - public int? projectId=0; + public int? id = 0; + public int? projectId = 0; //public int logicId; - public int? userId=0; - public string name; - public string simulationCode; - public logicData data; - public LogicWebConfig webConfig; + public int? userId = 0; + public string? name; + public string? simulationCode; + public logicData? data; + public LogicWebConfig? webConfig; //public SimulationParameters parameters; - public string status; - public string resultData; - public string createdAt; - public string updatedAt; - public string deletedAt; + public string? status; + public string? resultData; + public string? createdAt; + public string? updatedAt; + public string? deletedAt; //public SimulationProject project; - public List ModelFiles=new List(); + public List? ModelFiles = new List(); //public SimulationComponent component; //public SimulationUser user; } - [Serializable] public class logicData { - public string name; + public string? name; public bool trace; - public List queues; - public List resources; - public List stores; + public List? queues; + public List? resources; + public List? stores; + [SerializeReference] [JsonConverter(typeof(ComponentsConverter))] - public List components; - public int? simulation_time=0; + public List? components; + + public int? simulation_time = 0; } [Serializable] public class paramclass { - public SimulationParameters parameters=new SimulationParameters(); + public SimulationParameters? parameters = new SimulationParameters(); } [Serializable] @@ -101,28 +87,31 @@ namespace Octopus.Simulator { public bool realTime = false; } + [Serializable] public class emptyClass { } + [Serializable] public class SimulationParameters { - public int? speed=0; - public int? duration=0; + public int? speed = 0; + public int? duration = 0; public bool real_time; } [Serializable] public class HistoryParameters { - public int? projectId=0; - public int? logicId=0; - public string logicData; - public string name; + public int? projectId = 0; + public int? logicId = 0; + public string? logicData; + public string? name; } + public enum LogicItemType { Queue, @@ -142,55 +131,55 @@ namespace Octopus.Simulator public interface ILogicItem { - string Name { get; } - string Description { get; } - string Label { get; } + string? Name { get; } + string? Description { get; } + string? Label { get; } LogicItemType ItemType { get; } } [Serializable] public class LogicQueue : ILogicItem { - public string name = ""; - public string description = ""; - public string label; + public string? name = ""; + public string? description = ""; + public string? label; public int capacity = 0; public int quantity; public int priority_order; - public string queue_type; - public string Name => name; - public string Description => description; - public string Label => label; + public string? queue_type; + public string? Name => name; + public string? Description => description; + public string? Label => label; public LogicItemType ItemType => LogicItemType.Queue; } [Serializable] public class LogicResource : ILogicItem { - public string name = ""; + public string? name = ""; public int capacity = 0; - public string description = ""; - public string label; + public string? description = ""; + public string? label; public int? repair_time = 0; public double speed_factor = 0.0; public int? breakdown_interval = 0; - public string Name => name; - public string Description => description; - public string Label => label; + public string? Name => name; + public string? Description => description; + public string? Label => label; public LogicItemType ItemType => LogicItemType.Resource; } [Serializable] public class LogicStore : ILogicItem { - public string name; - public string description; - public string label; + public string? name; + public string? description; + public string? label; public int capacity; public int quantity; public int priority_order; - public string Name => name; - public string Description => description; - public string Label => label; + public string? Name => name; + public string? Description => description; + public string? Label => label; public LogicItemType ItemType => LogicItemType.Store; } @@ -198,73 +187,73 @@ namespace Octopus.Simulator public abstract class ILogicComponent : ILogicItem { public abstract ComponentType Type { get; } - public abstract string Name { get; } - public abstract string Description { get; } - public abstract string Label { get; } + public abstract string? Name { get; } + public abstract string? Description { get; } + public abstract string? Label { get; } public LogicItemType ItemType => LogicItemType.Component; } [Serializable] public class ProductGenerator : ILogicComponent { - public string name; - public int? rate=0; - public string description; - public string label; - public string output_queue; - public string defect_queue; - public string output_resource; + public string? name; + public int? rate = 0; + public string? description; + public string? label; + public string? output_queue; + public string? defect_queue; + public string? output_resource; public int prod_priority; - public int? batch_size=0; + public int? batch_size = 0; public int defect_rate; - public int? period=0; + public int? period = 0; public int? capacity = 0; - public override string Name => name; - public override string Description => description; - public override string Label => label; + public override string? Name => name; + public override string? Description => description; + public override string? Label => label; public override ComponentType Type => ComponentType.Product_Generator; } [Serializable] public class Processor : ILogicComponent { - public string name; - public string description; - public string label; + public string? name; + public string? description; + public string? label; public int processing_time; - public int? batch_size=0; - public List input_queues; - public string output_queue; - public string defect_queue; - public string required_resource; + public int? batch_size = 0; + public List? input_queues; + public string? output_queue; + public string? defect_queue; + public string? required_resource; public int process_amount; public float defect_rate; - public override string Name => name; - public override string Description => description; - public override string Label => label; + public override string? Name => name; + public override string? Description => description; + public override string? Label => label; public override ComponentType Type => ComponentType.Processor; } [Serializable] public class Transporter : ILogicComponent { - public string name; - public string description; - public string label; + public string? name; + public string? description; + public string? label; public int? transport_time = 0; public float? transport_distance = 0f; public float? movement_speed = 0f; public int? capacity = 0; - public string input_queue; - public string output_queue; - public string defect_queue; - public string required_resource; - public string transporter_type; + public string? input_queue; + public string? output_queue; + public string? defect_queue; + public string? required_resource; + public string? transporter_type; public float return_time; public int min_batch_size; - public override string Name => name; - public override string Description => description; - public override string Label => label; + public override string? Name => name; + public override string? Description => description; + public override string? Label => label; public override ComponentType Type => ComponentType.Transporter; } @@ -287,26 +276,26 @@ namespace Octopus.Simulator [Serializable] public class Conveyor : ILogicComponent { - public string name; - public string description; - public string label; + public string? name; + public string? description; + public string? label; public int move_time; public float belt_speed; public int? capacity = 0; - public string input_queue; - public string output_queue; - public string defect_queue; - public string required_resource; - public override string Name => name; - public override string Description => description; - public override string Label => label; + public string? input_queue; + public string? output_queue; + public string? defect_queue; + public string? required_resource; + public override string? Name => name; + public override string? Description => description; + public override string? Label => label; public override ComponentType Type => ComponentType.Conveyor; } [Serializable] public class InputQueue { - public string name; + public string? name; public int required_items; } @@ -315,16 +304,17 @@ namespace Octopus.Simulator { public int id; public int userId; - public string name; - public string description; - public string createdAt; - public string updatedAt; + public string? name; + public string? description; + public string? createdAt; + public string? updatedAt; } + [Serializable] public class SimulationModelFile { public int? id; - public WebModelData data; + public WebModelData? data; } [Serializable] @@ -332,48 +322,48 @@ namespace Octopus.Simulator { public int id; public int userId; - public string name; - public string description; - public string createdAt; - public string updatedAt; + public string? name; + public string? description; + public string? createdAt; + public string? updatedAt; } [Serializable] public class SimulationUser { public int id; - public string ccPositionId; - public string userid; - public string name; - public string auth; - public string email; + public string? ccPositionId; + public string? userid; + public string? name; + public string? auth; + public string? email; public bool active; - public string joinDate; + public string? joinDate; public bool activeClassifyRule; - public string signatureId; - public string employeeNumber; - public string resignationDate; - public string profileId; - public string createdAt; - public string updatedAt; + public string? signatureId; + public string? employeeNumber; + public string? resignationDate; + public string? profileId; + public string? createdAt; + public string? updatedAt; } [Serializable] public class LogicWebConfig { - public List nodes; - public List edges; + public List? nodes; + public List? edges; } [Serializable] public class Edge { - public string id; - public EdgeData data; - public string type; - public string label; - public string source; - public string target; + public string? id; + public EdgeData? data; + public string? type; + public string? label; + public string? source; + public string? target; public float sourceX; public float sourceY; public float targetX; @@ -383,40 +373,40 @@ namespace Octopus.Simulator [Serializable] public class EdgeData { - public string name; - public string type; - public string label; + public string? name; + public string? type; + public string? label; public bool visible; public bool isIgnore; public bool isShowName; - public string description; - public Node sourceNode; - public Node targetNode; + public string? description; + public Node? sourceNode; + public Node? targetNode; } [Serializable] public class Node { - public string id; - public NodeData data; - public string type; + public string? id; + public NodeData? data; + public string? type; public bool dragging; public bool isParent; - public Position position; + public Position? position; public bool resizing; public bool selected; - public Dimension dimensions; + public Dimension? dimensions; public bool initialized; - public HandleBounds handleBounds; - public ComputedPosition computedPosition; + public HandleBounds? handleBounds; + public ComputedPosition? computedPosition; } [Serializable] public class NodeData { - public string name; - public string type; - public string label; + public string? name; + public string? type; + public string? label; } [Serializable] @@ -426,18 +416,18 @@ namespace Octopus.Simulator public float y; } - [Serializable] public class Dimension { public float width; public float height; } + [Serializable] public class HandleBounds { - public List source; - public List target; + public List? source; + public List? target; } [Serializable] @@ -445,10 +435,10 @@ namespace Octopus.Simulator { public float x; public float y; - public string id; + public string? id; public float width; public float height; - public string position; + public string? position; } [Serializable] @@ -460,7 +450,7 @@ namespace Octopus.Simulator [Serializable] public class Meta { - public Param param; + public Param? param; } [Serializable] @@ -469,6 +459,8 @@ namespace Octopus.Simulator public int id; } + +#nullable disable public class ComponentsConverter : JsonConverter> { public override bool CanWrite => false; diff --git a/Assets/WorkSpace/LH/Panel_SimulationUI.cs b/Assets/WorkSpace/LH/Panel_SimulationUI.cs index 31fbe235..43076091 100644 --- a/Assets/WorkSpace/LH/Panel_SimulationUI.cs +++ b/Assets/WorkSpace/LH/Panel_SimulationUI.cs @@ -56,57 +56,81 @@ namespace Octopus.Simulator { isplaying = false; Button_Play.image.sprite = pause; - Request_SimulationPause(null, $"{requestAPI}/{WebParameters.id}/pause"); + + var requestURL = $"{requestAPI}/{WebParameters.id}/pause"; + webmanager.Reqeust(requestURL, RequestType.POST, null); + //Request_SimulationPause(null, $"{requestAPI}/{WebParameters.id}/pause"); } else { isplaying = true; Button_Play.image.sprite = playing; - Request_SimulationCreate(param, requestAPI); + + webmanager.Reqeust(requestAPI, RequestType.POST, SimulationCreate, param); + //Request_SimulationCreate(param, requestAPI); } } - void Request_SimulationCreate(HistoryParameters param, string api) - { - webmanager.Request_Post(param, api, (flag, value) => - { - if (flag) - { - SimulatorPostClass info = JsonConvert.DeserializeObject(value); - WebParameters.id = int.Parse(info.data.insertedId); + //void Request_SimulationCreate(HistoryParameters param, string api) + //{ + // webmanager.Request_Post(param, api, (flag, value) => + // { + // if (flag) + // { + // SimulatorPostClass info = JsonConvert.DeserializeObject(value); + // WebParameters.id = (int)info.data.insertedId; - Application.ExternalCall("setSimulationID", WebParameters.id); - Debug.Log("Call external setSimulationID" + WebParameters.id.ToString()); - Get_Simulation(); - } - }); + // Application.ExternalCall("setSimulationID", WebParameters.id); + // Debug.Log("Call external setSimulationID" + WebParameters.id.ToString()); + // Get_Simulation(); + // } + // }); + + //} + + //void Request_SimulationPause(HistoryParameters param, string api) + //{ + // webmanager.Request_Post(param, api, (flag, value) => + // { + // if (flag) + // { + // } + // }); + //} + + void SimulationCreate(SimulationData response) + { + WebParameters.id = (int)response.insertedId; + Application.ExternalCall("setSimulationID", WebParameters.id); + Debug.Log("Call external setSimulationID" + WebParameters.id.ToString()); + Get_Simulation(); } - void Request_SimulationPause(HistoryParameters param, string api) - { - webmanager.Request_Post(param, api, (flag, value) => - { - if (flag) - { - } - }); - } void Get_Simulation() { - string api = $"{webmanager.apiConfig.history}/{WebParameters.id}"; - webmanager.Request_Get(api, (flag, value) => - { - if (flag) - { - SimulatorGetClass info = JsonConvert.DeserializeObject(value); - WebParameters.code = info.data.simulationCode; - SetMqttConnect(); - } - }); + var reqeustURL = $"{webmanager.apiConfig.history}/{WebParameters.id}"; + //webmanager.Request_Get(reqeustURL, (flag, value) => + //{ + // if (flag) + // { + // SimulatorGetClass info = JsonConvert.DeserializeObject(value); + // WebParameters.code = info.data.simulationCode; + // SetMqttConnect(); + // } + //}); + + WebManager.Instance.Reqeust(reqeustURL, RequestType.GET, GetSimulationCallback); } + public void GetSimulationCallback(SimulatorGetData response) + { + WebParameters.code = response.simulationCode; + SetMqttConnect(); + } + + void SetMqttConnect() { MQTTManager.mqttManager.SubscribeTopic($"simulation/{WebParameters.code}/#"); @@ -119,12 +143,15 @@ namespace Octopus.Simulator param.parameters.duration = 3600; param.parameters.real_time = true; string requestAPI = $"{webmanager.apiConfig.history}/{WebParameters.id}/start"; - webmanager.Request_Post(param, requestAPI, (flag, value) => - { - if (flag) - { - } - }); + + webmanager.Reqeust(requestAPI, RequestType.POST, null, param); + + //webmanager.Request_Post(param, requestAPI, (flag, value) => + //{ + // if (flag) + // { + // } + //}); } void OnclickFastForwardBTN() @@ -149,24 +176,48 @@ namespace Octopus.Simulator void Request_SimulationComplete() { - string requestAPI = $"{webmanager.apiConfig.history}/{WebParameters.id}/pause"; - webmanager.Request_Post(null, requestAPI, (flag, value) => - { - if (flag) - { - requestAPI = $"{webmanager.apiConfig.history}/{WebParameters.id}/toggle-realtime"; - RealTime rt = new RealTime(); - rt.realTime = false; - webmanager.Request_Post(rt, requestAPI, (flag, value) => - { - if (flag) - { - emptyClass ec = new emptyClass(); - webmanager.Request_Post(ec, $"{webmanager.apiConfig.history}/{WebParameters.id}/resume", (flag, value) => { }); - } - }); - } - }); + var requestURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/pause"; + + webmanager.Reqeust(requestURL, RequestType.POST, PauseCallback); + + //webmanager.Request_Post(null, requestURL, (flag, value) => + //{ + // if (flag) + // { + // requestURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/toggle-realtime"; + // RealTime rt = new RealTime(); + // rt.realTime = false; + + // webmanager.Reqeust(requestURL, RequestType.POST, ToggleRealTimeCallback, rt); + + // //webmanager.Request_Post(rt, requestURL, (flag, value) => + // //{ + // // if (flag) + // // { + // // var reqeustURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/resume"; + // // emptyClass ec = new emptyClass(); + // // //webmanager.Request_Post(ec, reqeustURL, (flag, value) => { }); + + // // webmanager.Reqeust(reqeustURL, RequestType.POST, null); + // // } + // //}); + // } + //}); + } + + public void PauseCallback(UpdatedSimulationsInfo response) + { + var requsetURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/toggle-realtime"; + RealTime rt = new RealTime(); + rt.realTime = false; + webmanager.Reqeust(requsetURL, RequestType.POST, ToggleRealTimeCallback, rt); + } + + public void ToggleRealTimeCallback(RealTime response) + { + var reqeustURL = $"{webmanager.apiConfig.history}/{WebParameters.id}/resume"; + emptyClass ec = new emptyClass(); + webmanager.Reqeust(reqeustURL, RequestType.POST, null); } } } \ No newline at end of file diff --git a/Assets/WorkSpace/LH/ProjectDataManager.cs b/Assets/WorkSpace/LH/ProjectDataManager.cs index bde2c813..f3e5423d 100644 --- a/Assets/WorkSpace/LH/ProjectDataManager.cs +++ b/Assets/WorkSpace/LH/ProjectDataManager.cs @@ -24,14 +24,23 @@ namespace Octopus.Simulator } public void RequestInfo() { - WebManager.Instance.Request_Get($"{WebManager.Instance.apiConfig.project}/{WebParameters.config.projectId}", (flag, value) => - { - if (flag) - { - var info = JsonConvert.DeserializeObject(value); - SetText(info.data.name); - } - }); + var reqeustURL = $"{WebManager.Instance.apiConfig.project}/{WebParameters.config.projectId}"; + + WebManager.Instance.Reqeust(reqeustURL, RequestType.GET, ProjectInfoCallback); + + //WebManager.Instance.Request_Get(reqeustURL, (flag, value) => + //{ + // if (flag) + // { + // var info = JsonConvert.DeserializeObject(value); + // SetText(info.data.name); + // } + //}); + } + + public void ProjectInfoCallback(ProjectInfoData response) + { + SetText(response.name); } void SetText(string data) diff --git a/Assets/WorkSpace/LH/ProjectInfo.cs b/Assets/WorkSpace/LH/ProjectInfo.cs index 9102c96a..a8b98746 100644 --- a/Assets/WorkSpace/LH/ProjectInfo.cs +++ b/Assets/WorkSpace/LH/ProjectInfo.cs @@ -4,12 +4,6 @@ using System; namespace Octopus.Simulator.Networks { - [Serializable] - public class ProjectInfo - { - public ProjectInfoData data; - } - [Serializable] public class WebModelClass { @@ -25,12 +19,6 @@ namespace Octopus.Simulator.Networks public string info; } - [Serializable] - public class WebModelReturnClass - { - public WebModelReturnData data; - } - [Serializable] public class WebModelReturnData { diff --git a/Assets/WorkSpace/LH/Web/WebManager.cs b/Assets/WorkSpace/LH/Web/WebManager.cs index 2ecad528..90650573 100644 --- a/Assets/WorkSpace/LH/Web/WebManager.cs +++ b/Assets/WorkSpace/LH/Web/WebManager.cs @@ -10,14 +10,26 @@ using System; using System.Text; using Octopus.Simulator; +#pragma warning disable CS8632 + namespace UVC.Networks { //API를 통해 서버와 통신하기 위한 함수들이 내장되어 있습니다. //Post, Get. Put을 사용하며, Post의 경우엔 Class를 입력으로 받아 Json형식으로 변환하여 업로드합니다. //비동기로 실행하기 위해 Coroutine으로 제작되었으며, callback의 bool값을 통해 서버로부터 //정상적으로 API가 입력, 결과가 출력되었는지를 확인할 수 있습니다. - - + + public enum RequestType + { + //"GET", "POST", "PUT", "PATCH", "DELETE" + GET, + POST, + PUT, + PATCH, + DELETE, + + } + public class WebManager : MonoBehaviour { static WebManager webManager; @@ -115,6 +127,7 @@ namespace UVC.Networks request.SetRequestHeader("Authorization", "Bearer " + _webConfigLoader.Token); yield return request.SendWebRequest(); + Debug.Log(URL); Debug.Log(json); //result가 에러로 왔다면 @@ -217,58 +230,65 @@ namespace UVC.Networks } } //별도의 Data Content 가 없을 경우 reqeustURL 과 callback 등 만을 parameter로 넘기면 됨 - + //public void Reqeust_Get(string requestURL, Action callback, string json = "") + //{ + // RequestAsync(requestURL, RequestType.GET, json) + // .ContinueWith(result => callback?.Invoke(result)) + // .Forget(); + //} + //public void Reqeust_Post(string requestURL, Action callback, string json = "") + //{ + // RequestAsync(requestURL, RequestType.POST, json) + // .ContinueWith(result => callback?.Invoke(result)) + // .Forget(); + //} - public void Reqeust_Get(string requestURL, Action callback, string json = "") + //public void Reqeust_Put(string requestURL, Action callback, string json = "") + //{ + // RequestAsync(requestURL, RequestType.PUT, json) + // .ContinueWith(result => callback?.Invoke(result)) + // .Forget(); + //} + + //public void Reqeust_Patch(string requestURL, Action callback, string json = "") + //{ + // RequestAsync(requestURL, RequestType.PATCH, json) + // .ContinueWith(result => callback?.Invoke(result)) + // .Forget(); + //} + + //public void Reqeust_Delete(string requestURL, Action callback, string json = "") + //{ + // RequestAsync(requestURL, RequestType.DELETE, json) + // .ContinueWith(result => callback?.Invoke(result)) + // .Forget(); + //} + + //별도의 Data Content 가 없을 경우 reqeustURL 과 callback 등 만을 parameter로 넘기면 됨 + public void Reqeust(string requestURL, RequestType type , Action callback, object json = null) { - RequestAsync(requestURL, RequestType.GET, json) + if ( json == null) + { + RequestAsync(requestURL, type) .ContinueWith(result => callback?.Invoke(result)) .Forget(); - } + } + else if ( json != null) + { + var data = JsonConvert.SerializeObject(json); - public void Reqeust_Post(string requestURL, Action callback, string json = "") - { - RequestAsync(requestURL, RequestType.POST, json) + RequestAsync(requestURL, type, data) .ContinueWith(result => callback?.Invoke(result)) .Forget(); - } - - public void Reqeust_Put(string requestURL, Action callback, string json = "") - { - RequestAsync(requestURL, RequestType.PUT, json) - .ContinueWith(result => callback?.Invoke(result)) - .Forget(); - } - - public void Reqeust_Patch(string requestURL, Action callback, string json = "") - { - RequestAsync(requestURL, RequestType.PATCH, json) - .ContinueWith(result => callback?.Invoke(result)) - .Forget(); - } - - public void Reqeust_Delete(string requestURL, Action callback, string json = "") - { - RequestAsync(requestURL, RequestType.DELETE, json) - .ContinueWith(result => callback?.Invoke(result)) - .Forget(); - } - - - - public enum RequestType - { - //"GET", "POST", "PUT", "PATCH", "DELETE" - GET, - POST, - PUT, - PATCH, - DELETE, + } } - public async UniTask RequestAsync(string requestURL, RequestType type, string json = "") + + + + private async UniTask RequestAsync(string requestURL, RequestType type, string json = "") { string fullUrl = _webConfigLoader.BaseUrl + requestURL; @@ -285,9 +305,11 @@ namespace UVC.Networks if (IsSuccess(request.result)) { + Debug.Log(requestURL); + string responseJson = request.downloadHandler.text; - T result = JsonConvert.DeserializeObject(responseJson); - return result; + Base result = JsonConvert.DeserializeObject>(responseJson); + return result.data; } else { @@ -298,10 +320,9 @@ namespace UVC.Networks } + private bool IsSuccess(UnityWebRequest.Result result) { - return false; - switch(result) { case UnityWebRequest.Result.Success: diff --git a/Assets/WorkSpace/LWJ/SaveLoadmanager.cs b/Assets/WorkSpace/LWJ/SaveLoadmanager.cs index 9a733687..68523b45 100644 --- a/Assets/WorkSpace/LWJ/SaveLoadmanager.cs +++ b/Assets/WorkSpace/LWJ/SaveLoadmanager.cs @@ -135,29 +135,33 @@ namespace Octopus.Simulator.Networks modelClass.description = "new model"; modelClass.data.info = jsonObject; - string requestAPI = $"{WebManager.Instance.apiConfig.model}"; - Debug.Log(requestAPI); if (string.IsNullOrEmpty(WebParameters.config.modelId)) { - WebManager.Instance.Request_Post(modelClass, requestAPI, (flag, value) => - { - if (flag) - { - var webreturnClass = JsonConvert.DeserializeObject(value); - WebParameters.config.modelId = webreturnClass.data.insertedId.ToString(); - } - }); + var requestURL = $"{WebManager.Instance.apiConfig.model}"; + WebManager.Instance.Reqeust(requestURL, RequestType.POST, ModelCallback, modelClass); + + //WebManager.Instance.Request_Post(modelClass, requestURL, (flag, value) => + //{ + // if (flag) + // { + // var webreturnClass = JsonConvert.DeserializeObject(value); + // WebParameters.config.modelId = webreturnClass.data.insertedId.ToString(); + // } + //}); } else { - WebManager.Instance.Request_Put(modelClass, $"{requestAPI}/{WebParameters.config.modelId}", (flag, value) => - { - if (flag) - { - var webreturnClass = JsonConvert.DeserializeObject(value); - WebParameters.config.modelId = webreturnClass.data.insertedId.ToString(); - } - }); + var requestURL = $"{WebManager.Instance.apiConfig.model}/{WebParameters.config.modelId}"; + WebManager.Instance.Reqeust(requestURL, RequestType.PUT, ModelCallback, modelClass); + + //WebManager.Instance.Request_Put(modelClass, requestURL, (flag, value) => + //{ + // if (flag) + // { + // var webreturnClass = JsonConvert.DeserializeObject(value); + // WebParameters.config.modelId = webreturnClass.data.insertedId.ToString(); + // } + //}); } /* FileStream fileStream = new FileStream(string.Format("{0}.json", path), FileMode.Create); @@ -169,6 +173,11 @@ namespace Octopus.Simulator.Networks } + public void ModelCallback(WebModelReturnData response) + { + WebParameters.config.modelId = response.insertedId.ToString(); + } + public void Onclick_Load(string jsonData) { List loadInfos = new List(); @@ -197,7 +206,7 @@ namespace Octopus.Simulator.Networks DataManager.I.AddModel(spawnItem); - if (!string.IsNullOrEmpty(item.nodeID)) + if (!string.IsNullOrEmpty(item.nodeID) && !loadModels.ContainsKey(item.nodeID)) loadModels.Add(item.nodeID, spawnItem); }