private List <CocoRoleDressItemHolder> GetUnOwnedItemHolders(CocoRoleDressSceneHolder sceneHolder, List <string> categoryIds, CocoDressStateModel stateModel,
                                                                     bool containTempOwned = true)
        {
            if (categoryIds == null || categoryIds.Count <= 0)
            {
                return(null);
            }

            var unOwnedItemHolders = new List <CocoRoleDressItemHolder> ();

            categoryIds.ForEach(categoryId => {
                if (!sceneHolder.CategoryItemHolderDic.ContainsKey(categoryId))
                {
                    return;
                }

                var sceneCategoryItemHolders =
                    GetUnOwnedItemHoldersInList(sceneHolder.CategoryItemHolderDic [categoryId], stateModel, containTempOwned);
                if (sceneCategoryItemHolders != null && sceneCategoryItemHolders.Count > 0)
                {
                    unOwnedItemHolders.AddRange(sceneCategoryItemHolders);
                }
            });

            return(unOwnedItemHolders);
        }
Example #2
0
        private void RandomSortSceneDress(CocoRoleDressSceneHolder roleSceneHolder, HashSet <string> basicItemIds)
        {
            var sceneDressItemHolders = new List <CocoRoleDressItemHolder> (roleSceneHolder.itemHolders.Count);

            roleSceneHolder.CategoryItemHolderDic.ForEach(roleDressItemHolders => {
                RandomSortRoleDressItems(ref roleDressItemHolders, basicItemIds);
                sceneDressItemHolders.AddRange(roleDressItemHolders);
            });
            roleSceneHolder.itemHolders = sceneDressItemHolders;
        }
Example #3
0
        private CocoRoleDressHolder GenerateRoleDress(CocoDressEditorRoleDressConfigHolder editorRoleDressConfigHolder,
                                                      Dictionary <string, Dictionary <string, HashSet <string> > > allSceneDressItemIds)
        {
            var roleDressHolder = new CocoRoleDressHolder {
                id = editorRoleDressConfigHolder.dressId
            };

            // scene holders
            if (editorRoleDressConfigHolder.sceneConfigHolders.Count > 0)
            {
                editorRoleDressConfigHolder.sceneConfigHolders.ForEach(editorSceneConfigHolder => {
                    if (!allSceneDressItemIds.ContainsKey(editorSceneConfigHolder.sceneId))
                    {
                        return;
                    }

                    var sceneHolder = new CocoRoleDressSceneHolder {
                        id = editorSceneConfigHolder.sceneId
                    };
                    roleDressHolder.sceneHolders.Add(sceneHolder);

                    var sceneItemIds = allSceneDressItemIds [sceneHolder.id];
                    foreach (var categoryItemIds in sceneItemIds.Values)
                    {
                        foreach (var sceneDressItemId in categoryItemIds)
                        {
                            if (editorSceneConfigHolder.itemIdPrefixs.Count > 0)
                            {
                                editorSceneConfigHolder.itemIdPrefixs.ForEach(itemIdPrefix => {
                                    if (sceneDressItemId.StartsWith(itemIdPrefix))
                                    {
                                        var itemHolder = new CocoRoleDressItemHolder {
                                            id = sceneDressItemId, order = sceneHolder.itemHolders.Count
                                        };
                                        sceneHolder.itemHolders.Add(itemHolder);
                                    }
                                });
                            }
                            else
                            {
                                // default contain all items
                                var itemHolder = new CocoRoleDressItemHolder {
                                    id = sceneDressItemId, order = sceneHolder.itemHolders.Count
                                };
                                sceneHolder.itemHolders.Add(itemHolder);
                            }
                        }
                    }
                });
            }
            else
            {
                // default contain all scenes
                foreach (var kvpCategoryItemIds in allSceneDressItemIds)
                {
                    var sceneHolder = new CocoRoleDressSceneHolder {
                        id = kvpCategoryItemIds.Key
                    };
                    roleDressHolder.sceneHolders.Add(sceneHolder);

                    foreach (var sceneDressItemId in kvpCategoryItemIds.Value)
                    {
                        foreach (var itemId in sceneDressItemId.Value)
                        {
                            var itemHolder = new CocoRoleDressItemHolder {
                                id = itemId, order = sceneHolder.itemHolders.Count
                            };
                            sceneHolder.itemHolders.Add(itemHolder);
                        }
                    }
                }
            }

            return(roleDressHolder);
        }