public Popup(Image defaultImage) { this.defaultImage = defaultImage; this.Opacity = 0; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.Manual; this.BackColor = Color.White; control = new DailyAchievement() { IconSize = new Size(64, 64), IconVisible = true, NameVisible = true, NameFont = new System.Drawing.Font("Segoe UI Semibold", 11f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))), DescriptionVisible = true, DescriptionFont = new System.Drawing.Font("Segoe UI Semilight", 9.75f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), LevelVisible = true, LevelFont = new System.Drawing.Font("Segoe UI Semilight", 8.5f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Location = new Point(5, 5), Anchor = AnchorStyles.Top | AnchorStyles.Left, BackColor = Color.White, }; this.Controls.Add(control); }
public static void Can_have_a_product_requirement(DailyAchievement actual) { if (actual.RequiredAccess is not null) { Assert.Subset( new HashSet <ProductName> { HeartOfThorns, PathOfFire }, new HashSet <ProductName> { actual.RequiredAccess.Product } ); Assert.True( Enum.IsDefined(typeof(AccessCondition), actual.RequiredAccess.Condition) ); } }
private void SetupControls(DailyAchievements.Dailies dailies) { if (reusable == null) { reusable = new Util.ReusableControls(); } else { reusable.ReleaseAll(); } var achievements = reusable.CreateOrAll <DailyAchievement>(dailies.Count, delegate { var control = new DailyAchievement() { BackColor = Color.White, NameVisible = true, NameFont = fontName, IconSize = new Size(32, 32), IconVisible = true, Size = new Size(panelContent.Width, 50), Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, }; control.MouseEnter += control_MouseEnter; control.MouseLeave += control_MouseLeave; return(control); }); var bars = reusable.CreateOrAll <DailyCategoryBar>(dailies.Categories.Length + 1, delegate { var bar = new DailyCategoryBar() { Font = fontBar, BackColor = SystemColors.ControlLight, Size = new Size(panelContent.Width, 35), Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, }; bar.Collapsed += bar_Collapsed; bar.Expanded += bar_Expanded; return(bar); }); int x = 0, y = 0; //var primaryCategories = 3; //var lowLevel = new List<Control>(4); //int gi = 0, // gii; byte id = 0; var groups = this.groups = new DailyGroup[dailies.Categories.Length + 1]; var lowlevel = new DailyGroup() { id = 0, dailies = new DailyAchievements.Daily[4], collapsed = Settings.HiddenDailyCategories[0].Value, }; bool addedLow = false; int firstIndex = 0, lastIndex = groups.Length - 1; foreach (var c in dailies.Categories) { if (c.Name == "Fractals" && !addedLow) { if (lowlevel.collapsed) { groups[lastIndex--] = lowlevel; } else { groups[firstIndex++] = lowlevel; } addedLow = true; } id++; var group = new DailyGroup() { id = id, dailies = new DailyAchievements.Daily[c.Dailies.Length], collapsed = Settings.HiddenDailyCategories[id].Value, }; foreach (var d in c.Dailies) { if (d.MaxLevel < 80) { lowlevel.dailies[lowlevel.count++] = d; } else { group.dailies[group.count++] = d; } } if (group.count > 0) { var bar = group.bar = bars.GetNext(); bar.SetState(group.collapsed); bar.Text = c.Name; } if (group.collapsed) { groups[lastIndex--] = group; } else { groups[firstIndex++] = group; } } if (lowlevel.count > 0) { var bar = lowlevel.bar = bars.GetNext(); bar.Tag = lowlevel; bar.SetState(lowlevel.collapsed); bar.Text = "Pre level 80"; } if (!addedLow) { groups[firstIndex++] = lowlevel; } if (firstIndex != groups.Length) { var count = groups.Length - firstIndex; if (count > 1) { Array.Reverse(groups, firstIndex, count); } } firstIndex = 0; foreach (var group in groups) { group.index = firstIndex++; if (group.count > 0) { var bar = group.bar; bar.Tag = group; bar.Location = new Point(x, y); bar.Visible = true; y += bar.Height + 1; var visible = !group.collapsed; group.controls = new DailyAchievement[group.count]; for (var i = 0; i < group.count; i++) { var control = group.controls[i] = achievements.GetNext(); var d = group.dailies[i]; control.Daily = d; control.IconValue = d.Icon != null ? d.Icon : imageDefault; control.Location = new Point(x, y); control.Visible = visible; if (visible) { y += control.Height + 1; } } if (visible) { y--; } } } while (bars.HasNext) { bars.GetNext().Visible = false; } while (achievements.HasNext) { achievements.GetNext().Visible = false; } panelContent.Height = y; scrollV.Maximum = y - panelContainer.Height; if (bars.New != null) { panelContent.Controls.AddRange(bars.New); } if (achievements.New != null) { panelContent.Controls.AddRange(achievements.New); } }
public static void Max_level_is_between_1_and_80(DailyAchievement actual) => Assert.InRange(actual.Level.Max, 1, 80);
public static void Id_is_positive(DailyAchievement actual) => Assert.InRange(actual.Id, 1, int.MaxValue);