Ejemplo n.º 1
0
        private void openSaveAsDialog(Model.Level level)
        {
            Microsoft.Win32.SaveFileDialog saveFileDialog1 = new Microsoft.Win32.SaveFileDialog();

            saveFileDialog1.InitialDirectory = Directory.GetCurrentDirectory() + @"\Levels\Custom\";
            if (!Directory.Exists(saveFileDialog1.InitialDirectory))
            {
                Directory.CreateDirectory(saveFileDialog1.InitialDirectory);
            }
            saveFileDialog1.Filter = "XML Level File|*.xml";
            saveFileDialog1.Title  = "Save Level";
            saveFileDialog1.ShowDialog();

            var path = Directory.GetCurrentDirectory() + @"\Levels\Custom\";

            // If the file name is not an empty string open it for saving.
            if (saveFileDialog1.FileName != "")
            {
                level.Name = saveFileDialog1.SafeFileName.Split('.').First();
                // Saves the Image via a FileStream created by the OpenFile method.
                Model.Serializer.saveLevel(level, path, saveFileDialog1.SafeFileName);

                /*  System.IO.FileStream fs =
                 *   (System.IO.FileStream)saveFileDialog1.OpenFile();
                 *
                 *
                 * fs.Close();*/
            }
        }
Ejemplo n.º 2
0
        public static Level parseModelLevel(Model.Level modLevel)
        {
            // TODO: Name einfügen
            Level level = new Level("TODO");

            foreach (Model.GameObject.Room modRoom in modLevel.Rooms)
            {
                Room room = new Room();
                room.Player = new Player(modRoom.Player.Position);

                foreach (var modLightRay in modRoom.LightRays)
                {
                    LightRay lr = new LightRay(modLightRay.Position, modLightRay.RayDirection);
                    room.AddLightRay(lr);
                }
                foreach (var modMirror in modRoom.Mirrors)
                {
                    Mirror m = new Mirror(modMirror.RailStart, modMirror.RailEnd, modMirror.InitAngle, modMirror.StartingRelativePosition);
                    room.AddMirror(m);
                }
            }
            //  var room = new Room();
            //   room.Player = new Fledermaus.GameObjects.Player(modLevel.Player.InitialPosition);
            //  room.Exit = new Fledermaus.GameObjects.RectangularGameObject();


            return(level);
        }
Ejemplo n.º 3
0
        public void startLevel()
        {
            level = new Model.Level();
            if (Data.Instance.session.players == null)
            {
                level.createPlayers();
            }
            else
            {
                level.players = Data.Instance.session.players;
            }

            HUD = GameObject.FindWithTag(Tags.MainUI).GetComponent <HUDController>();
            HUD.createTimer();
            view = Camera.main.GetComponent <CameraController>();

            createZone();

            turn = 1;

            timer         = gameObject.AddComponent <Timer>();
            timer.time    = Data.Instance.mainSettings.turnTime;
            timer.OnTick += updateTimer;
            timer.OnEnd  += newTurn;
            timer.Launch();
        }
Ejemplo n.º 4
0
 public Game(int currentTick, Model.Properties properties, Model.Level level, Model.Player[] players, Model.Unit[] units, Model.Bullet[] bullets, Model.Mine[] mines, Model.LootBox[] lootBoxes)
 {
     this.CurrentTick = currentTick;
     this.Properties  = properties;
     this.Level       = level;
     this.Players     = players;
     this.Units       = units;
     this.Bullets     = bullets;
     this.Mines       = mines;
     this.LootBoxes   = lootBoxes;
 }
Ejemplo n.º 5
0
 public Lift(int n, Model.Level le, Model.People pe, Model.Statistics s)
 {
     l        = le; p = pe; sta = s;
     numLevel = n;
     for (int i = 0; i < numLevel; i++)
     {
         indicStat[i] = false;
     }
     TimerCallback tm    = new TimerCallback(Move);
     Timer         timer = new Timer(tm, null, 1000, 1000);
 }
Ejemplo n.º 6
0
 public MLift(int n, Level le, People pe, Statistics s)
 {
     l         = le; p = pe; sta = s;
     numLevel  = n;
     indicStat = new bool[numLevel];
     for (int i = 0; i < numLevel; i++)
     {
         indicStat[i] = false;
     }
     TimerCallback tm    = new TimerCallback(Move);
     Timer         timer = new Timer(tm, null, 1000, 1000);
 }
Ejemplo n.º 7
0
        protected override void Seed(SeminarDbContext context)
        {
            #region Locations

            var locationLondon = new Model.Location {
                Name = "London", Building = "Central Building", RoomNumber = "B101"
            };
            var locationVienna = new Model.Location {
                Name = "Vienna", Building = "Central Building", RoomNumber = "B102"
            };
            var locationSydney = new Model.Location {
                Name = "Sydney", Building = "Central Building", RoomNumber = "B103"
            };
            var locationNewYork = new Model.Location {
                Name = "New York", Building = "Central Building", RoomNumber = "B104"
            };
            var locationMoscow = new Model.Location {
                Name = "Moscow", Building = "Central Building", RoomNumber = "B105"
            };

            context.Locations.Add(locationLondon);
            context.Locations.Add(locationVienna);
            context.Locations.Add(locationSydney);
            context.Locations.Add(locationNewYork);
            context.Locations.Add(locationMoscow);
            context.SaveChanges();

            #endregion

            #region Tracks

            var trackWebDevelopment = new Model.Track {
                Name = "Web Development"
            };
            var trackMobileDevelopment = new Model.Track {
                Name = "Mobile Development"
            };
            var trackClientSide = new Model.Track {
                Name = "Client Side Development"
            };
            var trackServerSide = new Model.Track {
                Name = "Server Side Development"
            };
            var trackJavascript = new Model.Track {
                Name = "Javascript Frameworks"
            };

            context.Tracks.Add(trackWebDevelopment);
            context.Tracks.Add(trackMobileDevelopment);
            context.Tracks.Add(trackClientSide);
            context.Tracks.Add(trackServerSide);
            context.Tracks.Add(trackJavascript);
            context.SaveChanges();

            #endregion

            #region Levels

            var levelBeginner = new Model.Level {
                Name = "Beginner", Scaling = 1
            };
            var levelIntermediate = new Model.Level {
                Name = "Intermediate", Scaling = 2
            };
            var levelExpert = new Model.Level {
                Name = "Expert", Scaling = 3
            };
            var levelMaster = new Model.Level {
                Name = "Master", Scaling = 4
            };

            context.Levels.Add(levelBeginner);
            context.Levels.Add(levelIntermediate);
            context.Levels.Add(levelExpert);
            context.Levels.Add(levelMaster);
            context.SaveChanges();

            #endregion

            #region Seminars

            context.Seminars.Add(new Seminar {
                Title       = "AngularJS 101", Code = "AJS101",
                Description = "An overview of AngularJS", Level = levelIntermediate,
                Location    = locationSydney, Track = trackJavascript, Date = DateTime.Now.AddDays(5)
            });

            context.Seminars.Add(new Seminar {
                Title       = "Introduction to MVC", Code = "MVC101",
                Description = "An overview of ASP.NET MVC", Level = levelIntermediate,
                Location    = locationMoscow, Track = trackServerSide, Date = DateTime.Now.AddDays(2)
            });

            context.Seminars.Add(new Seminar {
                Title       = "Windows Phone Fundamentals", Code = "WPH101",
                Description = "An overview of Windows Phone", Level = levelBeginner,
                Location    = locationNewYork, Track = trackMobileDevelopment, Date = DateTime.Now.AddDays(-2)
            });

            context.Seminars.Add(new Seminar {
                Title       = "Advanced AngularJS", Code = "AJS789",
                Description = "An advanced look at AngularJS", Level = levelMaster,
                Location    = locationLondon, Track = trackJavascript, Date = DateTime.Now.AddDays(10)
            });

            context.Seminars.Add(new Seminar {
                Title       = "Advanced MVC", Code = "MVC987",
                Description = "An advanced look at ASP.NET MVC", Level = levelExpert,
                Location    = locationVienna, Track = trackServerSide, Date = DateTime.Now.AddDays(6)
            });

            context.SaveChanges();

            #endregion

            base.Seed(context);
        }