コード例 #1
0
ファイル: EntitySystem.cs プロジェクト: zuojiashun/src
        void AddEffect(IEntity target, uint effectID)
        {
            FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(effectID);

            if (edb != null && target != null)
            {
                AddLinkEffect node = new AddLinkEffect();
                node.nFollowType = (int)edb.flowType;
                node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
                node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

                // 使用资源配置表
                ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
                if (resDB == null)
                {
                    Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                    return;
                }
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;
                if (edb.bFollowRole)
                {
                    if (node.strEffectName.Length != 0)
                    {
                        target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 设置家园实体状态通过实体id
 /// </summary>
 /// <param name="landIndex">实体id</param>
 /// <param name="state">状态</param>
 /// <param name="indexID">homeland.xlsx 模型配置表里对应的索引id</param>
 void SetHomeEntityState(long uid, int state, uint indexID)
 {
     if (entityStateDic.ContainsKey(uid))
     {
         HomeEntityInfo info = entityStateDic[uid];
         info.state          = state;
         entityStateDic[uid] = info;
         IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
         if (es != null)
         {
             IEntity en = es.FindEntity(uid);
             if (en != null)
             {
                 HomeLandViewDatabase db = GameTableManager.Instance.GetTableItem <HomeLandViewDatabase>((uint)indexID, state);
                 if (db != null)
                 {
                     ResourceDataBase rdb = GameTableManager.Instance.GetTableItem <ResourceDataBase>(db.dwModelID);
                     if (rdb != null)
                     {
                         ChangePart cp = new ChangePart();
                         cp.strPartName = "main";
                         cp.strResName  = rdb.strPath;
                         en.SendMessage(EntityMessage.EntityCommand_ChangePart, cp);
                     }
                 }
             }
         }
     }
     else
     {
         Log.Error("not cotain uid " + uid.ToString());
     }
 }
コード例 #3
0
 public IEnumerable <TranslationText> Search(ResourceDataBase source, CultureInfo targetCulture)
 {
     using (TranslationStorage context = new TranslationStorage(getConnectionString()))
     {
         return(context.SearchTranslation(source.Value, source.ResxFile.Culture.Name, targetCulture.Name)
                .ToList());
     }
 }
コード例 #4
0
        /// <summary>
        /// 通过[编号]二分快速查表
        /// </summary>
        /// <param name="dwID">编号</param>
        /// <returns></returns>
        public static ResourceDataBase Query(this List <ResourceDataBase> sorted, uint dwID)
        {
            var key = new ResourceDataBase()
            {
                dwID = dwID
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(ResourceDataBase));
        }
コード例 #5
0
ファイル: Npc_Protocol.cs プロジェクト: zuojiashun/src
    void AddEffect(Vector3 pos, uint effectID)
    {
        FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(effectID);

        if (edb != null)
        {
            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return;
            }
            string path = resDB.strPath;


            Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
            if (rs == null)
            {
                return;
            }
            IEffect effect = null;
            rs.CreateEffect(ref path, ref effect, (obj) =>
            {
                if (obj == null)
                {
                    Log.Error("fx load failed: " + path);
                    return;
                }
                if (obj.GetNodeTransForm() == null)
                {
                    return;
                }
                obj.GetNodeTransForm().localPosition = pos;
                obj.GetNodeTransForm().localRotation = Quaternion.identity;
                obj.GetNodeTransForm().localScale    = Vector3.one;
                //DoPlay(obj.GetNodeTransForm().gameObject, position, rotation, scale);
            });
        }
    }
コード例 #6
0
    void AddEffect(Vector3 pos)
    {
        uint             resID = 50054;
        ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(resID);

        if (resDB == null)
        {
            Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}");
            return;
        }
        string path = resDB.strPath;

        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (rs == null)
        {
            return;
        }

        if (effect != null)
        {
            effect.Release();
        }
        rs.CreateEffect(ref path, ref effect, (obj) =>
        {
            if (obj == null)
            {
                return;
            }
            if (obj.GetNodeTransForm() == null)
            {
                return;
            }
            obj.GetNodeTransForm().localPosition = pos;
            obj.GetNodeTransForm().localRotation = Quaternion.identity;
            obj.GetNodeTransForm().localScale    = Vector3.one;

            //Engine.Utility.Log.Error("--->>特效坐标:" + mainPlayer.GetPos());
            //DoPlay(obj.GetNodeTransForm().gameObject, position, rotation, scale);
        });
    }
コード例 #7
0
    uint CreateEffect()
    {
        Client.IEntity target = ClientGlobal.Instance().GetEntitySystem().FindNPC(treeEntityID);
        if (target == null)
        {
            Engine.Utility.Log.Error("摇钱树实体查找不到,id为{0}", treeEntityID);
            return(0);
        }
        FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(10001);

        if (edb != null && target != null)
        {
            AddLinkEffect node = new AddLinkEffect();
            node.nFollowType = (int)edb.flowType;
            node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
            node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return(0);
            }
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            if (node.strEffectName.Length != 0)
            {
                int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);

                return((uint)id);
            }
        }

        return(0);
    }
コード例 #8
0
    uint CreateEffect(uint nEffectViewID)
    {
        IEntity       target = MainPlayerHelper.GetMainPlayer();
        FxResDataBase edb    = GameTableManager.Instance.GetTableItem <FxResDataBase>(nEffectViewID);

        if (edb != null && target != null)
        {
            if (nEffectViewID == 1002 && EntitySystem.EntityHelper.IsMainPlayer(target))
            {
                //  Engine.Utility.Log.Error("nEffectViewID:{0}", nEffectViewID);
            }

            AddLinkEffect node = new AddLinkEffect();
            node.nFollowType = (int)edb.flowType;
            node.rotate      = new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
            node.vOffset     = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

            // 使用资源配置表
            ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
            if (resDB == null)
            {
                Engine.Utility.Log.Error("EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                return(0);
            }
            node.strEffectName = resDB.strPath;
            node.strLinkName   = edb.attachNode;
            if (node.strEffectName.Length != 0)
            {
                int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);

                return((uint)id);
            }
        }

        return(0);
    }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
ファイル: EffectViewFactory.cs プロジェクト: sjb8100/src
        public uint CreateEffect(long lTargetID, uint nEffectViewID)
        {
            IPlayer player = SkillSystem.GetClientGlobal().MainPlayer;

            if (player == null)
            {
                Log.LogGroup("ZDY", "player is null");
                return(0);
            }
            IEntity       target = EntitySystem.EntityHelper.GetEntity(lTargetID);
            FxResDataBase edb    = GameTableManager.Instance.GetTableItem <FxResDataBase>(nEffectViewID);

            if (edb != null && target != null)
            {
                if (nEffectViewID == 1002 && EntitySystem.EntityHelper.IsMainPlayer(target))
                {
                    //  Log.Error("nEffectViewID:{0}", nEffectViewID);
                }
                if (target.GetNode() == null)
                {
                    Log.LogGroup("ZDY", "target getnode is null");
                    return(0);
                }
                Transform enTrans = target.GetTransForm();
                if (enTrans == null)
                {
                    Log.LogGroup("ZDY", "target getnode getransform is null");
                    return(0);
                }
                if (player == null)
                {
                    return(0);
                }

                if (player.GetTransForm() == null)
                {
                    Log.LogGroup("ZDY", "player GetTransForm is null");
                    return(0);
                }

                bool bRide = (bool)target.SendMessage(EntityMessage.EntityCommond_IsRide, null);

                Vector3 tarToPlayer = enTrans.position - player.GetTransForm().position;
                tarToPlayer.y = 0;
                Vector3 cross = Vector3.Cross(tarToPlayer, Vector3.forward);
                float   ang   = Vector3.Angle(tarToPlayer, Vector3.forward);
                if (cross.y < 0)
                {
                    ang = 360 - ang;
                }
                //  Log.Error("旋转角度 " + ang);
                Vector3       rot  = Quaternion.AngleAxis(ang, Vector3.up).eulerAngles;
                AddLinkEffect node = new AddLinkEffect();
                node.nFollowType = (int)edb.flowType;
                node.rotate      = -rot;// new Vector3(edb.rotate[0], edb.rotate[1], edb.rotate[2]);
                node.vOffset     = bRide ? new Vector3(edb.rideoffset[0], edb.rideoffset[1], edb.rideoffset[2]) : new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]);

                // 使用资源配置表
                ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <ResourceDataBase>(edb.resPath);
                if (resDB == null)
                {
                    Log.LogGroup("ZDY", "EffectViewFactory:找不到特效资源路径配置{0}", edb.resPath);
                    return(0);
                }
                node.strEffectName = resDB.strPath;
                node.strLinkName   = edb.attachNode;
                if (edb.bFollowRole)
                {
                    if (node.strEffectName.Length != 0)
                    {
                        int id = (int)target.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node);
                        return((uint)id);
                    }
                }
                else
                {
                    int level = 0;
                    if (target != null)
                    {
                        ISkillPart sp = target.GetPart(EntityPart.Skill) as ISkillPart;
                        if (sp != null)
                        {
                            level = sp.FxLevel;
                        }
                    }
                    return(SkillEffectManager.Helper.ReqPlayHitFx(node.strEffectName, target.GetPos(), node.rotate, Vector3.one, level));
                }
            }
            return(0);
        }