Пример #1
0
        public override bool InRectange(FreeUIUtil.Rectangle rec, IEventArgs args)
        {
            if (pos == null || change)
            {
                pos = selector.Select(args);
            }
            int   px = (int)(pos.GetX());
            int   py = (int)(pos.GetY());
            float r  = 0f;

            try
            {
                r = float.Parse(radius);
            }
            catch (Exception)
            {
                r = FreeUtil.ReplaceFloat(radius, args);
            }
            float x1 = rec.x - r;
            float x2 = rec.x + rec.width + r;
            float y1 = rec.y - r;
            float y2 = rec.y + rec.height + r;

            // 圆心在矩形的加上圆半径的范围内
            return(px >= x1 && px <= x2 && py >= y1 && py <= y2);
        }
Пример #2
0
 public virtual FreeUIUtil.Rectangle GetItemRegion(IEventArgs args, int screenW, int screenH)
 {
     Initial(args);
     FreeUIUtil.Rectangle rec = FreeUIUtil.GetXY(0, 0, screenW, screenH, iX, iY, FreeUtil.ReplaceInt(relative, args));
     rec.width  = iWidth;
     rec.height = iHeight;
     return(rec);
 }
Пример #3
0
 public virtual FreeUIUtil.Rectangle GetItemRegion(ItemInventory inventory, IEventArgs args, int screenW, int screenH, ItemPosition ip)
 {
     Initial(args);
     FreeUIUtil.Rectangle rec = GetItemRegion(args, screenW, screenH);
     rec.x = rec.x + ip.GetX() * itemWidth + (int)MyMath.Max(0, (ip.GetX() - 1)) * GetWidthMargin(inventory, args);
     rec.y = rec.y + ip.GetY() * itemHeight + (int)MyMath.Max(0, (ip.GetY() - 1)) * GetHeightMargin(inventory, args);
     return(rec);
 }
Пример #4
0
        public static void MoveItem(string key, FreeData fd, ISkillArgs args, int x, int y, int toGlobalX, int toGlobalY, int stageWidth, int stageHeigth, int fromGlobalX, int fromGlobalY)
        {
            toGlobalY   = stageHeigth - toGlobalY;
            fromGlobalY = stageHeigth - fromGlobalY;
            ItemPosition ip = GetItemPosition(args, key, fd.freeInventory.GetInventoryManager());

            if (ip != null)
            {
                InventoryManager     invManager = fd.freeInventory.GetInventoryManager();
                ItemInventory        fromInv    = ip.GetInventory();
                ItemInventory        toInv      = null;
                FreeUIUtil.Rectangle rec        = null;
                foreach (string inv in invManager.GetInventoryNames())
                {
                    ItemInventory ii = invManager.GetInventory(inv);
                    if (ii != null && ii.IsOpen())
                    {
                        rec = ((SimpleInventoryUI)ii.GetInventoryUI()).GetItemRegion(args, stageWidth, stageHeigth);
                        if (rec.In(toGlobalX, toGlobalY))
                        {
                            toInv = ii;
                            break;
                        }
                    }
                }
                if (toInv == fromInv || toInv == null)
                {
                    ItemInventoryUtil.MovePosition(ip.GetInventory(), ip.GetInventory(), (SimpleInventoryUI)fromInv.GetInventoryUI(), (SimpleInventoryUI)fromInv.GetInventoryUI(), ip, x, y, args);
                }
                else
                {
                    FreeUIUtil.Rectangle itemRec = ((SimpleInventoryUI)fromInv.GetInventoryUI()).GetItemRegion(fromInv, args, stageWidth, stageHeigth, ip);
                    ItemInventoryUtil.MovePosition(ip.GetInventory(), invManager.GetInventory(toInv.GetName()), (SimpleInventoryUI)fromInv.GetInventoryUI(), (SimpleInventoryUI)toInv.GetInventoryUI(), ip, toGlobalX - rec.x - (fromGlobalX - itemRec.x), toGlobalY
                                                   - rec.y - (fromGlobalY - itemRec.y), args);
                }
            }
        }
Пример #5
0
 public override bool InRectange(FreeUIUtil.Rectangle arg1, IEventArgs arg2)
 {
     return(false);
 }
Пример #6
0
 public abstract bool InRectange(FreeUIUtil.Rectangle arg1, IEventArgs arg2);