diff --git a/Assets/TRANS3_PluginHM/Scenes/HM_SceneStart.unity b/Assets/TRANS3_PluginHM/Scenes/HM_SceneStart.unity index 9ac68dacc632af7e950e0023b5f6a92509301256..2df10a23b4321617daa8f402672bf30fa2670cce 100644 --- a/Assets/TRANS3_PluginHM/Scenes/HM_SceneStart.unity +++ b/Assets/TRANS3_PluginHM/Scenes/HM_SceneStart.unity @@ -63095,6 +63095,9 @@ MonoBehaviour: onAppSettingEnd: m_PersistentCalls: m_Calls: [] + onSynchroEnd: + m_PersistentCalls: + m_Calls: [] childAvatars: - {fileID: 21300000, guid: d37b2a0103a7d3a4dbe5515de7901bb1, type: 3} - {fileID: 21300000, guid: 5b81b6917f2275344ae44b9c802fcfd6, type: 3} diff --git a/Assets/TRANS3_PluginHM/Scripts/Controllers/Contents/HM_ContentSynchroAWS.cs b/Assets/TRANS3_PluginHM/Scripts/Controllers/Contents/HM_ContentSynchroAWS.cs index c35aba02d7d6ea3621eb696b67597850894f302b..d10171bd9a293b0c59e7842b4d3a0291cb7952c3 100644 --- a/Assets/TRANS3_PluginHM/Scripts/Controllers/Contents/HM_ContentSynchroAWS.cs +++ b/Assets/TRANS3_PluginHM/Scripts/Controllers/Contents/HM_ContentSynchroAWS.cs @@ -37,6 +37,9 @@ public class HM_ContentSynchroAWS : HM_Content private long errorMaxValue = 0; private long errorCode = 0; private List<HM_SyncroAccountInfo> accountsInfo = new List<HM_SyncroAccountInfo>(); + private List<string> allAccounts = new List<string>(); + private List<string> successSynchroAccounts = new List<string>(); + private List<string> errorSynchroAccounts = new List<string>(); private List<string> deactivateToken = new List<string>(); @@ -93,6 +96,10 @@ public class HM_ContentSynchroAWS : HM_Content deactivateToken = new List<string>(); accountsInfo = new List<HM_SyncroAccountInfo>(); + allAccounts = new List<string>(); + successSynchroAccounts = new List<string>(); + errorSynchroAccounts = new List<string>(); + if (HM_PluginController.navContext == HM_PluginController.NAV_CONTEXT.NONE) { buttonReload.gameObject.SetActive(false); @@ -123,6 +130,8 @@ public class HM_ContentSynchroAWS : HM_Content foreach (HM_TeacherAccount t in HM_DataController.model.teacherAccounts) { + allAccounts.Add(t.teacherCode); + if (t.dataAWS._idToken != null && t.dataAWS._idToken.Length > 0) { nbrSynchro++; @@ -200,6 +209,8 @@ public class HM_ContentSynchroAWS : HM_Content if (result == 0) { + successSynchroAccounts.Add(info); + nbrSynchro--; HM_SyncroAccountInfo account = new HM_SyncroAccountInfo(); @@ -210,9 +221,12 @@ public class HM_ContentSynchroAWS : HM_Content accountsInfo.Add(account); HM_Scripts.optionPanel.UpdateData(); + } else { + errorSynchroAccounts.Add(info); + hasError = true; if (result > errorMaxValue) { @@ -247,8 +261,11 @@ public class HM_ContentSynchroAWS : HM_Content } } + //fin des synchronisations if (nbrSynchro == 0) { + pluginController.onSynchroEnd?.Invoke(allAccounts, successSynchroAccounts, errorSynchroAccounts); + if (hasError) { if (errorMaxValue == 2) diff --git a/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_NetworkController.cs b/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_NetworkController.cs index 02a15142879626cc45ec81780e74ea7180404a90..99c1a3c0407af8ab4861280e69364e90f64a6ff5 100644 --- a/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_NetworkController.cs +++ b/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_NetworkController.cs @@ -1035,7 +1035,7 @@ public class HM_NetworkController : MonoBehaviour }) .ConfigureAwait(false); - Debug.Log("User token successfully updated!"); + //Debug.Log("User token successfully updated!"); t.dataAWS._refreshToken = authFlowResponse.AuthenticationResult.RefreshToken; t.dataAWS._accessToken = authFlowResponse.AuthenticationResult.AccessToken; @@ -1079,11 +1079,7 @@ public class HM_NetworkController : MonoBehaviour public int OnDataSynchro(string data) { - Debug.Log(data); - // tentative d'uploader les archives ici . - - - + //Debug.Log(data); //les données contiennent un jeu de donnée retour HM_Log.ReplaceTextFile("HM_SyncDown1.txt", data, true); diff --git a/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_PluginController.cs b/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_PluginController.cs index e77ef0b565c1f4a72a89b63d4b7cdecf1983efbf..24355da914ba17083e302bf0ab8699269846dbcd 100644 --- a/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_PluginController.cs +++ b/Assets/TRANS3_PluginHM/Scripts/Controllers/HM_PluginController.cs @@ -47,6 +47,7 @@ public class HM_PluginController : MonoBehaviour public UnityEvent callbackSecondChildLogin; public UnityEvent onAppSettingCancel; public UnityEvent onAppSettingEnd; + public UnityEvent<List<string>, List<string>, List<string>> onSynchroEnd; public List<Sprite> childAvatars = new List<Sprite>(); @@ -401,11 +402,11 @@ public class HM_PluginController : MonoBehaviour void Start() { if (HM_NetworkController.currentENV == HM_NetworkController.ENV.DEVELOP) - GameObject.Find("HM_TextVersion").GetComponent<TextMeshProUGUI>().text = "v1.6.4 - DEVELOP"; + GameObject.Find("HM_TextVersion").GetComponent<TextMeshProUGUI>().text = "v1.6.5 - DEVELOP"; else if (HM_NetworkController.currentENV == HM_NetworkController.ENV.PREPROD) - GameObject.Find("HM_TextVersion").GetComponent<TextMeshProUGUI>().text = "v1.6.4 - PREPROD"; + GameObject.Find("HM_TextVersion").GetComponent<TextMeshProUGUI>().text = "v1.6.5 - PREPROD"; else - GameObject.Find("HM_TextVersion").GetComponent<TextMeshProUGUI>().text = "v1.6.4 - PROD"; + GameObject.Find("HM_TextVersion").GetComponent<TextMeshProUGUI>().text = "v1.6.5 - PROD"; HM_Scripts.optionPanel.HideButton(true); @@ -1149,6 +1150,28 @@ public class HM_PluginController : MonoBehaviour return teacherCodes; } + public static List<HM_ChildUser> GetAllActiveChildsOfTeacher(string teacherCode) + { + List<HM_ChildUser> activeChildAccount = new List<HM_ChildUser>(); + + foreach (HM_TeacherAccount t in HM_DataController.model.teacherAccounts) + { + if(t.teacherCode.ToUpper().Equals(teacherCode.ToUpper())) + { + foreach (HM_ChildUser c in t.childUsers) + { + if (c.activeUser) + { + activeChildAccount.Add(c); + } + } + return activeChildAccount; + } + } + + return null; + } + public void TestSecondUserLoginSuccess() { Debug.Log("TestSecondUserLoginSuccess"); @@ -1166,13 +1189,13 @@ public class HM_PluginController : MonoBehaviour Debug.Log(GetSettingsSession()); } - public static void CheckTraceExist(string fileURL, System.Action<int,string> callback) + public static void CheckTraceExist(string fileURL, System.Action<int,string> callback, int userIconId = -1, int userLoginCode = -1) { HM_Scripts.pluginController.StartPlugin(); HM_ReturnInfo returnInfo = new HM_ReturnInfo(); - if (HM_DataController.currentChildUser == null) + if (userIconId == -1 && userLoginCode == -1 && HM_DataController.currentChildUser == null) { returnInfo.code = -1; returnInfo.message = "Le plugin HM ne retrouve pas l'enfant actuellement connecté"; @@ -1199,6 +1222,14 @@ public class HM_PluginController : MonoBehaviour return; } + if ((userIconId == -1 && userLoginCode != -1) || (userIconId != -1 && userLoginCode == -1)) + { + returnInfo.code = -4; + returnInfo.message = "Une des deux données userIconId ou userLoginCode n'est pas renseigné"; + HM_Scripts.pluginController.StartCoroutine(OnCheckTraceExistResponse(returnInfo, callback)); + return; + } + fileURL = fileURL.Replace('\\', '/'); //construction URL @@ -1222,7 +1253,17 @@ public class HM_PluginController : MonoBehaviour appName = "evalulu"; break; } - string serverPath = "private/" + HM_DataController.currentTeacherAccount.dataAWS.identityId + "/traces/" + appName + "/" + HM_DataController.currentChildUser.userIconID + "/" + HM_DataController.currentChildUser.loginCode + "/" + filename; + + string serverPath = "private/" + HM_DataController.currentTeacherAccount.dataAWS.identityId + "/traces/" + appName + "/"; + + if (userIconId != -1 && userLoginCode != -1) + { + serverPath += userIconId + "/" + userLoginCode + "/" + filename; + } + else + { + serverPath += HM_DataController.currentChildUser.userIconID + "/" + HM_DataController.currentChildUser.loginCode + "/" + filename; + } Task.Run(async () => { @@ -1256,13 +1297,13 @@ public class HM_PluginController : MonoBehaviour yield return null; } - public static void UploadTrace(string fileURL, System.Action<int, string> callback) + public static void UploadTrace(string fileURL, System.Action<int, string> callback, int userIconId = -1, int userLoginCode = -1) { HM_Scripts.pluginController.StartPlugin(); HM_ReturnInfo returnInfo = new HM_ReturnInfo(); - if (HM_DataController.currentChildUser == null) + if (userIconId == -1 && userLoginCode == -1 && HM_DataController.currentChildUser == null) { returnInfo.code = -1; returnInfo.message = "Le plugin HM ne retrouve pas l'enfant actuellement connecté"; @@ -1289,6 +1330,14 @@ public class HM_PluginController : MonoBehaviour return; } + if ((userIconId == -1 && userLoginCode != -1) || (userIconId != -1 && userLoginCode == -1)) + { + returnInfo.code = -4; + returnInfo.message = "Une des deux données userIconId ou userLoginCode n'est pas renseigné"; + HM_Scripts.pluginController.StartCoroutine(OnUploadTraceResponse(returnInfo, callback)); + return; + } + fileURL = fileURL.Replace('\\', '/'); //construction URL @@ -1312,7 +1361,17 @@ public class HM_PluginController : MonoBehaviour appName = "evalulu"; break; } - string serverPath = "private/" + HM_DataController.currentTeacherAccount.dataAWS.identityId + "/traces/" + appName + "/"+ HM_DataController.currentChildUser.userIconID + "/" + HM_DataController.currentChildUser.loginCode + "/" + filename; + + string serverPath = "private/" + HM_DataController.currentTeacherAccount.dataAWS.identityId + "/traces/" + appName + "/"; + + if (userIconId != -1 && userLoginCode != -1) + { + serverPath += userIconId + "/" + userLoginCode + "/" + filename; + } + else + { + serverPath += HM_DataController.currentChildUser.userIconID + "/" + HM_DataController.currentChildUser.loginCode + "/" + filename; + } Task.Run(async () => { diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 309f3b4c4cba65c5513c1599b9aa5220a7485767..4c76ee2445507a241065218aaf56c70ac2c8ed4c 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -10,10 +10,10 @@ EditorBuildSettings: guid: 15e43849568c0614685a812adbb53ecd - enabled: 1 path: Assets/TRANS3_PluginHM/Scenes/HM_SceneStart.unity - guid: 3fed5cef0df1bab4495923b9e1b24dcd + guid: 2cda990e2423bbf4892e6590ba056729 - enabled: 1 path: Assets/Scenes/MainScene.unity - guid: 2cda990e2423bbf4892e6590ba056729 + guid: af50cb8e93ed4675807e50f4641fc9b9 - enabled: 1 path: Assets/Scenes/FinScreen.unity guid: 1e69761888eb64842a76c10483e2cf60 diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 91d568e77d855ffa2c6c122e4bb84a81753e4f0b..28713ce9afc5081263d4e6278e94a67d4ef11394 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -24,10 +24,10 @@ EditorUserSettings: value: 5057510250560c5d5d0a0a7312225d44424e4d737e7b246928781f61b6e4373c flags: 0 RecentlyUsedSceneGuid-6: - value: 025701560657515e545d0926447508454e474f2f797820647b7d4c35e1b93661 + value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661 flags: 0 RecentlyUsedSceneGuid-7: - value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661 + value: 025701560657515e545d0926447508454e474f2f797820647b7d4c35e1b93661 flags: 0 RecentlyUsedSceneGuid-8: value: 52045152560d5d025858542140750e44404f4d2b74797431292b1f66b1e5373c diff --git a/UserSettings/Layouts/default-2022.dwlt b/UserSettings/Layouts/default-2022.dwlt index d30dc69429c6629c7154735e76f9414c4f9731b3..b041fe04185a2e99fe92372f9678b10c66b185ab 100644 --- a/UserSettings/Layouts/default-2022.dwlt +++ b/UserSettings/Layouts/default-2022.dwlt @@ -19,7 +19,7 @@ MonoBehaviour: width: 1536 height: 772.8 m_ShowMode: 4 - m_Title: Project + m_Title: Game m_RootView: {fileID: 2} m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} @@ -119,7 +119,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 100} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 109 + controlID: 17 --- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 @@ -139,12 +139,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1236 + width: 1114.4 height: 722.8 m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 64 + controlID: 18 --- !u!114 &7 MonoBehaviour: m_ObjectHideFlags: 52 @@ -164,12 +164,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1236 - height: 337.6 + width: 1114.4 + height: 492.8 m_MinSize: {x: 200, y: 50} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 40 + controlID: 19 --- !u!114 &8 MonoBehaviour: m_ObjectHideFlags: 52 @@ -187,10 +187,10 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 412.8 - height: 337.6 - m_MinSize: {x: 201, y: 221} - m_MaxSize: {x: 4001, y: 4021} + width: 373.6 + height: 492.8 + m_MinSize: {x: 200, y: 200} + m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 13} m_Panes: - {fileID: 13} @@ -211,10 +211,10 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 412.8 + x: 373.6 y: 0 - width: 823.2 - height: 337.6 + width: 740.80005 + height: 492.8 m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 12} @@ -239,9 +239,9 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 337.6 - width: 1236 - height: 385.19998 + y: 492.8 + width: 1114.4 + height: 230 m_MinSize: {x: 231, y: 271} m_MaxSize: {x: 10001, y: 10021} m_ActualView: {fileID: 15} @@ -265,9 +265,9 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 1236 + x: 1114.4 y: 0 - width: 300 + width: 421.59998 height: 722.8 m_MinSize: {x: 275, y: 50} m_MaxSize: {x: 4000, y: 4000} @@ -296,10 +296,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 412.80002 + x: 373.6 y: 73.6 - width: 821.2 - height: 316.6 + width: 738.80005 + height: 471.8 m_SerializedDataModeController: m_DataMode: 0 m_PreferredDataMode: 0 @@ -316,7 +316,7 @@ MonoBehaviour: m_ShowGizmos: 0 m_TargetDisplay: 0 m_ClearColor: {r: 0, g: 0, b: 0, a: 0} - m_TargetSize: {x: 1026.5, y: 369.5} + m_TargetSize: {x: 923.50006, y: 563.5} m_TextureFilterMode: 0 m_TextureHideFlags: 61 m_RenderIMGUI: 1 @@ -331,10 +331,10 @@ MonoBehaviour: m_VRangeLocked: 0 hZoomLockedByDefault: 0 vZoomLockedByDefault: 0 - m_HBaseRangeMin: -410.6 - m_HBaseRangeMax: 410.6 - m_VBaseRangeMin: -147.8 - m_VBaseRangeMax: 147.8 + m_HBaseRangeMin: -369.40002 + m_HBaseRangeMax: 369.40002 + m_VBaseRangeMin: -225.40001 + m_VBaseRangeMax: 225.40001 m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMax: 1 m_VAllowExceedBaseRangeMin: 1 @@ -352,23 +352,23 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 21 - width: 821.2 - height: 295.6 - m_Scale: {x: 1, y: 1} - m_Translation: {x: 410.6, y: 147.8} + width: 738.80005 + height: 450.8 + m_Scale: {x: 0.99999994, y: 0.99999994} + m_Translation: {x: 369.40002, y: 225.4} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -410.6 - y: -147.8 - width: 821.2 - height: 295.6 + x: -369.40005 + y: -225.40001 + width: 738.8001 + height: 450.80002 m_MinimalGUI: 1 - m_defaultScale: 1 - m_LastWindowPixelSize: {x: 1026.5, y: 395.75} + m_defaultScale: 0.99999994 + m_LastWindowPixelSize: {x: 923.50006, y: 589.75} m_ClearInEditMode: 1 m_NoCameraWarning: 1 m_LowResolutionForAspectRatios: 01000000000000000000 @@ -396,8 +396,8 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 73.6 - width: 411.8 - height: 316.6 + width: 372.6 + height: 471.8 m_SerializedDataModeController: m_DataMode: 0 m_PreferredDataMode: 0 @@ -411,9 +411,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: b80f0100 + m_SelectedIDs: 509b0000 m_LastClickedID: 0 - m_ExpandedIDs: 02edffff40f4ffff7ef8ffff16fbffff88870000b8c30000 + m_ExpandedIDs: 6c83ffff36a3ffff64a6ffff2ec6ffff02ccffff5eecffff86f0ffff16fbffffec6200005ac30000f4f10000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -906,9 +906,9 @@ MonoBehaviour: m_Pos: serializedVersion: 2 x: 0 - y: 411.2 - width: 1235 - height: 364.19998 + y: 566.4 + width: 1113.4 + height: 209 m_SerializedDataModeController: m_DataMode: 0 m_PreferredDataMode: 0 @@ -920,7 +920,7 @@ MonoBehaviour: m_SaveData: [] m_OverlaysVisible: 1 m_SearchFilter: - m_NameFilter: m6a2 + m_NameFilter: m_ClassNames: [] m_AssetLabels: [] m_AssetBundleNames: [] @@ -930,24 +930,24 @@ MonoBehaviour: m_SkipHidden: 0 m_SearchArea: 1 m_Folders: - - Assets + - Assets/Scenes m_Globs: [] - m_OriginalText: m6a2 + m_OriginalText: m_ImportLogFlags: 0 m_FilterByTypeIntersection: 0 m_ViewMode: 1 m_StartGridSize: 64 m_LastFolders: - - Assets + - Assets/Scenes m_LastFoldersGridSize: -1 m_LastProjectPath: C:\Users\guill\OneDrive\Bureau\LUCIOLE\EVALULULU_DEC2023_2\lulu-testing m_LockTracker: m_IsLocked: 0 m_FolderTreeState: - scrollPos: {x: 0, y: 0} - m_SelectedIDs: 1c7c0000 - m_LastClickedID: 31772 - m_ExpandedIDs: 000000001c7c00004e7c000000ca9a3bffffff7f + scrollPos: {x: 0, y: 60} + m_SelectedIDs: 307c0000 + m_LastClickedID: 31792 + m_ExpandedIDs: 000000001e7c0000207c0000347c000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -975,7 +975,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 000000001c7c00001e7c0000207c0000227c0000 + m_ExpandedIDs: 000000001e7c0000207c0000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -1002,7 +1002,7 @@ MonoBehaviour: m_ListAreaState: m_SelectedInstanceIDs: m_LastClickedInstanceID: 0 - m_HadKeyboardFocusLastEvent: 0 + m_HadKeyboardFocusLastEvent: 1 m_ExpandedInstanceIDs: c6230000 m_RenameOverlay: m_UserAcceptedRename: 0 @@ -1052,9 +1052,9 @@ MonoBehaviour: m_Pos: serializedVersion: 2 x: 0 - y: 569.60004 - width: 1235 - height: 205.79999 + y: 566.4 + width: 1113.4 + height: 209 m_SerializedDataModeController: m_DataMode: 0 m_PreferredDataMode: 0 @@ -1085,9 +1085,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1236 + x: 1114.4 y: 73.6 - width: 299 + width: 420.59998 height: 701.8 m_SerializedDataModeController: m_DataMode: 0