Exemple #1
0
        public static ProjectGdd ProcessGddBasedOnMapping(Project project, GddConfiguration gddConf, bool isHtml)
        {
            try
            {
                _project = project;
                _gddConf = gddConf;
                Html     = "";

                //Cria o GDD
                var gdd = new ProjectGdd()
                {
                    CreationDate   = DateTime.Now,
                    Project        = project,
                    DesignerName   = LoginUtils.Designer.Name,
                    BasedOnMapping = true
                };

                gdd = DbFactory.ProjectGddRepository.Save(gdd);

                var headerHtml =
                    $"<h1 style='text-align: center;'>{gdd.Project.Title}</h1>" +
                    "<h3 style='text-align: center;'>(Game Design Document)</h3>" +
                    $"<h4 style='text-align: center;'>Created by: {gdd.DesignerName} in {DateTime.Now.ToShortDateString()} </h4>" +
                    $"<h6 style='text-align: center; color: silver;'>Game Id: {gdd.Project.Id}</h6>" +
                    "<h6 style='text-align: center; color: silver;'>Obs.: This document have been created based on game mapping performed to this project.</h6><br/>";

                var level             = 0;
                var gddConfigSections =
                    DbFactory.GddConfigurationElementsRepository.FindAllElementsByGddId(_gddConf.Id).Where(w => w.ParentElement == null).OrderBy(o => o.PresentationOrder).ToList();
                if (gddConfigSections.Count > 0)
                {
                    Html = "<p style='text-align: justify;'><ol>";

                    foreach (var element in gddConfigSections)
                    {
                        CreateGddChapterAndSections(element, level);
                    }

                    Html = Html + "</ol></p>";
                }

                Html = headerHtml + Html;

                gdd.GddContent = Encoding.UTF8.GetBytes(Html ?? "");
                gdd            = DbFactory.ProjectGddRepository.Update(gdd);

                return(gdd);
            }
            catch (Exception ex)
            {
                throw new Exception("It haven't been possible to generate the game design document.", ex);
            }
        }
Exemple #2
0
        public PartialViewResult SaveGdd(GddConfiguration gdd, Guid idGameGenre)
        {
            try
            {
                var designer  = LoginUtils.Designer;
                var gameGenre = DbFactory.GameGenreRepository.FirstById(idGameGenre);

                gdd.Designer         = designer;
                gdd.GameGenre        = gameGenre;
                gdd.Inactive         = false;
                gdd.IsConstant       = false;
                gdd.RegistrationDate = DateTime.Now;

                DbFactory.GddConfigurationRepository.Save(gdd);

                var gdds = DbFactory.GddConfigurationRepository.FindAllGenresByDesigner(designer, false);

                return(PartialView("_TblGdds", gdds));
            }
            catch (Exception ex)
            {
                return(PartialView("Error", new HandleErrorInfo(ex, "Configuration", "SaveGdd")));
            }
        }