void TryFillUpDressItem(CocoDressItemHolder itemHolder, List <string> shouldAddedItemIds, List <string> currItemIds, bool onlyInMainCategory = false) { if (itemHolder == null) { return; } // check if in main category if (onlyInMainCategory) { CocoDressCategoryHolder categoryHolder = (CocoDressCategoryHolder)itemHolder.ParentHolder; if (!categoryHolder.isMain) { return; } } // check if conflict with will added items List <CocoDressItemConflictData> lastConflictDatas = GetDressConflictDatas(itemHolder, shouldAddedItemIds); if (lastConflictDatas.Count > 0) { return; } // check if conflict with current existed items lastConflictDatas = GetDressConflictDatas(itemHolder, currItemIds); if (lastConflictDatas.Count > 0) { return; } // Debug.LogError ("fill: " + itemHolder.id); shouldAddedItemIds.Add(itemHolder.id); }
private CocoDressCategoryHolder GenerateCategory(string categoryPath, out Dictionary <string, HashSet <string> > sceneItemIds) { var categoryHolder = new CocoDressCategoryHolder { id = Path.GetFileName(categoryPath) }; if (categoryHolder.id == null) { sceneItemIds = null; return(null); } // match cover layer if (_editorConfigHolder.dressCategoryCoverLayerIds.ContainsKey(categoryHolder.id)) { categoryHolder.coverLayerId = _editorConfigHolder.dressCategoryCoverLayerIds [categoryHolder.id]; } // main category if (_editorConfigHolder.dressMainCategoryIds.Contains(categoryHolder.id)) { categoryHolder.isMain = true; } var scenePaths = Directory.GetDirectories(categoryPath); sceneItemIds = new Dictionary <string, HashSet <string> > (scenePaths.Length); foreach (var scenePath in scenePaths) { var sceneId = Path.GetFileName(scenePath); if (string.IsNullOrEmpty(sceneId)) { continue; } var itemHolders = CollectDressItemsInScene(scenePath); var reorganizedItemHolders = _owner.OnConfigRawItemsCollected(itemHolders, categoryHolder.id, sceneId); if (reorganizedItemHolders != null && reorganizedItemHolders.Count > 0) { itemHolders = reorganizedItemHolders; } if (itemHolders != null) { categoryHolder.itemHolders.AddRange(itemHolders.Values); sceneItemIds.Add(sceneId, new HashSet <string> (itemHolders.Keys)); } } return(categoryHolder); }
public List <string> GetAllNonMainItemIds() { List <string> itemIds = new List <string> (); m_CurrDressModelSetDic.ForEach((itemId, modelSet) => { CocoDressCategoryHolder categoryHolder = modelSet.ItemHolder.ParentHolder as CocoDressCategoryHolder; if (categoryHolder != null && !categoryHolder.isMain) { itemIds.Add(itemId); } }); return(itemIds); }
void CheckChangeForRemoveItem(CocoDressItemModelSet modelSet) { modelSet.ItemRenderers.ForEach(smr => { if (m_RendererDic.ContainsKey(smr.name)) { m_RendererDic.Remove(smr.name); } }); CocoDressItemHolder itemHolder = modelSet.ItemHolder; CocoDressCategoryHolder categoryHolder = (CocoDressCategoryHolder)itemHolder.ParentHolder; if (!categoryHolder.isMain) { return; } // record last item, in order to resume it var layer = itemHolder.CoverLayer; if (m_LastCoverItemHolderDic.ContainsKey(layer)) { m_LastCoverItemHolderDic [layer] = itemHolder; int index = m_SortedLastCovers.IndexOf(layer); for (int i = index + 1; i < m_SortedLastCovers.Count; i++) { m_SortedLastCovers [i - 1] = m_SortedLastCovers [i]; } m_SortedLastCovers [m_SortedLastCovers.Count - 1] = layer; //Debug.LogError ("update " + layer + " -> " + itemHolder.id); } else { m_LastCoverItemHolderDic.Add(layer, itemHolder); //Debug.LogError ("add " + layer + " -> " + itemHolder.id); m_SortedLastCovers.Add(layer); } }
private CocoDressCategoryConfigHolder GenerateCategoryConfig(CocoDressCategoryHolder categoryHolder) { return(GenerateConfig <CocoDressCategoryConfigHolder, CocoDressCategoryHolder> (categoryHolder, "dress_category")); }