· 8 years ago · Jul 20, 2018, 07:10 PM
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.UI;
5using UnityEngine.Video;
6using UnityEngine.SceneManagement;
7
8public class PlayWorldChangeAnimation : MonoBehaviour {
9
10 private VideoPlayer videoPlayer;
11 private AudioSource audioSource;
12 public VideoClip videoClip;
13 public AudioClip audioClip;
14 public RawImage rawImage;
15
16 //gameobjects to deactivate
17 public GameObject fondoCanvas;
18 public GameObject worldElementsCanvas;
19 public GameObject musicBackGround;
20
21 //routes to go to the next world
22 public string bundlePath;
23 public string bundleAsset;
24
25 void OnEnable() {
26 fondoCanvas.SetActive(false);
27 worldElementsCanvas.SetActive(false);
28 StartCoroutine(setReproductor());
29
30 }
31
32 // Use this for initialization
33 void Start () {
34
35 }
36
37
38 IEnumerator setReproductor(){
39
40 videoPlayer = gameObject.AddComponent<VideoPlayer>();
41 audioSource = gameObject.AddComponent<AudioSource>();
42
43 //video settings
44 videoPlayer.playOnAwake = true;
45 videoPlayer.isLooping = false;
46 videoPlayer.audioOutputMode = VideoAudioOutputMode.None;
47
48 //audio settings
49 audioSource.playOnAwake = true;
50 audioSource.Pause();
51 audioSource.loop = false;
52
53
54 videoPlayer.clip = videoClip;
55 audioSource.clip = audioClip;
56
57 while (!videoPlayer.isPrepared)
58 {
59 yield return null;
60 }
61
62 rawImage.texture = videoPlayer.texture;
63 rawImage.enabled = true;
64
65 musicBackGround.GetComponent<AudioSource>().Pause();
66 videoPlayer.Play();
67 audioSource.Play();
68
69 //this si where things start to get loaded
70 //SceneManager.LoadSceneAsync("LoadCityMap");
71 StartCoroutine(changeScene());
72 }
73
74 IEnumerator changeScene(){
75 yield return new WaitForSeconds(6);
76 AssetBundle.UnloadAllAssetBundles(true);
77 PlayerPrefs.SetInt("Position",0); // resetea siempre la posicion al inicio al salirse de las escenas
78 // GameObject.Find("SceneLoader").GetComponent<LoadScene>().LoadSceneWithBundleAsync("MapBase",bundlePath,bundleAsset);
79 StartCoroutine(GameObject.Find("SceneLoader").GetComponent<LoadScene>().LoadSceneWithBundleAsyncRoutine("MapBase",bundlePath,bundleAsset));
80 // yield return null;
81 }
82
83
84}
85
86
87//el avion y el cambio de scena ya esta , solo falta hacer el movimiento de la ficha y el avion para viajar
88//y hacer las scenas de carga , de forma que sean un modulo aparte facil de acceder igual que el avion
89// y sacar el boton del engrane
90// y hacer el script que mande a llamar al avion a la hora de completar las estrellas
91
92
93
94
95
96
97+++++++++++++++++++++
98
99
100using System.Collections;
101using System.Collections.Generic;
102using UnityEngine;
103
104public class PlayerPrefsManager {
105 public static string Language {
106 get
107 {
108 return PlayerPrefs.GetString("language","es-MX");
109 }
110 set{
111 PlayerPrefs.SetString("language",value);
112 }
113 }
114
115 public static int Grade{
116 get{
117 return PlayerPrefs.GetInt("grade",1);
118 }
119 set{
120 PlayerPrefs.SetInt("grade",value);
121 }
122 }
123
124 public static string Character {
125 get
126 {
127 return PlayerPrefs.GetString("character","Lili");
128 }
129 set{
130 PlayerPrefs.SetString("character",value);
131 }
132 }
133
134
135
136 public static bool PlayedAvionSea{
137 get{
138 int planeBoolean = PlayerPrefs.GetInt("planeSeaBoolean",0);
139 if(planeBoolean == 1){
140 return true;
141 } else {
142 return false;
143 }
144 }
145 set{
146 if(value){
147 PlayerPrefs.SetInt("planeSeaBoolean",1);
148 } else {
149 PlayerPrefs.SetInt("planeSeaBoolean",0);
150 }
151
152 }
153 }
154
155}
156
157
158
159+++++++++++++++++++++
160// load scene modificado
161
162
163using System.Collections;
164using System.Collections.Generic;
165using UnityEngine;
166using UnityEngine.SceneManagement;
167
168public class LoadScene : MonoBehaviour {
169
170 public string scene_target;
171 public string bundle_path;
172 public string bundle_asset;
173 public bool comesFromGame = false;
174 //private static bool changing_scene = false;
175
176 void Awake() {
177 DontDestroyOnLoad(this.gameObject);
178
179 if(GameObject.Find(gameObject.name) && GameObject.Find(gameObject.name) != this.gameObject){
180 Destroy(GameObject.Find(gameObject.name));
181 }
182
183 /*
184 if (changing_scene)
185 {
186 DontDestroyOnLoad(this.gameObject);
187
188 Destroy(this.gameObject);
189 }
190 */
191 }
192
193 public void ChangeScene(string scene){
194 SceneManager.LoadScene(scene);
195 }
196
197 public void LoadSceneWithBundle(string scene,string path,string asset){
198 scene_target = scene;
199 bundle_path = path;
200 bundle_asset = asset;
201 //changing_scene = true;
202 SceneManager.LoadScene(scene);
203 }
204
205 public void LoadSceneWithBundleAsync(string scene,string path,string asset){
206 StartCoroutine(LoadSceneWithBundleAsyncRoutine(scene,path,asset));
207 }
208
209 public IEnumerator LoadSceneWithBundleAsyncRoutine(string scene,string path,string asset){
210 scene_target = scene;
211 bundle_path = path;
212 bundle_asset = asset;
213
214 AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(scene);
215 asyncOperation.priority = 1;
216 asyncOperation.allowSceneActivation = false;
217
218 while(!asyncOperation.isDone){
219 float progress = Mathf.Clamp01(asyncOperation.progress / 0.9f);
220 Debug.Log("Loading progress: " + (progress * 100) + "%");
221
222 if(asyncOperation.progress == 0.9f){
223 asyncOperation.allowSceneActivation = true;
224
225 /* Debug.Log("press a key to start");
226 if(Input.anyKey){
227 asyncOperation.allowSceneActivation = true;
228 }
229 */
230 }
231 yield return null;
232 }
233
234 }
235
236}
237
238
239
240
241
242++++++++++++++++++++++++++++
243 // new data initializer
244
245using System.Collections;
246using System.Collections.Generic;
247using UnityEngine;
248
249public class DataInitializer : MonoBehaviour {
250
251 DataBaseService dataBaseService;
252 OpenModalWindow openModalWindow;
253 MoveOnClick moveOnClick;
254
255
256 void Start () {
257 dataBaseService = new DataBaseService();
258 openModalWindow = gameObject.GetComponent<OpenModalWindow>();
259 moveOnClick = gameObject.GetComponent<MoveOnClick>();
260
261 if(dataBaseService.getActivityInfo(moveOnClick.stageLevel).Count == 0){
262
263 if(moveOnClick.worldId == 1 || moveOnClick.worldId == 4 || moveOnClick.worldId == 7){
264 createActivityNoRandom();
265 } else {
266 createActivity();
267 }
268
269 Debug.Log("Actividad creada");
270 } else{
271 Debug.Log("ya existe una actividad creada");
272 }
273
274 }
275
276 void createActivity(){
277 System.Security.Cryptography.RNGCryptoServiceProvider provider = new System.Security.Cryptography.RNGCryptoServiceProvider();
278
279 var randomNumbers = new byte[1];
280 string[] rutaNumbersArray = new string[3];
281
282 int min = 1;
283 int max = 12;
284
285 bool condicion = true;
286 int contador = 0;
287 while (condicion)
288 {
289 int ruta = 0;
290
291 while(ruta < min || ruta > max){
292 provider.GetBytes(randomNumbers);
293 ruta = randomNumbers[0];
294 }
295
296
297 string rutaString = string.Format("{0:000}",ruta);
298 rutaNumbersArray[contador] = rutaString;
299 contador++;
300 if(contador == 3){
301 condicion = false;
302 }
303 }
304
305 string nuevaRutaOrder = openModalWindow.order_path.Substring(0,openModalWindow.order_path.Length - 3) + rutaNumbersArray[0];
306 string nuevaRutaJoin = openModalWindow.join_path.Substring(0,openModalWindow.join_path.Length - 3) + rutaNumbersArray[1];
307 string nuevaRutaSelect = openModalWindow.select_path.Substring(0,openModalWindow.select_path.Length - 3) + rutaNumbersArray[2];
308
309 dataBaseService.insertActivity(moveOnClick.worldId, moveOnClick.stageLevel, 0, "order", nuevaRutaOrder);
310 dataBaseService.insertActivity(moveOnClick.worldId, moveOnClick.stageLevel, 0, "join", nuevaRutaJoin);
311 dataBaseService.insertActivity(moveOnClick.worldId, moveOnClick.stageLevel, 0, "select", nuevaRutaSelect);
312
313 Debug.Log("REEEEEEEEEEEEEE RUTA ORDER"+ nuevaRutaOrder);
314 Debug.Log("REEEEEEEEEEEEEE RUTA JOIN " + nuevaRutaJoin);
315 Debug.Log("REEEEEEEEEEEEEE RUTA SELECT " + nuevaRutaSelect);
316
317 gameObject.GetComponent<LevelAndStarAsignator>().fillActivityInfo();
318 }
319
320
321 void createActivityNoRandom(){
322 dataBaseService.insertActivity(moveOnClick.worldId, moveOnClick.stageLevel, 0, "order", openModalWindow.order_path);
323 dataBaseService.insertActivity(moveOnClick.worldId, moveOnClick.stageLevel, 0, "join", openModalWindow.join_path);
324 dataBaseService.insertActivity(moveOnClick.worldId, moveOnClick.stageLevel, 0, "select", openModalWindow.select_path);
325
326 gameObject.GetComponent<LevelAndStarAsignator>().fillActivityInfo();
327 }
328
329
330}
331
332
333+++++++++++++++++++++++++++
334using System.Collections;
335using System.Collections.Generic;
336using UnityEngine;
337
338public class FichaPosition : MonoBehaviour {
339
340 Vector3 vectorPosicion;
341
342 public GameObject cam;
343 Transform[] path;
344
345 void Start () {
346 path = cam.GetComponent<MovePositions>().wayPointsArray;
347
348 MovePositions.currentNode = PlayerPrefs.GetInt("Position",0);
349
350 vectorPosicion.x = path[MovePositions.currentNode].position.x;
351 vectorPosicion.y = path[MovePositions.currentNode].position.y;
352 vectorPosicion.z = path[MovePositions.currentNode].position.z;
353
354 transform.position = vectorPosicion;
355
356 }
357
358/* void OnDestroy()
359 {
360 PlayerPrefs.SetInt("Position",MovePositions.currentNode);
361
362 }
363 */
364 void OnDisable(){
365 PlayerPrefs.SetInt("Position",MovePositions.currentNode);
366
367 }
368
369
370 void OnApplicationPause()
371 {
372 //void OnApplicationQuit() maybe ?
373 //PlayerPrefs.DeleteAll(); maybe yes ? maybe not?
374 PlayerPrefs.DeleteKey("Position");
375 // PlayerPrefs.SetInt("Position",0);
376 PlayerPrefs.DeleteKey("X");
377 PlayerPrefs.DeleteKey("Y");
378 PlayerPrefs.DeleteKey("Z");
379 }
380
381 void OnApplicationQuit(){
382 //void OnApplicationQuit() maybe ?
383 //PlayerPrefs.DeleteAll(); maybe yes ? maybe not?
384 PlayerPrefs.DeleteKey("Position");
385 // PlayerPrefs.SetInt("Position",0);
386 PlayerPrefs.DeleteKey("X");
387 PlayerPrefs.DeleteKey("Y");
388 PlayerPrefs.DeleteKey("Z");
389 }
390
391}
392
393
394++++++++++++++++++++++++++++++
395 // checar condicion avion
396
397using System.Collections;
398using System.Collections.Generic;
399using UnityEngine;
400
401public class ChecarCondicionAvion : MonoBehaviour {
402
403 public GameObject avionAnimacion;
404
405 private int califOrder;
406 private int califJoin;
407 private int califSelect;
408
409 // Use this for initialization
410 void Start () {
411 if(!PlayerPrefsManager.PlayedAvionSea){
412 checkFinalCal();
413 }
414
415
416 }
417
418 public void checkFinalCal(){
419 califOrder = gameObject.GetComponent<OpenModalWindow>().calOrder;
420 califJoin = gameObject.GetComponent<OpenModalWindow>().calJoin;
421 califSelect = gameObject.GetComponent<OpenModalWindow>().calSelect;
422
423 if(califOrder == 2 && califJoin == 2 && califSelect == 2){
424 avionAnimacion.SetActive(true);
425 PlayerPrefsManager.PlayedAvionSea = true;
426 }
427
428 }
429
430
431
432}
433
434
435+++++++++++++++++++++++++++++++++++++++++++++++
436
437using System.Collections;
438using System.Collections.Generic;
439using UnityEngine;
440using Mono.Data.Sqlite;
441using SQLite4Unity3d;
442using System.Data;
443using System;
444using System.IO;
445
446public class DataBaseService {
447
448 private SQLiteConnection _connection;
449 String namedb = "dbPrueba1";
450
451 String sqlQuerie;
452
453 public DataBaseService(){
454 #if UNITY_EDITOR
455 var dbPath = string.Format(@"Assets/StreamingAssets/{0}", namedb);
456 #else
457 // check if file exists in Application.persistentDataPath
458 var filepath = string.Format("{0}/{1}", Application.persistentDataPath, namedb);
459
460 if (!File.Exists(filepath))
461 {
462 Debug.Log("Database not in Persistent path");
463 // if it doesn't ->
464 // open StreamingAssets directory and load the db ->
465
466 #if UNITY_ANDROID
467 var loadDb = new WWW("jar:file://" + Application.dataPath + "!/assets/" + namedb); // this is the path to your StreamingAssets in android
468 while (!loadDb.isDone) { } // CAREFUL here, for safety reasons you shouldn't let this while loop unattended, place a timer and error check
469 // then save to Application.persistentDataPath
470 File.WriteAllBytes(filepath, loadDb.bytes);
471 #elif UNITY_IOS
472 var loadDb = Application.dataPath + "/Raw/" + namedb; // this is the path to your StreamingAssets in iOS
473 // then save to Application.persistentDataPath
474 File.Copy(loadDb, filepath);
475
476 #elif UNITY_WP8
477 var loadDb = Application.dataPath + "/StreamingAssets/" + namedb; // this is the path to your StreamingAssets in iOS
478 // then save to Application.persistentDataPath
479 File.Copy(loadDb, filepath);
480
481 #elif UNITY_WINRT
482 var loadDb = Application.dataPath + "/StreamingAssets/" + namedb; // this is the path to your StreamingAssets in iOS
483 // then save to Application.persistentDataPath
484 File.Copy(loadDb, filepath);
485 #else
486 var loadDb = Application.dataPath + "/StreamingAssets/" + namedb; // this is the path to your StreamingAssets in iOS
487 // then save to Application.persistentDataPath
488 File.Copy(loadDb, filepath);
489
490 #endif
491
492 Debug.Log("Database written");
493 }
494 var dbPath = filepath;
495
496 #endif
497 _connection = new SQLiteConnection(dbPath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create);
498
499 if(File.Exists(dbPath)){
500 initDatabase ();
501 }
502
503 }
504
505 public void insertActivity(int _id_mundo, int _id_estacion, int _calificacion, string _tipo, string _ruta){
506
507 var actividad = new Actividades{
508 Id_Mundo = _id_mundo,
509 Id_Estacion = _id_estacion,
510 Calificacion = _calificacion,
511 Tipo = _tipo,
512 Ruta = _ruta
513 };
514
515 var isSaved = _connection.Insert(actividad);
516 if(isSaved == 0){
517 Debug.Log("HA SUCEDIDO UN ERROR NO SE EJECUTO EL QUERIE");
518 } else {
519 Debug.Log("EJECUTAD QUERIE CON EXITO" + isSaved);
520 }
521
522 }
523
524
525 public List<Actividades> getActivityInfo(int idEstacion){
526
527 string sqlQuerie = "Select * From 'Actividades' WHERE Id_Estacion = ?";
528
529 object[] objeto = new object[1];
530 objeto[0] = idEstacion;
531
532 SQLiteCommand command = _connection.CreateCommand(sqlQuerie, objeto);
533
534 List<Actividades> actividadesList = command.ExecuteQuery<Actividades>();
535
536 return actividadesList;
537 }
538
539
540 public void updateActivityCalificacion(int id, int calificacion){
541
542 string sqlQuerie = "UPDATE Actividades SET Calificacion = ? WHERE id = ? AND Calificacion != 2";
543
544 object[] objeto = new object[2];
545 objeto[0] = calificacion;
546 objeto[1] = id;
547
548 SQLiteCommand command = _connection.CreateCommand(sqlQuerie, objeto);
549
550 var isSaved = command.ExecuteNonQuery();
551 if(isSaved == 1){
552 Debug.Log("se guardo y modifico con exito " + isSaved);
553 } else{
554 Debug.Log("no se guardo ni se modifico nada " + isSaved);
555 }
556
557 }
558
559
560 public void resetActividadesCal(){
561
562 string sqlQuerie = "UPDATE Actividades SET Calificacion = ?";
563
564 object[] objeto = new object[1];
565 objeto[0] = 0;
566
567 SQLiteCommand command = _connection.CreateCommand(sqlQuerie,objeto);
568
569 var isSaved = command.ExecuteNonQuery();
570 if(isSaved == 1){
571 Debug.Log("se modifico con exito " + isSaved);
572 } else {
573 Debug.Log("no ha sucedido nada " + isSaved);
574 }
575 }
576
577/*
578 public void createDB(){
579// String dbName = inputText.text;
580// String dbName = "dbPrueba1";
581 try {
582 // SqliteConnection conn = new SqliteConnection();
583 SqliteConnection.CreateFile("Assets/StreamingAssets/DataBases/" + dbName + ".sqlite");
584 } catch(Exception e) {
585 Debug.Log("La base de datos ya existe " + e);
586 return;
587 }
588 SqliteConnection dbConnection = new SqliteConnection("Data Source = Assets/StreamingAssets/DataBases/"+ dbName +".sqlite; Version = 3;");
589 dbConnection.Open();
590
591 // string sql = "create table highscores (name varchar(20), score int)";
592 string sql = "CREATE TABLE Mundo (Id INTEGER PRIMARY KEY AUTOINCREMENT, Nombre STRING (30), Estaciones INTEGER (4), Estrellas INTEGER (4))";
593
594 SqliteCommand command = new SqliteCommand(sql, dbConnection);
595 command.ExecuteNonQuery();
596
597 sql = "CREATE TABLE Estacion (Id INTEGER PRIMARY KEY AUTOINCREMENT, Id_Mundo INTEGER (4) REFERENCES Mundo (Id),Nombre STRING (30),Progreso INTEGER (4))";
598
599 command = new SqliteCommand(sql, dbConnection);
600 command.ExecuteNonQuery();
601
602 sql = "CREATE TABLE Actividades (Id INTEGER PRIMARY KEY AUTOINCREMENT, Id_Estacion INTEGER (4) REFERENCES Estacion (Id), Nombre STRING (30))";
603
604 command = new SqliteCommand(sql, dbConnection);
605 command.ExecuteNonQuery();
606
607 sql = "CREATE TABLE Player (Id INTEGER PRIMARY KEY AUTOINCREMENT, Nombre STRING (30), Nivel INTEGER (4), Estrellas INTEGER (4), UltimoMundo INTEGER (4) REFERENCES Mundo (Id))";
608
609 command = new SqliteCommand(sql,dbConnection);
610 command.ExecuteNonQuery();
611
612 dbConnection.Close();
613/*
614 sql = "insert into highscores (name, score) values ('Me', 9001)";
615
616 command = new SqliteCommand(sql, m_dbConnection);
617 command.ExecuteNonQuery();
618
619 dbConnection.Close();
620*/
621
622/*
623 void insertWorld(){
624 try{
625 // String dbName = "dbPrueba1";
626 // String sqlQuerie;
627 SqliteConnection connection = new SqliteConnection("Data Source = Assets/StreamingAssets/DataBases/"+ dbName +".sqlite; Version = 3;");
628 connection.Open();
629
630 sqlQuerie = "INSERT INTO Mundo(Id, Nombre, Estaciones, Estrellas) VALUES (1,'Sea Map',13,0)";
631
632 SqliteCommand command = new SqliteCommand(sqlQuerie, connection);
633 command.ExecuteNonQuery();
634
635 connection.Close();
636
637 } catch(Exception e ){
638 Debug.Log("HA SUCEDIDO UN ERROR " + e);
639 }
640
641 }
642
643 public void insertEstacion(){
644 try{
645 // String dbName = "dbPrueba1";
646 // String sqlQuerie;
647 SqliteConnection connection = new SqliteConnection("Data Source = Assets/StreamingAssets/DataBases/"+ dbName +".sqlite; Version = 3;");
648 connection.Open();
649
650 sqlQuerie = "INSERT INTO Estacion(Id, Id_Mundo, Nombre, Progreso) VALUES (1,1,'1-1',0)";
651
652 SqliteCommand command = new SqliteCommand(sqlQuerie, connection);
653 command.ExecuteNonQuery();
654
655 connection.Close();
656 } catch(Exception e ){
657 Debug.Log("HUBO UN ERROR" + e);
658 }
659 }
660
661 public void updatePlayer(WorldProgress worldProgress){
662 try{
663 // String dbName = "dbPrueba1";
664 // String sqlQuerie;
665 SqliteConnection connection = new SqliteConnection("Data Source = Assets/StreamingAssets/DataBases/"+ dbName + ".sqlite; Version = 3;");
666 connection.Open();
667
668 // sqlQuerie = "INSERT INTO Player(Id, Nombre, Nivel, Estrellas, UltimoMundo) VALUES ("+worldProgress.Id+",'"+worldProgress.Nombre+"',"+worldProgress.playerLevel+","+worldProgress.Estrellas+","+worldProgress.Progreso+")";
669 sqlQuerie = "UPDATE Player SET Id ="+ worldProgress.Id +",Nombre ='"+ worldProgress.Nombre +"' , Nivel ="+ worldProgress.playerLevel +", Estrellas ="+ worldProgress.Estrellas+ ", UltimoMundo="+ worldProgress.Progreso +" WHERE Id = "+worldProgress.Id +"";
670
671 SqliteCommand command = new SqliteCommand(sqlQuerie, connection);
672 command.ExecuteNonQuery();
673
674 connection.Close();
675
676 } catch (Exception e){
677 Debug.Log("HUBO UN ERROR"+ e);
678 }
679 }
680
681 public void getPlayerInfo(WorldProgress worldProgress){
682 // WorldProgress worldProgress = new WorldProgress();
683 SqliteConnection connection = new SqliteConnection("Data Source = Assets/StreamingAssets/DataBases/"+ dbName +".sqlite; Version = 3;");
684 connection.Open();
685
686 sqlQuerie = "SELECT * FROM Player WHERE Id = 1";
687
688 SqliteCommand command = new SqliteCommand(sqlQuerie, connection);
689 //SqliteDataReader reader = command.ExecuteReader();
690 using(SqliteDataReader reader = command.ExecuteReader()){
691 while(reader.Read()){
692 worldProgress.Id = reader.GetInt32(0);
693 worldProgress.Nombre = reader.GetString(1);
694 worldProgress.Estrellas = reader.GetInt32(3);
695 worldProgress.playerLevel = reader.GetInt32(2);
696 worldProgress.Progreso = reader.GetInt32(4);
697 }
698 }
699 }
700
701 //vvvvvvvvvvvvvvv helper method to reset the data base to 1
702
703 public void resetPlayerTolvl1(){
704 try{
705 SqliteConnection connection = new SqliteConnection("Data Source = Assets/StreamingAssets/DataBases/" + dbName + ".sqlite; Version = 3;");
706 connection.Open();
707
708 sqlQuerie = "Update Player SET Nivel = 1 WHERE Id = 1";
709
710 SqliteCommand command = new SqliteCommand(sqlQuerie, connection);
711 command.ExecuteNonQuery();
712
713 connection.Close();
714 } catch(Exception e){
715 Debug.Log("Eroror: " + e);
716 }
717 }
718 */
719
720 void initDatabase()
721 {
722 //comprobar que el archivo de la bd exista
723
724 string sqlQuerie = "SELECT name FROM sqlite_master WHERE name = ? AND type = 'table' ";
725 object[] obj = new object[1];
726 obj[0] = "Actividades";
727
728 SQLiteCommand command = _connection.CreateCommand(sqlQuerie, obj);
729
730 try
731 {
732 List<Actividades> actividadesList = command.ExecuteQuery<Actividades>();
733 Debug.Log(actividadesList.Count);
734
735 if (actividadesList.Count == 0)
736 {
737 _connection.DropTable<Actividades>();
738 _connection.CreateTable<Actividades>();
739
740 _connection.DropTable<Player>();
741 _connection.CreateTable<Player>();
742
743
744 _connection.DropTable<Mundo>();
745 _connection.CreateTable<Mundo>();
746 Debug.Log("Se creo la base de datos de nuevo");
747 }
748 else
749 {
750 Debug.Log("Ya existe la base de datos, no se creo de nuevo ");
751 }
752
753 }
754 catch (SQLiteException exeption)
755 {
756 Debug.Log(exeption);
757 }
758
759 /*
760 seedsStart ("start_play", 1);
761 //seedsStart ("start_finish", 2);
762 seedsStart ("unpause",3);
763
764
765
766 seedsEnd ("pause",1);
767 seedsEnd ("end_play",2);
768 //seedsEnd ("end_finish",3);
769 seedsEnd ("exit",4);
770
771 seedsScenes ("ciudad", 1);
772 seedsScenes ("parque", 2);
773 seedsScenes ("casa", 3);
774 seedsScenes ("baño", 4);
775 seedsScenes ("nana", 5);
776
777 */
778 }
779
780}