EquipmentItem: A class used to distinguish Item GameObjects as a EquipmentItem and what the player can do with these items
Inheritance: Item
Exemple #1
0
    private void OnEquipmentChanged_UCE_EquipableBuff()
    {
        // -- remove buffs

        for (int i = 0; i < buffs.Count; ++i)
        {
            if (equipmentBuffs.Any(x => x == buffs[i].data))
            {
                buffs.RemoveAt(i);
                --i;
            }
        }

        // -- clear list

        equipmentBuffs.Clear();

        // -- apply buffs & add to list again

        for (int i = 0; i < equipment.Count; ++i)
        {
            ItemSlot slot = equipment[i];

            if (slot.amount > 0)
            {
                EquipmentItem itemData = (EquipmentItem)slot.item.data;

                if (itemData != null && itemData.onEquipBuffSelf != null)
                {
                    itemData.ApplyEquipableBuff(this);
                    equipmentBuffs.Add(itemData.onEquipBuffSelf);
                }
            }
        }
    }
        public async Task <ActionResult <EquipmentRequestDto> > GetEquipmentRequest(Guid id)
        {
            EquipmentRequest request = await _logic.GetEquipmentRequestById(id);

            EquipmentRequestDto convertedRequest = _mapper.ConvertEquipmentRequestToEquipmentRequestDto(request);

            var token = await HttpContext.GetTokenAsync("access_token");

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                var response = await httpClient.GetAsync($"api/Team/{request.TeamID}");

                string apiResponse = await response.Content.ReadAsStringAsync();

                var team = JsonConvert.DeserializeObject <TeamDto>(apiResponse);
                convertedRequest.Team = team;

                response = await httpClient.GetAsync($"api/User/{request.UserID}");

                apiResponse = await response.Content.ReadAsStringAsync();

                var user = JsonConvert.DeserializeObject <UserDto>(apiResponse);
                convertedRequest.User = user;

                EquipmentItem item = await _logic.GetEquipmentItemById(request.ItemId);

                convertedRequest.Item = item;
            }

            return(convertedRequest);
        }
Exemple #3
0
        private void ButtonDeleteItem_Click(object sender, RoutedEventArgs e)
        {
            if (_selectedItem >= 0x0C && _selectedItem <= 0x21)
            {
                return;
            }

            var nameString = string.Empty;

            try
            {
                nameString = EquipName.EquipNames[_currentItem.Character][_currentItem.Name];
            }
            catch
            {
                nameString = "This item";
            }

            var confirm =
                MessageBox.Show(
                    $"{nameString} will be permanently deleted!\n\nAre you sure?",
                    "Confirm item deletion", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (confirm != MessageBoxResult.Yes)
            {
                return;
            }

            var itemEmpty = new EquipmentItem {
                Abilities = new ushort[4]
            };

            Data.Equipment.WriteItem(_selectedItem, itemEmpty);
            RefreshSelectedItem();
        }
Exemple #4
0
    ////////////////
    public static string GetItemInformationText(IItem item)
    {
        if (item == null)
        {
            return(string.Empty);
        }

        StringBuilder sb = new StringBuilder();

        if (item.GetItemType() == ItemType.equipment)
        {
            EquipmentItem equipment = (EquipmentItem)item;

            sb.AppendLine(equipment.Name);
            sb.AppendLine("Attack: " + equipment.AttackBonus);
            sb.AppendLine("Health: " + equipment.HealthBonus);
        }
        else
        {
            MaterialInfo material = (MaterialInfo)item;

            sb.AppendLine(material.Data.Name);
        }

        return(sb.ToString());
    }
	public BaseItem createItemByData(Property.Item data)
	{
		int templateid = (int)data.templateid;
		int type = ConfigManager.getInstance().getTypeByTemplateID(templateid);
		BaseItem info = null;
		switch(type)
		{
		case (int)GlobalDef.ItemType.ITEM_NORMAL:
			info = new BaseItem(); 
			break;
		case (int)GlobalDef.ItemType.ITEM_EQUIPMENT:
			info = new EquipmentItem();
			break;
		case (int)GlobalDef.ItemType.ITEM_MEDICINE:
			info = new PotionItem();
			break;
		case (int)GlobalDef.ItemType.ITEM_DIAMOND:
			info = new DiamondItem();
			break;
        case (int)GlobalDef.ItemType.ITEM_MATERIAL:
            info = new MaterialItem();
            break;
		}
		if(null == info)
		{
			info = new BaseItem(); 
		}
		info.parseData (data);
		return info;
	}
Exemple #6
0
        public async void TestForGetEquipmentItemById()
        {
            var options = new DbContextOptionsBuilder <EquipmentContext>()
                          .UseInMemoryDatabase(databaseName: "p3GetItemById")
                          .Options;

            using (var context = new EquipmentContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo r    = new Repo(context, new NullLogger <Repo>());
                var  item = new EquipmentItem
                {
                    EquipmentID = 43,
                    Description = "golf club"
                };
                r.EquipmentItems.Add(item);
                await r.CommitSave();

                var getItem = await r.GetEquipmentItemById(item.EquipmentID);

                Assert.Equal("golf club", getItem.Description);
            }
        }
        public async Task <EquipmentItemDTO> GetEquipmentItem(int Id)
        {
            EquipmentItem equipmentItem = await _context.EquipmentItem.FindAsync(Id);

            var employeeEquipmentItems = await _context.EmployeeEquipmentItem
                                         .Where(x => x.EquipmentItemId == Id)
                                         .ToListAsync();

            if (equipmentItem == null)
            {
                return(null);
            }
            else
            {
                equipmentItem.EmployeeEquipmentItems = employeeEquipmentItems;

                EquipmentItemDTO dto = new EquipmentItemDTO()
                {
                    Id    = equipmentItem.Id,
                    Name  = equipmentItem.Name,
                    Value = equipmentItem.Value
                };

                return(dto);
            }
        }
Exemple #8
0
    /// <summary>
    /// 현재 클래스의 데이터 값들을 복사한 데이터를 반환한다.
    /// </summary>
    /// <returns>반환할 데이터</returns>
    public EquipmentItem GetCopiedData()
    {
        EquipmentItem data = new EquipmentItem();

        data.CopyData(this);
        return(data);
    }
Exemple #9
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="eI"></param>
    private void LoadSlotItem(EquipmentItem eI)
    {
        for (int i = 0; i < eI.ModTypeList.Count; ++i)
        //foreach (EquipmentItem.MOD_TYPE mt in eI.ModTypeList)
        {
            switch (eI.ModTypeList[i])
            {
            case EquipmentItem.MOD_TYPE.ITEM_FIND_PROB:
                _currentEquipmentSpawnChance += _equipmentSpawnChance * eI.ModValueList[i];
                //TODO: collider size + sprite?
                //fixed sacks?-> no
                break;

            case EquipmentItem.MOD_TYPE.GOLD_FIND_PROB:
                _currentEquipmentSpawnChance += _equipmentSpawnChance * eI.ModValueList[i];
                break;

            case EquipmentItem.MOD_TYPE.FALL_SPEED:
                _currentFruitFallTime += _fallFruitTime * (-eI.ModValueList[i]);
                //_currentSpeed = _baseSpeed * (1f + eI.ModValue);
                //_currentRawSpeed = _currentSpeed;
                break;
            }
        }
    }
Exemple #10
0
 private void RepairItem(Item item)
 {
     if (item != null)
     {
         if (item is EquipmentItem)
         {
             double increaseValue = this.gameObject.GetComponentInParent <RepairInventory>().RepairValue;
             int    increaseCost  = this.gameObject.GetComponentInParent <RepairInventory>().RepairTickCost;
             if (this.IfICanSellBuyItem(this.inventory_gold, increaseCost))
             {
                 EquipmentItem equipmentItem = (EquipmentItem)item;
                 if (equipmentItem.Durability < 100)
                 {
                     equipmentItem.Repair(increaseValue);
                     this.IncreaseDecreaseGold(-increaseCost);
                 }
                 else
                 {
                     this.PrintToInfoPanel("Item has max durability");
                 }
             }
             else
             {
                 this.PrintToInfoPanel("You dont have enough gold");
             }
         }
     }
 }
Exemple #11
0
    /////////////////
    public void Init(JsonObject json)
    {
        if (json == null)
        {
            return;
        }

        JsonArray equipments = json.Get <JsonArray>("equipments");

        for (int i = 0; i < equipments.Count; i++)
        {
            string        obj  = (string)equipments[i];
            EquipmentItem item = GameDataStorage.Instance.GetEquipmentByName(obj);

            PlayerEquipments.Add(item);
        }

        JsonArray materials = json.Get <JsonArray>("materials");

        foreach (JsonObject item in materials)
        {
            MaterialData data   = GameDataStorage.Instance.GetMaterialByName((string)item["name"]);
            int          amount = item.GetInt("amount");

            PlayerMaterials.Add(new MaterialInfo(data, amount));
        }
    }
        public EquipmentBundle CreateStandardBundle()
        {
            var monitor = new EquipmentItem()
            {
                Name = "Monitor"
            };

            var keyboard = new EquipmentItem()
            {
                Name = "Keyboard"
            };

            var headset = new EquipmentItem()
            {
                Name = "Headset"
            };

            var standardBundle = new EquipmentBundle();

            standardBundle.Add(monitor);
            standardBundle.Add(keyboard);
            standardBundle.Add(headset);

            return(standardBundle);
        }
    public void ECloseButton()
    {
        //GameManager.instance.playerC.GetComponent<CharacterSwapping>().currentCharacter.GetComponent<Health>().GetComponent<PlayerController>().removeEquipmentItemFromPlayer(GetEItem());
        GameManager.instance.RemoveEquipmentItem(GetEItem());
        Debug.Log("removing");
        if (GameManager.instance.equipmentItems.Contains(GetEItem()))
        {
            Debug.Log("not completed removed");
        }
        equipItem = GetEItem();
        if (equipItem != null)
        {
            //show tooltip
            toolT.ShowTooltip();
            toolT.UpdateTooltip(GetDetailText(equipItem));

            RectTransformUtility.ScreenPointToLocalPointInRectangle(GameObject.Find("Canvas").transform as
                                                                    RectTransform, Input.mousePosition, null, out position);
            toolT.SetPosition(position);
        }
        else
        {
            //hide tooptip
            toolT.HideTooltip();
            toolT.UpdateTooltip("");
        }
    }
 public void onGetItemList(SocketModel module)
 {
     ItemMessage.MsgGetItemListRep msg = MsgSerializer.Deserialize<ItemMessage.MsgGetItemListRep>(module);
     BagStruct bag = MonoInstancePool.getInstance<BagManager>().getBagByType(msg.type);
     if (bag == null)
     {
         Debug.LogError("have not this bag!");
         return;
     }
     bag.clear();
     //Debug.Log("bag: " + msg.type + " have: " + msg.itemList.Count + " " + msg.equipList.Count);
     if (msg.type == (int)GlobalDef.BagType.B_EQUIPMENT)
     {
         for (int i = 0; i < msg.equipList.Count; i++)
         {
             Property.Equip item = msg.equipList[i];
             EquipmentItem baseItem = new EquipmentItem();
             baseItem.parseData(item);
             bag.addItem(baseItem);
             bag.IsDirty = true;
         }
     }
     else
     {
         for (int i = 0; i < msg.itemList.Count; i++)
         {
             Property.Item item = msg.itemList[i];
             BaseItem baseItem = MonoInstancePool.getInstance<BagManager>().createItemByData(item);
             bag.addItem(baseItem);
             bag.IsDirty = true;
         }
     }
 }
    public void OnEquipmentChanged_UCE_Skillbar()
    {
        UCE_SaveSkillbar();

        for (int i = 0; i < equipment.Count; ++i)
        {
            ItemSlot slot = equipment[i];

            if (slot.amount > 0)
            {
                EquipmentItem itemData = (EquipmentItem)slot.item.data;

                if (itemData != null && itemData.UCE_skillbarIndex > 0)
                {
                    if (itemData.UCE_skillbarIndex != UCE_skillbarIndex)
                    {
                        //UCE_SaveSkillbar();
                        UCE_skillbarIndex = itemData.UCE_skillbarIndex;
                        UCE_LoadSkillbar();

                        break;
                    }
                }
                else
                {
                    UCE_skillbarIndex = 0;
                }
            }
        }
    }
        public void AssignStandardBundleToEmployee_EmployeeId_ReturnsCorrectEmployee()
        {
            var employeeId = new Guid();

            var testItem = new EquipmentItem()
            {
                Name = "Test"
            };
            var testBundle = new EquipmentBundle();

            testBundle.Add(testItem);
            var bundleFactory = new Mock <IEquipmentBundleFactory>();

            bundleFactory.Setup(x => x.CreateStandardBundle())
            .Returns(testBundle);

            var employeeService = new Mock <IEmployeeService>();
            var testEmployee    = new Employee()
            {
                EmployeeId = employeeId,
                Bundle     = testBundle
            };

            employeeService.Setup(x => x.Connect(It.IsAny <Guid>(), It.IsAny <EquipmentBundle>()))
            .Returns(testEmployee);

            var auditService = new Mock <IAuditService>();
            var service      = new EquipmentService.EquipmentService(bundleFactory.Object, employeeService.Object, auditService.Object);
            var result       = service.AssignStandardBundleToEmployee(employeeId);

            Assert.Equal(employeeId, result.EmployeeId);
            Assert.Single(result.Bundle.Items);
            auditService.Verify(x => x.WriteEmploeeInformation(It.Is <Employee>(y => y == testEmployee)));
        }
	public void setQulatiProperty(EquipmentItem item)
	{
		for(int i = 0; i < ProName.Length; i++)
		{
			ProName[i].gameObject.SetActive(false);
		}

		int curIdx = 0;
		for (int i = 0; i < item.proptys.dictProperty.Count; i++) 
		{
			int num = item.proptys.dictProperty.ElementAt(i).Value;
			if(num != 0)
			{
				string name = GlobalDef.NewHeroPropertyName[item.proptys.dictProperty.ElementAt(i).Key];
				int res = item.proptys.dictProperty.ElementAt(i).Value;

				ProName[curIdx].gameObject.SetActive(true);
				ProName[curIdx].text = name;
				ProNum[curIdx].text = "+"+res;
				curIdx++;
				if(curIdx >= ProName.Length)
					return;
			}
		}
	}
    /// <summary>
    /// 换装
    /// </summary>
    /// <param name="data"></param>
    public virtual void Replace(EquipmentItem data)
    {
        item = data;
        //Debug.Log("Refresh this  item is null ? " + item == null);
        if (item != null)
        {

            if (icon)
            {
                icon.enabled = true;
                icon.spriteName = item.icon;
            }

            if (frame != null)
            {
                frame.spriteName = data.GetSprNameByQuality();
                frame.enabled = true;
            }

            if (labName != null) labName.text = item.name;
            if (labLevel != null) labLevel.text = item.equiplev + "级";

            //品质图标
            if (sprQuality) sprQuality.spriteName = data.GetQualitySprName();

        }
        else
        {
            if (icon) icon.enabled = false;
            if (frame != null)
            {
                frame.enabled = false;
            }
        }
    }
Exemple #19
0
        public void ChangeEquipment(EquipmentItem leftItem, EquipmentItem rightItem)
        {
            LeftItem  = leftItem;
            RightItem = rightItem;

            OnPlayerEquipmentChanged(new PlayerEquipmentChangedEventArgs(leftItem, rightItem));
        }
Exemple #20
0
        public async void TestForGetEquipmentItems()
        {
            var options = new DbContextOptionsBuilder <EquipmentContext>()
                          .UseInMemoryDatabase(databaseName: "p3GetItems")
                          .Options;

            using (var context = new EquipmentContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo r    = new Repo(context, new NullLogger <Repo>());
                var  item = new EquipmentItem
                {
                    EquipmentID = 43,
                    Description = "golf club"
                };
                r.EquipmentItems.Add(item);
                var item2 = new EquipmentItem
                {
                    EquipmentID = 61,
                    Description = "baseball glove"
                };
                r.EquipmentItems.Add(item2);
                await r.CommitSave();

                var getItems = await r.GetEquipmentItems();

                var convertedList = (List <EquipmentItem>)getItems;

                Assert.Equal("golf club", convertedList[0].Description);
                Assert.Equal("baseball glove", convertedList[1].Description);
            }
        }
Exemple #21
0
    ///////////////
    public void EquipItem(EquipmentItem item)
    {
        if (item == null)
        {
            return;
        }

        EquipmentItem equippedItem;

        // если на персонаже нет предмета в этом слоте, тогда надеваем предмет
        if (!HeroEquipment.TryGetValue(item.Slot, out equippedItem))
        {
            HeroEquipment.Add(item.Slot, item);
            InventoryContent.Instance.RemoveItem(item);

            if (OnEquipmentChanged != null)
            {
                OnEquipmentChanged();
            }

            return;
        }

        InventoryContent.Instance.AddEquipmentItem(equippedItem);
        InventoryContent.Instance.RemoveItem(item);
        HeroEquipment[item.Slot] = item;

        if (OnEquipmentChanged != null)
        {
            OnEquipmentChanged();
        }
    }
Exemple #22
0
        public void NewEquipment()
        {
            var want = new EquipmentItem
            {
                Name             = "OnionSword",
                Level            = 1,
                EquipAbleInSlots = new List <EquipSlots> {
                    EquipSlots.Main, EquipSlots.Sub
                },
                Skill           = SkillType.Sword,
                EquipAbleByJobs = new List <Job>
                {
                    Job.Warrior,
                    Job.RedMage,
                    Job.Thief,
                    Job.Paladin,
                    Job.DarkKnight,
                    Job.BeastMaster,
                    Job.Bard,
                    Job.Ranger,
                    Job.Ninja,
                    Job.Dragoon,
                    Job.BlueMage,
                    Job.Corsair,
                    Job.RuneFencer
                }
            };

            var weapon = OnionSword();
            var got    = Equipment.Equipment.GetEquipmentFromItem(weapon);

            EquipmentItemEquals(want, got);
        }
Exemple #23
0
    private void OnEquipmentChanged_UCE_Skillbar()
    {
        UCE_SaveSkillbar();

        for (int i = 0; i < equipment.slots.Count; ++i)
        {
            ItemSlot slot = equipment.slots[i];

            if (slot.amount > 0)
            {
                EquipmentItem itemData = (EquipmentItem)slot.item.data;

                if (itemData != null && itemData.UCE_skillbarIndex > 0)
                {
                    if (itemData.UCE_skillbarIndex != UCE_skillbarIndex)
                    {
                        //UCE_SaveSkillbar();
                        UCE_skillbarIndex = itemData.UCE_skillbarIndex;
                        UCE_LoadSkillbar();

                        break;
                    }

#if _iMMOUMA
                    return; //Vanishing Bar Fix
#endif
                }
                else
                {
                    UCE_skillbarIndex = 0;
                }
            }
        }
    }
Exemple #24
0
        public double SingleEquipmentMod(string stat, EquipmentItem item)
        {
            double mod = 0;

            foreach (KeyValuePair <string, double> itemStat in item.WeaponStats)
            {
                if (itemStat.Key == stat)
                {
                    mod += itemStat.Value;
                }
            }
            foreach (KeyValuePair <string, double> itemStat in item.ArmorStats)
            {
                if (itemStat.Key == stat)
                {
                    mod += itemStat.Value;
                }
            }
            foreach (KeyValuePair <string, double> itemStat in item.CharmStats)
            {
                if (itemStat.Key == stat)
                {
                    mod += itemStat.Value;
                }
            }
            return(mod);
        }
	public void addTempData()
	{
		for(int i = 0; i < 1/*GlobalDef.EquipmentTpye.E_MAX*/; i++)
		{
			EquipmentItem item = new EquipmentItem();
			item.guid = (long)i;
			item.templateID = 400001;
			equipmentBag.addItem(item);
			equipmentBag.IsDirty = true;
		}   
													
//		for(int i = 0; i < 5; i++)                   
//		{                                            
//			PotionItem item = new PotionItem();
//			item.guid = (long)i;
//			item.templateID = 530001+i;
//			potionBag.addItem(item);                                        
//		}
//		for(int i = 0; i < 5; i++)                   
//		{                                            
//			DiamondItem item = new DiamondItem();
//			item.guid = (long)i;
//			item.templateID = 600001+i;
//			getDiamondBag().addItem(item);                                   
//		}
//		for(int i = 0; i < 5; i++)
//		{
//			MaterialItem item = new MaterialItem();
//			item.guid = (long)i;
//			item.templateID = 510001+i;
//			getMaterialBag().addItem(item);                                   
//		}
	}
    private void CanUnequip_CursedEquipment(Player player, int inventoryIndex, int equipmentIndex, MutableWrapper <bool> bValid)
    {
        if (!bValid.Value)
        {
            return;                //when not valid, we dont have to check at all
        }
        if (player.equipment.Any(x => (x.amount > 0 && ((EquipmentItem)x.item.data).nullsAllCurses == true)))
        { // no need to check if any item can nullify curses
            bValid.Value = true;
            return;
        }

        int overrideLevel = 0;

        if (player.inventory[inventoryIndex].amount > 0)
        {
            EquipmentItem item = (EquipmentItem)player.inventory[inventoryIndex].item.data;
            overrideLevel = item.overrideCursedLevel;
        }

        bValid.Value = CanEquip(player, inventoryIndex, equipmentIndex) &&
                       (player.equipment.Any(x => (x.amount > 0 && (cursedLevel <= 0 || (cursedLevel > 0 && overrideLevel >= cursedLevel)))));

        if (bValid.Value == false)
        {
            player.UCE_TargetAddMessage(cursedCannotUnequipMsg);
        }
    }
    void ReinforceItemSuccess()
    {
        if (ItemDataViewer.DefaultInstance.GetCurrentTargetItem().GetItemType() == Item.E_TYPE.EQUIPMENT)
        {
            EquipmentItem item  = m_Item as EquipmentItem;
            EquipmentItem titem = ItemDataViewer.DefaultInstance.GetCurrentTargetItem() as EquipmentItem;

            if (!item || !titem)
            {
                return;
            }

            titem.IncreaseReinforceCount(item.GetReinforceCount() + 1);
        }
        else if (ItemDataViewer.DefaultInstance.GetCurrentTargetItem().GetItemType() == Item.E_TYPE.CHARACTER)
        {
            CharacterItem item  = m_Item as CharacterItem;
            CharacterItem titem = ItemDataViewer.DefaultInstance.GetCurrentTargetItem() as CharacterItem;

            if (!item || !titem)
            {
                return;
            }

            titem.IncreaseReinforceCount(item.GetReinforceCount() + 1);
        }

        InventoryManager.Instance.DestroyItem(m_Item);
        InventoryViewer.RefreshAllSlots();
        ItemDataViewer.DefaultInstance.Refresh();
        m_LobbyCanvasUI.GetStatusUI().Refresh();
    }
Exemple #28
0
        public ItemBase(EquipmentItem item)
        {
            Debug.Assert(item.ProductID == (int)ProductType);

            Quantity = item.Amount;
            Quality  = item.Quality;
        }
 public void RefreshCurrentSlot(EquipmentItem it)
 {
     if (currentEqptSlot != null)
     {
         currentEqptSlot.Replace(it);
     }
 }
        public MethodResult CanTransferItemToChest(Entity currentEntity, EquipmentItem item, HouseChest chest, int quantity)
        {
            if (currentEntity.EquipmentID != item.EquipmentID)
            {
                return(new MethodResult("You cannot transfer items from your chest to someone else!"));
            }

            if (item == null)
            {
                return(new MethodResult("Item does not exist!"));
            }

            if (quantity <= 0)
            {
                return(new MethodResult("You must transfer at least 1 item!"));
            }

            ProductTypeEnum productType = (ProductTypeEnum)item.ProductID;

            if (item.Amount < quantity)
            {
                return(new MethodResult($"You do not have enough {productType.ToHumanReadable().FirstUpper()} in chest!"));
            }

            if (GetUnusedSpace(chest) < quantity)
            {
                return(new MethodResult("You do not have enough space in chest!"));
            }

            return(MethodResult.Success);
        }
    private void OnEquipmentChanged_UCE_EquipmentStances()
    {
        foreach (Animator anim in GetComponentsInChildren <Animator>())
        {
            foreach (string stance in equipmentStances)
            {
                anim.SetBool(stance, false);
            }
        }

        for (int i = 0; i < equipment.slots.Count; ++i)
        {
            ItemSlot slot = equipment.slots[i];

            if (slot.amount > 0)
            {
                EquipmentItem itemData = (EquipmentItem)slot.item.data;

                if (itemData != null && itemData.category != "" && equipmentStances.Contains(itemData.category))
                {
                    foreach (Animator anim in GetComponentsInChildren <Animator>())
                    {
                        anim.SetBool(itemData.category, true);
                    }
                }
            }
        }
    }
Exemple #32
0
        public void AddEquipmentItem(int equipmentID, int productID, int quality, int amount = 1)
        {
            Contract.Requires(amount >= 1);
            Contract.Requires(quality >= 1 && quality <= 5);

            var equipment = DbSet.Find(equipmentID);

            if (equipment == null)
            {
                throw new ArgumentException();
            }

            var equipmentItem = equipment.EquipmentItems
                                .FirstOrDefault(ei => ei.Quality == quality && ei.ProductID == productID);

            if (equipmentItem != null)
            {
                equipmentItem.Amount += amount;
            }
            else
            {
                EquipmentItem item = new EquipmentItem()
                {
                    Amount    = amount,
                    ProductID = productID,
                    Quality   = quality,
                };

                equipment.EquipmentItems.Add(item);
            }
        }
Exemple #33
0
    public override void Refresh()
    {
        base.Refresh();

        if (!gameObject.activeSelf)
        {
            return;
        }

        EquipmentItem firstequip = null;

        for (int i = 0; i < m_EquipmentSlotUI.Length; ++i)
        {
            EquipmentItem item = InventoryManager.Instance.GetEquippedItem(i);
            if (item != null && item.GetWeaponModel() != null && firstequip == null)
            {
                firstequip = item;
            }
            m_EquipmentSlotUI[i].SetData(item);
        }

        m_CharacterSlotUI.SetData(InventoryManager.Instance.GetEquipmentCharacterData());
        string     modelname = InventoryManager.Instance.GetPlayerModelName();
        GameObject model     = Instantiate(Resources.Load <GameObject>(modelname + "/" + modelname), Vector3.zero, Quaternion.identity);

        m_CharacterPreviewUI.SetPreviewModel(model);
        if (firstequip)
        {
            m_CharacterPreviewUI.SetPerviewWeapon(firstequip.GetWeaponModel().name, firstequip.GetWeaponType());
        }
        else
        {
            m_CharacterPreviewUI.SetPerviewWeapon("", E_WEAPONTYPE.PUNCH);
        }
    }
Exemple #34
0
    void UpdateProperty()
    {
        attack = 0;
        defend = 0;
        speed  = 0;

        EquipmentItem headgearItem = headgear.GetComponentInChildren <EquipmentItem>();

        PlusProperty(headgearItem);
        EquipmentItem armorItem = armor.GetComponentInChildren <EquipmentItem>();

        PlusProperty(armorItem);
        EquipmentItem leftHandItem = leftHand.GetComponentInChildren <EquipmentItem>();

        PlusProperty(leftHandItem);
        EquipmentItem rightHandItem = rightHand.GetComponentInChildren <EquipmentItem>();

        PlusProperty(rightHandItem);
        EquipmentItem shoeItem = shoe.GetComponentInChildren <EquipmentItem>();

        PlusProperty(shoeItem);
        EquipmentItem accessoryItem = accessory.GetComponentInChildren <EquipmentItem>();

        PlusProperty(accessoryItem);
    }
    // -----------------------------------------------------------------------------------
    // UCE_RefreshMesh
    // -----------------------------------------------------------------------------------
    private void UCE_RefreshMesh(int index)
    {
        ItemSlot      slot = equipment[index];
        EquipmentInfo info = equipmentInfo[index];

        cachedRenderers = new Renderer[info.mesh.Length];

        for (int i = 0; i < info.mesh.Length; ++i)
        {
            cachedRenderers[i] = info.mesh[i].mesh.GetComponent <Renderer>();
        }

        if (info.requiredCategory != "" && info.mesh.Length > 0)
        {
            if (slot.amount > 0)
            {
                EquipmentItem itemData = (EquipmentItem)slot.item.data;
                UCE_SwitchToMesh(info, itemData.meshIndex, itemData.meshMaterial, itemData.switchableColors);
            }
            else
            {
                UCE_SwitchToMesh(info, 0, null, null);
            }
        }
    }
        public IActionResult AddNewMachine(NewMachineViewModel model)
        {
            IActionResult result = null;

            try
            {
                var newMachine = new EquipmentItem()
                {
                    Name          = model.Name,
                    Description   = model.Description,
                    CategoryId    = model.Category,
                    ImageURL      = model.ImageURL,
                    VideoLink     = model.VideoURL,
                    MachineNumber = model.Number
                };

                // Save the user account
                _db.AddNewMachine(newMachine);

                result = Ok();
            }
            catch (Exception)
            {
                result = BadRequest(new { Message = "Failed to add machine" });
            }
            return(result);
        }
	public void refresh(EquipmentItem item)
	{
		Name.text = item.name;
		Icon.spriteName = item.icon;
		ItemType.text = item.getItemType ();
		RoleType.text = item.getRoleLimit ();
		Level.text = "" + item.equiplev + "级";
		Quality.spriteName = item.getQualityBoundImgName();
	}
	public void refresh(EquipmentItem item)
	{
		if(item == null)
			return;
		m_EquipType = item.equitype;
		Icon.spriteName = item.icon;
		Quality.spriteName = item.getQualityBoundImgName();
		UPArrow.gameObject.SetActive (false);
	}
 /// <summary>
 /// 实例一个装备在上面
 /// </summary>
 /// <param name="data">可以是空</param>
 public virtual void Refresh(EquipmentItem data, HeroData hero = null)
 {
     heroData = hero;
     if (heroData != null)
     {
         if (sprHeroIcon) sprHeroIcon.spriteName = heroData.icon_middle;
     }
     Replace(data);
     //Debug.Log("Refresh this");
 }
	public void refresh(EquipmentItem item)
	{
		guid = item.guid;
		ItemProperty.refresh (item);
		int min = item.mindamage;
		int max = item.maxdamage;
		EquipDamageNum.text = min + "-" + max;

		QualityIcon.spriteName = item.getQualityIconImgName ();
		setQulatiProperty (item);
	}
    public override void Replace(EquipmentItem data)
    {
        if (data != null) //显示的时候由其它的函数调用
        {

        }
        else
        {
            select.gameObject.SetActive(false);
        }
        base.Replace(data);
    }
	public void addItem(long guid, EquipmentItem item)
	{
		if(list.ContainsKey(guid))
		{
			Debug.LogError("already has this key! guid: " + guid);
			return;
		}
		if(hasThisType(item.equitype))
		{
			removeItemByType(item.equitype);
		}
		list.Add(guid, item);
	}
	public void addTempItem()
	{
		EquipmentItem item = new EquipmentItem();
		item.guid = (long)1;
		item.templateID = 650001;		
//		if (test == 400001)
//			test = 400006;
//		else if (test == 400006)
//			test = 400004;


		addItem(item.guid, item);
		isDirty = true;
	}
	public void OnEquip(EquipmentItem item){
		OnUnEquip (item);
		foreach (EquipmentItemIdentifier identifier in equipment) {
			if(identifier.item.itemName == item.itemName){
				identifier.attachment.ForEach(x=>x.SetActive(true));
			}		
		}

		if (photonView != null && photonView.isMine && item.equipmentRegion == EquipmentRegion.Hands && item.defaultAttack != null) {
			gameObject.AddBehaviour(item.defaultAttack,attackGroup,true);
		}

		PhotonView.Get (gameObject).RPC ("OnNetworkEquip",PhotonTargets.Others,item.itemName);
	}
	public void OnUnEquip(EquipmentItem item){
		foreach (EquipmentItemIdentifier identifier in equipment) {
			if(identifier.item.equipmentRegion == item.equipmentRegion){
				identifier.attachment.ForEach(x=>x.SetActive(false));
			}		
		}

		if (photonView != null &&photonView.isMine && item.equipmentRegion == EquipmentRegion.Hands) {
			if(defaultAttack != null){
				gameObject.AddBehaviour(defaultAttack,attackGroup,true);
			}else{
				Destroy(gameObject.GetBehaviour(attackGroup));
			}
		}
		PhotonView.Get (gameObject).RPC ("OnNetworkUnEquip",PhotonTargets.Others,(int)item.equipmentRegion);
	}
	public void UpdateInfo(EquipmentItem item)
	{
        if (item == null)
        {
           gameObject.SetActive(false);
           return;
        }      

        Icon.spriteName = item.icon;
		Name.text = item.name;
		EquipType.text = item.getItemType();
		EquipPinzhi.text = item.getItemQuality();
		EquipSubType.text = item.getRoleLimit();
		EquipNeedLevel.text = "需要等级Lv." + item.needlv;
		if(MonoInstancePool.getInstance<HeroManager>().getCurShowHero().level >= item.needlv)
		{
			Color c = EquipNeedLevel.color;
			c.r = 0f; c.g = 1f; c.b = 0f;
			EquipNeedLevel.color = c;
		}
		Price.text = "" + item.sellprice1;


        Damage.text = item.mindamage + "-" + item.maxdamage +"伤害";
      
        if (item.changeStar != 0)
            setStarNum(item.changeStar);
        else
		    setStarNum(0);
        
		attributeList = new int[] { item.gattribute, item.base_attribute_int, item.base_attribute_int };

        setAttributeid(item);
        setDamond(item);

        LegendProperty.text = item.description;
	}
	/// <summary>
	/// 解析从服务器接收到的数据
	/// </summary>
	public void parseServerHero(Property.Hero data)
	{
		//template Data
		parseData(data.heroid);

		guid = (long)data.guid;
		templateID = data.heroid;
		activate = data.activate;
		level = data.level;
		if(data.starLevel > starLevel ){starLevel = data.starLevel;}
		exp = data.exp;
		debris = data.debris;
		realmList.curRealmLevel = data.realm;
		battle = data.battle;
		fighting = data.fighting;

		equipmentList.clear ();
		for(int j = 0; j < data.items.Count; j++)
		{
			EquipmentItem item = new EquipmentItem();
			Property.Equip item_data = data.items[j];
			item.parseData(data.items[j]);	
			equipmentList.addItem(item.guid, item);
			
			item.gemList.Clear();
			for(int k = 0; k < item_data.gemAry.Count; k++)
			{
				DiamondItem gemItem = new DiamondItem();
				Property.Item gemData = item_data.gemAry[k];
				gemItem.guid = (long)gemData.guid;
				gemItem.templateID = (int)gemData.templateid;
				gemItem.haveNum = (int)gemData.number;
				//					gemItem.type = (int)gemData.type;
				item.gemList.Add(gemItem.guid, gemItem);
			}			
		}
		Property.Horse horse = data.horse;
		//skill
		skillList.Clear();
		skillList.clearUseSkill();
		for(int s = 0; s < data.skills.Count; s++)
		{
			Property.Skill skillData = data.skills[s];
			int skillId = skillData.skillid;
			
			SkillItem skill = new SkillItem(this, skillId);
			skill.level = skillData.level;
			skill.active = skillData.activate;
			skill.slot = skillData.slot;
			skillList.Add(skill);
			if(skill.slot != -1 && skill.slot < skillList.useSkills.Length)
			{
				skillList.useSkills[skill.slot] = s;
			}
		}
	}
	void updateProperty(ItemProperty pro, EquipmentItem item)
	{
		pro.guid = item.guid;
		pro.setNum(item.haveNum);
		pro.templateID = item.templateID;
		pro.setIcon(item.icon);
		pro.type = item.type;
	}
    public void onAddItem(SocketModel module)
    {
        ItemMessage.MsgAddItemRep msg = MsgSerializer.Deserialize<ItemMessage.MsgAddItemRep>(module);

        BagStruct bag = MonoInstancePool.getInstance<BagManager>().getBagByType(msg.type);
        if (bag == null)
        {
            Debug.LogError("have not this bag!");
            return;
        }
        BaseItem baseItem = null;
        if (msg.equip != null)
        {
            baseItem = new EquipmentItem();
            (baseItem as EquipmentItem).parseData(msg.equip);
        }
        else
        {
            baseItem = MonoInstancePool.getInstance<BagManager>().createItemByData(msg.item);
        }

        Debug.Log("addItem num: " + baseItem.haveNum);
        bag.addItem(baseItem);
        bag.IsDirty = true;
    }
 public void ForgingEvent(EquipmentItem item, ulong hero_guid, bool ignorelost)
 {
     Debug.Log("sendmessage guid :" + item.guid + "  hero _  guid " + hero_guid);
     WaitForCallBack();
     MonoInstancePool.getInstance<SendItemSystemMsgHander>().SendForgingEquip((ulong)item.guid, (ulong)item.formerid, hero_guid, ignorelost);
 }
    public void addEquipment(EquipmentItem itemHero, EquipmentItem itemBag)
    {
        if (itemHero == null && itemBag == null)
        {
            gameObject.SetActive(false);
            return;
        }


        if (itemHero == null)
        {
            if (itemBag.gholestar1 == 0)
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_ALLGRADE,
                      (int)GlobalDef.EquipStateType.EQUIP_LEFT,
                      0, itemHero, itemBag);
            }
            else 
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_ALLGRADE,
                      (int)GlobalDef.EquipStateType.EQUIP_RIGHT,
                      0, itemHero, itemBag);
            }
           
        }

        if (itemBag == null)
        {
            if (itemHero.gholestar1 == 0)
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_ALLGRADE,
                      (int)GlobalDef.EquipStateType.EQUIP_LEFT,
                      0, itemHero, itemBag);
            }
            else
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_ALLGRADE,
                      (int)GlobalDef.EquipStateType.EQUIP_RIGHT,
                      0, itemHero, itemBag);
            }
        }


        if (itemBag != null && itemHero != null)
        {

            if (itemHero.gholestar1 == 0 && itemBag.gholestar1 == 0)
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_LOWGRADE, 0, 
                    0, itemHero, itemBag);
            }

           else if (itemHero.gholestar1 != 0 && itemBag.gholestar1 != 0)
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_HIGHTGRADE, 0,
                    0, itemHero, itemBag);
            }

            else if (itemHero.gholestar1 == 0 && itemBag.gholestar1 != 0)
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_ALLGRADE,
                            (int)GlobalDef.EquipStateType.EQUIP_CENTER,
                            (int)GlobalDef.EquipStateType.EQUIP_ONDRESS, itemHero, itemBag);
            }

            else if (itemHero.gholestar1 != 0 && itemBag.gholestar1 == 0)
            {
                objLocation((int)GlobalDef.EquipStateType.EQUIP_ALLGRADE,
                            (int)GlobalDef.EquipStateType.EQUIP_CENTER,
                            (int)GlobalDef.EquipStateType.EQUIP_INBAG, itemHero, itemBag);
            }  
        }      
    }
Exemple #52
0
    public void unequipSlot(EquipmentItem.EquipmentType type)
    {
        EquipmentItem curEquipped;
        switch (type) {
            case EquipmentItem.EquipmentType.equipable:
                curEquipped = equippedEquipable;
                equippedEquipable = null;
                addItem(curEquipped);

                break;
            case EquipmentItem.EquipmentType.secondary_equipable:
                curEquipped = equippedSecondaryEquipable;
                equippedSecondaryEquipable = null;
                addItem(curEquipped);

                break;

            case EquipmentItem.EquipmentType.jacket:
              curEquipped = equippedJacket;
              equippedJacket = null;
                addItem(curEquipped);

                break;

            case EquipmentItem.EquipmentType.boots:
                curEquipped = equippedBoots;
                equippedEquipable = null;
                addItem(equippedBoots);

                break;

        }
    }
Exemple #53
0
    /*Equipment code*/
    public bool EquipItem(EquipmentItem i)
    {
        //first make sure that you aren't equipping slots with injured arms that you shouldn't be able to be
        if ((i.equipmentType == EquipmentItem.EquipmentType.equipable && vitals.bodyPartHealth[(int)PlayerVitals.BodyPart.RightArm] <= 0) ||
            (i.equipmentType == EquipmentItem.EquipmentType.secondary_equipable && vitals.bodyPartHealth[(int)PlayerVitals.BodyPart.LeftArm] <= 0)) {
                textHints.SendMessage("ShowHint", (i.equipmentType == EquipmentItem.EquipmentType.equipable) ? "You cannot equip that with a broken right arm!" : "You cannot equip that with a broken left arm!");
                return false;
        }

        //cut this item out of the inventory
        inventory.Remove(i.name);
        inventoryNamesArray[i.inventoryLocation] = null;

        EquipmentItem curEquipped;
        switch (i.equipmentType) {
            case EquipmentItem.EquipmentType.equipable:
                curEquipped = equippedEquipable;
                equippedEquipable = i;
                //Debug.Log(curEquipped.name + " " + curEquipped.quantity.ToString());
                addItem(curEquipped);

                if (i is AxeItem) {
                    equippedItemScript.EquipItem((int)EquippedItemManager.Equippable.Axe, i.statPower);
                } else if (i is SidePlankItem) {
                    equippedItemScript.EquipItem((int)EquippedItemManager.Equippable.Plank);
                } else if (i is RoofPlankItem) {
                    equippedItemScript.EquipItem((int)EquippedItemManager.Equippable.RoofPiece1);
                } else if (i is BowItem) {
                    equippedItemScript.EquipItem((int)EquippedItemManager.Equippable.Bow, i.statPower);
                } else if (i is KnifeItem) {
                    equippedItemScript.EquipItem((int)EquippedItemManager.Equippable.Knife, i.statPower);
                } else if (i is DoorItem) {
                    equippedItemScript.EquipItem((int)EquippedItemManager.Equippable.Door);
                }

                if (GameObject.Find("GUIButtons").GetComponent<OpenCloseGUIs>().controlsAreDisabled) {
                    GameObject.Find("GUIButtons").GetComponent<OpenCloseGUIs>().disableNewItem();
                }

                break;
            case EquipmentItem.EquipmentType.secondary_equipable:
                curEquipped = equippedSecondaryEquipable;
                equippedSecondaryEquipable = i;
                addItem(curEquipped);

                break;

            case EquipmentItem.EquipmentType.jacket:
                curEquipped = equippedJacket;
                equippedJacket = i;
                addItem(curEquipped);

                break;

            case EquipmentItem.EquipmentType.boots:
                curEquipped = equippedBoots;
                equippedBoots = i;
                addItem(curEquipped);

                break;

        }

        return true;
    }
 public void CallBack(EquipmentItem item)
 {
     //清空:
     uiEquipItem.gameObject.SetActive(true);
     uiEquipItem.UpdateInfo(item);
     //currentEquip = item;
     Refresh();
 }
    //public override void OnEquipClick(EqptSlot s, ulong hero_guid = 0)
    //{
    //    if (s == localSlot || s.GetItem() == null) return;
    //    localSlot = s;

    //    this.hero_guid = hero_guid;

    //    Refresh();

    //}

    public override void Refresh()
    {
        if (currentEquip == null)
        {
            curSlotInPnl.Refresh(null);
            Debug.LogError("null");
        }
        else
        {
            curSlotInPnl.Refresh(currentEquip);

            if (infoForge.CanForge())
            {
                goNoFull.SetActive(true);
                goFull.SetActive(false);


                //new item
                EquipmentItem newItem = new EquipmentItem();
                newItem.templateID = infoForge.productid;
                newSlotInPnl.Refresh(newItem);

                labNeedCost.text = infoForge.price.ToString();
                if (infoForge.moneytype == 1) //gold
                {
                    sprNeedMoney.spriteName = GOLD;
                }
                else
                {
                    sprNeedMoney.spriteName = DIAMAGE;
                }


                labExtraCost.text = infoForge.priceExtra.ToString();
                if (infoForge.moneytypeExtra == 1)
                {
                    sprExtraMoney.spriteName = GOLD;
                }
                else
                {
                    sprExtraMoney.spriteName = DIAMAGE;
                }
                labFightingCapacity.text = AllStrings.fightingCapacity + " : " + infoForge.GetFC();
                labNeedLevel.text = AllStrings.needLevel + "Lv." + infoForge.NeedLvByEquip();

                List<MaterialItem> items = infoForge.GetMaterials();
                int iMax = Mathf.Min(mtlSlots.Count, items.Count);
                for (int i = 0; i < iMax; i++)
                {
                    mtlSlots[i].Refresh(items[i]);
                }
            }
            else
            {
                goNoFull.SetActive(false);
                goFull.SetActive(true);

                for (int i = 0; i < mtlSlots.Count; i++)
                {
                    mtlSlots[i].Refresh(null);
                }

                newSlotInPnl.Refresh(null);
            }
        }
    }
    private void objLocation(int current, int count, int itemCount, EquipmentItem itemHero, EquipmentItem itemBag)
    { 
        //定位    
        //分三种可能布局 current == 2 3 4
        CurEquipmentUI.SetActive(true);
        EquipmentInfoUI.SetActive(true);
        destroy(EquipmentBox);
       
        if (current == (int)GlobalDef.EquipStateType.EQUIP_LOWGRADE)
        {
            EquipmentInfoUI.SetActive(false);
            GameObject obj = Instantiate(CurEquipmentUI,new Vector3(0,0,0),Quaternion.identity) as GameObject;
            obj.transform.parent = EquipmentBox.transform;
			obj.transform.localPosition = new Vector3(170, -3.34f, 0);
            obj.transform.localScale = new Vector3(1,1,1);
            EquipItemUI itemB = obj.GetComponent<EquipItemUI>();
            itemB.UpdateInfo(itemBag);
            itemB.m_close.gameObject.SetActive(true); 
            itemB.m_equipSprite.gameObject.SetActive(false);

			CurEquipmentUI.transform.localPosition = new Vector3(-170, -3.34f, 0);
            EquipItemUI itemH = CurEquipmentUI.GetComponent<EquipItemUI>();
            itemH.UpdateInfo(itemHero);
            itemH.m_close.gameObject.SetActive(false);
            itemH.m_equipSprite.gameObject.SetActive(true);
            ButtonScrollView.transform.localPosition = new Vector3(395, -50, 0);
        }

         else if (current == (int)GlobalDef.EquipStateType.EQUIP_HIGHTGRADE)
        {
            CurEquipmentUI.SetActive(false);
            GameObject obj = Instantiate(EquipmentInfoUI, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            obj.transform.parent = EquipmentBox.transform;
            obj.transform.localPosition = new Vector3(170, 0, 0);
            obj.transform.localScale = new Vector3(1, 1, 1);
            EquipmentInfoUI.transform.localPosition = new Vector3(-170, 0, 0);
            EquipItemUI itemB = obj.GetComponent<EquipItemUI>();
            itemB.UpdateInfo(itemBag);
            itemB.m_close.gameObject.SetActive(true); 
            itemB.m_equipSprite.gameObject.SetActive(false);

            EquipItemUI itemH = EquipmentInfoUI.GetComponent<EquipItemUI>();
            itemH.UpdateInfo(itemHero);
            itemH.m_close.gameObject.SetActive(false);
            itemH.m_equipSprite.gameObject.SetActive(true);
            ButtonScrollView.transform.localPosition = new Vector3(395, -150, 0);
        }

        else if (current == (int)GlobalDef.EquipStateType.EQUIP_ALLGRADE)
        {
            //count == 5 6 7
            if (count == (int)GlobalDef.EquipStateType.EQUIP_LEFT)
            {
                EquipmentInfoUI.SetActive(false);
				CurEquipmentUI.transform.localPosition = new Vector3(0, -3.34f, 0);
                ButtonScrollView.transform.localPosition = new Vector3(225, -50, 0);

                EquipItemUI itemH = CurEquipmentUI.GetComponent<EquipItemUI>();
                if (itemHero != null)
                {                  
                    itemH.UpdateInfo(itemHero);
                    itemH.m_close.gameObject.SetActive(true);
                    itemH.m_equipSprite.gameObject.SetActive(true);
                }

                if (itemBag != null)
                {
                    itemH.UpdateInfo(itemBag);
                    itemH.m_equipSprite.gameObject.SetActive(false);
                    itemH.m_close.gameObject.SetActive(true);
                }
                    
            }

           else if (count == (int)GlobalDef.EquipStateType.EQUIP_RIGHT)
            {
                CurEquipmentUI.SetActive(false);
                EquipmentInfoUI.transform.localPosition = new Vector3(0, 0, 0);
                
                ButtonScrollView.transform.localPosition = new Vector3(225, -150, 0);

                EquipItemUI itemH = EquipmentInfoUI.GetComponent<EquipItemUI>();

                if (itemHero != null)
                {
                    itemH.UpdateInfo(itemHero);
                    itemH.m_close.gameObject.SetActive(true);
                    itemH.m_equipSprite.gameObject.SetActive(true);
                }

                if (itemBag != null)
                {
                    itemH.UpdateInfo(itemBag);
                    itemH.m_close.gameObject.SetActive(true);
                    itemH.m_equipSprite.gameObject.SetActive(false);
                }
            }

            else if (count == (int)GlobalDef.EquipStateType.EQUIP_CENTER)
            {
                //判断装备是属于哪个档次 来布局
                if (itemCount == (int)GlobalDef.EquipStateType.EQUIP_ONDRESS)
                {
					CurEquipmentUI.transform.localPosition = new Vector3(-170, -3.34f, 0);
                    EquipmentInfoUI.transform.localPosition = new Vector3(170, 0, 0);
                    ButtonScrollView.transform.localPosition = new Vector3(395, -150, 0);

                    EquipItemUI itemH = CurEquipmentUI.GetComponent<EquipItemUI>();
                    itemH.UpdateInfo(itemHero);
                    itemH.m_close.gameObject.SetActive(false);
                    itemH.m_equipSprite.gameObject.SetActive(true);

                    EquipItemUI itemB = EquipmentInfoUI.GetComponent<EquipItemUI>();
                    itemB.UpdateInfo(itemBag);
                    itemB.m_close.gameObject.SetActive(true);
                    itemB.m_equipSprite.gameObject.SetActive(false);

                }
                else if (itemCount == (int)GlobalDef.EquipStateType.EQUIP_INBAG)
                {
					CurEquipmentUI.transform.localPosition = new Vector3(170, -3.34f, 0);
                    EquipmentInfoUI.transform.localPosition = new Vector3(-170, 0, 0);
                    ButtonScrollView.transform.localPosition = new Vector3(395, -50, 0);
                    EquipItemUI itemH = EquipmentInfoUI.GetComponent<EquipItemUI>();
                    itemH.UpdateInfo(itemHero);
                    itemH.m_close.gameObject.SetActive(false);
                    itemH.m_equipSprite.gameObject.SetActive(true);

                    EquipItemUI itemB = CurEquipmentUI.GetComponent<EquipItemUI>();
                    itemB.UpdateInfo(itemBag);
                    itemB.m_close.gameObject.SetActive(true);
                    itemB.m_equipSprite.gameObject.SetActive(false);
                }
            }
        }
        ButtonScrollView.SetActive(false);
        ButtonScrollView.SetActive(true);
        if (grid != null)
            grid.repositionNow = true;
    }
	public void showEquipInfo(EquipmentItem item)
	{
		if(null == item)
		{
			return;
		}
		var manager = (UIManager)FindObjectOfType (typeof(UIManager));
		if (manager == null) 
		{
			return;		
		}
		Transform equipment_info = manager.getPanel("EquipmentInfoUI");
		if (null == equipment_info) 
		{
			return;		
		}
		equipment_info.gameObject.SetActive(true);
		EquipInfoUI info = equipment_info.GetComponentInChildren<EquipInfoUI>();
		info.addEquipment(null, item);
	}
    void SetDatas(HeroManager manager, List<HeroDebugData> heroDatas)
    {
        HeroDebugData data;
        HeroData hero;
        for (int i = 0; i < heroDatas.Count; i++)
        {
            hero = new HeroData();
            data = heroDatas[i];

            //set max
            for (int j = 0; j < data.equipment.Count; j++)
            {
                EquipmentItem item = new EquipmentItem();
                Property.Equip e = new Property.Equip();

                if (data.equipment[j].equipId > 0 && data.equipment[j].equipLevel > 0)
                {
                    e.templateid = (uint)data.equipment[j].equipId;
                    item.parseData(e);

                    //Debug.Log(item.equitype);
                    //set level
                    item.equiplev = data.equipment[j].equipLevel;
                    hero.equipmentList.addItem(i * 10 + j, item);
                }
            }

            //set id level
            if (data.heroId > 0 && data.heroLevel > 0)
            {
                hero.templateID = data.heroId;
                hero.guid = (long)1111111 + i;
                hero.level = data.heroLevel;
                hero.property.country = i + 1;
                hero.activate = false;
                hero.battle = i;
                hero.starLevel = data.heroStar;

                hero.parseData(hero.templateID);

                hero.refreshProperty();
                manager.addHero(hero.guid, hero);
                Debug.Log("hero is init " + i + "   resname : " + hero.resname);
            }

            if (i < 3)
                manager.fightHeroList.setFightHero(hero.battle, hero.guid);
        }
    }
    public EquipProperty(EquipmentItem item)
    {
        this.quality = item.quality;
        this.equipType = item.equitype;
        this.basePropType = item.base_attribute_type;
        if (quality > 1) { inctPropTypes.Add(item.quality_attribute_id1); inctPropValues.Add(infoQualityAttribute.int1); }
        if (quality > 2) { inctPropTypes.Add(item.quality_attribute_id2); inctPropValues.Add(infoQualityAttribute.int2); }
        if (quality > 3) { inctPropTypes.Add(item.quality_attribute_id3); inctPropValues.Add(infoQualityAttribute.int3); }
        if (quality > 4) { inctPropTypes.Add(item.quality_attribute_id4); inctPropValues.Add(infoQualityAttribute.int4); }

        if (item.equitype == 1)
        {
            //lv1:基本属性
            minDamage = item.mindamage;
            maxDamage = item.maxdamage;
        }
        else
            //  lv1:基本属性 
            CalcProp(item.base_attribute_type, item.base_attribute_int);

        //lv1:品质属性:0级一般不开启
        if (IsEnableQualityProp(0))
        {
            Debug.LogError("0 level Enable Quality prop???");
        }

        Refresh(item.equiplev);
    }
Exemple #60
0
 public bool EquipArmor(EquipmentItem a_armor)
 {
     foreach (EquipmentSlot i in _Equipment)
     {
         if (i.slot == a_armor.slot)
         {
             if (i.equiped == null)
             {
                 i.equiped = a_armor;
                 UpdateStats();
                 return true;
             }
         }
     }
     return false;
 }