public virtual void AddPosSelecotr(string name, IPosSelector pos) { if (!posMap.ContainsKey(name)) { posMap[name] = new Stack <IPosSelector>(); } this.posMap[name].Push(pos); }
public virtual UnitPosition Select(IEventArgs args) { IPosSelector pos = args.ComponentMap.GetPos(name); if (pos != null) { return(pos.Select(args)); } else { if (defaultPos != null) { return(defaultPos.Select(args)); } } return(null); }
public override string GetRotation(IEventArgs args, IPosSelector selector) { return(string.Empty); }
public virtual void TempUsePos(string name, IPosSelector pos) { AddPosSelecotr(name, pos); }
public override string GetRotation(IEventArgs args, IPosSelector selector) { return(FreeUtil.ReplaceVar(rotation, args)); }
public override string GetXyz(IEventArgs args, IPosSelector selector) { return(FreeUtil.ReplaceVar(xyz, args)); }
public virtual void SetSelector(IPosSelector selector) { this.selector = selector; }
public static void Build(SimpleProto builder, IEventArgs args, string key, string img, bool show, bool pvs, string xyz, string scale, string rotaion, Iterable <IFreeEffect> effects, IList <IFreeUIAuto> autos, IPosSelector selector, string size) { builder.Key = 60; builder.Bs.Add(show); builder.Bs.Add(pvs); AddPosition(xyz, scale, rotaion, builder); builder.Ks.Add(1); builder.Ss.Add(key); if (img == null) { builder.Ss.Add(string.Empty); } else { builder.Ss.Add(img); } builder.Ss.Add(GetAutoString(autos, args)); if (StringUtil.IsNullOrEmpty(size)) { builder.Ss.Add(string.Empty); } else { builder.Ss.Add(FreeUtil.ReplaceVar(size, args)); } if (effects != null) { foreach (IFreeEffect com in effects) { builder.Ks.Add(com.GetKey(args)); AddPosition(com.GetXyz(args, selector), com.GetScale(args), com.GetRotation(args, selector), builder); builder.Ss.Add(com.GetStyle(args, key)); builder.Ss.Add(GetAutoString(com.GetAutos(args), args)); } } }
public void setPos(IPosSelector pos) { this.pos = pos; }
public override string GetRotation(IEventArgs args, IPosSelector selector) { return(GetCurrentEffect(args).GetRotation(args, selector)); }
public virtual void SetDefaultPos(IPosSelector defaultPos) { this.defaultPos = defaultPos; }
public abstract string GetRotation(IEventArgs args, IPosSelector selector);
public abstract string GetXyz(IEventArgs args, IPosSelector selector);
public virtual void SetPos(IPosSelector pos) { this.pos = pos; }
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); }
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"); } }