Esempio n. 1
0
        public static FreeUIUtil.Rectangle GetXY(IEventArgs args, IList <IFreeComponent> list, int index, int screenW, int screenH)
        {
            IFreeComponent component = list[index];
            int            x         = FreeUtil.ReplaceInt(component.GetX(args), args);
            int            y         = FreeUtil.ReplaceInt(component.GetY(args), args);
            int            re        = FreeUtil.ReplaceInt(component.GetRelative(args), args);
            int            p         = FreeUtil.ReplaceInt(component.GetParent(args), args);

            if (p == 0)
            {
                return(GetXY(0, 0, screenW, screenH, x, y, re));
            }
            else
            {
                FreeUIUtil.Rectangle rec = GetXY(args, list, p - 1, screenW, screenH);
                return(GetXY(rec.x, rec.y, screenW, screenH, x, y, re));
            }
        }
Esempio n. 2
0
 public virtual bool In(FreeUIUtil.Rectangle r)
 {
     return((r.x <= x + width && r.x + r.width >= x) && (r.y <= y + height && r.y + r.height >= y));
 }
Esempio n. 3
0
        public static FreeUIUtil.Rectangle GetXY(int startX, int startY, int width, int height, int x, int y, int relative)
        {
            FreeUIUtil.Rectangle rec = new FreeUIUtil.Rectangle();
            switch (relative)
            {
            case 0:
            {
                rec.x = startX + x;
                rec.y = startY + y;
                break;
            }

            case 1:
            {
                rec.x = startX + width - x;
                rec.y = startY + y;
                break;
            }

            case 2:
            {
                rec.x = startX + x;
                rec.y = startY + height - y;
                break;
            }

            case 3:
            {
                rec.x = startX + width - x;
                rec.y = startY + height - y;
                break;
            }

            case 4:
            {
                rec.x = startX + width / 2 - x;
                rec.y = startY + height / 2 - y;
                break;
            }

            case 5:
            {
                rec.x = startX + width / 2 + x;
                rec.y = startY + height / 2 - y;
                break;
            }

            case 6:
            {
                rec.x = startX + width / 2 - x;
                rec.y = startY + height / 2 + y;
                break;
            }

            case 7:
            {
                rec.x = startX + width / 2 + x;
                rec.y = startY + height / 2 + y;
                break;
            }

            case 8:
            {
                rec.x = startX + width / 2 - x;
                rec.y = startY + y;
                break;
            }

            case 9:
            {
                rec.x = startX + width / 2 - x;
                rec.y = startY + height - y;
                break;
            }

            case 10:
            {
                rec.x = startX + x;
                rec.y = startY + height / 2 - y;
                break;
            }

            case 11:
            {
                rec.x = startX + width - x;
                rec.y = startY + height / 2 - y;
                break;
            }

            default:
            {
                break;
            }
            }
            return(rec);
        }