Exemple #1
0
    public bool UpdataShop(int[] objIDs)
    {
        mBuyItemList.Clear();
        m_ShopIDList.Clear();
        foreach (int objID in objIDs)
        {
            ItemObject itemObj = ItemMgr.Instance.Get(objID);

            if (null != itemObj)
            {
                //LogManager.Debug("a item is on sell!ID:" + objID);
                ShopData data = ShopRespository.GetShopDataByItemId(itemObj.protoId);
                if (data == null)
                {
                    LogManager.Error("data is null! itemID = ", itemObj.protoId);
                    mBuyItemList.Add(null);
                    m_ShopIDList.Add(-1);
                    continue;
                }

                //itemObj.CountUp(data.m_LimitNum);
                mBuyItemList.Add(itemObj);
                m_ShopIDList.Add(data.m_ID);
            }
            else
            {
                LogManager.Error("itemObj is null! ID = ", objID);
                mBuyItemList.Add(null);
                m_ShopIDList.Add(-1);
                continue;
            }
        }
        return(true);
    }
Exemple #2
0
    public bool AddNewItemOnSell(int objID, int index)
    {
        ItemObject itemObj = ItemMgr.Instance.Get(objID);

        if (null != itemObj)
        {
            LogManager.Info("An item is on sell!ID:", objID);
            ShopData data = ShopRespository.GetShopDataByItemId(itemObj.protoId);
            itemObj.IncreaseStackCount(data.m_LimitNum);
            mBuyItemList[index] = itemObj;
            m_ShopIDList[index] = data.m_ID;
        }
        else
        {
            LogManager.Error("itemObj is null! ID = ", objID);
            return(false);
        }
        return(true);
    }
Exemple #3
0
    /// <summary>
    /// 多人模式初始化商店所售物品
    /// </summary>
    public void InitNpcShopWhenMultiMode(int npcid, int[] ids)
    {
        if (!mInit)
        {
            InitWindow();
        }
        //npc = NpcManager.Instance.GetNpc(npcid);
        //m_CurNpcName = npc.NpcName;

        GameUI.Instance.mNpcWnd.Hide();

        mBuyItemList.Clear();
        m_ShopIDList.Clear();
        foreach (int id in ids)
        {
            ItemObject itemObj = ItemMgr.Instance.Get(id);
            if (null != itemObj)
            {
                //LogManager.Debug("a item is on sell!ID:" + objID);
                ShopData data = ShopRespository.GetShopDataByItemId(itemObj.protoId);
                if (data == null)
                {
                    LogManager.Error("data is null! itemID = ", itemObj.protoId);
                    mBuyItemList.Add(null);
                    m_ShopIDList.Add(-1);
                    continue;
                }

                //itemObj.CountUp(data.m_LimitNum);
                mBuyItemList.Add(itemObj);
                m_ShopIDList.Add(data.m_ID);
            }
            else
            {
                LogManager.Error("itemObj is null!");
                mBuyItemList.Add(null);
                m_ShopIDList.Add(-1);
                continue;
            }
        }

        m_CurNpcID = npcid;

        //mRepurchaseList.Clear();
        //foreach (int objID in repurcaseId)
        //{
        //	ItemObject itemObj = ItemMgr.Instance.Get(objID);

        //	if (null != itemObj)
        //	{
        //		//LogManager.Debug("a item is on sell!ID:" + objID);
        //		mRepurchaseList.Add(itemObj);
        //	}
        //	else
        //	{
        //		mRepurchaseList.Add(null);
        //		continue;
        //	}

        //}

        ResetItem();

        if (!isShow)
        {
            Show();
        }
    }