示例#1
0
        private void AddStatistic(KeyValuePair <string, Statistic> statistic)
        {
            //create new check box for this advancement
            var box = new CheckBox();

            box.Text            = "     " + statistic.Value.Name;
            box.Width           = 120;
            box.Margin          = new Padding(0, 0, 1, 1);
            box.ImageAlign      = ContentAlignment.MiddleLeft;
            box.Appearance      = Appearance.Button;
            box.AutoSize        = false;
            box.CheckedChanged += OnCheckedChanged;

            //find appropriate image
            if (pngs.TryGetValue(statistic.Value.Icon, out string icon))
            {
                box.Image = SpriteSheet.BitmapFromFile(icon, 16, 16);
            }
            else if (pngs.TryGetValue(statistic.Value.Icon + SpriteSheet.RESOLUTION_PREFIX + "16", out icon))
            {
                box.Image = SpriteSheet.BitmapFromFile(icon, 16, 16);
            }
            else if (gifs.TryGetValue(statistic.Value.Icon, out icon))
            {
                box.Image = Image.FromFile(icon);
            }

            statisticBoxes[statistic.Key] = box;
            statistics.Controls.Add(box);
        }
示例#2
0
        private void AddAdvancement(string key, Advancement advancement)
        {
            //create new check box for this advancement
            var box = new CheckBox();

            box.Text            = "     " + advancement.Name;
            box.Width           = 175;
            box.Margin          = new Padding(0, 0, 1, 1);
            box.ImageAlign      = ContentAlignment.MiddleLeft;
            box.Appearance      = Appearance.Button;
            box.AutoSize        = false;
            box.Tag             = advancement.Type;
            box.CheckedChanged += OnCheckedChanged;

            //find appropriate image
            if (pngs.TryGetValue(advancement.Icon, out string icon))
            {
                box.Image = SpriteSheet.BitmapFromFile(icon, 16, 16);
            }
            else if (pngs.TryGetValue(advancement.Icon + SpriteSheet.RESOLUTION_PREFIX + "16", out icon))
            {
                box.Image = SpriteSheet.BitmapFromFile(icon, 16, 16);
            }
            else if (gifs.TryGetValue(advancement.Icon, out icon))
            {
                box.Image = Image.FromFile(icon);
            }

            advancementBoxes[key] = box;
            advancements.Controls.Add(box);
        }
示例#3
0
        private void AddCriterion(KeyValuePair <string, Criterion> criterion)
        {
            //create new check box for this criterion
            var box = new CheckBox();

            box.Text       = "     " + criterion.Value.Name;
            box.Width      = 120;
            box.Margin     = new Padding(0, 0, 1, 1);
            box.ImageAlign = ContentAlignment.MiddleLeft;
            box.Appearance = Appearance.Button;
            box.AutoSize   = false;

            //find appropriate image
            if (pngs.TryGetValue(criterion.Value.Icon, out string icon))
            {
                box.Image = SpriteSheet.BitmapFromFile(icon, 16, 16);
            }
            else if (pngs.TryGetValue(criterion.Value.Icon + SpriteSheet.RESOLUTION_PREFIX + "16", out icon))
            {
                box.Image = SpriteSheet.BitmapFromFile(icon, 16, 16);
            }
            else if (gifs.TryGetValue(criterion.Value.Icon, out icon))
            {
                box.Image = Image.FromFile(icon);
            }

            criterionBoxes[criterion.Value.ParentID + "/" + criterion.Key] = box;
            criteria.Controls.Add(box);
        }