Exemple #1
0
    public override void OnWeaponEquOk(Tab_WeaponModel tabData)
    {
        OnWeaponUnEquOk();
        if (tabData == null)
        {
            return;
        }
        base.OnWeaponEquOk(tabData);
        Obj_OtherPlayer otherPlayer = m_cachedObjCharacter as Obj_OtherPlayer;

        if (otherPlayer != null && (otherPlayer.LWeaponObject != null || otherPlayer.RWeaponObject))
        {
            Transform effectPointBone;
            if (otherPlayer.LWeaponObject != null)
            {
                effectPointBone = otherPlayer.LWeaponObject.transform.Find(tabData.LWeaponBindPointPath);
                if (effectPointBone != null)
                {
                    if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_LWEAPON))
                    {
                        m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_LWEAPON] = effectPointBone.gameObject;
                    }
                    else
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_LWEAPON, effectPointBone.gameObject);
                    }
                    m_effectBindPointsOnWeaponList.Add(GlobeVar.EFFECT_BIND_POINT_LWEAPON);
                }
            }
            if (otherPlayer.RWeaponObject != null)
            {
                effectPointBone = otherPlayer.RWeaponObject.transform.Find(tabData.RWeaponBindPointPath);
                if (effectPointBone != null)
                {
                    if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_RWEAPON))
                    {
                        m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_RWEAPON] = effectPointBone.gameObject;
                    }
                    else
                    {
                        m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_RWEAPON, effectPointBone.gameObject);
                    }
                    m_effectBindPointsOnWeaponList.Add(GlobeVar.EFFECT_BIND_POINT_RWEAPON);
                }
            }

            int count = tabData.getWeaponEffectCount();
            int effectId;
            for (int i = 0; i < count; i++)
            {
                effectId = tabData.GetWeaponEffectbyIndex(i);
                if (effectId >= 0)
                {
                    PlayEffect(effectId);
                }
            }
        }
    }
    public void OnLoadWeaponOK(Tab_WeaponModel tabData)
    {
        ObjAnimModel objAnim = gameObject.GetComponent <ObjAnimModel>();

        if (objAnim == null)
        {
            return;
        }

        Transform effectPointBone;

        if (objAnim.LWeaponObject != null)
        {
            effectPointBone = objAnim.LWeaponObject.transform.Find(tabData.LWeaponBindPointPath);
            if (effectPointBone != null)
            {
                if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_LWEAPON))
                {
                    m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_LWEAPON] = effectPointBone.gameObject;
                }
                else
                {
                    m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_LWEAPON, effectPointBone.gameObject);
                }
            }
        }
        if (objAnim.RWeaponObject != null)
        {
            effectPointBone = objAnim.RWeaponObject.transform.Find(tabData.RWeaponBindPointPath);
            if (effectPointBone != null)
            {
                if (m_effectBindPointCache.ContainsKey(GlobeVar.EFFECT_BIND_POINT_RWEAPON))
                {
                    m_effectBindPointCache[GlobeVar.EFFECT_BIND_POINT_RWEAPON] = effectPointBone.gameObject;
                }
                else
                {
                    m_effectBindPointCache.Add(GlobeVar.EFFECT_BIND_POINT_RWEAPON, effectPointBone.gameObject);
                }
            }
        }

        int count = tabData.getWeaponEffectCount();
        int effectId;

        for (int i = 0; i < count; i++)
        {
            effectId = tabData.GetWeaponEffectbyIndex(i);
            if (effectId >= 0)
            {
                PlayEffect(effectId);
            }
        }
    }