Commit 2f0622dd76eb5c89a0ca36e03886c2ed243c8c13
1 parent
80a71388
Exists in
master
and in
3 other branches
Finish refactoring
Showing
8 changed files
with
147 additions
and
52 deletions
Show diff stats
Assets/Scenes/Main.unity
@@ -515,7 +515,7 @@ GameObject: | @@ -515,7 +515,7 @@ GameObject: | ||
515 | m_Icon: {fileID: 0} | 515 | m_Icon: {fileID: 0} |
516 | m_NavMeshLayer: 0 | 516 | m_NavMeshLayer: 0 |
517 | m_StaticEditorFlags: 0 | 517 | m_StaticEditorFlags: 0 |
518 | - m_IsActive: 0 | 518 | + m_IsActive: 1 |
519 | --- !u!224 &126648712 | 519 | --- !u!224 &126648712 |
520 | RectTransform: | 520 | RectTransform: |
521 | m_ObjectHideFlags: 0 | 521 | m_ObjectHideFlags: 0 |
@@ -574,12 +574,12 @@ MonoBehaviour: | @@ -574,12 +574,12 @@ MonoBehaviour: | ||
574 | m_OnClick: | 574 | m_OnClick: |
575 | m_PersistentCalls: | 575 | m_PersistentCalls: |
576 | m_Calls: | 576 | m_Calls: |
577 | - - m_Target: {fileID: 0} | ||
578 | - m_MethodName: | 577 | + - m_Target: {fileID: 210788816} |
578 | + m_MethodName: OnCancel | ||
579 | m_Mode: 1 | 579 | m_Mode: 1 |
580 | m_Arguments: | 580 | m_Arguments: |
581 | m_ObjectArgument: {fileID: 0} | 581 | m_ObjectArgument: {fileID: 0} |
582 | - m_ObjectArgumentAssemblyTypeName: | 582 | + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine |
583 | m_IntArgument: 0 | 583 | m_IntArgument: 0 |
584 | m_FloatArgument: 0 | 584 | m_FloatArgument: 0 |
585 | m_StringArgument: | 585 | m_StringArgument: |
@@ -8431,7 +8431,7 @@ MonoBehaviour: | @@ -8431,7 +8431,7 @@ MonoBehaviour: | ||
8431 | m_PersistentCalls: | 8431 | m_PersistentCalls: |
8432 | m_Calls: | 8432 | m_Calls: |
8433 | - m_Target: {fileID: 210788816} | 8433 | - m_Target: {fileID: 210788816} |
8434 | - m_MethodName: OnDownloadCancel | 8434 | + m_MethodName: OnCancel |
8435 | m_Mode: 1 | 8435 | m_Mode: 1 |
8436 | m_Arguments: | 8436 | m_Arguments: |
8437 | m_ObjectArgument: {fileID: 0} | 8437 | m_ObjectArgument: {fileID: 0} |
Assets/Scripts/Export Video/AndroidJavaUti.cs
1 | -using UnityEngine; | 1 | +/********************** |
2 | +********LAVID********** | ||
3 | +***VLibras Project***** | ||
4 | +*------------------------------------------------------------------------ | ||
5 | +*Description: | ||
6 | +*This class is an Android Plugin that gets the current sd card path from | ||
7 | +* Android Device, making available the access to files folder. | ||
8 | +*--------------------------------------------------------------------------- | ||
9 | +*Plugin directory: | ||
10 | +* - Assets/Plugins/Android | ||
11 | +*References: | ||
12 | +* - http://docs.unity3d.com/ScriptReference/AndroidJavaClass.html | ||
13 | +*------------------------------------------------------------------------ | ||
14 | +*Author: Thiago Filipe | ||
15 | +*thiago.filipe@lavid.ufpb.br | ||
16 | +***********************/ | ||
17 | + | ||
18 | +using UnityEngine; | ||
2 | using System.Collections; | 19 | using System.Collections; |
3 | using System; | 20 | using System; |
4 | 21 | ||
@@ -26,8 +43,6 @@ public class AndroidJavaUti{ | @@ -26,8 +43,6 @@ public class AndroidJavaUti{ | ||
26 | return m_pkgName; | 43 | return m_pkgName; |
27 | } | 44 | } |
28 | } | 45 | } |
29 | - | ||
30 | - | ||
31 | public static string CurrentSDCardPath | 46 | public static string CurrentSDCardPath |
32 | { | 47 | { |
33 | get | 48 | get |
Assets/Scripts/Export Video/AndroidToast.cs
1 | -using UnityEngine; | 1 | +/********************** |
2 | +********LAVID********** | ||
3 | +***VLibras Project***** | ||
4 | +*------------------------------------------------------------------------ | ||
5 | +*Description: | ||
6 | +*This class is a Android Plugin that allows the creation of Toast | ||
7 | +* notifications. | ||
8 | +*--------------------------------------------------------------------------- | ||
9 | +*Plugin directory: | ||
10 | +* - Assets/Plugins/Android | ||
11 | +*References: | ||
12 | +* - http://docs.unity3d.com/ScriptReference/AndroidJavaClass.html | ||
13 | +*------------------------------------------------------------------------ | ||
14 | +*Author: Thiago Filipe | ||
15 | +*thiago.filipe@lavid.ufpb.br | ||
16 | +***********************/ | ||
17 | + | ||
18 | +using UnityEngine; | ||
2 | using System.Collections; | 19 | using System.Collections; |
3 | 20 | ||
4 | public class AndroidToast : MonoBehaviour | 21 | public class AndroidToast : MonoBehaviour |
@@ -7,7 +24,6 @@ public class AndroidToast : MonoBehaviour | @@ -7,7 +24,6 @@ public class AndroidToast : MonoBehaviour | ||
7 | AndroidJavaClass UnityPlayer; | 24 | AndroidJavaClass UnityPlayer; |
8 | AndroidJavaObject context; | 25 | AndroidJavaObject context; |
9 | 26 | ||
10 | - | ||
11 | public void showToast(string toastString){ | 27 | public void showToast(string toastString){ |
12 | if (Application.platform == RuntimePlatform.Android) | 28 | if (Application.platform == RuntimePlatform.Android) |
13 | { | 29 | { |
@@ -17,7 +33,7 @@ public class AndroidToast : MonoBehaviour | @@ -17,7 +33,7 @@ public class AndroidToast : MonoBehaviour | ||
17 | 33 | ||
18 | AndroidJavaClass Toast = new AndroidJavaClass("android.widget.Toast"); | 34 | AndroidJavaClass Toast = new AndroidJavaClass("android.widget.Toast"); |
19 | AndroidJavaObject javaString = new AndroidJavaObject("java.lang.String", toastString); | 35 | AndroidJavaObject javaString = new AndroidJavaObject("java.lang.String", toastString); |
20 | - AndroidJavaObject toast = Toast.CallStatic<AndroidJavaObject>("makeText", context, javaString, Toast.GetStatic<int>("LENGTH_SHORT")); | 36 | + AndroidJavaObject toast = Toast.CallStatic<AndroidJavaObject>("makeText", context, javaString, Toast.GetStatic<int>("LENGTH_LONG")); //Toast Duration Time |
21 | toast.Call("show"); | 37 | toast.Call("show"); |
22 | } | 38 | } |
23 | } | 39 | } |
Assets/Scripts/Export Video/ExportLayers.cs
@@ -13,4 +13,12 @@ public class ExportLayers{ | @@ -13,4 +13,12 @@ public class ExportLayers{ | ||
13 | OnLockExport, | 13 | OnLockExport, |
14 | All | 14 | All |
15 | } | 15 | } |
16 | + | ||
17 | + public enum ConnectionStatusError | ||
18 | + { | ||
19 | + INTERNET_CONNECTION_FAILURE, | ||
20 | + DOWNLOAD_CONNECTION_FAILURE, | ||
21 | + CONNECTION_TIMEOUT_FAILURE, | ||
22 | + ERROR_CONNECTION_FAILURE | ||
23 | + } | ||
16 | } | 24 | } |
Assets/Scripts/Export Video/ExportVideo.cs
@@ -32,22 +32,34 @@ public class ExportVideo : MonoBehaviour { | @@ -32,22 +32,34 @@ public class ExportVideo : MonoBehaviour { | ||
32 | public ScreenManager screenManager; | 32 | public ScreenManager screenManager; |
33 | private MobileNativeDialog nativeDialog; | 33 | private MobileNativeDialog nativeDialog; |
34 | 34 | ||
35 | - public static string gloss = "Gloss"; | 35 | + private static string gloss = "Gloss"; |
36 | private string currentGloss = "CurrentGloss"; | 36 | private string currentGloss = "CurrentGloss"; |
37 | private string currentTime = ""; | 37 | private string currentTime = ""; |
38 | private const string SERVER_URL = "http://150.165.205.38/video/"; | 38 | private const string SERVER_URL = "http://150.165.205.38/video/"; |
39 | 39 | ||
40 | + /* Strings related to the Android Dialog*/ | ||
40 | private string title = "Download"; | 41 | private string title = "Download"; |
41 | private string message = "Para compartilhar é preciso realizar o download do vídeo. Tamanho do Download: "; | 42 | private string message = "Para compartilhar é preciso realizar o download do vídeo. Tamanho do Download: "; |
42 | private string yesOp = "DOWNLOAD"; | 43 | private string yesOp = "DOWNLOAD"; |
43 | private string noOp = "CANCELAR"; | 44 | private string noOp = "CANCELAR"; |
45 | + | ||
46 | + | ||
44 | private float videoSize = 0; | 47 | private float videoSize = 0; |
45 | - private string videoId = ""; | ||
46 | - private bool CancelDownload = false; | 48 | + private string videoId = ""; |
47 | private byte[] videoContent = null; | 49 | private byte[] videoContent = null; |
48 | - | ||
49 | 50 | ||
50 | 51 | ||
52 | + private bool videoRequestRunning = false; | ||
53 | + private bool videoDownloadRunning = false; | ||
54 | + | ||
55 | + | ||
56 | + /*Getting called by PlayerManager, setting the gloss property*/ | ||
57 | + | ||
58 | + public static void SetGloss(string _gloss) | ||
59 | + { | ||
60 | + PlayerLogger.Log("ExportVideo", "SetGloss", "Setting current gloss to gloss property from ExportVideo"); | ||
61 | + gloss = _gloss; | ||
62 | + } | ||
51 | 63 | ||
52 | /* Function that hides the export button and | 64 | /* Function that hides the export button and |
53 | * shows the progress bar while getting video info*/ | 65 | * shows the progress bar while getting video info*/ |
@@ -61,7 +73,7 @@ public class ExportVideo : MonoBehaviour { | @@ -61,7 +73,7 @@ public class ExportVideo : MonoBehaviour { | ||
61 | StartCoroutine("requestVideoInfo"); | 73 | StartCoroutine("requestVideoInfo"); |
62 | Debug.Log("Hiding export button and showing progress loading"); | 74 | Debug.Log("Hiding export button and showing progress loading"); |
63 | 75 | ||
64 | - } | 76 | + } |
65 | 77 | ||
66 | /* Function that gets called by the web request | 78 | /* Function that gets called by the web request |
67 | * hiding the progress bar and showing the download | 79 | * hiding the progress bar and showing the download |
@@ -116,16 +128,30 @@ public class ExportVideo : MonoBehaviour { | @@ -116,16 +128,30 @@ public class ExportVideo : MonoBehaviour { | ||
116 | screenManager.changeExportStates(ExportLayers.ExportLayer.Share_Layer, true); | 128 | screenManager.changeExportStates(ExportLayers.ExportLayer.Share_Layer, true); |
117 | } | 129 | } |
118 | 130 | ||
119 | - public void OnDownloadCancel() | ||
120 | - { | ||
121 | - Debug.Log("User canceled the download, resetting states to default"); | ||
122 | - CancelDownload = true; | ||
123 | - screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | ||
124 | - videoContent = null; | 131 | + /*Cancels the VideoRequest or VideoDownload by interrupting the coroutine and resetting values*/ |
125 | 132 | ||
133 | + public void OnCancel() | ||
134 | + { | ||
135 | + if (videoRequestRunning) | ||
136 | + { | ||
137 | + StopCoroutine("requestVideoInfo"); | ||
138 | + PlayerLogger.Log("ExportVideo", "OnRequestCancel", "User canceled the request, resetting states to default."); | ||
139 | + | ||
140 | + }else if (videoDownloadRunning) | ||
141 | + { | ||
142 | + StopCoroutine("videoDownload"); | ||
143 | + PlayerLogger.Log("ExportVideo", "videoDownload", "User canceled the download, resetting states to default."); | ||
144 | + } | ||
126 | 145 | ||
146 | + videoId = ""; | ||
147 | + videoSize = 0; | ||
148 | + videoContent = null; | ||
149 | + screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | ||
127 | } | 150 | } |
128 | 151 | ||
152 | + /*With sharing layer active, gets called when the user clicks on it and makes | ||
153 | + * the video available to share*/ | ||
154 | + | ||
129 | public void OnShareVideo() | 155 | public void OnShareVideo() |
130 | { | 156 | { |
131 | Debug.Log("Sharing video content"); | 157 | Debug.Log("Sharing video content"); |
@@ -136,6 +162,7 @@ public class ExportVideo : MonoBehaviour { | @@ -136,6 +162,7 @@ public class ExportVideo : MonoBehaviour { | ||
136 | else | 162 | else |
137 | { | 163 | { |
138 | new AndroidToast().showToast("Erro ao compartilhar vídeo"); | 164 | new AndroidToast().showToast("Erro ao compartilhar vídeo"); |
165 | + screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | ||
139 | } | 166 | } |
140 | 167 | ||
141 | }else | 168 | }else |
@@ -147,6 +174,7 @@ public class ExportVideo : MonoBehaviour { | @@ -147,6 +174,7 @@ public class ExportVideo : MonoBehaviour { | ||
147 | new MediaShareAndroid().ShareActivity(videoContent, currentTime); | 174 | new MediaShareAndroid().ShareActivity(videoContent, currentTime); |
148 | else | 175 | else |
149 | { | 176 | { |
177 | + screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | ||
150 | new AndroidToast().showToast("Erro ao compartilhar vídeo"); | 178 | new AndroidToast().showToast("Erro ao compartilhar vídeo"); |
151 | } | 179 | } |
152 | 180 | ||
@@ -154,85 +182,87 @@ public class ExportVideo : MonoBehaviour { | @@ -154,85 +182,87 @@ public class ExportVideo : MonoBehaviour { | ||
154 | 182 | ||
155 | } | 183 | } |
156 | 184 | ||
185 | + /*Coroutine that downloads the video and update the progress download layer*/ | ||
157 | 186 | ||
158 | private IEnumerator videoDownload() | 187 | private IEnumerator videoDownload() |
159 | { | 188 | { |
189 | + videoDownloadRunning = true; | ||
160 | WWW DownloadVideo = new WWW(SERVER_URL + videoId); | 190 | WWW DownloadVideo = new WWW(SERVER_URL + videoId); |
161 | - while (!CancelDownload && !DownloadVideo.isDone) | 191 | + while (!DownloadVideo.isDone) |
162 | { | 192 | { |
163 | screenManager.updateProgressDownloadSprite(DownloadVideo.progress); | 193 | screenManager.updateProgressDownloadSprite(DownloadVideo.progress); |
164 | yield return null; | 194 | yield return null; |
165 | } | 195 | } |
166 | 196 | ||
167 | - if (!CancelDownload) | 197 | + try |
168 | { | 198 | { |
169 | if (DownloadVideo.bytesDownloaded > 0 && DownloadVideo.bytesDownloaded <= videoSize) | 199 | if (DownloadVideo.bytesDownloaded > 0 && DownloadVideo.bytesDownloaded <= videoSize) |
170 | { | 200 | { |
171 | videoContent = DownloadVideo.bytes; | 201 | videoContent = DownloadVideo.bytes; |
172 | - | ||
173 | OnDownloadFinished(); | 202 | OnDownloadFinished(); |
174 | - }else | 203 | + } |
204 | + else | ||
175 | { | 205 | { |
176 | - new AndroidToast().showToast("Erro ao efetuar download. Tente novamente"); | ||
177 | - screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | 206 | + GetConnectionStatusError(ExportLayers.ConnectionStatusError.DOWNLOAD_CONNECTION_FAILURE); |
178 | } | 207 | } |
179 | - }else | 208 | + |
209 | + | ||
210 | + } | ||
211 | + finally | ||
180 | { | 212 | { |
181 | - CancelDownload = false; | ||
182 | - yield break; | 213 | + videoDownloadRunning = false; |
183 | } | 214 | } |
184 | } | 215 | } |
185 | 216 | ||
217 | + /*Coroutine that makes the video information request*/ | ||
218 | + | ||
186 | private IEnumerator requestVideoInfo() | 219 | private IEnumerator requestVideoInfo() |
187 | { | 220 | { |
188 | - | 221 | + videoRequestRunning = true; |
189 | WWWForm JsonRequest = new WWWForm(); | 222 | WWWForm JsonRequest = new WWWForm(); |
190 | JsonRequest.AddField("gloss", gloss); | 223 | JsonRequest.AddField("gloss", gloss); |
191 | WWW videoInfoRequest = new WWW(SERVER_URL,JsonRequest); | 224 | WWW videoInfoRequest = new WWW(SERVER_URL,JsonRequest); |
192 | - | ||
193 | - | ||
194 | - | ||
195 | 225 | ||
196 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "Request for: " + SERVER_URL); | 226 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "Request for: " + SERVER_URL); |
197 | 227 | ||
198 | yield return WaitForResponse(videoInfoRequest); | 228 | yield return WaitForResponse(videoInfoRequest); |
199 | 229 | ||
200 | - | ||
201 | - | ||
202 | try | 230 | try |
203 | { | 231 | { |
204 | if (!videoInfoRequest.isDone) | 232 | if (!videoInfoRequest.isDone) |
205 | { | 233 | { |
206 | 234 | ||
207 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | 235 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); |
208 | - new AndroidToast().showToast("Erro de conexão, tenta novamente."); | 236 | + GetConnectionStatusError(ExportLayers.ConnectionStatusError.CONNECTION_TIMEOUT_FAILURE); |
209 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "TimeOut"); | 237 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "TimeOut"); |
210 | } | 238 | } |
211 | else if (videoInfoRequest.error != null) | 239 | else if (videoInfoRequest.error != null) |
212 | { | 240 | { |
213 | 241 | ||
214 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | 242 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); |
215 | - new AndroidToast().showToast("Erro de conexão, tenta novamente."); | 243 | + GetConnectionStatusError(ExportLayers.ConnectionStatusError.INTERNET_CONNECTION_FAILURE); |
216 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "(WWW) Error: " + videoInfoRequest.error); | 244 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "(WWW) Error: " + videoInfoRequest.error); |
217 | } | 245 | } |
218 | else if (videoInfoRequest.responseHeaders.Count == 0) | 246 | else if (videoInfoRequest.responseHeaders.Count == 0) |
219 | { | 247 | { |
220 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "(WWW) Unsucessful Answer"); | 248 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "(WWW) Unsucessful Answer"); |
221 | - new AndroidToast().showToast("Erro de conexão, tenta novamente."); | 249 | + GetConnectionStatusError(ExportLayers.ConnectionStatusError.ERROR_CONNECTION_FAILURE); |
222 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | 250 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); |
223 | 251 | ||
224 | } | 252 | } |
225 | else if (!videoInfoRequest.responseHeaders["STATUS"].Contains("200")) | 253 | else if (!videoInfoRequest.responseHeaders["STATUS"].Contains("200")) |
226 | { | 254 | { |
227 | - new AndroidToast().showToast("Erro de conexão, tenta novamente."); | 255 | + |
228 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "Unsuccessful answer (" + videoInfoRequest.responseHeaders["STATUS"] + ")."); | 256 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "Unsuccessful answer (" + videoInfoRequest.responseHeaders["STATUS"] + ")."); |
257 | + GetConnectionStatusError(ExportLayers.ConnectionStatusError.ERROR_CONNECTION_FAILURE); | ||
229 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | 258 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); |
230 | 259 | ||
231 | } | 260 | } |
232 | else if (String.IsNullOrEmpty(videoInfoRequest.text)) | 261 | else if (String.IsNullOrEmpty(videoInfoRequest.text)) |
233 | { | 262 | { |
234 | - new AndroidToast().showToast("Erro de conexão, tenta novamente."); | 263 | + |
235 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); | 264 | screenManager.changeExportStates(ExportLayers.ExportLayer.All, true); |
265 | + GetConnectionStatusError(ExportLayers.ConnectionStatusError.ERROR_CONNECTION_FAILURE); | ||
236 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "Empty answer."); | 266 | PlayerLogger.Log("ExportVideo", "requestVideoInfo", "Empty answer."); |
237 | } | 267 | } |
238 | else | 268 | else |
@@ -252,12 +282,15 @@ public class ExportVideo : MonoBehaviour { | @@ -252,12 +282,15 @@ public class ExportVideo : MonoBehaviour { | ||
252 | } | 282 | } |
253 | finally | 283 | finally |
254 | { | 284 | { |
285 | + videoRequestRunning = false; | ||
255 | 286 | ||
256 | 287 | ||
257 | 288 | ||
258 | } | 289 | } |
259 | } | 290 | } |
260 | 291 | ||
292 | + | ||
293 | + | ||
261 | public IEnumerator WaitForResponse(WWW www, Events.RequestSuccess success, Events.RequestError error) | 294 | public IEnumerator WaitForResponse(WWW www, Events.RequestSuccess success, Events.RequestError error) |
262 | { | 295 | { |
263 | yield return Methods.WaitForResponse(www, 60f, success, error); | 296 | yield return Methods.WaitForResponse(www, 60f, success, error); |
@@ -269,6 +302,29 @@ public class ExportVideo : MonoBehaviour { | @@ -269,6 +302,29 @@ public class ExportVideo : MonoBehaviour { | ||
269 | yield return WaitForResponse(www, null, null); | 302 | yield return WaitForResponse(www, null, null); |
270 | } | 303 | } |
271 | 304 | ||
305 | + public static void GetConnectionStatusError(ExportLayers.ConnectionStatusError error) | ||
306 | + { | ||
307 | + switch (error) | ||
308 | + { | ||
309 | + case ExportLayers.ConnectionStatusError.CONNECTION_TIMEOUT_FAILURE: | ||
310 | + new AndroidToast().showToast("Erro de conexão. Tente novamente."); | ||
311 | + break; | ||
312 | + case ExportLayers.ConnectionStatusError.DOWNLOAD_CONNECTION_FAILURE: | ||
313 | + new AndroidToast().showToast("Erro ao efetuar download, tente novamente."); | ||
314 | + break; | ||
315 | + case ExportLayers.ConnectionStatusError.INTERNET_CONNECTION_FAILURE: | ||
316 | + new AndroidToast().showToast("Não há acesso à internet. Verifique sua conexão"); | ||
317 | + break; | ||
318 | + case ExportLayers.ConnectionStatusError.ERROR_CONNECTION_FAILURE: | ||
319 | + new AndroidToast().showToast("Problema na conexão. Aguarde e tente novamente."); | ||
320 | + break; | ||
321 | + default: | ||
322 | + new AndroidToast().showToast("Ocorreu um erro. Estamos trabalhando para solucioná-lo!"); | ||
323 | + break; | ||
324 | + } | ||
325 | + | ||
326 | + } | ||
327 | + | ||
272 | 328 | ||
273 | 329 | ||
274 | 330 |
Assets/Scripts/Export Video/MediaShareAndroid.cs
@@ -32,13 +32,13 @@ public class MediaShareAndroid : MonoBehaviour | @@ -32,13 +32,13 @@ public class MediaShareAndroid : MonoBehaviour | ||
32 | private string FileName = "/VLibrasVideo_"; | 32 | private string FileName = "/VLibrasVideo_"; |
33 | 33 | ||
34 | 34 | ||
35 | + /*Makes sure that Vlibras Folder gets created and write the video bytes in it.*/ | ||
36 | + | ||
35 | private void WriteOnAndroid(byte[] videoContent) | 37 | private void WriteOnAndroid(byte[] videoContent) |
36 | { | 38 | { |
37 | if(!Directory.Exists(AndroidPath + Vlibras)) | 39 | if(!Directory.Exists(AndroidPath + Vlibras)) |
38 | { | 40 | { |
39 | - Directory.CreateDirectory(AndroidPath + Vlibras); | ||
40 | - | ||
41 | - | 41 | + Directory.CreateDirectory(AndroidPath + Vlibras); |
42 | } | 42 | } |
43 | if (!Directory.Exists(AndroidPath + Vlibras + FileName)) | 43 | if (!Directory.Exists(AndroidPath + Vlibras + FileName)) |
44 | File.WriteAllBytes(AndroidPath + Vlibras + FileName, videoContent); | 44 | File.WriteAllBytes(AndroidPath + Vlibras + FileName, videoContent); |
@@ -47,7 +47,7 @@ public class MediaShareAndroid : MonoBehaviour | @@ -47,7 +47,7 @@ public class MediaShareAndroid : MonoBehaviour | ||
47 | 47 | ||
48 | } | 48 | } |
49 | 49 | ||
50 | - | 50 | + /* Creates the sharing activity and shows the chooser to the user*/ |
51 | 51 | ||
52 | public void ShareActivity(byte[] videoContent, string CurrentTime) | 52 | public void ShareActivity(byte[] videoContent, string CurrentTime) |
53 | { | 53 | { |
Assets/Scripts/PlayerManager.cs
@@ -85,6 +85,8 @@ public class PlayerManager : GenericPlayerManager { | @@ -85,6 +85,8 @@ public class PlayerManager : GenericPlayerManager { | ||
85 | this.signs = this.gameObject.GetComponent<Dictionary>().Signs; | 85 | this.signs = this.gameObject.GetComponent<Dictionary>().Signs; |
86 | } | 86 | } |
87 | 87 | ||
88 | + | ||
89 | + | ||
88 | public void playDict(string word) | 90 | public void playDict(string word) |
89 | { | 91 | { |
90 | PlayerLogger.Log("Requesting dictionary: " + word); | 92 | PlayerLogger.Log("Requesting dictionary: " + word); |
@@ -93,7 +95,7 @@ public class PlayerManager : GenericPlayerManager { | @@ -93,7 +95,7 @@ public class PlayerManager : GenericPlayerManager { | ||
93 | base.gloss = word; | 95 | base.gloss = word; |
94 | 96 | ||
95 | base.playNow(word); | 97 | base.playNow(word); |
96 | - ExportVideo.gloss = word; | 98 | + ExportVideo.SetGloss(word); |
97 | this.screenManager.changeExportStates(ExportLayers.ExportLayer.OnLockExport, false); | 99 | this.screenManager.changeExportStates(ExportLayers.ExportLayer.OnLockExport, false); |
98 | 100 | ||
99 | this.screenManager.hideScreen(); | 101 | this.screenManager.hideScreen(); |
@@ -279,10 +281,8 @@ public class PlayerManager : GenericPlayerManager { | @@ -279,10 +281,8 @@ public class PlayerManager : GenericPlayerManager { | ||
279 | gloss = glossRequest.text; | 281 | gloss = glossRequest.text; |
280 | 282 | ||
281 | base.gloss = gloss; | 283 | base.gloss = gloss; |
282 | - ExportVideo.gloss = gloss; | ||
283 | - | ||
284 | - base.playNow(base.gloss); | ||
285 | - | 284 | + ExportVideo.SetGloss(gloss); |
285 | + base.playNow(base.gloss); | ||
286 | 286 | ||
287 | yield break; | 287 | yield break; |
288 | } | 288 | } |
Assets/Scripts/UI/ScreenManager.cs
@@ -371,7 +371,7 @@ public class ScreenManager : MonoBehaviour { | @@ -371,7 +371,7 @@ public class ScreenManager : MonoBehaviour { | ||
371 | setShareLayerState(show_Layer); | 371 | setShareLayerState(show_Layer); |
372 | break; | 372 | break; |
373 | case ExportLayers.ExportLayer.OnLockExport: | 373 | case ExportLayers.ExportLayer.OnLockExport: |
374 | - onLockExport = show_Layer; | 374 | + onLockExport = show_Layer; |
375 | break; | 375 | break; |
376 | default: | 376 | default: |
377 | onLockExport = false; | 377 | onLockExport = false; |