コード例 #1
0
        public Report2DResultViewModel(GameReport2DTemplate template)
        {
            Name = template.GameReport2DTemplateName;
            var rowsSet = GenerateSet(template, template.FirstCharacterGroup);

            var columnsSet = GenerateSet(template, template.SecondCharacterGroup);

            Rows    = GetChildGroups(rowsSet);
            Columns = GetChildGroups(columnsSet);

            Values = rowsSet.SelectMany(row => columnsSet.Select(column => new { row, column }))
                     .ToDictionary(
                x => new KeyValuePair <int, int>(x.row.Key, x.column.Key),
                x => new CellValue(x.row.Value.Characters.Intersect(x.column.Value.Characters).ToList())
                );
        }
コード例 #2
0
        private static Dictionary <int, GroupChars> GenerateSet(GameReport2DTemplate template, CharacterGroup group)
        {
            var rowsSet = group.ChildGroups
                          .Where(g => !g.IsSpecial || !g.ChildGroups.Any())
                          .ToDictionary(
                g => g.CharacterGroupId,
                g => new GroupChars {
                Name = g.CharacterGroupName, Characters = GetFlatCharacters(g)
            });

            rowsSet.Add(-1,
                        new GroupChars
            {
                Name       = null,
                Characters = template.Project.Characters
                             .Except(rowsSet.SelectMany(r => r.Value.Characters)).ToList(),
            });
            return(rowsSet);
        }