Beispiel #1
0
    public Room(RoomScale scale)
    {
        data = LevelData.getLevel (ApplicationData.getLastLevel());
        int width = data.getRoomWidth ();
        int height = data.getRoomHeight ();

        entities = new RoomEntity[height][];
        for (int i=0; i < height; i++) {
            entities[i] = new RoomEntity[width];
        }

        instance = this;
        HallBuilder hallBuilder = new HallBuilder ();

        this.hall = hallBuilder.build (data);
        this.scale = scale;
        HallMeshBuilder meshBuilder = new HallMeshBuilder ();
        meshBuilder.setHall (hall);
        meshBuilder.setScale (scale);
        meshBuilder.process ();
        RoomObjectGenerator generator = new RoomObjectGenerator (data);

        for (int i=0; i<width; i++) {
            for (int j=0; j<height; j++) {
                entities[j][i] = generator.instantiateRoomObject(i, j);
            }
        }

        Game.GetInstance ().player.wait (6);
        if (ApplicationData.getLastLevel () == 1) {
            SoundManager.instance.PlaySingle ("introduccion");
        } else {
            SoundManager.instance.PlaySingle ("entrada-laberinto");
        }
    }
Beispiel #2
0
        public Center(ExpansionFeature expansion_feature)
        {
            _ExpansionFeature = expansion_feature;

            _Hall = new Hall();
            _Updater = new Updater();
        }
 public ActionResult Create([Bind(Include = "Id,RowsCount,SeatsInRow")] Hall hall)
 {
     try {
         hallManager.AddHall(hall);
         return(RedirectToAction("Index"));
     }
     catch (Exception) {
         ModelState.AddModelError("error", "unable to save the hall");
         return(View(hall));
     }
 }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,Nr,Rows,Columns")] Hall hall)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hall);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hall));
        }
Beispiel #5
0
        public static string ImportHallSeats(CinemaContext context, string jsonString)
        {
            #region Query
            //Using the file halls-seats.json, import the data from that file into the database.

            //Constraints
            //     •	If any validation errors occur, such as invalid hall name, zero or negative seats count,
            //         ignore the entity and print an error message.
            #endregion

            var collectionOfSeatsDto = JsonConvert.DeserializeObject <HallImportDto[]>(jsonString);
            var halls = new List <Hall>();

            var sb = new StringBuilder();

            foreach (var hallDto in collectionOfSeatsDto)
            {
                if (!IsValid(hallDto) || hallDto.Seats <= 0)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                var hall = new Hall
                {
                    Name  = hallDto.Name,
                    Is3D  = hallDto.Is3D,
                    Is4Dx = hallDto.Is4Dx
                };

                for (int i = 0; i < hallDto.Seats; i++)
                {
                    hall.Seats.Add(new Seat());
                }

                halls.Add(hall);

                var status = "Normal";
                if (hall.Is4Dx)
                {
                    status = hall.Is3D ? "4DX/3D" : "4DX";
                }
                else if (hall.Is3D)
                {
                    status = "3D";
                }

                sb.AppendLine(String.Format(SuccessfulImportHallSeat, hall.Name, status, hall.Seats.Count));
            }
            context.Halls.AddRange(halls);
            context.SaveChanges();

            return(sb.ToString().TrimEnd());
        }
 public static int GetSeatColumn(this SeatingModel seat, Hall hall)
 {
     if (seat.Seat.SeatNumber % hall.NumberOfColumns == 0)
     {
         return(hall.NumberOfColumns);
     }
     else
     {
         return(seat.Seat.SeatNumber % hall.NumberOfColumns);
     }
 }
        public async Task <ActionResult> Edit([Bind(Include = "HallId,HallName,HallCapacity,HallDescription,HImage1,HImage2,HImage3,HImage4,Hall_price_Hour")] Hall hall)
        {
            if (ModelState.IsValid)
            {
                db.Entry(hall).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(hall));
        }
        public ActionResult EditHall(Hall updatedHall)
        {
            var updateResult = _ticketService.UpdateHall(updatedHall);

            if (updateResult)
            {
                return(RedirectToAction("GetHallsList"));
            }

            return(Content("Update failed. Plese, contact system administrator."));
        }
        public ActionResult AddHall(Hall newHall)
        {
            var creationResult = _ticketService.CreateHall(newHall);

            if (creationResult)
            {
                return(RedirectToAction("GetHallsList"));
            }

            return(Content("Update failed. Please, contact system administrator."));
        }
        public IActionResult GetHall(int hallId)
        {
            Hall hall = _hallService.GetById(hallId);

            if (hall == null)
            {
                return(Fail("找不到影厅"));
            }

            return(Ok(hall));
        }
        public IHttpActionResult GetHallById(int id)
        {
            Hall hall = db.Hall.Find(id);

            if (hall == null)
            {
                return(NotFound());
            }

            return(Ok(hall));
        }
Beispiel #12
0
        public static string ImportHallSeats(CinemaContext context, string jsonString)
        {
            var hallsDto = JsonConvert.DeserializeObject <ImportHallDto[]>(jsonString);

            var sb = new StringBuilder();

            var halls = new List <Hall>();

            foreach (var hallDto in hallsDto)
            {
                if (!IsValid(hallDto))
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                var hall = new Hall
                {
                    Name  = hallDto.Name,
                    Is3D  = hallDto.Is3D,
                    Is4Dx = hallDto.Is4Dx
                };

                for (int i = 0; i < hallDto.Seats; i++)
                {
                    hall.Seats.Add(new Seat());
                }

                halls.Add(hall);

                var status = string.Empty;
                if (hall.Is4Dx)
                {
                    status = hall.Is3D ? "4Dx/3D" : "4Dx";
                }
                else if (hall.Is3D)
                {
                    status = "3D";
                }
                else
                {
                    status = "Normal";
                }

                sb.AppendLine(string.Format(SuccessfulImportHallSeat, hall.Name, status, hall.Seats.Count));
            }

            context.Halls.AddRange(halls);
            context.SaveChanges();

            var result = sb.ToString().TrimEnd();

            return(result);
        }
        // GET: Halls/Edit/5
        public ActionResult Edit(int id)
        {
            Hall h = hallManager.GetHallById(id);

            if (h == null)
            {
                //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                return(HttpNotFound());
            }
            return(View(h));
        }
Beispiel #14
0
        public ActionResult EditHall(Hall updatedHall)
        {
            var updateResoult = _ticketService.UpdateHall(updatedHall);

            if (updateResoult)
            {
                return(RedirectToAction("GetHallsList"));
            }

            return(Content("Update failed."));
        }
        // JSON
        public static string ImportHallSeats(CinemaContext context, string jsonString)
        {
            var hallsImportDTOs = JsonConvert.DeserializeObject <List <HallImportDTO> >(jsonString);

            var halls = new List <Hall>();
            var sb    = new StringBuilder();

            foreach (var currentHallDTO in hallsImportDTOs)
            {
                var isValidHall = IsValid(currentHallDTO);

                if (!isValidHall)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                var hall = new Hall
                {
                    Name  = currentHallDTO.Name,
                    Is4Dx = currentHallDTO.Is4Dx,
                    Is3D  = currentHallDTO.Is3D
                };

                for (int i = 0; i < currentHallDTO.Seats; i++)
                {
                    hall.Seats.Add(new Seat());
                }

                halls.Add(hall);

                string status = "";

                if (hall.Is4Dx)
                {
                    status = hall.Is3D ? "4Dx/3D" : "4Dx";
                }
                else if (hall.Is3D)
                {
                    status = "3D";
                }
                else
                {
                    status = "Normal";
                }

                sb.AppendLine(string.Format(SuccessfulImportHallSeat, hall.Name, status, hall.Seats.Count));
            }

            context.Halls.AddRange(halls);
            context.SaveChanges();

            return(sb.ToString().TrimEnd());
        }
Beispiel #16
0
        public ActionResult AddHall(Hall newHall)
        {
            var creationResoult = _ticketService.CreateHall(newHall);

            if (creationResoult)
            {
                return(RedirectToAction("GetHallsList"));
            }

            return(Content("Update failed."));
        }
Beispiel #17
0
        public IActionResult Delete(Hall hall)
        {
            var result = _hallService.Delete(hall);

            if (result.Success)
            {
                return(Ok(result.Message));
            }

            return(BadRequest(result.Message));
        }
Beispiel #18
0
        public static string ImportHallSeats(CinemaContext context, string jsonString)
        {
            var hallsDto = JsonConvert.DeserializeObject <HallDto[]>(jsonString);

            StringBuilder sb = new StringBuilder();

            var halls = new List <Hall>();

            foreach (var dto in hallsDto)
            {
                if (!IsValid(dto) || dto.Seats <= 0)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                var hall = new Hall()
                {
                    Name  = dto.Name,
                    Is4Dx = dto.Is4Dx,
                    Is3D  = dto.Is3D
                };

                for (int i = 0; i < dto.Seats; i++)
                {
                    hall.Seats.Add(new Seat());
                }

                var type = "Normal";

                if (hall.Is4Dx)
                {
                    type = "4Dx";
                }

                if (hall.Is3D)
                {
                    type = "3D";
                }

                if (hall.Is4Dx && hall.Is3D)
                {
                    type = "4Dx" + "/3D";
                }

                halls.Add(hall);
                sb.AppendLine(string.Format(SuccessfulImportHallSeat, hall.Name, type, hall.Seats.Count));
            }

            context.Halls.AddRange(halls);
            context.SaveChanges();

            return(sb.ToString());
        }
Beispiel #19
0
        public async Task <Hall> Edit(Hall hall)
        {
            if (hall == null)
            {
                return(null);
            }
            _ctx.Hales.Update(hall);
            await _ctx.SaveChangesAsync();

            return(hall);
        }
 public void AddHall(Hall hall)
 {
     using (SqlConnection connection = new SqlConnection(connectionstring))
     {
         SqlCommand cmd = new SqlCommand("AddHall", connection);
         cmd.CommandType = System.Data.CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@nameOfHall", hall.NameOfHall);
         connection.Open();
         cmd.ExecuteNonQuery();
     }
 }
Beispiel #21
0
        //Get api/hall/{id}
        public IHttpActionResult GetById(int id)
        {
            Hall hall = repo.GetById(id);

            if (hall == null)
            {
                return(NotFound());
            }

            return(Ok(hall));
        }
Beispiel #22
0
        public async Task <IActionResult> Create(Hall model)
        {
            if (model != null)
            {
                model.RestaurantID = (string)TempData["CafeID"];
                _context.Add(model);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", new { id = model.RestaurantID }));
            }
            return(View(model));
        }
Beispiel #23
0
        public void Add(int cinema, byte num, string type, byte rows, byte seats)
        {
            Hall c = new Hall();

            c.Num           = num;
            c.Type          = type;
            c.AmountOfRow   = rows;
            c.AmountOfSeats = seats;
            c.Cinema        = db.CinemaSet.Find(cinema);
            db.HallSet.Add(c);
            db.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "ID,StoreID,SellerID,NumberHall,CountWorker,Floor")] Hall hall)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hall).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SellerID = new SelectList(db.Sellers, "ID", "Name", hall.SellerID);
     ViewBag.StoreID  = new SelectList(db.Stores, "ID", "Name", hall.StoreID);
     return(View(hall));
 }
Beispiel #25
0
        public async Task <IHttpActionResult> PostHall(Hall hall)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Halls.Add(hall);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = hall.ID }, hall));
        }
        public ActionResult Edit(Hall hall)
        {
            HallsDal dal     = new HallsDal();
            Hall     objHall = (from x in dal.Halls
                                where x.HallName == hall.HallName
                                select x).Single <Hall>();

            dal.Halls.Remove(objHall);
            dal.Halls.Add(hall);
            dal.SaveChanges();
            return(RedirectToAction("MyPage", "Home"));
        }
Beispiel #27
0
        private void CreateHall(ApplicationDbContext context, string name, string adress, int id)
        {
            var hall = new Hall
            {
                Name   = name,
                Adress = adress,
                CityId = id
            };

            context.Halls.Add(hall);
            context.SaveChanges();
        }
Beispiel #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        public void Update(HallModel model)
        {
            Hall   hall   = Mapper.Map <Hall>(model);
            string errors = Validate(hall);

            if (errors != null)
            {
                throw new ValidationException(errors);
            }

            _hallRepository.Update(hall);
        }
Beispiel #29
0
        private Hall CreateAndSaveHall(List <Row> rows)
        {
            Hall hall = new Hall
            {
                Rows = rows
            };

            applicationDbContext.Halls.Add(hall);
            applicationDbContext.SaveChanges();

            return(hall);
        }
Beispiel #30
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Hall Get(Guid id)
 {
     try
     {
         Hall hall = _entities.Where(p => p.Id.Equals(id)).FirstOrDefault();
         return(hall);
     }
     catch (Exception)
     {
         return(null);
     }
 }
        private static Hall CreateSeats(int hallSeats, Hall hall)
        {
            for (int i = 0; i < hallSeats; i++)
            {
                hall.Seats.Add(new Seat
                {
                    Hall = hall
                });
            }

            return(hall);
        }
        public void AddSessionsPack(Film film, Session session, Hall hall)
        {
            AddFilm(film);

            var hallSize = hall.Size;

            for (int i = 0; i < hallSize; i++)
            {
                var temp = new Session(film.Id, session.Hall, session.Price, session.Time, session.Status, i + 1);
                AddSession(temp);
            }
        }
Beispiel #33
0
    public Hall build(LevelData data)
    {
        hallWidth = data.getRoomWidth ();
        hallHeight = data.getRoomHeight ();
        Hall hall = new Hall (hallWidth, hallHeight);

        for (int i=0; i<hallWidth; i++) {
            for (int j=0; j<hallHeight; j++) {
                hall.setHallNode(i, j, generateHallNode(data, i, j));
            }
        }
        return hall;
    }
Beispiel #34
0
        public Center(
			IAccountFinder account_finder, 
			IFishStageQueryer fish_stage_queryer, 
			IGameRecorder rq, 
			ITradeNotes trade_account)
        {
            _GameRecorder = rq;
            _AccountFinder = account_finder;
            _FishStageQueryer = fish_stage_queryer;
            _Tradefinder = trade_account;

            _Updater = new Updater();
            _Hall = new Hall();
        }
 public void setHall(Hall hall)
 {
     this.hall = hall;
     hallWalls = new Dictionary<string, Dictionary<HallNode.Wall, WallData>> ();
 }
Beispiel #36
0
 public Center(IStorage storage)
 {
     _Stroage = storage;
     _Hall = new Hall();
     _Update = new Updater();
 }
Beispiel #37
0
 void Regulus.Framework.ILaunched.Launch()
 {
     _Hall = new Hall();
 }
Beispiel #38
0
    //function to show arrow path
    void ShowPath(bool on, List<int> arrow)
    {
        Hall hall = new Hall();
        if (on)
        {
            for (int i = 0; i < arrow.Count; i++)
            {
                rooms[arrow[i]].GetComponent<Room>().arrow = on;
                if (i == 0)
                {
                    hall.DrawLine(rooms[player.room], rooms[arrow[i]]);
                    if(arrow.Count > 1)
                        hall.DrawLine(rooms[arrow[i]], rooms[arrow[i+1]]);
                }
                else if (i + 1 < arrow.Count)
                    hall.DrawLine(rooms[arrow[i]], rooms[arrow[i + 1]]);
            }
        }

        else
        {
            for (int i = 0; i < arrow.Count; i++)
            {
                if (i == 0)
                {
                    StartCoroutine(HidePath(rooms[player.room]));   //needed to not hide path immediately
                    StartCoroutine(HidePath(rooms[arrow[i]]));
                }
                else
                    StartCoroutine(HidePath(rooms[arrow[i]]));
            }
        }
    }