public void OnConfigGenerationEnded(CocoAssetConfigHolder assetConfigHolder) { if (onConfigGenerationEnded != null) { onConfigGenerationEnded(assetConfigHolder); } }
private void SetConfigAssetTags(CocoAssetConfigHolder assetConfigHolder) { SetConfigTags(assetConfigHolder.categoryConfigHolders); SetConfigTags(assetConfigHolder.sceneConfigHolders); SetConfigTags(assetConfigHolder.roleDressConfigHolders); SetConfigTags(assetConfigHolder.roleBodyConfigHolders); SetConfigTags(assetConfigHolder.roleConfigHolders); SetConfigTag(assetConfigHolder); }
public void AutoSetAssetBundleTags(CocoAssetConfigHolder assetConfigHolder, string rootDirectory) { if (assetConfigHolder == null) { return; } _rootDirectory = rootDirectory; InitContentTags(); SetAssetTags(assetConfigHolder); }
public void OnConfigAllRoleDressItemsAfterRandomSorting(CocoAssetConfigHolder assetConfigHolder) { if (onConfigRoleDressItemAfterRandomSorting == null) { return; } assetConfigHolder.RoleDressHolderDic.ForEach(roleDressHolder => { roleDressHolder.sceneHolders.ForEach(sceneHolder => { sceneHolder.itemHolders.ForEach(itemHolder => onConfigRoleDressItemAfterRandomSorting(itemHolder)); }); }); }
private void LoadAssetConfig() { var path = Path.Combine(_assetConfigFullDirectory, m_EditConfigHolder.globalConfigFileName); m_AssetConfigHolder = CocoData.LoadFromJsonFile <CocoAssetConfigHolder> (path); if (m_AssetConfigHolder == null) { return; } m_AssetConfigHolder.LoadSubConfigs(_rootFullDirectory); m_AssetConfigHolder.LinkParent(null); }
private void SetSceneAssetTags(CocoAssetConfigHolder assetConfigHolder) { foreach (var sceneHolder in assetConfigHolder.SceneHolderDic.Values) { var tag = CocoDressSettings.ASSET_BUNDLE_TAG_PREFIX + sceneHolder.id; foreach (var categoryHolder in sceneHolder.categoryHolders) { foreach (var itemHolder in categoryHolder.itemHolders) { SetItemTag(itemHolder.LinkedDressItemHolder, tag); } } } }
private void AutoGenerateAssetConfig() { var path = Path.Combine(_assetConfigFullDirectory, m_EditConfigHolder.globalConfigFileName); if (m_AssetConfigHolder != null || File.Exists(path)) { if (EditorUtility.DisplayDialog(MESSAGE_TITLE_WARNING, MESSAGE_CONTENT_AUTO_GENERATE, BUTTON_CANCEL, BUTTON_STILL_CONTINUE)) { return; } } m_AssetConfigHolder = _assetConfigurator.AutoGenerateConfigByOwner(this); SaveAssetConfig(); }
private void RandomSortRoleDresses(CocoAssetConfigHolder assetConfigHolder) { // collect all basic items var basicItemIds = new HashSet <string> (); assetConfigHolder.RoleHolderDic.ForEach(roleHolder => { roleHolder.basicItemIds.ForEach(basicItemId => { if (!basicItemIds.Contains(basicItemId)) { basicItemIds.Add(basicItemId); } }); }); assetConfigHolder.RoleDressHolderDic.ForEach(roleDressHolder => { // reset random seed for each role if (ShouldResetRandomSeed(roleDressHolder.id)) { Random.InitState(0); } roleDressHolder.sceneHolders.ForEach(sceneHolder => { RandomSortSceneDress(sceneHolder, basicItemIds); }); }); }
private CocoAssetConfigHolder GenerateAssetConfig() { // create asset config holder var fullPath = Path.Combine(_assetConfigFullDirectory, _editorConfigHolder.globalConfigFileName); var assetConfigHolder = new CocoAssetConfigHolder() { id = Path.GetFileNameWithoutExtension(_editorConfigHolder.globalConfigFileName), assetPath = GetRelativePath(fullPath) }; var allSceneDressItemIds = new Dictionary <string, Dictionary <string, HashSet <string> > > (); // create category holders var originAssetPath = Path.Combine(_rootFullDirectory, _editorConfigHolder.assetDirectory); originAssetPath = CocoDressEditorHelper.GetFullPath(originAssetPath); var categoryPaths = Directory.GetDirectories(originAssetPath); foreach (var path in categoryPaths) { Dictionary <string, HashSet <string> > sceneItemIds; var categoryHolder = GenerateCategory(path, out sceneItemIds); var categoryConfigHolder = GenerateCategoryConfig(categoryHolder); var tItemCount = 0; foreach (var item in sceneItemIds.Values) { tItemCount += item.Count; if (tItemCount > 0) { break; } } if (categoryHolder != null && tItemCount > 0) { assetConfigHolder.categoryConfigHolders.Add(categoryConfigHolder); CollectAllSceneDressItemIds(allSceneDressItemIds, sceneItemIds, categoryHolder.id); } } // create scene holders foreach (var kvpSceneDressItemIds in allSceneDressItemIds) { var sceneHolder = GenerateScene(kvpSceneDressItemIds.Key, kvpSceneDressItemIds.Value); var sceneConfigHolder = GenerateSceneConfig(sceneHolder); if (sceneConfigHolder != null) { assetConfigHolder.sceneConfigHolders.Add(sceneConfigHolder); } } // create role dress _editorConfigHolder.roleDressConfigHolders.ForEach(editorRoleDressConfigHolder => { var roleDressHolder = GenerateRoleDress(editorRoleDressConfigHolder, allSceneDressItemIds); if (roleDressHolder != null) { var roleDressConfigHolder = GenerateRoleDressConfig(roleDressHolder); if (roleDressConfigHolder != null) { assetConfigHolder.roleDressConfigHolders.Add(roleDressConfigHolder); } } }); // create role body _editorConfigHolder.roleBodyConfigHolders.ForEach(editorRoleBodyConfigHolder => { var roleBodyHolder = GenerateRoleBody(editorRoleBodyConfigHolder); if (roleBodyHolder != null) { var roleBodyConfigHolder = GenerateRoleBodyConfig(roleBodyHolder); if (roleBodyConfigHolder != null) { assetConfigHolder.roleBodyConfigHolders.Add(roleBodyConfigHolder); } } }); // create role _editorConfigHolder.roleConfigHolders.ForEach(editorRoleConfigHolder => { var roleHolder = GenerateRole(editorRoleConfigHolder); if (roleHolder != null) { var roleConfigHolder = GenerateRoleConfig(roleHolder); if (roleConfigHolder != null) { assetConfigHolder.roleConfigHolders.Add(roleConfigHolder); } } }); return(assetConfigHolder); }
private void SetAssetTags(CocoAssetConfigHolder assetConfigHolder) { SetConfigAssetTags(assetConfigHolder); SetSceneAssetTags(assetConfigHolder); }