public void item_change(OneBagSlot slot) { if (slot.currentUseType == useType.end)//该槽位未解锁 { return; } initPropList(); currentSlotIndex = slot.index; }
public void InitBag(useType use_type) { currentUseType = use_type; List <GDEItemData> list = SDDataManager.Instance.PlayerData.propsTeam; if (list.Count < SDConstants.BagStartVolime)//初始化 { SDDataManager.Instance.PlayerData.propsTeam.Clear(); SDDataManager.Instance.PlayerData.Set_propsTeam(); GDEItemData a = new GDEItemData(GDEItemKeys.Item_MaterialEmpty) { id = string.Empty, num = 0, index = 0, }; SDDataManager.Instance.PlayerData.propsTeam.Add(a); SDDataManager.Instance.PlayerData.Set_propsTeam(); GDEItemData a1 = new GDEItemData(GDEItemKeys.Item_MaterialEmpty) { id = string.Empty, num = 0, index = 1, }; SDDataManager.Instance.PlayerData.propsTeam.Add(a1); SDDataManager.Instance.PlayerData.Set_propsTeam(); list = SDDataManager.Instance.PlayerData.propsTeam; } // allSlots.Clear(); for (int i = 0; i < scrollRect.content.childCount; i++) { OneBagSlot bs = scrollRect.content.GetChild(i).GetComponent <OneBagSlot>(); if (i < list.Count)//已解锁位置 { bs.initSlot(currentUseType, list[i]); } else { bs.initSlot(useType.end , new GDEItemData(GDEItemKeys.Item_MaterialEmpty) { id = string.Empty, num = 0 }); } bs.index = i; allSlots.Add(bs); } }
public void item_use(OneBagSlot slot) { currentSlotIndex = slot.index; GDEItemData P = SDDataManager.Instance.PlayerData.propsTeam[currentSlotIndex]; if (P != null && !string.IsNullOrEmpty(P.id)) { consumableItem item = SDDataManager.Instance.getConsumableById(P.id); if (!item.isProp) { return; } CurrentPropItem = item; BM._PropTarget = item.AIM; BM.refreshPropEnableTarget(); BM._PropRange = item.AOE; SDGameManager.Instance.isUsingProp = true; BM.PropSpecialStr = item.SpecialStr; BM.PF.checkSpecialStr(item.SpecialStr, P.id); } }