Пример #1
0
        /// <summary>
        /// 舰娘能否佩戴该装备,可以返回true,否则返回false;舰娘、装备没有找到都返回false
        /// </summary>
        /// <param name="shipId">舰娘id</param>
        /// <param name="itemId">装备id</param>
        /// <returns></returns>
        public bool CanShipEquipItem(int shipId, int itemId)
        {
            KancolleShipData ship;

            if (ShipDataDictionary.TryGetValue(shipId, out ship))
            {
                KancolleShipType shipType;
                //找到舰娘类型
                if (ShipTypeDictionary.TryGetValue(ship.Type, out shipType))
                {
                    //舰娘的可装备字典
                    var dic = shipType.EquipItemType;
                    KancolleSlotItemData item;
                    //找到装备
                    if (SlotDictionary.TryGetValue(itemId, out item))
                    {
                        //item3为该装备的装备类型
                        if (dic.ContainsKey(item.Type.Item3))
                        {
                            //可装备(1)则为true,否则为false
                            return(dic[item.Type.Item3] != 0);
                        }
                    }
                }
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// 获取装备名,若不存在则返回null
        /// </summary>
        /// <param name="ownedItem"></param>
        /// <returns></returns>
        public string GetSlotItemName(KancolleSlotItem ownedItem)
        {
            KancolleSlotItemData itemData;

            if (SlotDictionary.TryGetValue(ownedItem.SlotItemId, out itemData))
            {
                return(itemData.Name);
            }
            return(null);
        }