Esempio n. 1
0
        /// <summary>初始化新的角色的所有物品</summary>
        public void InitCharacter(
            int netId,
            int charId,
            out E_Bag resBag,
            out E_StoreHouse resStoreHouse,
            out E_EquipmentRegion resEqRegion
            )
        {
            // 若角色已经初始化
            if (m_bagDict.ContainsKey(netId))
            {
                resBag        = GetBag(netId);
                resStoreHouse = GetStoreHouse(netId);
                resEqRegion   = GetEquiped(netId);
                return;
            }
            // 初始化背包, 仓库, 装备区
            resBag        = m_bagPool.GetInstance();
            resStoreHouse = m_storeHousePool.GetInstance();
            resEqRegion   = m_equipmentRegionPool.GetInstance();

            E_Item[] itemInBag, itemInStoreHouse, itemEquiped;
            m_ddh.GetAndResetCharacterItemInstance(charId, out itemInBag, out itemInStoreHouse, out itemEquiped);
            resBag.Reset(itemInBag);
            resStoreHouse.Reset(itemInStoreHouse);
            resEqRegion.Reset(itemEquiped);

            // 索引各区域
            m_bagDict[netId]             = resBag as E_Bag;
            m_storeHouseDict[netId]      = resStoreHouse as E_StoreHouse;
            m_equipmentRegionDict[netId] = resEqRegion as E_EquipmentRegion;

            // 地面物品视野
            m_characterGroundItemSightDict.TryAdd(netId, new List <E_GroundItem> ());
        }
Esempio n. 2
0
        public E_Bag GetBag(int netId)
        {
            E_Bag res = null;

            m_bagDict.TryGetValue(netId, out res);
            return(res);
        }