| | |
| | | using TableConfig; |
| | | |
| | | using UnityEngine; |
| | | using UnityEditor; |
| | | |
| | |
| | | { |
| | | public void BuildModelRes(int id, bool isHighMesh = false) |
| | | { |
| | | ModelResConfig _modelRes = Config.Instance.Get<ModelResConfig>(id); |
| | | ModelResConfig _modelRes = ModelResConfig.Get(id); |
| | | if (_modelRes == null) |
| | | { |
| | | Debug.LogWarningFormat("要生成的ModelRes资源id: {0} 并不存在于配置表中, 请确认是否填写有错.", id); |
| | |
| | | return; |
| | | } |
| | | |
| | | ModelResConfig _modelRes = Config.Instance.Get<ModelResConfig>(id); |
| | | ModelResConfig _modelRes = ModelResConfig.Get(id); |
| | | string _path = _modelRes.ResourcesName; |
| | | string _resName = _modelRes.ResourcesName; |
| | | if (_path.IndexOf('/') != -1) |
| | |
| | | _path = _path.Substring(0, _modelRes.ResourcesName.IndexOf('/')); |
| | | } |
| | | |
| | | if (suffix.Equals(InstanceResourcesLoader.raceSuffix)) |
| | | { |
| | | HandleMaterial(_path, _resName, _modelRes.Material_Fight_Normal); |
| | | HandleMaterial(_path, _resName, _modelRes.Material_UI_Normal); |
| | | HandleMaterial(_path, _resName, _modelRes.Material_Fight_Suit); |
| | | HandleMaterial(_path, _resName, _modelRes.Material_UI_Suit); |
| | | } |
| | | |
| | | BuildPrefab(_path, _resName, suffix, null, isHighMesh); |
| | | } |
| | | |
| | | public static void HandleMaterial(string path, string bunedleName, string assetName) |
| | | { |
| | | if (string.IsNullOrEmpty(assetName)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | string _originalePath = string.Format("Assets/ART/Role/{0}/Materials/{1}.mat", path, assetName); |
| | | var _old = AssetDatabase.LoadAssetAtPath<Material>(_originalePath); |
| | | var _material = Object.Instantiate(_old); |
| | | AssetDatabase.CreateAsset(_material, "Assets/ResourcesOut/Mob/" + path + "/Materials/" + assetName + ".mat"); |
| | | var _importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(_material)); |
| | | _importer.assetBundleName = ResourcesPath.MOB_FOLDER_NAME |
| | | + (InstanceResourcesLoader.raceSuffix + bunedleName).ToLower(); |
| | | |
| | | EditorUtility.SetDirty(_material); |
| | | } |
| | | |
| | | public static void BuildAnimationClip(int id) |
| | |
| | | return; |
| | | } |
| | | |
| | | ModelResConfig _modelRes = Config.Instance.Get<ModelResConfig>(id); |
| | | ModelResConfig _modelRes = ModelResConfig.Get(id); |
| | | string _path = _modelRes.ResourcesName; |
| | | if (_path.IndexOf('/') != -1) |
| | | { |
| | |
| | | |
| | | public static void BuildAnimatorController(int id, string templeName, string configName) |
| | | { |
| | | if (!IsBuildAnimatorController) |
| | | if (!IsBuildAnimatorController && !IsBuildAnimatorUIController) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | ModelResConfig _modelRes = Config.Instance.Get<ModelResConfig>(id); |
| | | ModelResConfig _modelRes = ModelResConfig.Get(id); |
| | | string _path = _modelRes.ResourcesName; |
| | | if (_path.IndexOf('/') != -1) |
| | | { |
| | |
| | | } |
| | | |
| | | BuildAnimatorController(_path, templeName, configName); |
| | | |
| | | if (ResourcesBuilder.IsBuildAnimatorUIController) |
| | | { |
| | | BuildAnimatorController(_path, "Temple_AnimatorController_UI", "animatorBuildConfig", null); |
| | | } |
| | | } |
| | | |
| | | protected override void OnSetupRenderer(string path, string resName, ref Renderer renderer) |
| | | { |
| | | {//Assets/ART/Role/A_Zs_Sb/Materials/A_Zs05_Sb.mat |
| | | string _originalPath = path; |
| | | |
| | | if (path.EndsWith("_Sb")) |
| | | { |
| | | path = path.Replace("_Sb", ""); |
| | | resName = resName.Replace("_Sb", ""); |
| | | } |
| | | string _materialPath = string.Format("Assets/ART/Role/{0}/Materials/{1}.mat", path, resName); |
| | | |
| | | Material _material = AssetDatabase.LoadAssetAtPath<Material>(_materialPath); |
| | |
| | | |
| | | // 设置为不接受阴影 |
| | | renderer.receiveShadows = false; |
| | | |
| | | renderer.materials = new Material[0]; |
| | | renderer.sharedMaterial = AssetDatabase.LoadAssetAtPath<Material>(_materialPath); |
| | | if (_originalPath.Equals("A_Zs") || _originalPath.Equals("A_Fs")) |
| | | { |
| | | renderer.material = renderer.sharedMaterial = null; |
| | | renderer.materials = renderer.sharedMaterials = new Material[0]; |
| | | } |
| | | else |
| | | { |
| | | renderer.material = renderer.sharedMaterial = AssetDatabase.LoadAssetAtPath<Material>(_materialPath); |
| | | } |
| | | |
| | | // 这里是对翅膀的特殊处理 |
| | | Transform _parent = renderer.transform.parent; |