コード例 #1
0
        public override void DoAction(IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(key))
            {
                key = BaseEventArgs.DEFAULT;
            }
            IParable unit = args.GetUnit(key);

            if (unit != null)
            {
                IPara sort = unit.GetParameters().Get(sorter);
                if (sort != null && sort is ParaListSet)
                {
                    ParaListSet pls = (ParaListSet)sort;
                    IParable    pa  = Get();
                    if (action != null)
                    {
                        args.TempUse(TEMP_SORT, pa);
                        args.TempUse("element", pa);
                        action.Act(args);
                        args.Resume("element");
                        args.Resume(TEMP_SORT);
                    }
                    pls.AddParaList(pa.GetParameters());
                }
            }
        }
コード例 #2
0
        public override void DoAction(IEventArgs args)
        {
            if (inter)
            {
                if (fd != null)
                {
                    fd.freeInventory.StopUseItem(args, fd);
                    UseCommonAction use = new UseCommonAction();
                    use.key    = "showBottomTip";
                    use.values = new List <ArgValue>();
                    use.values.Add(new ArgValue("msg", "{desc:10072,{item.name}}"));

                    args.TempUse("current", fd);
                    args.TempUse("item", ip);
                    use.Act(args);
                    args.Resume("current");
                    args.Resume("item");
                    PlayerAnimationAction.DoAnimation(PlayerAnimationAction.Stop, fd.Player);
                    FreeSoundUtil.Stop("use", args, fd);

                    PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
                }
            }
            else
            {
                if (ip != null && fd != null)
                {
                    UseItem(ip, fd, (ISkillArgs)args);
                    fd.freeInventory.StopUseItem(args, fd);
                }
            }
        }
コード例 #3
0
        public void Start(IEventArgs args)
        {
            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            args.TempUse("entity", this);
            args.TempUse(name, this);

            if (createAction != null)
            {
                createAction.Act(args);
            }

            FreeData creator = (FreeData)args.GetUnit("creator");

            if (creator != null)
            {
                CreatorId = creator.Player.playerInfo.EntityId;
            }

            if (skills != null && skills.Count > 0)
            {
                skill = new UnitSkill(this);
                foreach (ISkill sk in skills)
                {
                    skill.AddSkill(sk);
                }
            }

            move.Start(fr, _entity);

            xPara.SetValue(_entity.position.Value.x);
            yPara.SetValue(_entity.position.Value.y);
            zPara.SetValue(_entity.position.Value.z);

            if (effect != null)
            {
                AutoPositionValue auto = new AutoPositionValue();
                auto.SetId(_entity.entityKey.Value.EntityId.ToString());
                auto.SetField("pos");
                effect.AddAuto(auto);

                AutoScaleValue scale = new AutoScaleValue();
                scale.SetId(_entity.entityKey.Value.EntityId.ToString());
                scale.SetField("scale");
                effect.AddAuto(scale);

                effect.SetSelector(new PosAssignSelector(_entity.position.Value.x.ToString(),
                                                         _entity.position.Value.y.ToString(), _entity.position.Value.z.ToString()));

                //Debug.LogFormat("start pos {0}", _entity.position.Value.ToString());

                effect.Act(args);
            }

            args.Resume(name);
            args.Resume("entity");
        }
コード例 #4
0
        public void Frame(IEventArgs args, int interval)
        {
            if (_entity.isFlagDestroy)
            {
                return;
            }
            args.TempUse("entity", this);
            args.TempUse(name, this);

            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            move.Frame(fr, _entity, interval);

            xPara.SetValue(_entity.position.Value.x);
            yPara.SetValue(_entity.position.Value.y);
            zPara.SetValue(_entity.position.Value.z);

            foreach (PlayerEntity player in follows)
            {
                Vector3 v = _entity.position.Value;
                //v.y = v.y + 20;
                player.position.Value = v;
            }
            if (gameObject != null)
            {
                gameObject.transform.position = _entity.position.Value;
            }

            if (skill != null)
            {
                skill.Frame((FreeRuleEventArgs)args);
            }

            if (frameAction != null)
            {
                frameAction.Act(args);
            }

            if (effect != null && args.Rule.ServerTime - lastEffectTime > 1000L)
            {
                foreach (PlayerEntity player in args.GameContext.player.GetInitializedPlayerEntities())
                {
                    if (!effect.GetPlayerIds().Contains(player.entityKey.Value.EntityId))
                    {
                        effect.Act(args);
                        effect.AddPlayerId(player.entityKey.Value.EntityId);
                        lastEffectTime = args.Rule.ServerTime;
                        break;
                    }
                }
            }
            args.Resume(name);
            args.Resume("entity");
        }
コード例 #5
0
        public override void DoAction(IEventArgs args)
        {
            if (addtimePara == null)
            {
                addtimePara = new IntPara(ParaConstant.PARA_ITEM_ADD_TIME, 0);
            }
            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            if (StringUtil.IsNullOrEmpty(count))
            {
                count = INI_COUNT;
            }
            FreeItem fi = FreeItemManager.GetItem(fr, FreeUtil.ReplaceVar(key, args), FreeUtil.ReplaceInt(count, args));

            if (StringUtil.IsNullOrEmpty(name))
            {
                name = InventoryManager.DEFAULT;
            }
            IGameUnit player = GetPlayer(args);

            if (player != null)
            {
                FreeData fd = (FreeData)player;
                args.TempUse(ParaConstant.PARA_PLAYER_CURRENT, fd);
                args.TempUse(ParaConstant.PARA_ITEM, fi);

                args.TempUsePara(new StringPara("from", ChickenConstant.BagGround));

                if (action != null)
                {
                    action.Act(args);
                }

                if (fd.freeInventory.GetInventoryManager().GetInventory(FreeUtil.ReplaceVar(name, args)).AddItem((ISkillArgs)args, fi, true))
                {
                    //addtimePara.setValue(fr.room.getServerTime());
                    fi.GetParameters().AddPara(addtimePara);
                }
                else
                {
                    if (failAction != null)
                    {
                        fr.TempUse(ParaConstant.PARA_ITEM, fi);
                        failAction.Act(args);
                        fr.Resume(ParaConstant.PARA_ITEM);
                    }
                }

                fr.ResumePara("from");
                fr.Resume(ParaConstant.PARA_PLAYER_CURRENT);
                fr.Resume(ParaConstant.PARA_ITEM);
            }
        }
コード例 #6
0
        public void SetMove(IEventArgs args, IFreeMove move)
        {
            this.move = move;

            args.TempUse("entity", this);
            args.TempUse(name, this);

            move.Start((FreeRuleEventArgs)args, _entity);

            args.Resume(name);
            args.Resume("entity");
        }
コード例 #7
0
 public virtual void Remove(IEventArgs args)
 {
     this.paras.AddPara(new BoolPara("disable", disable));
     args.TempUse("buf", this);
     if (creator != null && creator.hasFreeData)
     {
         args.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
     }
     Disable(args);
     args.Resume("buf");
     if (creator != null && creator.hasFreeData)
     {
         args.Resume("creator");
     }
 }
コード例 #8
0
        public override void DoAction(IEventArgs args)
        {
            if (values != null)
            {
                args.TempUse(UnitTestConstant.Tester, GetPlayer(args));

                GameTrigger trigger = FreeLog.GetTrigger();

                foreach (ITestValue value in values)
                {
                    TestValue tv = value.GetCaseValue(args);
                    tv.Name = value.Name;

                    if (!dic.ContainsKey(tv.Name))
                    {
                        dic.Add(tv.Name, new List <TestValue>());
                        dic[tv.Name].Add(tv);
                    }

                    List <TestValue> list = dic[tv.Name];

                    if (!list[list.Count - 1].IsSame(tv))
                    {
                        list.Add(tv);
                    }
                }

                args.Resume(UnitTestConstant.Tester);
            }
        }
コード例 #9
0
ファイル: ReduceDamageUtil.cs プロジェクト: yangfan111/common
        private static float ReduceDamage(IEventArgs args, FreeData fd, PlayerDamageInfo damage, ItemPosition ip, int percent, ItemType itemType)
        {
            if (ip != null)
            {
                float realDamage = damage.damage;
                float reduce     = damage.damage * percent / 100;
                float realReduce = reduce;

                damage.damage -= realReduce;
                fd.Player.statisticsData.Statistics.DefenseDamage += reduce;

                // 普通帽子不减少
                if (reduce > 0)
                {
                    ip.SetCount(ip.GetCount() - (int)realDamage);
                    UpdateGamePlayData(fd, ip, itemType);

                    args.TempUse("current", fd);

                    if (ip.GetCount() <= 0)
                    {
                        ip.GetInventory().RemoveItem((FreeRuleEventArgs)args, ip);
                        FuntionUtil.Call(args, "showBottomTip", "msg", "{desc:10075," + ip.key.GetName() + "}");
                    }
                    else
                    {
                        ip.GetInventory().GetInventoryUI().UpdateItem((FreeRuleEventArgs)args, ip.GetInventory(), ip);
                    }

                    args.Resume("current");
                }
            }

            return(damage.damage);
        }
コード例 #10
0
ファイル: TriggerArgs.cs プロジェクト: yangfan111/CsharpCode
        public void Trigger(IEventArgs args, GameTriggers triggers, int trigger)
        {
            for (int i = 0; i < units.Count; i++)
            {
                if (units[i].unit != null)
                {
                    args.TempUse(units[i].key, units[i].unit);
                }
            }
            for (int i = 0; i < paras.Count; i++)
            {
                args.TempUsePara(paras[i]);
            }

            triggers.Trigger(trigger, args);

            for (int i = 0; i < units.Count; i++)
            {
                if (units[i].unit != null)
                {
                    args.Resume(units[i].key);
                }
            }
            for (int i = 0; i < paras.Count; i++)
            {
                args.ResumePara(paras[i].GetName());
            }

            Reset();
        }
コード例 #11
0
ファイル: TriggerArgs.cs プロジェクト: yangfan111/CsharpCode
        public void Act(IEventArgs args, IGameAction action)
        {
            for (int i = 0; i < units.Count; i++)
            {
                if (units[i].unit != null)
                {
                    args.TempUse(units[i].key, units[i].unit);
                }
            }
            for (int i = 0; i < paras.Count; i++)
            {
                args.TempUsePara(paras[i]);
            }

            action.Act(args);

            for (int i = 0; i < units.Count; i++)
            {
                if (units[i].unit != null)
                {
                    args.Resume(units[i].key);
                }
            }
            for (int i = 0; i < paras.Count; i++)
            {
                args.ResumePara(paras[i].GetName());
            }

            Reset();
        }
コード例 #12
0
        public static bool CanChangeBag(IEventArgs args, FreeData fd, int cat, int id)
        {
            bool         can      = true;
            float        capacity = GetCapacity(fd);
            float        weight   = GetWeight(fd);
            FreeItemInfo info     = FreeItemConfig.GetItemInfo(cat, id);

            if (cat == (int)ECategory.Avatar)
            {
                float oldCap = GetCapacity(fd, cat, id);

                can = Math.Round(capacity - weight, 3) >= Math.Round(oldCap - info.capacity, 3);
            }

            if (!can)
            {
                UseCommonAction use = new UseCommonAction();
                use.key    = "showBottomTip";
                use.values = new List <ArgValue>();
                use.values.Add(new ArgValue("msg", "{desc:10074}"));

                args.TempUse("current", fd);
                use.Act(args);
                args.Resume("current");
            }

            return(can);
        }
コード例 #13
0
 public virtual void ShowEffect(IEventArgs args, PlayerEntity player)
 {
     if (!showedIds.Contains(player.playerInfo.PlayerId) && !this.disable)
     {
         args.TempUse("buf", this);
         if (effectAction == null)
         {
             show.SetScope(1);
             show.SetTime(0);
             show.SetPlayer("current");
             if (!StringUtil.IsNullOrEmpty(effect))
             {
                 show.Act(args);
             }
         }
         else
         {
             effectAction.SetScope(1);
             effectAction.SetPlayer("current");
             effectAction.Act(args);
         }
         args.Resume("buf");
         showedIds.Add(player.playerInfo.PlayerId);
     }
 }
コード例 #14
0
        public static void HandleMoveAction(ItemInventory fromIn, ItemInventory toIn, IInventoryUI fromUI, IInventoryUI toUI, ItemPosition ip, IEventArgs args, bool remove)
        {
            args.TempUse(PARA_ITEM, ip);
            args.GetDefault().GetParameters().TempUse(new StringPara(PARA_ITEM_MOVE_FROM, fromIn.GetName()));
            args.GetDefault().GetParameters().TempUse(new StringPara(PARA_ITEM_MOVE_TO, toIn.GetName()));
            if (remove)
            {
                if (fromUI.MoveAction != null)
                {
                    fromUI.MoveAction.Act(args);
                }
            }
            else
            {
                if (toUI != fromUI)
                {
                    if (toUI.MoveAction != null)
                    {
                        toUI.MoveAction.Act(args);
                    }
                }
            }

            args.Resume(PARA_ITEM);
            args.GetDefault().GetParameters().Resume(PARA_ITEM_MOVE_FROM);
            args.GetDefault().GetParameters().Resume(PARA_ITEM_MOVE_TO);
        }
コード例 #15
0
        public override void DoAction(IEventArgs args)
        {
            FreeData targetPlayer = ((FreeData)args.GetUnit(this.player));

            if (bufs != null)
            {
                foreach (FreeBuf buf in bufs)
                {
                    FreeBuf copy = (FreeBuf)SerializeUtil.Clone(buf);
                    if (targetPlayer != null)
                    {
                        copy.SetCreator(targetPlayer.Player);
                    }
                    if (!copy.OnCreate(args))
                    {
                        continue;
                    }
                    args.TempUse("buf", copy);
                    try
                    {
                        args.FreeContext.Bufs.AddFreeBuf(copy, args);
                    }
                    catch (Exception e)
                    {
                        Sharpen.Runtime.PrintStackTrace(e);
                    }
                    args.Resume("buf");
                }
            }
        }
コード例 #16
0
        public override void DoAction(IEventArgs args)
        {
            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            if (StringUtil.IsNullOrEmpty(count) || count.Equals("0"))
            {
                count = INI_COUNT;
            }
            int      c    = FreeUtil.ReplaceInt(count, args);
            FreeItem item = FreeItemManager.GetItem(fr, FreeUtil.ReplaceVar(key, args), c);

            if (item != null)
            {
                if (!StringUtil.IsNullOrEmpty(time))
                {
                    ((FreeGameItem)item).SetTime(time);
                }
                item.Drop(fr, pos.Select(args));
                if (action != null)
                {
                    args.TempUse(ParaConstant.PARA_ITEM, item);
                    action.Act(args);
                    args.Resume(ParaConstant.PARA_ITEM);
                }
            }
        }
コード例 #17
0
        public override void DoAction(IEventArgs args)
        {
            if (values != null)
            {
                SimpleParaList testParaList = new SimpleParaList();

                FreeData fd = GetPlayer(args);
                if (null != fd)
                {
                    PlayerEntity player = fd.Player;
                    var          entity = args.GameContext.mapObject.GetEntityWithEntityKey(new EntityKey(player.gamePlay.UseEntityId, (int)EEntityType.MapObject));
                    if (null != entity && entity.hasDoorData)
                    {
                        testParaList.AddFields(new ObjectFields(entity.doorData));
                    }
                }

                SimpleParable sp = new SimpleParable(testParaList);
                args.TempUse("testPara", sp);

                args.TempUse(UnitTestConstant.Tester, GetPlayer(args));

                GameTrigger trigger = FreeLog.GetTrigger();

                foreach (ITestValue value in values)
                {
                    TestValue tv = value.GetCaseValue(args);
                    tv.Name = value.Name;

                    if (!dic.ContainsKey(tv.Name))
                    {
                        dic.Add(tv.Name, new List <TestValue>());
                        dic[tv.Name].Add(tv);
                    }

                    List <TestValue> list = dic[tv.Name];

                    if (!list[list.Count - 1].IsSame(tv))
                    {
                        list.Add(tv);
                    }
                }

                args.Resume("testPara");
                args.Resume(UnitTestConstant.Tester);
            }
        }
コード例 #18
0
        public virtual void OnCreate(IEventArgs skill)
        {
            startTime      = skill.Rule.ServerTime;
            this.ins       = new HashSet <long>();
            this.showedIds = new HashSet <long>();
            this.realKey   = FreeUtil.ReplaceVar(key, skill);
            this.realTime  = FreeUtil.ReplaceInt(time, skill);
            this.paras     = new SimpleParaList();

            skill.TempUse("buf", this);
            bool hasCreator = false;

            if (creator != null && creator.hasFreeData)
            {
                skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
                hasCreator = true;
            }
            AddParas(skill);
            if (createAction != null)
            {
                createAction.Act(skill);
            }
            if (effectAction != null)
            {
                effectAction.SetSelector(GetPos(region.GetCenter(skill)));
                effectAction.SetKey("bufeffect_" + realKey);
            }
            else
            {
                if (show == null)
                {
                    show = new FreeEffectShowAction();
                    show.SetKey(effect);
                    show.SetPos(GetPos(region.GetCenter(skill)));
                }
            }
            skill.Resume("buf");
            if (creator != null && hasCreator)
            {
                skill.Resume("creator");
            }
            if (!StringUtil.IsNullOrEmpty(condition))
            {
                bufCondition = new ExpParaCondition(FreeUtil.ReplaceVar(condition, skill));
            }
        }
コード例 #19
0
ファイル: FreeBufManager.cs プロジェクト: yangfan111/common
 public virtual void ShowBuf(PlayerEntity player, IEventArgs args)
 {
     args.TempUse("current", (FreeData)player.freeData.FreeData);
     foreach (KeyValuePair <string, FreeBuf> buf in map)
     {
         buf.Value.ShowEffect(args, player);
     }
     args.Resume("current");
 }
コード例 #20
0
ファイル: ItemPosition.cs プロジェクト: yangfan111/CsharpCode
        public virtual bool DragTo(IEventArgs args, com.wd.free.item.ItemPosition target)
        {
            args.TempUse("source", this);
            args.TempUse("target", target);
            bool drag = false;

            if (key.GetDragCondition() != null && key.GetDragCondition().Meet(args))
            {
                if (key.GetDragAction() != null)
                {
                    key.GetDragAction().Act(args);
                    drag = true;
                }
            }
            args.Resume("source");
            args.Resume("target");
            return(drag);
        }
コード例 #21
0
        private static float ReduceDamage(IEventArgs args, PlayerEntity player, PlayerDamageInfo damage, int percent, bool armor)
        {
            float readDamage = damage.damage;

            if (damage.type != (int)EUIDeadType.Weapon && damage.type != (int)EUIDeadType.Unarmed)
            {
                return(readDamage);
            }

            float reduce     = damage.damage * percent / 100;
            float realReduce = reduce;

            if (armor)
            {
                realReduce = Math.Min(player.gamePlay.CurArmor, reduce);
            }
            else
            {
                realReduce = Math.Min(player.gamePlay.CurHelmet, reduce);
            }
            damage.damage -= realReduce;

            FreeData fd = (FreeData)player.freeData.FreeData;

            // 普通帽子不减少
            args.TempUse("current", fd);
            if (realReduce > 0)
            {
                if (armor)
                {
                    player.gamePlay.CurArmor = Math.Max(0, player.gamePlay.CurArmor - (int)readDamage);
                    if (player.gamePlay.CurArmor == 0)
                    {
                        PlayerItemAvatarAction.TakeOff(player, player.gamePlay.ArmorLv);
                        FreeItemInfo info = FreeItemConfig.GetItemInfo((int)ECategory.Avatar, player.gamePlay.ArmorLv);
                        FuntionUtil.Call(args, "showBottomTip", "msg", "{desc:10075," + info.name + "}");
                    }
                }
                else
                {
                    player.gamePlay.CurHelmet = Math.Max(0, player.gamePlay.CurHelmet - (int)readDamage);
                    if (player.gamePlay.CurHelmet == 0)
                    {
                        PlayerItemAvatarAction.TakeOff(player, player.gamePlay.HelmetLv);
                        FreeItemInfo info = FreeItemConfig.GetItemInfo((int)ECategory.Avatar, player.gamePlay.HelmetLv);
                        FuntionUtil.Call(args, "showBottomTip", "msg", "{desc:10075," + info.name + "}");
                    }
                }

                player.statisticsData.Statistics.DefenseDamage += realReduce;
            }
            args.Resume("current");

            return(damage.damage);
        }
コード例 #22
0
            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);
                    }
                }
            }
コード例 #23
0
        public override void DoAction(IEventArgs args)
        {
            FreeRuleEventArgs fr     = (FreeRuleEventArgs)args;
            IGameUnit         player = GetPlayer(args);

            if (player != null)
            {
                if (!StringUtil.IsNullOrEmpty(item))
                {
                    IParable pe = args.GetUnit(item);
                    if (pe != null && pe is ItemPosition)
                    {
                        args.TempUse("current", (FreeData)player);
                        ItemPosition ip = (ItemPosition)pe;
                        ip.GetInventory().RemoveItem(fr, ip);
                        RemoveUI(ip, fr);
                        args.Resume("current");
                    }
                }
                else
                {
                    method = new SelectMethod(FreeUtil.ReplaceVar(exp, args));

                    FreeData       fd           = (FreeData)player;
                    ItemPosition[] currentItems = fd.freeInventory.Select(method);
                    if (StringUtil.IsNullOrEmpty(count))
                    {
                        count = "1";
                    }
                    int c = FreeUtil.ReplaceInt(count, args);
                    for (int i = 0; i < MyMath.Min(c, currentItems.Length); i++)
                    {
                        args.TempUse("current", (FreeData)player);
                        ItemPosition ip = currentItems[i];
                        ip.GetInventory().RemoveItem(fr, ip);
                        RemoveUI(ip, fr);
                        args.Resume("current");
                    }
                }
            }
        }
コード例 #24
0
        public void Frame(IEventArgs args, int interval)
        {
            if (_entity.isFlagDestroy)
            {
                return;
            }
            args.TempUse("entity", this);
            args.TempUse(name, this);

            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            move.Frame(fr, _entity, interval);

            xPara.SetValue(_entity.position.Value.x);
            yPara.SetValue(_entity.position.Value.y);
            zPara.SetValue(_entity.position.Value.z);

            foreach (PlayerEntity player in follows)
            {
                Vector3 v = _entity.position.Value;
                //v.y = v.y + 20;
                player.position.Value = v;
            }
            if (gameObject != null)
            {
                gameObject.transform.position = _entity.position.Value;
            }

            if (skill != null)
            {
                skill.Frame((FreeRuleEventArgs)args);
            }

            if (frameAction != null)
            {
                frameAction.Act(args);
            }

            args.Resume(name);
            args.Resume("entity");
        }
コード例 #25
0
        public static void Handle(IEventArgs args, DebugCommand message, PlayerEntity player)
        {
            if (commandDic.ContainsKey(message.Command.ToLower()))
            {
                FreeLog.Reset();

                IGameAction action = commandDic[message.Command.ToLower()];

                if (FreeLog.IsEnable())
                {
                    FreeLog.SetTrigger(string.Format("命令行 {0}: {1}", message.Command, string.Join(" ", message.Args)));
                }

                if (commandPara == null)
                {
                    commandPara = new StringPara("command", "");
                }

                if (message.Args != null)
                {
                    for (int i = 1; i <= message.Args.Length; i++)
                    {
                        args.TempUsePara(new StringPara("arg" + i, message.Args[i - 1]));
                    }
                }


                args.TempUsePara(commandPara);
                args.TempUse("current", (FreeData)player.freeData.FreeData);

                action.Act(args);

                if (message.Command == "relive")
                {
                    player.isFlagCompensation = true;
                }

                args.Resume("current");
                args.ResumePara("command");

                if (message.Args != null)
                {
                    for (int i = 1; i <= message.Args.Length; i++)
                    {
                        args.ResumePara("arg" + i);
                    }
                }

                FreeLog.Print();
            }
        }
コード例 #26
0
        public override void DoAction(IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(key))
            {
                key = BaseEventArgs.DEFAULT;
            }
            IParable unit = args.GetUnit(key);

            if (unit != null)
            {
                IPara sort = unit.GetParameters().Get(sorter);
                if (sort != null)
                {
                    ParaListSet pls = (ParaListSet)sort;
                    if (action != null)
                    {
                        Iterator <ParaList> it = pls.Iterator();
                        int i = 1;
                        while (it.HasNext())
                        {
                            ParaList pl = it.Next();
                            args.TempUse("element", new SimpleParable(pl));
                            args.GetDefault().GetParameters().TempUse(new IntPara("index", i++));
                            if (condition == null || condition.Meet(args))
                            {
                                if (action != null)
                                {
                                    action.Act(args);
                                }
                                if (FreeUtil.ReplaceBool(remove, args))
                                {
                                    it.Remove();
                                }
                            }
                            args.GetDefault().GetParameters().Resume("index");
                            args.Resume("element");
                        }
                        if (i == 1)
                        {
                            if (noneAction != null)
                            {
                                noneAction.Act(args);
                            }
                        }
                    }
                }
            }
        }
コード例 #27
0
        public virtual bool IsCanDrop(ItemPosition ip, IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(canDrop))
            {
                return(true);
            }
            if (canDropCondition == null || ((canDrop.IndexOf(FreeUtil.VAR_START_CHAR) > -1) && (canDrop.IndexOf(FreeUtil.VAR_END_CHAR) > -1)))
            {
                canDropCondition = new ExpParaCondition(canDrop);
            }
            args.TempUse("item", ip);
            bool can = canDropCondition.Meet(args);

            args.Resume("item");
            return(can);
        }
コード例 #28
0
 private void SetArg(IEventArgs fr, long s)
 {
     foreach (string key in map[s].Keys)
     {
         IParable pa = map[s][key];
         ParaList snapshotParaList = vMap[s][key];
         if (pa != null && snapshotParaList != null)
         {
             foreach (string field in snapshotParaList.GetFields())
             {
                 pa.GetParameters().TempUse(snapshotParaList.Get(field));
             }
         }
         fr.TempUse(key, pa);
     }
 }
コード例 #29
0
        public override void DoAction(IEventArgs args)
        {
            if (values != null)
            {
                args.TempUse(UnitTestConstant.Tester, GetPlayer(args));

                GameTrigger trigger = FreeLog.GetTrigger();

                foreach (var value in values)
                {
                    TestValue tv = value.GetCaseValue(args);
                    tv.Name = value.Name;
                    RecordResult(args, trigger, new TestValue[] { tv });
                }

                args.Resume(UnitTestConstant.Tester);
            }
        }
コード例 #30
0
        private void HandlePlayer(Collider collider, IEventArgs fr, Contexts contexts, float damage, Vector3 bombPos)
        {
            var entityReference = collider.transform.GetComponent <EntityReference>();
            var player          = entityReference.Reference as PlayerEntity;

            if (null == player)
            {
                Logger.ErrorFormat("player {0} has no player reference ", collider.name);
                return;
            }
            if (HasObstacle(player.position.Value, player.position.Value + Vector3.up * CeilCheckDistance))
            {
                return;
            }

            /*if (player.IsOnVehicle())
             * {
             *  if (Logger.IsDebugEnabled)
             *  {
             *      Logger.Debug("player in vehicle ");
             *  }
             *  var vehicleEntity = contexts.vehicle.GetEntityWithEntityKey(player.controlledVehicle.EntityKey);
             *  vehicleEntity.GetGameData().DecreaseHp(Core.Prediction.VehiclePrediction.Cmd.VehiclePartIndex.Body, damage);
             * }
             * else
             * {*/
            if (null != action)
            {
                disPara.SetValue(Math.Max(0,
                                          (fr.GetFloat(radius) - Vector3.Distance(bombPos, player.position.Value)) / fr.GetFloat(radius)));
                fr.TempUsePara(damagePara);
                fr.TempUsePara(disPara);
                fr.TempUsePara(typePara);
                fr.TempUse("current", (FreeData)player.freeData.FreeData);
                action.Act(fr);

                fr.ResumePara("damage");
                fr.ResumePara("dis");
                fr.ResumePara("type");
                fr.Resume("current");
            }

            //}
        }