/// <summary> /// 装备是否可穿戴. /// </summary> /// <returns><c>true</c>, if equip can put was calculated, <c>false</c> otherwise.</returns> /// <param name="Info">Info.</param> public bool CheckEquipCanPut() { bool bRedPot = false; List <int> listEquipID = new List <int>(); listEquipID.Add(Equipment0); listEquipID.Add(Equipment1); listEquipID.Add(Equipment2); listEquipID.Add(Equipment3); listEquipID.Add(Equipment4); listEquipID.Add(Equipment5); for (int i = 0; i < listEquipID.Count; i++) { int itemTypeID = 0; EquipmentPutType type = SoldierM.CheckCanPutEquip(this, listEquipID[i], i, ref itemTypeID); if (!bRedPot) { bRedPot = (type == EquipmentPutType.CanPut) || (type == EquipmentPutType.CanCombinePut); if (bRedPot) { break; } } } return(bRedPot); }
/// <summary> /// /// </summary> /// <param name="dItemID"></param> /// <param name="posIndex">装备索引 0~5</param> /// <param name="solderierInfo"></param> public void SetData(int dItemID, int posIndex, SoldierInfo solderierInfo) { m_iItemID = dItemID; m_soldierInfo = solderierInfo; m_iPosIndex = posIndex; m_itemTypeID = SoldierM.GetSoldierEquip(solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex); if (m_itemTypeID == 0) { NGUIUtil.DebugLog(string.Format(" SoldierTypeID={0},Quality={1},EquipIndex={2} 装备静态数据未配置", solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex)); return; } if (m_iItemID == 0)//当未穿装备时 { ItemTypeInfo info = ItemDC.SearchItem(m_itemTypeID); if (info != null) { m_iItemID = info.ID; m_itemTypeID = info.itemType; m_icon = info.m_Icon; } else { s_itemtypeInfo sInfo = ItemM.GetItemInfo(m_itemTypeID); if (sInfo != null) { m_icon = sInfo.icon; } else { NGUIUtil.DebugLog("itemTypeID =" + m_itemTypeID + " 未配置"); } } } else//已装备 { ItemTypeInfo info1 = ItemDC.GetItem(m_iItemID); if (info1 == null || info1.Positon == 0) { NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + m_iItemID); return; } m_icon = info1.m_Icon; if (info1 != null) { m_iEquipQuality = info1.m_Quality; } } int itemTypeid = 0; m_equipmentPutType = SoldierM.CheckCanPutEquip(solderierInfo, dItemID, posIndex, ref itemTypeid); SetUI(); }
public void SetZhuangBeiList(List <int> listItemID) { bool bRedPot = false; for (int i = 0; i < listItemID.Count; i++) { int itemTypeID = 0; EquipmentPutType type = SoldierM.CheckCanPutEquip(Info, listItemID[i], i, ref itemTypeID); EquipPutType = type; if (type == EquipmentPutType.CanPut || type == EquipmentPutType.CanCombine || type == EquipmentPutType.CanCombinePut) { NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", "pdbxx_002ic"); } else if (type == EquipmentPutType.HaveCannot) { NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", "pdbxx_003ic"); } else if (type == EquipmentPutType.HavePut) { ItemTypeInfo info1 = ItemDC.GetItem(listItemID[i]); if (info1 == null || info1.Positon == 0) { NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + listItemID[i]); MyHead.SprZhuangBeiList[i].sprite2D = null; continue; } else { NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", info1.m_Icon.ToString()); } } else { MyHead.SprZhuangBeiList[i].sprite2D = null; } if (!bRedPot) { bRedPot = (type == EquipmentPutType.CanPut) || (type == EquipmentPutType.CanCombinePut); } } MyHead.SprLittleRed.gameObject.SetActive(bRedPot); }
/// <summary> /// 检测是否存在这样的炮弹兵:存在空闲装备位,且装备可以通过合成得到(金币足够)或直接关卡掉落得到 /// </summary> public bool CheckExistEquipPosNoEquip() { List <int> listEquipID = new List <int>(); listEquipID.Add(Equipment0); listEquipID.Add(Equipment1); listEquipID.Add(Equipment2); listEquipID.Add(Equipment3); listEquipID.Add(Equipment4); listEquipID.Add(Equipment5); for (int i = 0; i < listEquipID.Count; i++) { int itemTypeID = 0; EquipmentPutType type = SoldierM.CheckCanPutEquip(this, listEquipID[i], i, ref itemTypeID); if (type == EquipmentPutType.NoCanCombine || type == EquipmentPutType.ReadyCombine) { return(true); } } return(false); }