Ejemplo n.º 1
0
        public string GetPath(int id, EResourceType type)
        {
            string url = "";

            switch (type)
            {
            case EResourceType.Effect:
            {
                Tab_Effect data = TableManager.GetEffectByID(id, 0);
                if (data == null)
                {
                    LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id);
                    return(url);
                }
                url = data.Path.Substring(data.Path.LastIndexOf('/') + 1);
                url = BundleManager.GetBundleLoadUrl(BundleManager.PathEffectPrefab, url + ".data");
                return(url);
            }

            case EResourceType.CharacterModel:
            {
                Tab_CharModel model = TableManager.GetCharModelByID(id, 0);
                if (model == null)
                {
                    LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id);
                    return(url);
                }
                url = BundleManager.GetBundleLoadUrl(BundleManager.PathModelPrefab, model.ResPath + ".data");
                return(url);
            }
            }
            LogModule.ErrorLog("GetPath failed invalid type {0} id {1} !", type, id);
            return("ffff");
        }
    protected override void LoadEffect(Tab_Effect effectData, PlayEffectDelegate delPlayEffect, object param)
    {
        if (effectData == null)
        {
            return;
        }
        if (m_effectBindPointCache == null)
        {
            return;
        }

        GameObject effectParentObj = null;

        if (m_effectBindPointCache.ContainsKey(effectData.ParentName) && m_effectBindPointCache[effectData.ParentName] != null)
        {
            effectParentObj = m_effectBindPointCache[effectData.ParentName];
        }
        if (effectParentObj != null)
        {
            AddEffect(effectParentObj, effectData, delPlayEffect, param);
        }
        else
        {
            if (m_BaseEffectBindPoint != null)
            {
                AddEffect(m_BaseEffectBindPoint.gameObject, effectData, delPlayEffect, param);
            }
            else
            {
                LogModule.ErrorLog("find bind point failed!, id {0} bindPoint {1}", effectData.EffectID, effectData.ParentName);
            }
        }
    }
Ejemplo n.º 3
0
 public AddEffectData(GameObject parentObj, Tab_Effect effectData, PlayEffectDelegate delPlayEffect, object param)
 {
     _parentObj     = parentObj;
     _effectData    = effectData;
     _delPlayEffect = delPlayEffect;
     _param         = param;
 }
 public bool ChangeColorEffct()
 {
     if (m_EffectCountCache == null)
     {
         return(false);
     }
     foreach (KeyValuePair <int, int> pair in m_EffectCountCache)
     {
         if (pair.Value > 0)
         {
             Tab_Effect startEffect = TableManager.GetEffectByID(pair.Key, 0);
             if (null != startEffect)
             {
                 if (startEffect.Type == (int)EEffectChangeType.TYPE_CHANGBLUE)
                 {
                     if (m_EffectHolder != null)
                     {
                         m_EffectHolder.SetMaterialColor(GlobeVar.BLUEMATERIAL_R, GlobeVar.BLUEMATERIAL_G, GlobeVar.BLUEMATERIAL_B);
                     }
                     break;
                 }
                 else if (startEffect.Type == (int)EEffectChangeType.TYPE_CHANGRED)
                 {
                     if (m_EffectHolder != null)
                     {
                         m_EffectHolder.SetMaterialColor(GlobeVar.REDMATERIAL_R, GlobeVar.REDMATERIAL_G, GlobeVar.REDMATERIAL_B);
                     }
                     break;
                 }
             }
         }
     }
     return(true);
 }
Ejemplo n.º 5
0
 //目前UI特效直接挂在指定gameobj上面
 protected override void LoadEffect(Tab_Effect effectData, PlayEffectDelegate delPlayEffect, object param)
 {
     if (effectData == null)
     {
         return;
     }
     if (m_EffectGameObj != null)
     {
         AddEffect(m_EffectGameObj, effectData, delPlayEffect, param);
     }
 }
 protected override void LoadEffect(Tab_Effect effectData, PlayEffectDelegate delPlayEffect, object param)
 {
     if (effectData == null)
     {
         return;
     }
     if (m_BaseEffectBindPoint != null)
     {
         AddEffect(m_BaseEffectBindPoint.gameObject, effectData, delPlayEffect, param);
     }
 }
    public override void StopEffect(int effectID, bool bStopAll = true)
    {
        base.StopEffect(effectID, bStopAll);
        //材质变色材料停止的时候 置回初始颜色
        if (m_EffectHolder != null)
        {
            Tab_Effect startEffect = TableManager.GetEffectByID(effectID, 0);
            if (null != startEffect)
            {
                if (startEffect.Type == (int)EEffectChangeType.TYPE_CHANGBLUE ||
                    startEffect.Type == (int)EEffectChangeType.TYPE_CHANGRED)
                {
                    m_EffectHolder.SetMaterialInitColor();
                }
            }
        }

        foreach (KeyValuePair <string, GameObject> pair in m_effectBindPointCache)
        {
            if (pair.Value == null || pair.Value.transform == null)
            {
                //Debug.LogError("m_effectBindPointCache 中 特效 是 null ");
                continue;
            }

            for (int i = 0; i < pair.Value.transform.childCount; i++)
            {
                Transform childTransform = pair.Value.transform.GetChild(i);
                if (childTransform)
                {
                    FXController curController = childTransform.GetComponent <FXController>();
                    if (curController)
                    {
                        //处于播放完的隐藏状态 不需要stop
                        if (curController.Remaindelay < 0 &&
                            curController.Remainduration < 0 &&
                            curController.gameObject.activeSelf == false)
                        {
                            continue;
                        }
                        if (curController.EffectID == effectID)
                        {
                            curController.Stop();
                            if (!bStopAll)
                            {
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
    public void PlayEffect(int effectID, PlayEffectDelegate delPlayEffect = null, object param = null)
    {
        if (!m_hasInited)
        {
        }
        Tab_Effect EffectInfo = TableManager.GetEffectByID(effectID, 0);

        if (EffectInfo == null)
        {
            if (null != delPlayEffect)
            {
                delPlayEffect(null, param);
            }
            return;
        }
        if (!DoPlayEffectWhenModelInvisible && !EffectHolderVisible && EffectInfo.Duration > 0)
        {
            return;
        }
        //设置了 取消技能特效 且满足条件
        if (EffectInfo.IsCanHide && !PlayerPreferenceData.SystemSkillEffectEnable)  //&& IsCanHideEffectObj)  这个 永远 返回 false ....
        {
            return;
        }
        ///特效持有者对象为空时 不处理 回调null
        if (m_EffectGameObj == null)
        {
            LogModule.WarningLog("effect can not play before init");
            if (null != delPlayEffect)
            {
                delPlayEffect(null, param);
            }
            return;
        }
        //加个数量限制
        //如果表格配置为-1则不限制,此时不用判断数量
        if (EffectInfo.MaxOwnNum >= 0 && GetEffectCountById(effectID) >= EffectInfo.MaxOwnNum)
        {
            return;
        }

        LoadEffect(EffectInfo, delPlayEffect, param);

        // 高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!
        // 要开始挖坑了!!!	坑////////坑////////坑////////坑////////坑////////坑/////
        // 高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!高能预警!!
//		if (GlobeVar.PLAYERLEVELUPEFFECTID == effectID)
//		{
//			UIManager.HideAllUIWhenLevelUp();
//		}
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="parentObj"></param>
    /// <param name="effectData"></param>
    /// <param name="delPlayEffect"></param>
    /// <param name="param"></param>
    protected void AddEffect(GameObject parentObj, Tab_Effect effectData, PlayEffectDelegate delPlayEffect,
                             object param)
    {
        if (null == effectData)
        {
            LogModule.ErrorLog("effectData is null");
            if (null != delPlayEffect)
            {
                delPlayEffect(null, param);
            }
            return;
        }
        ChangeMaterialColor(effectData.Type);

        //已经存在 数量加1
        if (m_EffectCountCache.ContainsKey(effectData.EffectID))
        {
            m_EffectCountCache[effectData.EffectID] = m_EffectCountCache[effectData.EffectID] + 1;
        }
        //不存在 添加进去 数量为1
        else
        {
            m_EffectCountCache.Add(effectData.EffectID, 1);
        }

        if (effectData.IsOnlyDeactive && m_dicEffectCache.ContainsKey(effectData.EffectID) && m_dicEffectCache[effectData.EffectID].Count > 0)
        {
            FXController curFXController = m_dicEffectCache[effectData.EffectID][0];
            m_dicEffectCache[effectData.EffectID].RemoveAt(0);
            if (curFXController)
            {
                //区域特效单独处理
                if (effectData.Type == (int)EEffectChangeType.TYPE_TARGETAREA)
                {
                    Games.SkillModle.SkillCore.SkillTargetData targetData = param as Games.SkillModle.SkillCore.SkillTargetData;
                    if (targetData != null)
                    {
                        if (targetData._hasSet)
                        {
                            curFXController.ChangePositionForAreaEffect(GetTargetAreaPos(targetData, curFXController.GetPosition()));
                        }
                        else
                        {
                            curFXController.ResetAreaEffect();
                        }
                    }
                }
                curFXController.Play(this);
            }

            if (null != delPlayEffect)
            {
                delPlayEffect(curFXController.m_FirstChild, param);
            }
            return;
        }

        AddEffectData curData = new AddEffectData(parentObj, effectData, delPlayEffect, param);

        m_NeedPlayEffectIdCacheList.Add(effectData.EffectID);
        //凑活的方式 如果 该粒子没有在
        GameObject resObj = ResourceManager.LoadResource(effectData.Path) as GameObject;

        if (null != resObj)
        {
            LoadEffectComplete(new LoadedObjData()
            {
                LoadedObj = resObj
            }, curData);
            return;
        }

        BundleManager.LoadEffectInQueue(effectData.EffectID, LoadEffectComplete, curData);
    }
 protected abstract void LoadEffect(Tab_Effect effectData, PlayEffectDelegate delPlayEffect, object param);