Esempio n. 1
0
        public Statistics(LogList logList, ImageProvider imageProvider)
        {
            var refreshButton = new Button {
                Text = "Refresh statistics for current filter"
            };

            BeginVertical(new Padding(5));
            {
                BeginHorizontal();
                {
                    Add(null, true);
                    Add(refreshButton);
                    Add(null, true);
                }
                EndHorizontal();
            }
            EndVertical();

            BeginVertical();
            {
                BeginHorizontal();
                {
                    BeginGroup("Profession counts", new Padding(5), new Size(5, 5), xscale: true);
                    {
                        foreach (var profession in GameData.Professions.Select(x => x.profession))
                        {
                            professionCountLabels[profession] = new Label {
                                Text = "Unknown"
                            };

                            BeginHorizontal();
                            {
                                var imageView = new ImageView {
                                    Image = imageProvider.GetTinyProfessionIcon(profession)
                                };
                                Add(imageView);
                                Add(professionCountLabels[profession]);
                            }
                            EndHorizontal();
                        }

                        Add(null);
                    }
                    EndGroup();

                    BeginGroup("Specialization counts", xscale: true);
                    {
                        // Core specializations (no elite)
                        BeginHorizontal();
                        {
                            BeginVertical(new Padding(5), new Size(5, 5));
                            {
                                foreach (var profession in GameData.Professions.Select(x => x.profession))
                                {
                                    specializationCoreCountLabels[profession] = new Label {
                                        Text = "Unknown"
                                    };

                                    BeginHorizontal();
                                    {
                                        var imageView = new ImageView
                                        {
                                            Image = imageProvider.GetTinyProfessionIcon(profession)
                                        };
                                        Add(imageView);
                                        Add(specializationCoreCountLabels[profession]);
                                    }
                                    EndHorizontal();
                                }

                                Add(null);
                            }
                            EndVertical();

                            // Heart of Thorns elite specializations
                            BeginVertical(new Padding(5), new Size(5, 5));
                            {
                                foreach (var specialization in GameData.Professions.Select(x => x.hot))
                                {
                                    specializationEliteCountLabels[specialization] = new Label {
                                        Text = "Unknown"
                                    };

                                    BeginHorizontal();
                                    {
                                        var imageView = new ImageView
                                        {
                                            Image = imageProvider.GetTinyProfessionIcon(specialization)
                                        };
                                        Add(imageView);
                                        Add(specializationEliteCountLabels[specialization]);
                                    }
                                    EndHorizontal();
                                }

                                Add(null);
                            }
                            EndVertical();

                            // Path of Fire elite specializations
                            BeginVertical(new Padding(5), new Size(5, 5));
                            {
                                foreach (var specialization in GameData.Professions.Select(x => x.pof))
                                {
                                    specializationEliteCountLabels[specialization] = new Label {
                                        Text = "Unknown"
                                    };

                                    BeginHorizontal();
                                    {
                                        var imageView = new ImageView
                                        {
                                            Image = imageProvider.GetTinyProfessionIcon(specialization)
                                        };
                                        Add(imageView);
                                        Add(specializationEliteCountLabels[specialization]);
                                    }
                                    EndHorizontal();
                                }

                                Add(null);
                            }
                            EndVertical();
                        }
                        EndHorizontal();
                    }
                    EndGroup();
                }
                EndHorizontal();
            }
            EndVertical();
            AddSeparateRow(null);

            refreshButton.Click += (sender, args) =>
            {
                var professionCounts = new Dictionary <Profession, int>();

                var specializationCoreCounts  = new Dictionary <Profession, int>();
                var specializationEliteCounts = new Dictionary <EliteSpecialization, int>();
                int logCount = 0;

                foreach (Profession profession in Enum.GetValues(typeof(Profession)))
                {
                    professionCounts[profession]         = 0;
                    specializationCoreCounts[profession] = 0;
                }

                foreach (EliteSpecialization specialization in Enum.GetValues(typeof(EliteSpecialization)))
                {
                    specializationEliteCounts[specialization] = 0;
                }

                foreach (var log in logList.DataStore)
                {
                    if (log.ParsingStatus != ParsingStatus.Parsed)
                    {
                        continue;
                    }

                    foreach (var player in log.Players)
                    {
                        professionCounts[player.Profession]++;
                        if (player.EliteSpecialization == EliteSpecialization.None)
                        {
                            specializationCoreCounts[player.Profession]++;
                        }
                        else
                        {
                            specializationEliteCounts[player.EliteSpecialization]++;
                        }
                    }

                    logCount++;
                }

                foreach (var pair in professionCountLabels)
                {
                    var profession = pair.Key;
                    var label      = pair.Value;
                    var count      = professionCounts[profession];
                    label.Text = $"{count} ({count / (float) logCount:0.00} on average)";
                }

                foreach (var pair in specializationCoreCountLabels)
                {
                    var profession = pair.Key;
                    var label      = pair.Value;
                    var count      = specializationCoreCounts[profession];
                    label.Text = $"{count}";
                }

                foreach (var pair in specializationEliteCountLabels)
                {
                    var specialization = pair.Key;
                    var label          = pair.Value;
                    var count          = specializationEliteCounts[specialization];
                    label.Text = $"{count}";
                }
            };
        }
Esempio n. 2
0
        public AdvancedFilters(ManagerForm managerForm, ImageProvider imageProvider)
        {
            BeginVertical(new Padding(5));
            {
                BeginGroup("Group composition", new Padding(5));
                {
                    AddSeparateRow(new Label {
                        Text = "Not implemented yet, doesn't do anything."
                    });
                    BeginVertical();
                    {
                        BeginHorizontal();
                        {
                            Add(new Label {
                                Text = "Required classes: "
                            });
                            Add(new ImageView());
                        }
                        EndHorizontal();
                        BeginHorizontal();
                        {
                            // Core professions
                            BeginVertical(spacing: new Size(2, 2));
                            {
                                foreach (var profession in GameData.Professions.Select(x => x.profession))
                                {
                                    BeginHorizontal();
                                    {
                                        Add(imageProvider.GetTinyProfessionIcon(profession));
                                        Add(new Label
                                        {
                                            Text = profession.ToString(),
                                            VerticalAlignment = VerticalAlignment.Center,
                                        });
                                        Add(new TextStepper()
                                        {
                                            Width = 50
                                        });
                                        Add(null);
                                    }
                                    EndHorizontal();
                                }
                            }
                            EndVertical();
                            // HoT elite specializations
                            BeginVertical(spacing: new Size(2, 2));
                            {
                                foreach (var specialization in GameData.Professions.Select(x => x.hot))
                                {
                                    BeginHorizontal();
                                    {
                                        Add(imageProvider.GetTinyProfessionIcon(specialization));
                                        Add(new Label
                                        {
                                            Text = specialization.ToString(),
                                            VerticalAlignment = VerticalAlignment.Center,
                                        });
                                        Add(new TextStepper()
                                        {
                                            Width = 50
                                        });
                                        Add(null);
                                    }
                                    EndHorizontal();
                                }
                            }
                            EndVertical();
                            // PoF elite specializations
                            BeginVertical(spacing: new Size(2, 2));
                            {
                                foreach (var specialization in GameData.Professions.Select(x => x.pof))
                                {
                                    BeginHorizontal();
                                    {
                                        Add(imageProvider.GetTinyProfessionIcon(specialization));
                                        Add(new Label
                                        {
                                            Text = specialization.ToString(),
                                            VerticalAlignment = VerticalAlignment.Center,
                                        });
                                        Add(new TextStepper()
                                        {
                                            Width = 50
                                        });
                                        Add(null);
                                    }
                                    EndHorizontal();
                                }
                            }
                            EndVertical();
                        }
                        EndHorizontal();
                    }
                    EndVertical();
                }
                EndGroup();
            }
            EndVertical();

            var unparsedCheckBox = new CheckBox {
                Text = "Unparsed"
            };

            unparsedCheckBox.CheckedBinding.Bind(managerForm, x => x.ShowParseUnparsedLogs);
            var parsingCheckBox = new CheckBox {
                Text = "Parsing"
            };

            parsingCheckBox.CheckedBinding.Bind(managerForm, x => x.ShowParseParsingLogs);
            var parsedCheckBox = new CheckBox {
                Text = "Parsed"
            };

            parsedCheckBox.CheckedBinding.Bind(managerForm, x => x.ShowParseParsedLogs);
            var failedCheckBox = new CheckBox {
                Text = "Failed"
            };

            failedCheckBox.CheckedBinding.Bind(managerForm, x => x.ShowParseFailedLogs);
            BeginVertical(new Padding(5));
            {
                BeginGroup("Parsing status", new Padding(5));
                {
                    AddRow(unparsedCheckBox, parsingCheckBox, parsedCheckBox, failedCheckBox);
                }
                EndGroup();
            }
            EndVertical();
        }
Esempio n. 3
0
        public SquadCompositionFilterPanel(ImageProvider imageProvider, LogFilters filters)
        {
            var filterSnapshot = filters.CompositionFilters.DeepClone();

            BeginVertical(spacing: new Size(5, 5));
            {
                BeginHorizontal();
                {
                    // Core professions
                    BeginVertical(spacing: new Size(2, 2));
                    {
                        foreach (var filter in filterSnapshot.CoreProfessionFilters)
                        {
                            BeginHorizontal();
                            {
                                var image = new ImageView {
                                    Image   = imageProvider.GetTinyProfessionIcon(filter.Profession),
                                    ToolTip = $"Core {GameNames.GetName(filter.Profession)}"
                                };
                                Add(image);
                                Add(ConstructDropDown(filter));
                                Add(ConstructStepper(filter));
                                Add(null);
                            }
                            EndHorizontal();
                        }
                    }
                    EndVertical();

                    // Elite specializations
                    var specializationFilterGroups = new[] {
                        filterSnapshot.HeartOfThornsSpecializationFilters,
                        filterSnapshot.PathOfFireSpecializationFilters
                    };
                    foreach (var specializationFilters in specializationFilterGroups)
                    {
                        BeginVertical(spacing: new Size(2, 2));
                        {
                            foreach (var filter in specializationFilters)
                            {
                                BeginHorizontal();
                                {
                                    var image = new ImageView {
                                        Image   = imageProvider.GetTinyProfessionIcon(filter.EliteSpecialization),
                                        ToolTip = GameNames.GetName(filter.EliteSpecialization)
                                    };
                                    Add(image);
                                    Add(ConstructDropDown(filter));
                                    Add(ConstructStepper(filter));
                                    Add(null);
                                }
                                EndHorizontal();
                            }
                        }
                        EndVertical();
                    }
                }
                EndHorizontal();
            }
            EndVertical();

            BeginVertical(new Padding(5, 5), new Size(5, 5));
            {
                AddRow(null, ConstructResetButton(filterSnapshot), ConstructApplyButton(filters, filterSnapshot));
            }
            EndVertical();
        }
Esempio n. 4
0
        public SpecializationStatistics(ImageProvider imageProvider)
        {
            BeginVertical();
            {
                BeginHorizontal();
                {
                    BeginGroup("Profession counts", new Padding(5), new Size(5, 5), xscale: true);
                    {
                        foreach (var profession in ProfessionData.Professions.Select(x => x.Profession))
                        {
                            professionCountLabels[profession] = new Label {
                                Text = "Unknown"
                            };

                            BeginHorizontal();
                            {
                                var imageView = new ImageView
                                {
                                    Image   = imageProvider.GetTinyProfessionIcon(profession),
                                    ToolTip = GameNames.GetName(profession)
                                };
                                Add(imageView);
                                Add(professionCountLabels[profession]);
                            }
                            EndHorizontal();
                        }

                        Add(null);
                    }
                    EndGroup();

                    BeginGroup("Specialization counts", xscale: true);
                    {
                        BeginHorizontal();
                        {
                            BeginVertical(new Padding(5), new Size(5, 5));
                            {
                                foreach (var profession in ProfessionData.Professions)
                                {
                                    BeginHorizontal();
                                    {
                                        coreCountLabels[profession.Profession] = new Label {
                                            Text = "Unknown", Width = 60
                                        };
                                        var coreImage = new ImageView
                                        {
                                            Image   = imageProvider.GetTinyProfessionIcon(profession.Profession),
                                            ToolTip = $"Core {GameNames.GetName(profession.Profession)}"
                                        };
                                        Add(coreImage);
                                        Add(coreCountLabels[profession.Profession]);

                                        foreach (var specialization in new[] { profession.HoT, profession.PoF })
                                        {
                                            eliteCountLabels[specialization] = new Label {
                                                Text = "Unknown", Width = 60
                                            };
                                            var image = new ImageView
                                            {
                                                Image   = imageProvider.GetTinyProfessionIcon(specialization),
                                                ToolTip = GameNames.GetName(specialization)
                                            };
                                            Add(image);
                                            Add(eliteCountLabels[specialization]);
                                        }
                                    }
                                    EndHorizontal();
                                }

                                Add(null);
                            }
                            EndVertical();
                        }
                        EndHorizontal();
                    }
                    EndGroup();
                    Add(null);
                }
                EndHorizontal();

                Add(null, yscale: true);
            }
            EndVertical();
            AddSeparateRow(null);
        }