Пример #1
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");
                }
            }
        }
Пример #2
0
        public void AddFreeBuf(FreeBuf buf)
        {
            if (bufs == null)
            {
                bufs = new List <FreeBuf>();
            }

            bufs.Add(buf);
        }
Пример #3
0
        public virtual void Reset(IEventArgs args, string key)
        {
            FreeBuf buf = map[key];

            if (buf != null)
            {
                buf.Reset(args);
            }
        }
Пример #4
0
        public virtual void RemoveBuf(IEventArgs args, string key)
        {
            FreeBuf buf = map[key];

            if (buf != null)
            {
                buf.Remove(args);
                map.Remove(key);
            }
        }
Пример #5
0
        public virtual void AddFreeBuf(FreeBuf buf, IEventArgs args)
        {
            string key = FreeUtil.ReplaceVar(buf.GetKey(), args);

            if (map.ContainsKey(key))
            {
                FreeLog.Error("buf '" + key + "' 覆盖了原有的BUF", null);
            }
            this.map[key] = buf;
        }
Пример #6
0
 public virtual void Eat(PlayerEntity player, ISkillArgs skill)
 {
     MyDictionary <string, FreeBuf> .Enumerator it = map.GetEnumerator();
     while (it.MoveNext())
     {
         FreeBuf buf = it.Current.Value;
         FreeLog.SetTrigger(buf);
         buf.Eat(player, skill);
     }
 }