Beispiel #1
0
        //2.创建buff特效
        public BuffEffect CreateBuffEffect(Ientity buffEntity, uint buffTypeID, uint instID)
        {
            BuffConfigInfo buffInfo = ConfigReader.GetBuffInfo(buffTypeID);


            //判断是否有后续击飞效果
            if (buffInfo != null && buffInfo.eFlyEffectID != 0)
            {
                //获取击飞信息
                SkillFlyConfig skillFlycfg = ConfigReader.GetSkillFlyConfig(buffInfo.eFlyEffectID);
                if (skillFlycfg != null && buffEntity != null)
                {
                    //Iplayer player = buffEntity as Iplayer;

                    //被击飞信息
                    string beatFLyAction = skillFlycfg.moveAction;
                    float  raiseSpeed    = skillFlycfg.raiseSpeed;
                    float  raiseAccSpeed = skillFlycfg.raiseAccSpeed;
                    float  fallSpeed     = skillFlycfg.fallSpeed;
                    float  fallAccSpeed  = skillFlycfg.fallAccSpeed;
                    float  stayTime      = skillFlycfg.stayTime;
                    int    canbeRecover  = skillFlycfg.bIsCanBeRecover;

                    buffEntity.OnBeatFly(buffInfo.BuffID, beatFLyAction, raiseSpeed, raiseAccSpeed, fallSpeed, fallAccSpeed, stayTime, canbeRecover);
                }
            }

            //判断资源路径是否有效
            if (buffInfo == null || buffInfo.EffectRes == "0")
            {
                return(null);
            }

            string resourcePath = GameConstDefine.LoadGameBuffEffectPath + buffInfo.EffectRes;


            //加载特效信息
            BuffEffect effect = new BuffEffect();

            effect.InstID    = instID;
            effect.entity    = buffEntity;
            effect.projectID = instID;
            effect.resPath   = resourcePath;

            //创建特效
            effect.Create();

            //创建声音
            string soundName = GameConstDefine.LoadGameSoundPath + buffInfo.sound;

            if (buffInfo.sound != "0")
            {
                PlayAudio(effect, soundName, effect.obj);
            }

            //保存特效列表
            AddEffect(effect.projectID, effect);

            return(effect);
        }
Beispiel #2
0
        //
        public void RemoveBuff(uint instID)
        {
            if (buffDict.ContainsKey(instID))
            {
                //if (buffDict[instID].buffTypeID == 1017 && buffDict[instID].entity.GameObjGUID == PlayerManager.Instance.LocalPlayer.GameObjGUID)
                //{
                //    if (isSelfHaveBuffType(1017))
                //    {

                //    }
                //    //to do set skillbtn enable
                //}
                Buff           b  = buffDict[instID];
                BuffConfigInfo bi = ConfigReader.GetBuffInfo(b.buffTypeID);

                buffDict.Remove(instID);
                if (bi != null)
                {
                    if (bi.effectID == (int)eBuffEffect.eBuffEffectXuanYun || bi.effectID == (int)eBuffEffect.eBuffEffectShuFu)
                    {
                        if (b.entity != null)
                        {
                            if (isHaveStopBuff(b.entity.GameObjGUID) == false)
                            {
                                b.entity.OnEntityRomoveAstrictBuff();
                            }
                        }
                    }
                }

                //如果该Buffer带有BeatFlyMotion效果,立即取消BeatFlyMotion效果
                if (b != null && bi.eFlyEffectID != 0)
                {
                    //获取击飞信息
                    SkillFlyConfig skillFlycfg = ConfigReader.GetSkillFlyConfig(bi.eFlyEffectID);

                    if (skillFlycfg != null && b.entity != null)
                    {
                        b.entity.BeatFlyFallDown(bi.BuffID);
                    }
                }



                //refresh ui
                if (UIBuffUnityInterface.Instance != null)
                {
                    UIBuffUnityInterface.Instance.RefreshUIItem();
                }

                if (isSelfHaveBuffType(chenmoID) == false)
                {
                    EventCenter.Broadcast <bool>(EGameEvent.eGameEvent_LocalPlayerSilence, false);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns>0 - 特效路径,1 - 声音路径</returns>
        /// <param name="id">Identifier.</param>
        public string GetBuffEffectPath(uint id)
        {
            BuffConfigInfo buffInfo = ConfigReader.GetBuffInfo(id);

            //判断是否有后续击飞效果
            if (buffInfo != null && buffInfo.eFlyEffectID != 0)
            {
                return(GameConstDefine.LoadGameBuffEffectPath + buffInfo.EffectRes);
            }
            return(null);
        }
Beispiel #4
0
        //

        public Buff AddBuff(uint instID, uint typeID, float remainTime, Ientity entity)
        {
            if (IsHaveBuff(instID))
            {
                return(buffDict[instID]);
            }
            if (entity == null)
            {
                return(null);
            }

            if (isHaveStopBuff(entity.GameObjGUID) == false)
            {
                BuffConfigInfo bi = ConfigReader.GetBuffInfo(typeID);
                if (null != bi)
                {
                    if (bi.effectID == (int)eBuffEffect.eBuffEffectXuanYun || bi.effectID == (int)eBuffEffect.eBuffEffectShuFu)
                    {
                        entity.OnEntityGetAstrictBuff();
                    }
                }
            }

            Buff b = new Buff();

            b.buffID     = instID;
            b.buffTypeID = typeID;
            b.buffTime   = remainTime;
            b.entity     = entity;

            //buffDict[instID] = b;
            buffDict.Add(instID, b);

            if (isSelfHaveBuffType(chenmoID) == true)
            {
                EventCenter.Broadcast <bool>(EGameEvent.eGameEvent_LocalPlayerSilence, true);
            }
            //refresh ui
            if (UIBuffUnityInterface.Instance != null)
            {
                UIBuffUnityInterface.Instance.RefreshUIItem();
            }


            return(b);
        }
Beispiel #5
0
        public void RemoveBuff(uint instID)
        {
            if (mBuffDict.ContainsKey(instID))
            {
                Buff           b  = mBuffDict[instID];
                BuffConfigInfo bi = ConfigReader.GetBuffInfo(b.TypeID);

                mBuffDict.Remove(instID);
                if (bi != null)
                {
                    if (bi.effectID == (int)BuffEffectEnum.XuanYun || bi.effectID == (int)BuffEffectEnum.ShuFu)
                    {
                        if (b.Entity != null)
                        {
                            if (isHaveStopBuff(b.Entity.GameObjGUID) == false)
                            {
                                b.Entity.OnEntityRomoveAstrictBuff();
                            }
                        }
                    }
                }
                //如果该Buffer带有BeatFlyMotion效果,立即取消BeatFlyMotion效果
                if (b != null && bi.eFlyEffectID != 0)
                {
                    //获取击飞信息
                    SkillFlyConfig skillFlycfg = ConfigReader.GetSkillFlyConfig(bi.eFlyEffectID);

                    if (skillFlycfg != null && b.Entity != null)
                    {
                        b.Entity.BeatFlyFallDown(bi.BuffID);
                    }
                }

                if (UIBuffUnityInterface.Instance != null)
                {
                    UIBuffUnityInterface.Instance.RefreshUIItem();
                }

                if (isSelfHaveBuffType(chenmoID) == false)
                {
                    EventCenter.Broadcast <bool>((Int32)GameEventEnum.GameEvent_LocalPlayerSilence, false);
                }
            }
        }
Beispiel #6
0
        //主角是否有不能移动的buff

        public bool isHaveStopBuff(UInt64 key)
        {
            foreach (Buff b in buffDict.Values)
            {
                if (b == null || b.entity == null || b.entity.GameObjGUID != key)
                {
                    continue;
                }
                BuffConfigInfo bi = ConfigReader.GetBuffInfo(b.buffTypeID);
                if (null == bi)
                {
                    continue;
                }

                if (bi.effectID == (int)eBuffEffect.eBuffEffectXuanYun || bi.effectID == (int)eBuffEffect.eBuffEffectShuFu)
                {
                    return(true);
                }
            }
            return(false);
        }
    public ReadBuffConfig(string xmlFilePath)
    {
        //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset;
        ResourceItem xmlfileUnit = ResourcesManager.Instance.loadImmediate(xmlFilePath, ResourceType.ASSET);
        TextAsset    xmlfile     = xmlfileUnit.Asset as TextAsset;

        if (!xmlfile)
        {
            //Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath);
        }

        xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlfile.text);
        XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("SkillCfg_buff ").ChildNodes;

        for (int i = 0; i < infoNodeList.Count; i++)
        {    //(XmlNode xNode in infoNodeList)
            if ((infoNodeList[i] as XmlElement).GetAttributeNode("un32ID") == null)
            {
                continue;
            }

            string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("un32ID").InnerText;
            //Debug.LogError(typeName);
            BuffConfigInfo buffInfo = new BuffConfigInfo();
            buffInfo.BuffID = Convert.ToUInt32(typeName);
            foreach (XmlElement xEle in infoNodeList[i].ChildNodes)
            {
                #region 搜索
                switch (xEle.Name)
                {
                case "szName":
                {
                    buffInfo.BuffName = Convert.ToString(xEle.InnerText);
                }
                break;

                case "szEffectIcon":
                {
                    buffInfo.IconRes = Convert.ToString(xEle.InnerText);
                }
                break;

                //case "szEffectDes":
                //    {
                //        buffInfo.DescContent = Convert.ToString(xEle.InnerText);
                //    }
                //    break;
                case "n32EffectID":
                {
                    buffInfo.effectID = Convert.ToInt32(xEle.InnerText);
                }
                break;

                case "szEffection":
                {
                    buffInfo.EffectRes = Convert.ToString(xEle.InnerText);
                }
                break;

                case "eEffect0LastTick":
                {
                    buffInfo.TotalTime = Convert.ToInt32(xEle.InnerText) / 1000.0f;
                }
                break;

                case "szEffectSound":
                {
                    buffInfo.sound = Convert.ToString(xEle.InnerText);
                }
                break;

                //case "n32Effect0ID":
                //    {
                //        buffInfo.EffectType = Convert.ToInt32(xEle.InnerText);
                //    }
                //    break;
                case "eFlyEffectID":
                {
                    buffInfo.eFlyEffectID = Convert.ToInt32(xEle.InnerText);
                } break;
                }

                #endregion
            }
            ConfigReader.buffXmlInfoDict.Add(buffInfo.BuffID, buffInfo);
        }
    }
Beispiel #8
0
        public float GetTotalTime()
        {
            BuffConfigInfo buffInfo = ConfigReader.GetBuffInfo(TypeID);

            return(buffInfo == null ? 1000000 : ConfigReader.GetBuffInfo(TypeID).TotalTime);
        }
Beispiel #9
0
        public string GetSpriteName()
        {
            BuffConfigInfo buffInfo = ConfigReader.GetBuffInfo(TypeID);

            return(buffInfo == null ? "" : ConfigReader.GetBuffInfo(TypeID).IconRes);
        }