Exemplo n.º 1
0
        public void LinkRoleDressItemHolder(CocoRoleDressItemHolder roleDressItemHolder)
        {
            if (m_LinkedRoleDressItemHolders.Contains(roleDressItemHolder))
            {
                return;
            }

            m_LinkedRoleDressItemHolders.Add(roleDressItemHolder);
        }
Exemplo n.º 2
0
        public CocoRoleDressItemHolder GetItemHolder(string itemId)
        {
            CocoRoleDressItemHolder matchedItemHolder = null;

            foreach (var kvpCategoryItemHolders in CategoryItemHolderDic)
            {
                matchedItemHolder = kvpCategoryItemHolders.Value.Find(itemHolder => itemHolder.id == itemId);
            }

            return(matchedItemHolder);
        }
Exemplo n.º 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);
        }