少年修仙传客户端代码仓库
client_Wu Xijin
2018-12-24 769eca1d9e5d4c7a0d1875a71ddb63d0aebc404f
Fight/GameActor/GActorPlayerBase.cs
@@ -230,6 +230,8 @@
        GameObject _prefab = null;
        HideWeaponEffect();
        HideSecondaryEffect();
        HideHorseEffect();
        if (m_HorseModel)
@@ -597,6 +599,8 @@
        MP_Weapon = m_WeaponModel.transform;
        RequestShadow();
        ShowWeaponEffect();
    }
    public void SwitchSecondary(uint itemID)
@@ -704,6 +708,8 @@
        OnPutonSecondary(SecondaryID, m_SecondaryModel);
        RequestShadow();
        ShowSecondaryEffect();
    }
    public void SwitchWing(uint itemID)
@@ -1389,6 +1395,26 @@
    }
    private List<SFXController> m_HorseEffectList = new List<SFXController>();
    private List<SFXController> m_WeaponEffectList = new List<SFXController>();
    private List<SFXController> m_SecondaryEffectList = new List<SFXController>();
    public void HideSecondaryEffect()
    {
        foreach (var _ctrl in m_SecondaryEffectList)
        {
            SFXPlayUtility.Instance.Release(_ctrl);
        }
        m_SecondaryEffectList.Clear();
    }
    public void HideWeaponEffect()
    {
        foreach (var _ctrl in m_WeaponEffectList)
        {
            SFXPlayUtility.Instance.Release(_ctrl);
        }
        m_WeaponEffectList.Clear();
    }
    public void HideHorseEffect()
    {
@@ -1399,10 +1425,92 @@
        m_HorseEffectList.Clear();
    }
    public void ShowSecondaryEffect()
    {
        HideSecondaryEffect();
        if (SecondaryID <= 0)
        {
            return;
        }
        var _itemConfig = Config.Instance.Get<ItemConfig>((int)SecondaryID);
        if (_itemConfig != null)
        {
            return;
        }
        var _config = Config.Instance.Get<ModelResConfig>(_itemConfig.ChangeOrd);
        if (_config == null)
        {
            Debug.LogError("找不到配置ModelResConfig: " + _itemConfig.ChangeOrd);
            return;
        }
        var _boneList = ModelResConfig.GetBoneList(_config.ResourcesName);
        var _effectlist = ModelResConfig.GetEffectList(_config.ResourcesName);
        if (_boneList != null && _effectlist != null)
        {
            for (int i = 0; i < _boneList.Count; ++i)
            {
                if (_boneList[i].Equals("null"))
                {
                    var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_SecondaryModel.transform);
                    m_SecondaryEffectList.Add(_ctrl);
                }
                else
                {
                    var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_SecondaryModel.transform.GetChildTransformDeeply(_boneList[i]));
                    m_SecondaryEffectList.Add(_ctrl);
                }
            }
        }
    }
    public void ShowWeaponEffect()
    {
        HideWeaponEffect();
        if (WeaponItemID <= 0)
        {
            return;
        }
        var _itemConfig = Config.Instance.Get<ItemConfig>((int)WeaponItemID);
        if (_itemConfig != null)
        {
            return;
        }
        var _config = Config.Instance.Get<ModelResConfig>(_itemConfig.ChangeOrd);
        if (_config == null)
        {
            Debug.LogError("找不到配置ModelResConfig: " + _itemConfig.ChangeOrd);
            return;
        }
        var _boneList = ModelResConfig.GetBoneList(_config.ResourcesName);
        var _effectlist = ModelResConfig.GetEffectList(_config.ResourcesName);
        if (_boneList != null && _effectlist != null)
        {
            for (int i = 0; i < _boneList.Count; ++i)
            {
                if (_boneList[i].Equals("null"))
                {
                    var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_WeaponModel.transform);
                    m_WeaponEffectList.Add(_ctrl);
                }
                else
                {
                    var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_WeaponModel.transform.GetChildTransformDeeply(_boneList[i]));
                    m_WeaponEffectList.Add(_ctrl);
                }
            }
        }
    }
    public void ShowHorseEffect()
    {
        HideHorseEffect();
        if(HorseID <= 0)
        if (HorseID <= 0)
        {
            return;
        }
@@ -1418,13 +1526,25 @@
            Debug.LogError("找不到配置ModelResConfig: " + _horseConfig.Model);
            return;
        }
        var _dict = ModelResConfig.GetEffectDict(_config.ResourcesName);
        if (_dict != null)
        var _boneList = ModelResConfig.GetBoneList(_config.ResourcesName);
        var _effectlist = ModelResConfig.GetEffectList(_config.ResourcesName);
        if (_boneList != null && _effectlist != null)
        {
            foreach (var _bone in _dict.Keys)
            for (int i = 0; i < _boneList.Count; ++i)
            {
                var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_dict[_bone], m_HorseModel.transform.GetChildTransformDeeply(_bone));
                m_HorseEffectList.Add(_ctrl);
                if (_boneList[i].Equals("null"))
                {
                    var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_HorseModel.transform);
                    m_HorseEffectList.Add(_ctrl);
                }
                else
                {
                    var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], m_HorseModel.transform.GetChildTransformDeeply(_boneList[i]));
                    m_HorseEffectList.Add(_ctrl);
                }
            }
        }
    }
@@ -2456,6 +2576,15 @@
    private Dictionary<int, SFXController> m_GodWeaponEffectDict = new Dictionary<int, SFXController>();
    public virtual void ShowGodWeaponEffect() { }
    public void HideGodWeaponEffect()
    {
        SwitchGodWeapon(1, 0);
        SwitchGodWeapon(2, 0);
        SwitchGodWeapon(4, 0);
    }
    public void SwitchGodWeapon(int type, int level)
    {
        bool _showOrHide = true;