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); } }