private CocoRoleDressConfigHolder GenerateRoleDressConfig(CocoRoleDressHolder roleDressHolder) { return(GenerateConfig <CocoRoleDressConfigHolder, CocoRoleDressHolder> (roleDressHolder, "role_dress")); }
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); }