コード例 #1
0
    IEquippableUIItem CreateStubItemFromTempTypeAndEquippedness(System.Type tempType, bool isEquipped)
    {
        IEquippableUIItem item = Substitute.For <IEquippableUIItem>();

        if (tempType == typeof(IBowTemplate))
        {
            IBowTemplate bowTemp = Substitute.For <IBowTemplate>();
            item.GetItemTemplate().Returns(bowTemp);
        }
        else if (tempType == typeof(IWearTemplate))
        {
            IWearTemplate wearTemp = Substitute.For <IWearTemplate>();
            item.GetItemTemplate().Returns(wearTemp);
        }
        else
        {
            ICarriedGearTemplate carriedGearTemp = Substitute.For <ICarriedGearTemplate>();
            item.GetItemTemplate().Returns(carriedGearTemp);
        }
        if (isEquipped)
        {
            item.IsEquipped().Returns(true);
        }
        else
        {
            item.IsEquipped().Returns(false);
        }
        return(item);
    }
コード例 #2
0
    public TestEqpII CreateTestEqpII(System.Type tempType, out IEquippableItemIconConstArg arg)
    {
        IEquippableItemIconConstArg thisArg;
        TestEqpII         testEqpII = CreateTestEqpII(out thisArg);
        IEquippableUIItem item      = (IEquippableUIItem)thisArg.item;

        if (tempType == typeof(IBowTemplate))
        {
            item.GetItemTemplate().Returns(Substitute.For <IBowTemplate>());
        }
        else if (tempType == typeof(IWearTemplate))
        {
            item.GetItemTemplate().Returns(Substitute.For <IWearTemplate>());
        }
        else if (tempType == typeof(ICarriedGearTemplate))
        {
            item.GetItemTemplate().Returns(Substitute.For <ICarriedGearTemplate>());
        }
        else
        {
            throw new System.ArgumentException("tempType must be of type IItemTemplate");
        }

        arg = thisArg;
        return(testEqpII);
    }
コード例 #3
0
    IEquippableUIItem CreateItemWithMaxEqpQAndTemplate(int maxEqpQ, System.Type type)
    {
        IEquippableUIItem eqpItem = Substitute.For <IEquippableUIItem>();

        eqpItem.GetMaxEquippableQuantity().Returns(maxEqpQ);
        if (type == typeof(IBowTemplate))
        {
            eqpItem.GetItemTemplate().Returns(Substitute.For <IBowTemplate>());
        }
        else if (type == typeof(IWearTemplate))
        {
            eqpItem.GetItemTemplate().Returns(Substitute.For <IWearTemplate>());
        }
        else
        {
            eqpItem.GetItemTemplate().Returns(Substitute.For <ICarriedGearTemplate>());
        }
        return(eqpItem);
    }
コード例 #4
0
        public override bool HasItemSpace(IUIItem item)
        {
            CheckPassedIUIItemTypeValidity(item);
            IEquippableUIItem eqpItem  = item as IEquippableUIItem;           //safe
            IItemTemplate     itemTemp = eqpItem.GetItemTemplate();

            if (itemTemp is IBowTemplate && !eqpItem.IsEquipped())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        public override bool HasItemSpace(IUIItem item)
        {
            CheckPassedIUIItemTypeValidity(item);
            IEquippableUIItem eqpItem     = item as IEquippableUIItem;        //safe
            IItemTemplate     eqpItemTemp = eqpItem.GetItemTemplate();

            if (eqpItemTemp is ICarriedGearTemplate)
            {
                int maxEquippableQuantity = eqpItem.GetMaxEquippableQuantity();
                int equippedQuantity      = this.GetItemQuantity(eqpItem);
                int space = maxEquippableQuantity - equippedQuantity;
                return(space > 0);
            }
            else
            {
                return(false);
            }
        }