示例#1
0
        private void Start()
        {
            WeaponItem weapon = new WeaponItem();

            weapon.Data             = new WeaponData();
            weapon.Data.Id          = 1;
            weapon.Data.UniqueUUID  = ItemA_ID;
            weapon.Data.Name        = "AK47";
            weapon.Data.Description = "Weapon mid-range";

            IItem item = weapon as IItem;

            // Debug.Log("I have [" + Inventory.ItemsCount + "] items.");
            //// The event was changed and we should no be passing the inventory interface anymore
            //// only the inventory uuid
            //EventMessenger.Instance.Raise(new EventAddItemToInventory(Inventory, Inventory.InventoryUUID, item));
            //Debug.Log("I have [" + Inventory.ItemsCount + "] items.");
        }
示例#2
0
        private void Start()
        {
            #region INVENTORY TESTS
            if (shouldTestInventory)
            {
                Debug.Log("Start Testing inventory UUID is [" + TheInventory.InventoryUUID + "]");

                // Testing adding item to the inventory
                WeaponItem weapon = new WeaponItem();
                weapon.Data             = new WeaponData();
                weapon.Data.Id          = 1;
                weapon.Data.UniqueUUID  = ItemA_ID;
                weapon.Data.Name        = "AK47";
                weapon.Data.Description = "Weapon mid-range";

                Debug.Log(weapon.Data.UniqueUUID);

                TestAddItemToInventory(weapon);

                // Get specific item
                TestGetSpecificItem(weapon);

                // Testing updating item on inventory
                WeaponItem weapon2 = new WeaponItem();
                weapon2.Data             = new WeaponData();
                weapon2.Data.Id          = 1;
                weapon2.Data.UniqueUUID  = ItemB_ID;
                weapon2.Data.Name        = "AK47";
                weapon2.Data.Description = "Weapon mid-range altered.";

                TestUpdateItemInTheInventory(weapon2);

                // Test remove item
                TestRemoveItemFromInventory(weapon2);
                // Count all items
                TestCountAllItemsFromInventory(weapon, weapon2);

                // Get all items
                TestGetAllItemsFromInventory(weapon, weapon2);
            }
            #endregion INVENTORY TESTS

            //EventMessager.Instance.Raise(new EventTest(ItemA_ID));
        }
示例#3
0
        public IItem FactoryItem()
        {
            IItem testItem = new WeaponItem();

            testItem.Data               = new WeaponData();
            testItem.Data.Id            = 1;
            testItem.Data.UniqueUUID    = System.Guid.NewGuid().ToString();// ItemA_ID;
            testItem.Data.Name          = "AK47";
            testItem.Data.Quantity      = 777;
            testItem.Data.Description   = "Weapon mid-range";
            testItem.Data.InventoryUUID = Inventory.InventoryUUID;
            testItem.Inventory          = Inventory;

            testItem.NSData = new WeaponNSData();

            testItem.NSData.Icon = itemIcon;

            return(testItem as IItem);
        }