Example #1
0
        public override void DoAction(IEventArgs args)
        {
            UnitPara up   = UnitPara.Parse(FreeUtil.ReplaceVar(this.para, args))[0];
            IPara    para = up.GetPara(args);

            if (para != null)
            {
                double d = FreeUtil.ReplaceDouble(formula, args);
                if (para is IntPara)
                {
                    para.SetValue("=", new IntPara(string.Empty, (int)d));
                }
                if (para is FloatPara)
                {
                    para.SetValue("=", new FloatPara(string.Empty, (float)d));
                }
                if (para is DoublePara)
                {
                    para.SetValue("=", new DoublePara(string.Empty, d));
                }
                else
                {
                    IPara v = new DoublePara("v", d);
                    para.SetValue("=", v);
                }
            }
        }
Example #2
0
 public virtual double GetDouble(IEventArgs args)
 {
     if (!initialed || dynamic)
     {
         realValue = FreeUtil.ReplaceDouble(para, args);
         initialed = true;
     }
     return((double)realValue);
 }
Example #3
0
        protected override void BuildMessage(IEventArgs args)
        {
            this.scope = "4";

            builder.Key = FreeMessageConstant.ScoreInfo;

            //游戏是否开始
            builder.Bs.Add(FreeUtil.ReplaceBool("{gameStart}", args));
            //总玩家数
            builder.Ins.Add(FreeUtil.ReplaceInt("{startPlayerCount}", args));
            //存活者数
            builder.Ins.Add(FreeUtil.ReplaceInt("{playerCount}", args));


            //当前玩家击杀数(每个玩家不一样)
            if (args.GetUnit("current") != null)
            {
                builder.Ins.Add(FreeUtil.ReplaceInt("{current.killNum}", args));
            }
            else
            {
                builder.Ins.Add(FreeUtil.ReplaceInt("{current.killNum}", args));
            }


            //击杀者姓名
            if (args.GetUnit("killer") == null)
            {
                builder.Ss.Add(FreeUtil.ReplaceVar("", args));
                builder.Ds.Add(0);
                builder.Ins.Add(0);
                builder.Ins.Add(0);
            }
            else
            {
                //击杀者姓名
                builder.Ss.Add(FreeUtil.ReplaceVar("{killer.name}", args));
                //击杀者队伍ID
                builder.Ds.Add(FreeUtil.ReplaceDouble("{killer.id}", args));
                //击杀者武器ID
                builder.Ins.Add(FreeUtil.ReplaceInt("{killer.currentWeaponId}", args));
                //击杀方式
                builder.Ins.Add(2);
            }

            //死者姓名
            builder.Ss.Add(FreeUtil.ReplaceVar("{killed.name}", args));
            //死者队伍ID
            builder.Ds.Add(FreeUtil.ReplaceDouble("{killed.id}", args));
            //死亡方式
            builder.Ins.Add(1);
        }
Example #4
0
        public virtual IPara GetPara(IEventArgs args)
        {
            IPara para = ParaUtil.GetPara(type);

            if (para != null)
            {
                para = (IPara)para.Copy();
                para.SetName(name);
                if (value == null)
                {
                    value = string.Empty;
                }

                if (para is StringPara)
                {
                    ((StringPara)para).SetValue(FreeUtil.ReplaceVar(value, args));
                }
                else if (para is BoolPara)
                {
                    ((BoolPara)para).SetValue(FreeUtil.ReplaceBool(value, args));
                }
                else
                {
                    double v = FreeUtil.ReplaceDouble(value, args);

                    if (para is IntPara)
                    {
                        ((IntPara)para).SetValue((int)v);
                    }
                    else
                    {
                        if (para is FloatPara)
                        {
                            ((FloatPara)para).SetValue((float)v);
                        }
                        else
                        {
                            if (para is DoublePara)
                            {
                                ((DoublePara)para).SetValue(v);
                            }
                        }
                    }
                }
                para.SetPublic(isPublic);
                para.SetName(FreeUtil.ReplaceVar(para.GetName(), args));
            }

            return(para);
        }
Example #5
0
        private void HandleKill(IEventArgs args)
        {
            if (code == "KillInfo")
            {
                SimpleProto message = FreePool.Allocate();
                message.Key = FreeMessageConstant.ScoreInfo;
                message.Ks.Add(3);
                message.Bs.Add(true);

                PlayerDamageInfo damageInfo = GetDamageInfo(args);

                //击杀者姓名
                if (args.GetUnit("killer") == null)
                {
                    message.Ss.Add("");
                    message.Ds.Add(-1);
                    message.Ins.Add(0);
                    message.Ins.Add(damageInfo.KillType);
                    message.Ins.Add(damageInfo.KillFeedbackType);
                }
                else
                {
                    //击杀者姓名
                    message.Ss.Add(FreeUtil.ReplaceVar("{killer.PlayerName}", args));
                    //击杀者队伍ID
                    message.Ds.Add(FreeUtil.ReplaceDouble("{killer.TeamId}", args));
                    //击杀者武器ID
                    message.Ins.Add(damageInfo.weaponId);
                    //击杀方式
                    message.Ins.Add(damageInfo.KillType);
                    //击杀反馈
                    message.Ins.Add(damageInfo.KillFeedbackType);
                }

                //死者姓名
                message.Ss.Add(FreeUtil.ReplaceVar("{killed.PlayerName}", args));
                //死者队伍ID
                message.Ds.Add(FreeUtil.ReplaceDouble("{killed.TeamId}", args));
                //死亡方式
                message.Ins.Add(damageInfo.type);

                //                Debug.Log("KillInfo ..." + message.ToString());

                SendMessageAction.sender.SendMessage(args, message, 4, string.Empty);
            }
        }
Example #6
0
        private void HandleBioDamage(IEventArgs args)
        {
            if (code == "BioDamage")
            {
                SimpleProto message = FreePool.Allocate();
                message.Key = FreeMessageConstant.ScoreInfo;
                message.Ks.Add(3);
                message.Bs.Add(true);

                PlayerDamageInfo damageInfo = GetDamageInfo(args);
                IParable         source     = args.GetUnit("source");
                if (null == source)
                {
                    return;
                }
                FreeData freeData = (FreeData)args.GetUnit("source");
                if (null == freeData)
                {
                    return;
                }
                int jobAttribute = 0;
                if (freeData.Player.hasGamePlay)
                {
                    jobAttribute = freeData.Player.gamePlay.JobAttribute;
                }
                if (jobAttribute == (int)EJobAttribute.EJob_EveryMan ||
                    jobAttribute == (int)EJobAttribute.EJob_Hero)
                {
                    return;
                }

                message.Ss.Add(FreeUtil.ReplaceVar("{source.PlayerName}", args));
                message.Ds.Add(FreeUtil.ReplaceDouble("{source.TeamId}", args));
                message.Ins.Add(damageInfo.weaponId);
                message.Ins.Add(damageInfo.KillType);
                message.Ins.Add(damageInfo.KillFeedbackType);

                message.Ss.Add(FreeUtil.ReplaceVar("{target.PlayerName}", args));
                message.Ds.Add(FreeUtil.ReplaceDouble("{target.TeamId}", args));
                message.Ins.Add(damageInfo.type);

                SendMessageAction.sender.SendMessage(args, message, 4, string.Empty);
            }
        }
Example #7
0
        public override UnitPosition Select(IEventArgs args)
        {
            UnitPosition up       = pos.Select(args);
            UnitPosition targetUp = targetPos.Select(args);

            if (up != null && targetUp != null)
            {
                Vector3 dir = new Vector3();
                dir.x = targetUp.GetX() - up.GetX();
                dir.y = targetUp.GetY() - up.GetY();
                dir.z = targetUp.GetZ() - up.GetZ();

                dir = UnityPositionUtil.vectorToAngles(dir);

                double angle = FreeUtil.ReplaceDouble(this.angle, args);

                up = UnityPositionUtil.GetAnglePosition(up, angle + dir.x, 0, FreeUtil.ReplaceFloat(radius, args), 0);
            }

            return(up);
        }
Example #8
0
 public long GetLong(string v)
 {
     return((long)FreeUtil.ReplaceDouble(v, this));
 }
Example #9
0
 public double getDouble(string v)
 {
     return(FreeUtil.ReplaceDouble(v, this));
 }
            public virtual void SetHonor(IEventArgs args, FreeData[] fds)
            {
                if (ids == null)
                {
                    ids = new HashSet <int>();
                }
                if (con == null || (condition != null && condition.Contains(FreeUtil.VAR_START) && condition.Contains(FreeUtil.VAR_END)))
                {
                    if (!StringUtil.IsNullOrEmpty(condition))
                    {
                        con = new ExpParaCondition(condition);
                    }
                }
                ids.Clear();
                IList <PlayerHonorAction.PlayerValue> pvs = new List <PlayerHonorAction.PlayerValue>();

                foreach (FreeData fd in fds)
                {
                    args.TempUse("player", fd);
                    try
                    {
                        if (con == null || con.Meet(args))
                        {
                            PlayerHonorAction.PlayerValue pv = new PlayerHonorAction.PlayerValue(fd, FreeUtil.ReplaceDouble(formula, args), desc);
                            pvs.Add(pv);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new GameConfigExpception(e.Message);
                    }
                    finally
                    {
                        args.Resume("player");
                    }
                }
                pvs.Sort();
                int order = GetOrder(args);

                if (order > 0)
                {
                    if (order <= pvs.Count)
                    {
                        ids.Add((int)pvs[order - 1].data.Player.playerInfo.PlayerId);
                    }
                }
                else
                {
                    foreach (PlayerHonorAction.PlayerValue pv in pvs)
                    {
                        ids.Add((int)pv.data.Player.playerInfo.PlayerId);
                    }
                }
            }