コード例 #1
0
        private static Point GetSkillBarLocation()
        {
            Int32Rect rect         = new Int32Rect(0, 90, 230, 650);
            Point     comparePoint = new Point(464, 742);
            Color     compareColor = ColorUtils.GetColorAt(comparePoint);

            PointGroupColorDiff points = new PointGroupColorDiff(rect,
                                                                 new Point(0, 0),
                                                                 new Point(-1, 0),
                                                                 new Point(13, 0),
                                                                 new Point(0, 1),
                                                                 new Point(0, 2)
                                                                 );

            Point exactPoint;

            using (points)
            {
                points.AddDiff(0, 1, 80);
                points.AddDiff(0, 2, 47);
                points.AddDiff(0, 3, 1);
                points.AddDiff(0, 4, 4);
                points.AddDiff(0, compareColor, 9);
                points.Tolerance = 3;
                exactPoint       = points.FindExactPoint();
            }

            return(exactPoint);
        }
コード例 #2
0
        public override void OnEnter()
        {
            base.OnEnter();
            ResetSlots();
            InitGroup();
            using (group)
            {
                Point topLeft = group.FindExactPoint();

                if (!topLeft.IsZero())
                {
                    topLeft.Offset(1, 0);
                    Debug.Log($"bar is at: {topLeft}");
                    Point relativeTopLeft = group.GetRelativePoint(topLeft);
                    for (int slot = 0; slot < NB_SLOTS; slot++)
                    {
                        slots[slot] = IsSlotEmpty(relativeTopLeft, slot);
                    }

                    for (int i = 0; i < slots.Length; i++)
                    {
                        Debug.Log($"slot {i} is empty: {slots[i]}");
                    }

                    currentSlot = 0;
                    Loot(topLeft);
                }
                else
                {
                    Debug.Log("Failed to find top bar");
                    FinishState();
                }
            }
        }