/** 服务器添加物品 */
    public void onAddItemsByServer(IntIntMap autoUseItems, IntObjectMap <ItemData> dic, int way)
    {
        bool need = CallWayConfig.get(way).needAddItemNotice;

        if (need)
        {
            _tempAddItems.clear();

            if (autoUseItems != null)
            {
                autoUseItems.forEach((k, v) =>
                {
                    _tempAddItems.add(GameC.player.bag.createItem(k, v));
                });
            }
        }

        if (dic != null)
        {
            foreach (var kv in dic.entrySet())
            {
                doAddItemByServer(kv.key, kv.value, way);
            }
        }

        onChanged();

        if (CallWayConfig.get(way).needAddItemNotice)
        {
            //TODO:合并因为到达单个物品上限的拆分问题
            onAddItemNotice(_tempAddItems, way);
            _tempAddItems.clear();
        }
    }
Exemple #2
0
    protected void modelLoadOver(GameObject obj)
    {
        if (!_unit.enabled)
        {
            return;
        }

        _modelReady = true;

        onModelLoadOver(_showModelID, obj);

        foreach (var kv in _partReady.entrySet())
        {
            onPartLoadOver(kv.key, _partDic.get(kv.key), kv.value);
        }
    }
    /** 重新构造辅助数据 */
    private void reMakeData()
    {
        _itemNums.clear();
        _dicByID.clear();

        foreach (var kv in _dic.entrySet())
        {
            ItemData v = kv.value;
            //绑定index
            v.index = kv.key;
            v.reloadConfig();

            getItemDicByIDAbs(v.id).put(v.index, v);

            _itemNums.addValue(v.id, v.num);
        }
    }