Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        public PartialViewResult CreateGdd(Guid id)
        {
            try
            {
                var project = DbFactory.ProjectRepository.FirstById(id);

                var gdd = new ProjectGdd()
                {
                    CreationDate   = DateTime.Now,
                    Project        = project,
                    DesignerName   = LoginUtils.Designer.Name,
                    BasedOnMapping = false
                };

                gdd = DbFactory.ProjectGddRepository.Save(gdd);

                return(PartialView("_ShowGdd", gdd));
            }
            catch (Exception ex)
            {
                return(PartialView("Error", new HandleErrorInfo(ex, "Project", "CreateGdd")));
            }
        }