示例#1
0
        /// <summary>
        /// 取消某个对象身上的状态图标
        /// </summary>
        /// <param name="cmd"></param>
        public void CancleBuffState(stCancelStateIcoListMagicUserCmd_S cmd)
        {
            INPC npc = m_Master as INPC;

            if (npc != null)
            {
                if (npc.IsTrap())
                {
                    return;
                }
            }

            RemoveEntityBuff(cmd.dwTempID, cmd.dwStateThisID);
        }
示例#2
0
        /// <summary>
        /// 状态信息下行消息
        /// </summary>
        /// <param name="cmd"></param>
        public void ReciveBuffState(stSendStateIcoListMagicUserCmd_S cmd)
        {
            if (cmd.refresh == 1)
            {
                ClearAllBuff();
            }
            IEntity en  = EntitySystem.EntityHelper.GetEntity(cmd.byType, cmd.dwTempID);
            INPC    npc = en as INPC;

            if (npc != null)
            {
                if (npc.IsTrap())
                {
                    return;
                }
            }
            ReceiveBuffList(cmd.statelist);
        }
示例#3
0
    void AddIcon(IList npcList, IconType type)
    {
        for (int j = 0; j < npcList.Count; j++)
        {
            IEntity entity = npcList[j] as IEntity;
            if (entity != null)
            {
                if (entity is INPC)
                {
                    INPC npc = entity as INPC;

                    if (npc != null)
                    {
                        if (npc.IsTrap())
                        {//陷阱不显示
                            continue;
                        }
                        if (npc.IsMonster())
                        {
                            type = IconType.mastericon;
                        }
                        else if (npc.IsPet())
                        {
                            type = IconType.peticon;
                        }
                        else
                        {
                            type = IconType.npcicon;
                        }
                    }
                }

                if (entity is IRobot)
                {
                    type = IconType.robot;
                }

                if (entity is IPlayer)
                {
                    IPlayer player = entity as IPlayer;
                    if (player != null)
                    {
                        type = GetIconTypeByPlayer(player);
                    }
                }

                GameObject iconGo;
                if (!iconDic.TryGetValue(entity.GetUID(), out iconGo))
                {
                    iconGo = MapIconPoolManager.Instance.GetIcon(type, entity, m_widget_Root.transform);
                    iconDic.Add(entity.GetUID(), iconGo);
                    AddIconToMap(iconGo, entity);
                }
                else
                {
                    iconGo.name = MapIconPoolManager.Instance.GetIconName(type, entity);
                    UISprite spr = iconGo.GetComponent <UISprite>();
                    if (spr != null)
                    {
                        SetIconSprite(type, spr);
                    }
                    AddIconToMap(iconGo, entity);
                }
            }
        }


        List <long> lstUID = entityTable[GetStrByIconType(type)];

        if (lstUID != null)
        {
            lstUID.Clear();
            for (int i = 0; i < npcList.Count; ++i)
            {
                IEntity entity = npcList[i] as IEntity;
                if (entity == null)
                {
                    continue;
                }
                lstUID.Add(entity.GetUID());
            }
        }
    }
示例#4
0
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.SKILLSYSTEM_SHOWDAMAGE)
        {
            stShowDemage st      = (stShowDemage)param;
            bool         IsMyNpc = false;//是否是其他人的宠物或者召唤物
            if ((GameCmd.SceneEntryType)st.attacktype != GameCmd.SceneEntryType.SceneEntry_Player)
            {
                IEntity attacker = EntitySystem.EntityHelper.GetEntity((GameCmd.SceneEntryType)st.attacktype, st.attackID);
                if (attacker != null)
                {
                    INPC npc = attacker as INPC;
                    if (npc != null)
                    {
                        if (npc.IsMainPlayerSlave())
                        {
                            IsMyNpc = true;
                        }
                    }
                }
            }

            uint skillid = st.skillid;
            List <GameCmd.stMultiAttackDownMagicUserCmd_S.stDefender> defenerList = st.defenerList;
            if (IsMyNpc || st.attackID == MainPlayerHelper.GetPlayerID())
            {
                //如果攻击者是自己或者自己的宠物 飘血

                for (int i = 0; i < defenerList.Count; i++)
                {
                    var        info = defenerList[i];
                    EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType);
                    if (info.dwDamage == 0 && info.byDamType == (uint)GameCmd.AttackType.ATTACK_TYPE_FO)
                    {
                        continue;
                    }
                    ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID);
                }
            }
            else
            {
                for (int i = 0; i < defenerList.Count; i++)
                {
                    var info = defenerList[i];
                    //如果受击者是自己或者自己的宠物 飘血
                    if (info.dwDamage == 0 && info.byDamType == (uint)GameCmd.AttackType.ATTACK_TYPE_FO)
                    {
                        continue;
                    }
                    if (info.dwDefencerID != MainPlayerHelper.GetPlayerID())
                    {
                        IEntity en = EntitySystem.EntityHelper.GetEntity(info.byDefencerType, info.dwDefencerID);
                        if (en != null)
                        {
                            INPC npc = en as INPC;
                            if (npc != null)
                            {
                                if (npc.IsTrap())
                                {
                                    return;
                                }
                                if (npc.IsMainPlayerSlave())
                                {//防御者是自己的宠物
                                    EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType);
                                    ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID);
                                }
                            }
                            else
                            {
                                //怪打人 血量同步 先不同步
                                //IPlayer otherPlayer = en as IPlayer;
                                //if(otherPlayer != null)
                                //{
                                //    SetEntityCurHP(en, info.dwDefencerHP);
                                //}
                            }
                        }
                    }
                    else
                    {//防御者是自己
                        EntityType type = EntitySystem.EntityHelper.GetEntityEtype(info.byDefencerType);
                        ShowDamage(info.dwDamage, info.byDamType, info.dwDefencerID, type, info.dwDefencerHP, skillid, st.attackID);
                    }
                }
            }
        }
        else if (eventID == (int)Client.GameEventID.SKILLSYSTEM_SHOWBUFFDAMAGE)
        {
            stBuffDamage st = (stBuffDamage)param;

            ShowBuffDamage(st);
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
        {
            stPropUpdate prop = (stPropUpdate)param;
            if (MainPlayerHelper.GetPlayerUID() != prop.uid)
            {
                return;
            }
            if (prop.nPropIndex == (int)PlayerProp.Exp)
            {
                int exp = prop.newValue - prop.oldValue;
                if (exp < 0)
                {
                    return;
                }

                ShowExp(exp);
            }
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_LEAVEMAP)
        {
            OnLowMemoryWarning();
        }
        else if (eventID == (int)GameEventID.APPLICATION_LOWMEMORY)
        {
            OnLowMemoryWarning();
        }
    }
        /// <summary>
        /// 播放防御者受击动作
        /// </summary>
        /// <param name="cmd"></param>
        private bool PlayDefenerAni(GameCmd.stMultiAttackDownMagicUserCmd_S cmd)
        {
            if (cmd == null)
            {
                return(false);
            }
            SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>(cmd.wdSkillID, 1);

            if (db != null)
            {
                for (int i = 0; i < db.beAttactEffect.Count; i++)
                {
                    var           effectid = db.beAttactEffect[i];
                    FxResDataBase edb      = GameTableManager.Instance.GetTableItem <FxResDataBase>(effectid);
                    if (edb != null)
                    {
                        if (cmd != null)
                        {
                            for (int j = 0; j < cmd.data.Count; j++)
                            {
                                var    item    = cmd.data[j];
                                string aniName = edb.targetAniName;

                                IEntity defender = EntityHelper.GetEntity(item.byDefencerType, item.dwDefencerID);
                                if (defender == null)
                                {
                                    //Log.Error( "死亡状态不能播放受击动作" );
                                    return(false);
                                }
                                if (defender is INPC)
                                {
                                    INPC npc = defender as INPC;
                                    if (npc != null)
                                    {
                                        if (npc.IsTrap())
                                        {
                                            return(false);
                                        }
                                    }
                                }
                                if (edb.playAudio != 0)
                                {
                                    ResourceDataBase rdb = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.playAudio);
                                    if (rdb != null)
                                    {
                                        Transform trans = defender.GetTransForm();
                                        if (trans == null)
                                        {
                                            return(false);
                                        }
                                        PlayAudio(trans.gameObject, rdb.strPath);
                                    }
                                }



                                EffectViewFactory.Instance().CreateEffect(defender.GetUID(), effectid);
                                if (item.byDamType != (uint)GameCmd.AttackType.ATTACK_TYPE_HD)
                                {
                                    SendPlayDefenerAniMessage(defender, aniName);
                                }
                            }
                        }
                    }
                }
            }

            return(true);
        }