コード例 #1
0
 public void Error(ISkillArgs args, ItemInventory inventory, string msg)
 {
     if (errorAction != null)
     {
         if (Runtime.CurrentTimeMillis() - lastErrorTime > 2000)
         {
             if (args != null)
             {
                 args.GetDefault().GetParameters().TempUse(new StringPara("message", msg));
                 errorAction.Act(args);
                 args.GetDefault().GetParameters().Resume("message");
             }
             lastErrorTime = Runtime.CurrentTimeMillis();
         }
     }
 }
コード例 #2
0
        public override void Effet(ISkillArgs args)
        {
            if (effect != null)
            {
                if (aPara == null)
                {
                    aPara = new BoolPara(Active);
                }

                aPara.SetValue(active);

                args.GetDefault().GetParameters().TempUse(aPara);

                effect.Act(args);

                args.GetDefault().GetParameters().Resume(Active);

                active = !active;
            }
        }
コード例 #3
0
        private void RealEat(PlayerEntity player, ISkillArgs skill)
        {
            if (!this.disable && (bufCondition == null || bufCondition.Meet(skill)))
            {
                ShowEffect(skill, player);
                skill.TempUse("buf", this);
                if (creator != null)
                {
                    skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
                }
                pos.SetX(player.position.Value.x);
                pos.SetY(player.position.Value.y);
                pos.SetZ(player.position.Value.z);
                if (region.In(skill, pos))
                {
                    if (!ins.Contains(player.playerInfo.PlayerId))
                    {
                        if (enterAction != null)
                        {
                            enterAction.Act(skill);
                        }
                        ins.Add(player.playerInfo.PlayerId);
                    }
                    if (trigger == null || trigger.Triggered(skill) == ISkillTrigger.TriggerStatus.Success)
                    {
                        if (eatAction != null)
                        {
                            // record parentkey
                            IPosSelector posCenter = GetPos(region.GetCenter(skill));
                            skill.GetDefault().GetParameters().TempUse(new IntPara("posindex", posCenter.Select(skill).GetRandomindex()));
                            eatAction.Act(skill);
                            skill.GetDefault().GetParameters().RemovePara("posindex");

                            // handle
                            if (posindex >= 0)
                            {
                                skill.GetDefault().GetParameters().TempUse(new IntPara("resetpos", posindex));
                                skill.Triggers.Trigger(FreeTriggerConstant.PLAYER_EAT_BUF, skill);
                                skill.GetDefault().GetParameters().RemovePara("resetpos");
                            }

                            if (consume)
                            {
                                skill.FreeContext.Bufs.RemoveBuf(skill, this.realKey);
                            }
                        }
                    }
                }
                else
                {
                    if (ins.Contains(player.playerInfo.PlayerId))
                    {
                        if (leaveAction != null)
                        {
                            leaveAction.Act(skill);
                        }
                        ins.Remove(player.playerInfo.PlayerId);
                    }
                }
                if (creator != null)
                {
                    skill.Resume("creator");
                }
                skill.Resume("buf");
            }
        }