| | 1 | | using System.Collections.Generic; |
| | 2 | | using DCL.Builder; |
| | 3 | |
|
| | 4 | | internal class ScenesRefreshHelper |
| | 5 | | { |
| 0 | 6 | | public Dictionary<string, ISceneCardView> oldDeployedScenes { get; private set; } |
| 0 | 7 | | public Dictionary<string, ISceneCardView> oldProjectsScenes { get; private set; } |
| 0 | 8 | | public bool isOldDeployedScenesEmpty { get; private set; } |
| 0 | 9 | | public bool isOldProjectScenesEmpty { get; private set; } |
| | 10 | |
|
| | 11 | | public void Set(Dictionary<string, ISceneCardView> oldDeployedScenes, |
| | 12 | | Dictionary<string, ISceneCardView> oldProjectsScenes) |
| | 13 | | { |
| 5 | 14 | | this.oldDeployedScenes = oldDeployedScenes; |
| 5 | 15 | | this.oldProjectsScenes = oldProjectsScenes; |
| | 16 | |
|
| 5 | 17 | | isOldDeployedScenesEmpty = oldDeployedScenes == null || oldDeployedScenes.Count == 0; |
| 5 | 18 | | isOldProjectScenesEmpty = oldProjectsScenes == null || oldProjectsScenes.Count == 0; |
| 5 | 19 | | } |
| | 20 | |
|
| | 21 | | public bool WasDeployedScene(ISceneData sceneData) |
| | 22 | | { |
| 18 | 23 | | if (isOldDeployedScenesEmpty) |
| 1 | 24 | | return false; |
| | 25 | |
|
| 17 | 26 | | return oldDeployedScenes.ContainsKey(sceneData.id); |
| | 27 | | } |
| | 28 | |
|
| | 29 | | public bool WasProjectScene(ISceneData sceneData) |
| | 30 | | { |
| 9 | 31 | | if (isOldProjectScenesEmpty) |
| 6 | 32 | | return false; |
| | 33 | |
|
| 3 | 34 | | return oldProjectsScenes.ContainsKey(sceneData.id); |
| | 35 | | } |
| | 36 | |
|
| 7 | 37 | | public bool IsSceneUpdate(ISceneData sceneData) { return WasDeployedScene(sceneData) || WasProjectScene(sceneData); |
| | 38 | |
|
| 9 | 39 | | public bool IsSceneDeployStatusChanged(ISceneData sceneData) { return (!sceneData.isDeployed && WasDeployedScene(sce |
| | 40 | |
|
| | 41 | | public Dictionary<string, ISceneCardView> GetOldDictionary(ISceneData sceneData) |
| | 42 | | { |
| 0 | 43 | | if (WasDeployedScene(sceneData)) |
| | 44 | | { |
| 0 | 45 | | return oldDeployedScenes; |
| | 46 | | } |
| 0 | 47 | | if (WasProjectScene(sceneData)) |
| | 48 | | { |
| 0 | 49 | | return oldProjectsScenes; |
| | 50 | | } |
| | 51 | |
|
| 0 | 52 | | return null; |
| | 53 | | } |
| | 54 | | } |