Пример #1
0
    public void MoveItem(int fromPanel, int toPanel, UInt64 uuId, UInt64 uuOtherId)
    {
        sdMainChar mc = sdGameLevel.instance.mainChar;

        sdGameItem itemFrom = getItem(uuId);
        sdGameItem itemTo   = getItem(uuOtherId);

        if (itemFrom != null)
        {
            itemFrom.bagIndex = toPanel;
            if (toPanel == 0)
            {
                itemDB.Remove(uuId);
            }
        }
        if (itemTo != null)
        {
            itemTo.bagIndex = fromPanel;
        }

        if (fromPanel == (int)PanelType.Panel_Bag)
        {
            //从背包穿装备..
            if (toPanel == (int)PanelType.Panel_Equip)
            {
                if (itemTo != null)
                {
                    itemTo.takeOff(mc);
                }
                if (itemFrom != null)
                {
                    itemFrom.takeOn(mc);
                }
            }
            //出售装备..
            else if (toPanel == 0)
            {
            }
        }
        else if (fromPanel == (int)PanelType.Panel_Equip)
        {
            if (itemFrom != null)
            {
                itemFrom.takeOff(mc);
            }
            Hashtable  info  = sdConfDataMgr.Instance().GetItemById(itemFrom.templateID.ToString());
            sdGameItem dummy = mc.getStartItem(int.Parse(info["Character"].ToString()));
            if (dummy != null)
            {
                dummy.takeOnNake(mc);
            }
        }

        int type = 0;

        type |= fromPanel;
        type |= toPanel;
        sdSlotMgr.Instance.Notify(type);
    }
Пример #2
0
    public void RemoveItem(UInt64 uuId)
    {
        sdGameItem item = getItem(uuId);

        if (item.bagIndex == (int)PanelType.Panel_Equip)
        {
            sdMainChar mc = sdGameLevel.instance.mainChar;
            if (mc != null)
            {
                item.takeOff(mc);
                Hashtable  info  = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                sdGameItem dummy = mc.getStartItem(int.Parse(info["Character"].ToString()));
                if (dummy != null)
                {
                    dummy.takeOnNake(mc);
                }
            }
        }
        itemDB.Remove(uuId);
    }