示例#1
0
        public void SavePlayerSkills(Bitmap bitmap)
        {
            Directory.CreateDirectory($"{OutputDirectoryDated}/Skill");

            for (int i = 0; i < 4; i++)
            {
                var skill = cropWindowService.CropSkill(bitmap, i);

                skill.Save($"{OutputDirectoryDated}/Skill/Skill{i}.png");
            }
        }
        public void Extract(Bitmap bitmap)
        {
            if (bitmap == null)
            {
                return;
            }

            for (int i = 0; i < 6; i++)
            {
                var oldSkill = modelService.GetSkill(i);

                var visibleSkillBitmap = imageService.CropSkill(bitmap, i);
                var newSkill           = ExtractSkill(visibleSkillBitmap, i, bitmap);

                modelService.SetSkill(i, newSkill);

                if (newSkill?.CanBeCasted == true)
                {
                    Publish(new SkillCanBeCastedEvent {
                        SkillIndex = i, SkillName = newSkill.Name
                    });
                }

                if (newSkill?.Name != oldSkill?.Name)
                {
                    Publish(new SkillRecognitionChangedEvent {
                        Index = i, NewSkillName = newSkill?.Name ?? SkillName.None
                    });
                }
            }
        }