public virtual void DeleteItem(ISkillArgs args, ItemInventory inventory, ItemPosition ip)
 {
     if (delete == null)
     {
         delete = new FreeUIDeleteAction();
     }
     delete.SetKey(ip.GetUIKey());
     delete.SetScope(1);
     delete.SetPlayer("current");
     delete.Act(args);
 }
Beispiel #2
0
 private void UpdateHotKey(SimpleInventoryUI ui, IEventArgs args, ItemPosition ip)
 {
     if (ui.hotkey != null && GetHotKey() != null)
     {
         string hotkey = ui.hotkey.GetHotKey(args, ip);
         if (!StringUtil.IsNullOrEmpty(hotkey))
         {
             FreeUIUpdateAction update = new FreeUIUpdateAction();
             update.SetPlayer("current");
             update.SetScope(1);
             update.SetKey(ip.GetUIKey());
             FreeUIImageValue value = new FreeUIImageValue();
             value.SetUrl(hotkey);
             value.SetSeq(this.hotkey.ToString());
             update.AddValue(value);
             update.Act(args);
         }
     }
 }
Beispiel #3
0
        public virtual void Draw(SimpleInventoryUI ui, IEventArgs args, ItemInventory inventory, ItemPosition ip)
        {
            this.inventory = inventory;
            if (fui == null)
            {
                fui = new FreeUICreateAction();
                Sharpen.Collections.AddAll(fui.GetComponents(), components);
            }
            ip.GetParameters().AddPara(new StringPara("inventory", inventory.GetName()));
            StringPara img      = new StringPara("img", string.Empty);
            StringPara itemName = new StringPara("name", string.Empty);
            IntPara    count    = new IntPara("count", 0);

            args.GetDefault().GetParameters().TempUse(img);
            args.GetDefault().GetParameters().TempUse(count);
            args.GetDefault().GetParameters().TempUse(itemName);

            img.SetValue(ip.GetKey().GetImg());
            count.SetValue(ip.GetCount());
            itemName.SetValue(ip.GetKey().GetName());
            FreeImageComponet back = GetBackground();

            if (ui.nomouse)
            {
                back.SetNoMouse("true");
            }
            if (ui.itemFixed)
            {
                back.SetFixed("true");
            }
            int startX = GetX(args, ui, ip, back);
            int startY = GetY(args, ui, ip, back);

            if (!StringUtil.IsNullOrEmpty(notused) && !StringUtil.IsNullOrEmpty(used))
            {
                if (ip.IsUsed())
                {
                    back.SetUrl(used);
                }
                else
                {
                    back.SetUrl(notused);
                }
            }
            back.SetX(startX.ToString());
            back.SetY(startY.ToString());
            back.SetRelative(ui.relative);
            back.SetEvent(inventory.GetName() + "," + ip.GetX() + "," + ip.GetY());
            FreeImageComponet itemImg         = back;
            FreeImageComponet secondComponent = GetItemImage();

            if (secondComponent != null)
            {
                back.SetEvent(string.Empty);
                itemImg = secondComponent;
            }
            if (ui.nomouse)
            {
                itemImg.SetNoMouse("true");
            }
            if (ui.itemFixed)
            {
                itemImg.SetFixed("true");
            }
            itemImg.SetUrl(ip.GetKey().GetImg());
            itemImg.SetOriginalSize(ip.GetKey().GetItemWidth() + "," + ip.GetKey().GetItemHeight());
            if (itemImg == back)
            {
                AdjustSize(args, ui, ip, inventory, back, itemImg, startX, startY);
            }
            else
            {
                AdjustSize(args, ui, ip, inventory, back, itemImg, 0, 0);
            }
            SetCount(ip);
            fui.SetKey(ip.GetUIKey());
            fui.SetShow(inventory.IsOpen());
            fui.SetScope(1);
            fui.SetPlayer("current");
            fui.Act(args);
            UpdateHotKey(ui, args, ip);
            args.GetDefault().GetParameters().Resume("img");
            args.GetDefault().GetParameters().Resume("name");
            args.GetDefault().GetParameters().Resume("count");
        }