| | |
| | | protected const byte param_Prefab = 2;
|
| | | protected const byte param_Clip = 4;
|
| | | protected const byte param_AnimatorController = 8;
|
| | | protected const byte param_AnimatorUIController = 16;
|
| | |
|
| | | protected class MountPointInfo
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public static bool IsBuildAnimatorUIController
|
| | | {
|
| | | get
|
| | | {
|
| | | return (buildParams & param_AnimatorUIController) != 0;
|
| | | }
|
| | | set
|
| | | {
|
| | | if (value)
|
| | | {
|
| | | buildParams |= param_AnimatorUIController;
|
| | | }
|
| | | else
|
| | | {
|
| | | buildParams &= ~param_AnimatorUIController;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected static List<MountPointInfo> m_MountPointInfoList = new List<MountPointInfo>();
|
| | |
|
| | | public void BuildPrefab(string path, string resName, string suffix, string outName = null)
|
| | | public void BuildPrefab(string path, string resName, string suffix, string outName = null, bool isHighMesh = false)
|
| | | {
|
| | | if (string.IsNullOrEmpty(outName))
|
| | | {
|
| | |
| | | string _absOriginalePath = string.Format("{0}/ART/Role/{1}/{2}.FBX", Application.dataPath, path, resName);
|
| | | string _originalAssetPath = string.Format("Assets/ART/Role/{0}/{1}.FBX", path, resName);
|
| | |
|
| | | string _absAssetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutPath, suffix, outName);
|
| | | string _assetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, outName);
|
| | | if ((resName.StartsWith("A_Zs") || resName.StartsWith("A_Fs"))
|
| | | && !isHighMesh
|
| | | && (suffix.Equals(InstanceResourcesLoader.raceSuffix) || suffix.Equals(InstanceResourcesLoader.handSuffix)))
|
| | | {
|
| | | _absOriginalePath = string.Format("{0}/ART/Role/{1}/{2}_Dm.FBX", Application.dataPath, path, resName);
|
| | | _originalAssetPath = string.Format("Assets/ART/Role/{0}/{1}_Dm.FBX", path, resName);
|
| | | }
|
| | |
|
| | | string _acAbsAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | string _acAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | string _tempPrefabName = outName;
|
| | |
|
| | | if (isHighMesh
|
| | | && ((resName.StartsWith("A_Zs") || resName.StartsWith("A_Fs"))
|
| | | && (suffix.Equals(InstanceResourcesLoader.raceSuffix) || suffix.Equals(InstanceResourcesLoader.handSuffix))))
|
| | | {
|
| | | _tempPrefabName += "_UI";
|
| | |
|
| | | _absOriginalePath = string.Format("{0}/ART/Role/{1}/{2}.FBX", Application.dataPath, path, resName);
|
| | | _originalAssetPath = string.Format("Assets/ART/Role/{0}/{1}.FBX", path, resName);
|
| | | }
|
| | |
|
| | | string _absAssetPath = string.Format("{0}Gmodels/{1}{2}.prefab", ResourcesPath.ResourcesOutPath, suffix, _tempPrefabName);
|
| | | string _assetPath = string.Format("{0}Gmodels/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, _tempPrefabName);
|
| | |
|
| | | string _acAbsAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, path);
|
| | | string _acAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, path);
|
| | |
|
| | | if (!outName.Equals(resName))
|
| | | {
|
| | | _acAbsAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | _acAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | }
|
| | |
|
| | | if (string.IsNullOrEmpty(_absOriginalePath))
|
| | | {
|
| | |
| | | // 指定动画控制器
|
| | | if (!File.Exists(_acAbsAssetPath))
|
| | | {
|
| | | Debug.LogWarningFormat("检测到此prefab资源: {0} 的AnimatorContorller(动画控制器)资源尚未生成, 这里需要注意啊此资源是否需要先生成AnimatorContorller(动画控制器), 再生成prefab资源.", path);
|
| | | Debug.LogWarningFormat("检测到此prefab资源: {0} 的AnimatorContorller(动画控制器)资源尚未生成, 这里需要注意啊此资源是否需要先生成AnimatorContorller(动画控制器), 再生成prefab资源.", _acAssetPath);
|
| | | }
|
| | |
|
| | | ColliderInfo _colliderInfo = null;
|
| | |
| | | }
|
| | |
|
| | | // 为了防止fbx本身就带有材质, 这里去掉fbx上的Import material属性
|
| | | ModelImporter _modelImport = AssetImporter.GetAtPath(_originalAssetPath) as ModelImporter;
|
| | | if (_modelImport != null)
|
| | | {
|
| | | if (_modelImport.importMaterials)
|
| | | {
|
| | | _modelImport.importMaterials = false;
|
| | | _modelImport.SaveAndReimport();
|
| | | }
|
| | | }
|
| | | //ModelImporter _modelImport = AssetImporter.GetAtPath(_originalAssetPath) as ModelImporter;
|
| | | //if (_modelImport != null)
|
| | | //{
|
| | | // if (_modelImport.importMaterials)
|
| | | // {
|
| | | // _modelImport.importMaterials = false;
|
| | | // _modelImport.SaveAndReimport();
|
| | | // }
|
| | | //}
|
| | |
|
| | | GameObject _prefab = Object.Instantiate(_fbxRes);
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 加载特效
|
| | | if (outName.StartsWith("M")
|
| | | || outName.StartsWith("N")
|
| | | || outName.StartsWith("B_")
|
| | | || outName.StartsWith("Zq"))
|
| | | {
|
| | | HandlerModelEffect("horseEffectConfig", null, outName, ref _prefab);
|
| | | }
|
| | | else if (InstanceResourcesLoader.raceSuffix.Equals(suffix))
|
| | | {
|
| | | HandlerModelEffect("clothesEffectConfig", path, resName, ref _prefab);
|
| | | }
|
| | | //if (outName.StartsWith("M")
|
| | | // || outName.StartsWith("N")
|
| | | // || outName.StartsWith("B_")
|
| | | // || outName.StartsWith("Zq"))
|
| | | //{
|
| | | // HandlerModelEffect("horseEffectConfig", null, outName, ref _prefab);
|
| | | //}
|
| | | //else if (InstanceResourcesLoader.raceSuffix.Equals(suffix))
|
| | | //{
|
| | | // HandlerModelEffect("clothesEffectConfig", path, resName, ref _prefab);
|
| | | //}
|
| | |
|
| | | if (_colliderInfo != null)
|
| | | {
|
| | |
| | | _collider.height = _colliderInfo.height;
|
| | | }
|
| | |
|
| | | Transform _rendererNode = _prefab.transform.Find(resName);
|
| | | string _tempName = resName;
|
| | |
|
| | | if ((resName.StartsWith("A_Zs") || resName.StartsWith("A_Fs"))
|
| | | && (suffix.Equals(InstanceResourcesLoader.raceSuffix)
|
| | | || suffix.Equals(InstanceResourcesLoader.handSuffix))
|
| | | && !isHighMesh)
|
| | | {
|
| | | _tempName += "_Dm";
|
| | | }
|
| | |
|
| | | Transform _rendererNode = _prefab.transform.Find(_tempName);
|
| | | if (!_rendererNode)
|
| | | {
|
| | | _rendererNode = _prefab.transform;
|
| | |
| | | Renderer _renderer = _rendererNode.GetComponent<Renderer>();
|
| | | if (_renderer)
|
| | | {
|
| | | OnSetupRenderer(path, resName, ref _renderer);
|
| | | OnSetupRenderer(path, _tempName, ref _renderer);
|
| | | }
|
| | |
|
| | | Animation _animation = _prefab.GetComponent<Animation>();
|
| | |
| | | Object.DestroyImmediate(_animation);
|
| | | }
|
| | |
|
| | | Animator _animator = _prefab.GetComponent<Animator>();
|
| | |
|
| | | if (!_animator)
|
| | | if (suffix.Equals(InstanceResourcesLoader.raceSuffix)
|
| | | || suffix.Equals(InstanceResourcesLoader.horseSuffix)
|
| | | || suffix.Equals(InstanceResourcesLoader.wingSuffix))
|
| | | {
|
| | | _animator = _prefab.AddComponent<Animator>();
|
| | | }
|
| | | Animator _animator = _prefab.GetComponent<Animator>();
|
| | |
|
| | | // 绑定动画控制器
|
| | | RuntimeAnimatorController _runtimeAnimatorContorller = AssetDatabase.LoadAssetAtPath<RuntimeAnimatorController>(_acAssetPath);
|
| | | if (_runtimeAnimatorContorller)
|
| | | {
|
| | | _animator.runtimeAnimatorController = _runtimeAnimatorContorller;
|
| | | if (!_animator)
|
| | | {
|
| | | _animator = _prefab.AddComponent<Animator>();
|
| | | }
|
| | |
|
| | | if (suffix.Equals(InstanceResourcesLoader.wingSuffix))
|
| | | {
|
| | | // 绑定动画控制器
|
| | | RuntimeAnimatorController _runtimeAnimatorContorller = AssetDatabase.LoadAssetAtPath<RuntimeAnimatorController>(_acAssetPath);
|
| | | if (_runtimeAnimatorContorller)
|
| | | {
|
| | | _animator.runtimeAnimatorController = _runtimeAnimatorContorller;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | PrefabUtility.CreatePrefab(_assetPath, _prefab, ReplacePrefabOptions.Default);
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | string _configPath = ResourcesPath.ResourcesOutAssetPath + "Mob/" + configName + ".asset";
|
| | | string _configPath = ResourcesPath.ResourcesOutAssetPath + "Gmodels/" + configName + ".asset";
|
| | | HorseEffectConfig _horseEffectConfig = AssetDatabase.LoadAssetAtPath<HorseEffectConfig>(_configPath);
|
| | | if (_horseEffectConfig == null
|
| | | || _horseEffectConfig.effectConfigList == null
|
| | |
| | | _effect = Object.Instantiate(_effect);
|
| | | _effect.name = _effect.name.Replace("(Clone)", "");
|
| | | _effect.transform.SetParentEx(_parent, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | _effect.SetLayer(LayerUtility.BattleEffect, true);
|
| | | _effect.SetLayer(LayerUtility.BattleEffectLow, true);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | string _absOriginaleDirectory = string.Format("{0}/ART/Role/{1}", Application.dataPath, path);
|
| | | string _assetOriginalDirectory = string.Format("Assets/ART/Role/{0}", path);
|
| | | string _absAssetDirectory = string.Format("{0}/ResourcesOut/Mob/{1}/AnimationClips", Application.dataPath, path);
|
| | | string _assetDirectory = string.Format("Assets/ResourcesOut/Mob/{0}/AnimationClips", path);
|
| | | string _absAssetDirectory = string.Format("{0}/ResourcesOut/Gmodels/{1}/AnimationClips", Application.dataPath, path);
|
| | | string _assetDirectory = string.Format("Assets/ResourcesOut/Gmodels/{0}/AnimationClips", path);
|
| | |
|
| | | if (!Directory.Exists(_absOriginaleDirectory))
|
| | | {
|
| | |
| | | outName = resName;
|
| | | }
|
| | |
|
| | | string _absAssetPath = string.Format("{0}Mob/{1}", ResourcesPath.ResourcesOutPath, resName);
|
| | | string _absAssetPath = string.Format("{0}Gmodels/{1}", ResourcesPath.ResourcesOutPath, outName);
|
| | |
|
| | | if (!Directory.Exists(_absAssetPath))
|
| | | {
|
| | | Directory.CreateDirectory(_absAssetPath);
|
| | | }
|
| | |
|
| | | _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | _absAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, outName, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | string _assetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, outName, AnimatorControllerLoader.controllerSuffix, outName);
|
| | |
|
| | | string _assetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerSuffix, outName);
|
| | | if (templeName.Equals("Temple_AnimatorController_BossShow"))
|
| | | {
|
| | | _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerShowSuffix, resName);
|
| | | _assetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerShowSuffix, resName);
|
| | | _absAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerShowSuffix, resName);
|
| | | _assetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerShowSuffix, resName);
|
| | | }
|
| | |
|
| | | if (templeName.Equals("Temple_AnimatorController_Realm"))
|
| | | {
|
| | | _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerRealmSuffix, resName);
|
| | | _assetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerRealmSuffix, resName);
|
| | | _absAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, resName, AnimatorControllerLoader.controllerRealmSuffix, resName);
|
| | | _assetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, resName, AnimatorControllerLoader.controllerRealmSuffix, resName);
|
| | | }
|
| | | string _templePath = string.Format("{0}Mob/{1}.controller", ResourcesPath.ResourcesOutPath, templeName);
|
| | |
|
| | | if (templeName.Equals("Temple_AnimatorController_UI"))
|
| | | {
|
| | | _absAssetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, outName, AnimatorControllerLoader.controllerUISuffix, outName);
|
| | | _assetPath = string.Format("{0}Gmodels/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, outName, AnimatorControllerLoader.controllerUISuffix, outName);
|
| | | }
|
| | |
|
| | | string _templePath = string.Format("{0}Gmodels/{1}.controller", ResourcesPath.ResourcesOutPath, templeName);
|
| | |
|
| | | if (File.Exists(_absAssetPath))
|
| | | {
|
| | |
| | |
|
| | | // 读取配置文件
|
| | | string _configPath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
| | | "mob/",
|
| | | "gmodels/",
|
| | | configName,
|
| | | ".asset");
|
| | |
|
| | |
| | | EditorUtility.SetDirty(_animatorController);
|
| | |
|
| | | AssetImporter _assetImport = AssetImporter.GetAtPath(_assetPath);
|
| | | _assetImport.assetBundleName = ResourcesPath.MOB_FOLDER_NAME + ResourcesPath.MOB_SUFFIX + resName;
|
| | | _assetImport.assetBundleName = ResourcesPath.MOB_FOLDER_NAME + ResourcesPath.MOB_SUFFIX + outName;
|
| | |
|
| | | EditorUtility.ClearProgressBar();
|
| | |
|
| | |
| | | {
|
| | |
|
| | | string _assetPath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
| | | "mob/",
|
| | | "gmodels/",
|
| | | modelName,
|
| | | "/AnimationClips/",
|
| | | clipName,
|