少年修仙传客户端基础资源
client_Wu Xijin
2018-10-21 6f8ed2e37f8762fb3501a671d0dca40bcd68edae
Assets/Editor/Actor/ResourcesBuilder.cs
@@ -10,6 +10,7 @@
    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
    {
@@ -106,18 +107,67 @@
        }
    }
    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)
    public void BuildPrefab(string path, string resName, string suffix, string outName = null, bool isHighMesh = false)
    {
        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);
        if (string.IsNullOrEmpty(outName))
        {
            outName = resName;
        }
        string _absAssetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutPath, suffix, resName);
        string _assetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, resName);
        string _absOriginalePath = string.Format("{0}/ART/Role/{1}/{2}_Dm.FBX", Application.dataPath, path, resName);
        string _originalAssetPath = string.Format("Assets/ART/Role/{0}/{1}_Dm.FBX", path, resName);
        if ((!resName.StartsWith("A_Zs") && !resName.StartsWith("A_Fs"))
          || !suffix.Equals(InstanceResourcesLoader.raceSuffix))
        {
            _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 _tempPrefabName = outName;
        if (isHighMesh
        && ((!resName.StartsWith("A_Zs") && !resName.StartsWith("A_Fs"))
            || !suffix.Equals(InstanceResourcesLoader.raceSuffix)))
        {
            _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}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutPath, suffix, _tempPrefabName);
        string _assetPath = string.Format("{0}Mob/{1}{2}.prefab", ResourcesPath.ResourcesOutAssetPath, suffix, _tempPrefabName);
        string _acAbsAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, path);
        string _acAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, path);
        if (!outName.Equals(resName))
        {
            _acAbsAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, path, AnimatorControllerLoader.controllerSuffix, outName);
            _acAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, path, AnimatorControllerLoader.controllerSuffix, outName);
        }
        if (string.IsNullOrEmpty(_absOriginalePath))
        {
@@ -127,7 +177,7 @@
        // 指定动画控制器
        if (!File.Exists(_acAbsAssetPath))
        {
            Debug.LogWarningFormat("检测到此prefab资源: {0} 的AnimatorContorller(动画控制器)资源尚未生成, 这里需要注意啊此资源是否需要先生成AnimatorContorller(动画控制器), 再生成prefab资源.", path);
            Debug.LogWarningFormat("检测到此prefab资源: {0} 的AnimatorContorller(动画控制器)资源尚未生成, 这里需要注意啊此资源是否需要先生成AnimatorContorller(动画控制器), 再生成prefab资源.", _acAssetPath);
        }
        ColliderInfo _colliderInfo = null;
@@ -243,10 +293,12 @@
        }
        // 加载特效
        if (InstanceResourcesLoader.horseSuffix.Equals(suffix)
         || resName.Contains("B_Cw"))
        if (outName.StartsWith("M")
         || outName.StartsWith("N")
         || outName.StartsWith("B_")
         || outName.StartsWith("Zq"))
        {
            HandlerModelEffect("horseEffectConfig", null, resName, ref _prefab);
            HandlerModelEffect("horseEffectConfig", null, outName, ref _prefab);
        }
        else if (InstanceResourcesLoader.raceSuffix.Equals(suffix))
        {
@@ -261,7 +313,15 @@
            _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) && !isHighMesh)
        {
            _tempName += "_Dm";
        }
        Transform _rendererNode = _prefab.transform.Find(_tempName);
        if (!_rendererNode)
        {
            _rendererNode = _prefab.transform;
@@ -376,7 +436,7 @@
            _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);
        }
    }
@@ -491,23 +551,41 @@
        AssetDatabase.Refresh();
    }
    public static void BuildAnimatorController(string resName, string templeName, string configName)
    public static void BuildAnimatorController(string resName, string templeName, string configName, string outName = null)
    {
        string _absAssetPath = string.Format("{0}Mob/{1}", ResourcesPath.ResourcesOutPath, resName);
        if (string.IsNullOrEmpty(outName))
        {
            outName = resName;
        }
        string _absAssetPath = string.Format("{0}Mob/{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, resName);
        _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, outName, AnimatorControllerLoader.controllerSuffix, outName);
        string _assetPath = string.Format("{0}Mob/{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, resName);
        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);
        }
        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);
        }
        if(templeName.Equals("Temple_AnimatorController_UI"))
        {
            _absAssetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutPath, outName, AnimatorControllerLoader.controllerUISuffix, outName);
            _assetPath = string.Format("{0}Mob/{1}/{2}{3}.controller", ResourcesPath.ResourcesOutAssetPath, outName, AnimatorControllerLoader.controllerUISuffix, outName);
        }
        string _templePath = string.Format("{0}Mob/{1}.controller", ResourcesPath.ResourcesOutPath, templeName);
        if (File.Exists(_absAssetPath))