예제 #1
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));
            }
        }
예제 #2
0
        public virtual bool 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();

            this.posindex = -1;
            ParaList list = skill.GetDefault().GetParameters();

            if (list.HasPara("posindex"))
            {
                posindex = (int)list.Get("posindex").GetValue();
            }
            skill.TempUse("buf", this);

            IPosSelector pos = GetPos(region.GetCenter(skill));

            if (pos.Select(skill).GetInvalid())
            {
                return(false);
            }

            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(pos);
                effectAction.SetKey("bufeffect_" + realKey);
            }
            else
            {
                if (show == null)
                {
                    show = new FreeEffectShowAction();
                    show.SetKey(effect);
                    show.SetPos(pos);
                }
            }
            skill.Resume("buf");
            if (creator != null && hasCreator)
            {
                skill.Resume("creator");
            }
            if (!StringUtil.IsNullOrEmpty(condition))
            {
                bufCondition = new ExpParaCondition(FreeUtil.ReplaceVar(condition, skill));
            }
            return(true);
        }