Ejemplo n.º 1
0
        public void SaveScene(string sceneName)
        {
            SceneDescription = new SceneDescription
            {
                sceneName = sceneName
            };
            SceneDescription scene = db.Table <SceneDescription>().Where(x => x.sceneName.Equals(sceneName)).FirstOrDefault();

            if (scene != null)
            {
                DeleteScene(scene);
            }

            db.Insert(SceneDescription);
            foreach (var item in shapes)
            {
                item.sceneID = SceneDescription.sceneID;
                db.Insert(item, item.GetType());
            }
            foreach (var item in lights)
            {
                item.sceneID = SceneDescription.sceneID;
                db.Insert(item, item.GetType());
            }
        }
Ejemplo n.º 2
0
 public void DeleteScene(SceneDescription scene)
 {
     if (scene != null)
     {
         db.Execute("DELETE FROM Light WHERE sceneID = ?", scene.sceneID);
         db.Execute("DELETE FROM Box WHERE sceneID = ?", scene.sceneID);
         db.Execute("DELETE FROM Sphere WHERE sceneID = ?", scene.sceneID);
         db.Execute("DELETE FROM Plane WHERE sceneID = ?", scene.sceneID);
         db.Execute("DELETE FROM Torus WHERE sceneID = ?", scene.sceneID);
         db.Execute("DELETE FROM SceneDescription WHERE sceneID = ?", scene.sceneID);
     }
 }
Ejemplo n.º 3
0
        public void LoadScene(string sceneName)
        {
            SceneDescription scene = db.Table <SceneDescription>().Where(x => x.sceneName.Equals(sceneName)).FirstOrDefault();

            List <Shape> dbshapes = new List <Shape>();

            dbshapes.AddRange(db.Table <Sphere>().Where(x => x.sceneID.Equals(scene.sceneID)).ToList());
            dbshapes.AddRange(db.Table <Box>().Where(x => x.sceneID.Equals(scene.sceneID)).ToList());
            dbshapes.AddRange(db.Table <Torus>().Where(x => x.sceneID.Equals(scene.sceneID)).ToList());
            dbshapes.AddRange(db.Table <Plane>().Where(x => x.sceneID.Equals(scene.sceneID)).ToList());
            SetShapes(dbshapes);

            var dblights = db.Table <Light>().Where(x => x.sceneID.Equals(scene.sceneID)).ToList();

            SetLights(dblights);
        }
Ejemplo n.º 4
0
        public void DeleteScene(string sceneName)
        {
            SceneDescription scene = db.Table <SceneDescription>().Where(x => x.sceneName.Equals(sceneName)).FirstOrDefault();

            DeleteScene(scene);
        }