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"); } } }
public override void DoAction(IEventArgs args) { if (string.IsNullOrEmpty(this.player)) { this.player = "current"; } var unit = GetPlayer(args); if (skills != null && unit != null) { foreach (var skill in skills) { unit.GetUnitSkill().AddSkill((ISkill)SerializeUtil.Clone(skill)); } byte[] bs = SerializeUtil.ObjectToByte(skills); SimpleProto msg = FreePool.Allocate(); msg.Key = FreeMessageConstant.ClientSkill; for (int i = 0; i < bs.Length; i++) { msg.Ins.Add(bs[i]); } FreeMessageSender.SendMessage(unit.Player, msg); } }
public object GetObject(string name) { if (objDic.ContainsKey(name)) { return(SerializeUtil.Clone(objDic[name])); } Logger.ErrorFormat("{0} is not defined as object.", name); Debug.LogErrorFormat("{0} is not defined as object.", name); //throw new RuntimeException(name + " is not defined as object."); return(null); }
public override void DoAction(IEventArgs args) { FreeData player = GetPlayer(args); if (player != null) { OnePlayerBuf buf = new OnePlayerBuf(); buf.buf = this.buf; buf.startAction = (IGameAction)SerializeUtil.Clone(startAction); buf.action = (IGameAction)SerializeUtil.Clone(action); buf.endAction = (IGameAction)SerializeUtil.Clone(endAction); player.Bufs.RegisterPlayerBuf(buf); } }
public static UnitSkill GetSkill(int weaponId) { UnitSkill unitSkill = new UnitSkill(new WeaponFreeData(weaponId)); if (skillDic.ContainsKey(weaponId)) { List <ISkill> skills = (List <ISkill>)SerializeUtil.Clone(skillDic[weaponId]); for (int i = 0; i < skills.Count; i++) { unitSkill.AddSkill(skills[i]); } } return(unitSkill); }
public override void DoAction(IEventArgs args) { if (string.IsNullOrEmpty(this.player)) { this.player = "current"; } var unit = GetPlayer(args); if (skills != null && unit != null) { foreach (var skill in skills) { unit.GetUnitSkill().AddSkill((ISkill)SerializeUtil.Clone(skill)); } } }
public override void DoAction(IEventArgs args) { FreeMoveEntity en = args.GameContext.freeMove.CreateEntity(); en.AddEntityKey(new EntityKey(args.GameContext.session.commonSession.EntityIdGenerator.GetNextEntityId(), (short)EEntityType.FreeMove)); en.AddPosition(); en.AddFreeData(FreeUtil.ReplaceVar(name, args), new FreeEntityData(en)); en.freeData.Cat = ""; en.freeData.Value = ""; en.freeData.ScaleX = 1f; en.freeData.ScaleY = 1f; en.freeData.ScaleZ = 1f; if (distance > 0) { en.AddPositionFilter(Core.Components.PositionFilterType.Filter2D, distance); } en.isFlagSyncNonSelf = true; FreeEntityData entityData = (FreeEntityData)en.freeData.FreeData; entityData.move = (IFreeMove)SerializeUtil.Clone(move); entityData.createAction = createAction; entityData.action = action; entityData.name = FreeUtil.ReplaceVar(name, args); entityData.condition = condition; entityData.removeAction = removeAction; entityData.effect = (FreeEffectCreateAction)SerializeUtil.Clone(effect); entityData.width = width; entityData.length = length; entityData.height = height; entityData.deadAction = deadAction; entityData.damageAction = damageAction; entityData.frameAction = (IGameAction)SerializeUtil.Clone(frameAction); entityData.removeCondition = removeCondition; entityData.removedCondition = removedCondition; entityData.hp = hp; if (width > 0 && height > 0 && length > 0) { AssetInfo info = GetAssetInfo(args, effect); if (!string.IsNullOrEmpty(info.AssetName)) { args.GameContext.session.commonSession.AssetManager.LoadAssetAsync( entityData, info, SetGameObject); } } if (skills != null) { entityData.skills = new List <ISkill>(); foreach (ISkill skill in skills) { entityData.skills.Add((ISkill)SerializeUtil.Clone(skill)); } } FreeData fd = GetPlayer(args); if (fd != null) { args.TempUse("creator", fd); } entityData.Start(args); if (fd != null) { args.Resume("creator"); } }
public virtual ISkill Clone() { return((ISkill)SerializeUtil.Clone(this)); }
public override void DoAction(IEventArgs args) { args.FreeContext.MultiFrame.AddAction(FreeUtil.ReplaceVar(key, args), (IGameAction)SerializeUtil.Clone(action)); }