Exemplo n.º 1
0
        public override void DoAction(IEventArgs args)
        {
            ItemDrop[] list = FreeItemDrop.GetDropItems(FreeUtil.ReplaceVar(cat, args), FreeUtil.ReplaceInt(count, args), args.GameContext.session.commonSession.RoomInfo.MapId);

            if (list != null)
            {
                Vector3 p = UnityPositionUtil.ToVector3(pos.Select(args));
                foreach (ItemDrop drop in list)
                {
                    args.GameContext.session.entityFactoryObject.SceneObjectEntityFactory.
                    CreateSimpleEquipmentEntity((ECategory)drop.cat, drop.id, drop.count, new Vector3(p.x + RandomUtil.Random(-100, 100) / 100f, p.y, p.z + RandomUtil.Random(-100, 100) / 100f));
                }
            }
        }
Exemplo n.º 2
0
        private string ValueString(IEventArgs args)
        {
            List <string> list = new List <string>();

            if (values != null)
            {
                foreach (OnePrefabValue v in values)
                {
                    list.Add(FreeUtil.ReplaceVar(v.field, args) + FreeMessageConstant.SpilterField + FreeUtil.ReplaceVar(v.value, args));
                }
            }

            return(StringUtil.GetStringFromStrings(list, FreeMessageConstant.SpliterRecord));
        }
Exemplo n.º 3
0
        public override void DoAction(IEventArgs args)
        {
            if (addtimePara == null)
            {
                addtimePara = new IntPara(ParaConstant.PARA_ITEM_ADD_TIME, 0);
            }
            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            if (StringUtil.IsNullOrEmpty(count))
            {
                count = INI_COUNT;
            }
            FreeItem fi = FreeItemManager.GetItem(fr, FreeUtil.ReplaceVar(key, args), FreeUtil.ReplaceInt(count, args));

            if (StringUtil.IsNullOrEmpty(name))
            {
                name = InventoryManager.DEFAULT;
            }
            IGameUnit player = GetPlayer(args);

            if (player != null)
            {
                FreeData fd = (FreeData)player;
                args.TempUse(ParaConstant.PARA_PLAYER_CURRENT, fd);
                args.TempUse(ParaConstant.PARA_ITEM, fi);
                if (action != null)
                {
                    action.Act(args);
                }

                if (fd.freeInventory.GetInventoryManager().GetInventory(FreeUtil.ReplaceVar(name, args))
                    .AddItem((ISkillArgs)args, fi, true))
                {
                    //addtimePara.setValue(fr.room.getServerTime());
                    fi.GetParameters().AddPara(addtimePara);
                }
                else
                {
                    if (failAction != null)
                    {
                        fr.TempUse(ParaConstant.PARA_ITEM, fi);
                        failAction.Act(args);
                        fr.Resume(ParaConstant.PARA_ITEM);
                    }
                }

                fr.Resume(ParaConstant.PARA_PLAYER_CURRENT);
                fr.Resume(ParaConstant.PARA_ITEM);
            }
        }
Exemplo n.º 4
0
 private ArgValue GetArgValue(FuncArg arg, IList <ArgValue> values, IEventArgs args)
 {
     if (values != null)
     {
         foreach (ArgValue av in values)
         {
             if (arg.GetName().Equals(av.GetName()))
             {
                 return(av);
             }
         }
     }
     return(new ArgValue(arg.GetName(), FreeUtil.ReplaceVar(arg.GetDefaultValue(), args)));
 }
Exemplo n.º 5
0
 private void Adjust(UnitPosition up, IEventArgs args)
 {
     up.SetX(up.GetX() + FreeUtil.ReplaceInt(x, args));
     up.SetY(up.GetY() + FreeUtil.ReplaceInt(y, args));
     up.SetZ(up.GetZ() + FreeUtil.ReplaceInt(z, args));
     if (!StringUtil.IsNullOrEmpty(pitch))
     {
         up.SetPitch(FreeUtil.ReplaceFloat(pitch, args));
     }
     if (!StringUtil.IsNullOrEmpty(yaw))
     {
         up.SetYaw(FreeUtil.ReplaceFloat(yaw, args));
     }
 }
Exemplo n.º 6
0
        public virtual IPara GetPara(IEventArgs args)
        {
            IPara para = ParaUtil.GetPara(type);

            if (para != null)
            {
                para = (IPara)para.Copy();
                para.SetName(name);
                if (value == null)
                {
                    value = string.Empty;
                }

                if (para is StringPara)
                {
                    ((StringPara)para).SetValue(FreeUtil.ReplaceVar(value, args));
                }
                else if (para is BoolPara)
                {
                    ((BoolPara)para).SetValue(FreeUtil.ReplaceBool(value, args));
                }
                else
                {
                    double v = FreeUtil.ReplaceDouble(value, args);

                    if (para is IntPara)
                    {
                        ((IntPara)para).SetValue((int)v);
                    }
                    else
                    {
                        if (para is FloatPara)
                        {
                            ((FloatPara)para).SetValue((float)v);
                        }
                        else
                        {
                            if (para is DoublePara)
                            {
                                ((DoublePara)para).SetValue(v);
                            }
                        }
                    }
                }
                para.SetPublic(isPublic);
                para.SetName(FreeUtil.ReplaceVar(para.GetName(), args));
            }

            return(para);
        }
Exemplo n.º 7
0
        public override void DoAction(IEventArgs args)
        {
            PlayerEntity    playerEntity = GetPlayerEntity(args);
            int             index        = FreeUtil.ReplaceInt(weaponKey, args);
            EWeaponSlotType st           = FreeWeaponUtil.GetSlotType(index);

            playerEntity.WeaponController().PureSwitchIn(st);

            SimpleProto message = FreePool.Allocate();

            message.Key = FreeMessageConstant.ChangeWeapon;
            message.Ins.Add(index);
            FreeMessageSender.SendMessage(playerEntity, message);
        }
Exemplo n.º 8
0
 public virtual void Handle(IEventArgs args, SimpleProto b)
 {
     if (changes != null)
     {
         foreach (FreeUISimpleShow.UIChange uc in changes)
         {
             b.Ins.Add(FreeUtil.ReplaceInt(uc.fromTime, args));
             b.Ins.Add(FreeUtil.ReplaceInt(uc.toTime, args));
             b.Fs.Add(FreeUtil.ReplaceFloat(uc.fromValue, args));
             b.Fs.Add(FreeUtil.ReplaceFloat(uc.toValue, args));
             b.Ss.Add(FreeUtil.ReplaceVar(uc.field, args));
         }
     }
 }
Exemplo n.º 9
0
        public override void DoAction(IEventArgs args)
        {
            SceneObjectEntity entity = (SceneObjectEntity)args.GameContext.session.entityFactoryObject.SceneObjectEntityFactory.CreateSimpleEquipmentEntity(
                (Assets.XmlConfig.ECategory)FreeUtil.ReplaceInt(cat, args),
                FreeUtil.ReplaceInt(id, args),
                FreeUtil.ReplaceInt(count, args),
                UnityPositionUtil.ToVector3(pos.Select(args)));

            if (entity != null && !string.IsNullOrEmpty(time))
            {
                entity.AddLifeTime(DateTime.Now, args.GetInt(time));
            }
            Debug.LogFormat("create item {0},{1},{2}", FreeUtil.ReplaceInt(cat, args), FreeUtil.ReplaceInt(id, args), FreeUtil.ReplaceInt(count, args));
        }
Exemplo n.º 10
0
        protected override void BuildMessage(IEventArgs args)
        {
            if (show == null)
            {
                show = new FreeUISimpleShow();
            }

            builder.Key = 51;
            builder.Ks.Add(0);
            builder.Ss.Add(FreeUtil.ReplaceNumber(key, args));
            builder.Ks.Add(show.GetKey());
            builder.Ks.Add(FreeUtil.ReplaceInt(time, args));
            show.Handle(args, builder);
        }
Exemplo n.º 11
0
        private void SetArg(FuncArg arg, IList <ArgValue> funcArgs, IEventArgs args)
        {
            ArgValue fa = GetArgValue(arg, funcArgs, args);

            if (fa != null)
            {
                IPara para = ParaUtil.GetPara(arg.GetType());
                if (para != null)
                {
                    try
                    {
                        IPara old = new ParaExp(fa.GetValue()).GetSourcePara(args);
                        if (old != null)
                        {
                            if (old.GetValue() != null)
                            {
                                para = para.Initial("=", old.GetValue().ToString());
                            }
                            else
                            {
                                para = para.Initial("=", string.Empty);
                            }
                        }
                        else
                        {
                            para = para.Initial("=", FreeUtil.ReplaceNumber(fa.GetValue(), args));
                        }
                    }
                    catch (Exception)
                    {
                        para = para.Initial("=", FreeUtil.ReplaceNumber(fa.GetValue(), args));
                    }
                    para.SetName("arg_" + arg.GetName());
                    args.GetDefault().GetParameters().TempUse(para);
                    IPara p = (IPara)para.Borrow();
                    p.SetName(arg.GetName());
                    if (para.GetValue() != null)
                    {
                        p.SetValue("=", para);
                    }
                    args.GetDefault().GetParameters().TempUse(p);
                    FreeLog.FuncArg(p.ToString());
                }
                else
                {
                    // 非简单变量
                    ((BaseEventArgs)args).TempUse(arg.GetName(), args.GetUnit(fa.GetValue()));
                }
            }
        }
Exemplo n.º 12
0
 private void Ini(IEventArgs args)
 {
     if (con == null || (condition != null && condition.Contains(FreeUtil.VAR_START) && condition.Contains(FreeUtil.VAR_END)))
     {
         if (!StringUtil.IsNullOrEmpty(condition))
         {
             con = new ExpParaCondition(FreeUtil.ReplaceVar(condition, args));
         }
         if (StringUtil.IsNullOrEmpty(selectedName))
         {
             selectedName = "current";
         }
     }
 }
Exemplo n.º 13
0
        public override string GetStyle(IEventArgs args)
        {
            string realText = text;

            try
            {
                realText = FreeUtil.ReplaceVar(text, args);
            }
            catch (Exception)
            {
            }
            return(realText + "_$$$_" + FreeUtil.ReplaceFloat(size, args) + "_$$$_" + FreeUtil.ReplaceVar(color, args) + "_$$$_" + bold + "_$$$_" + FreeUtil.ReplaceVar(font, args) + "_$$$_" + hAlign + "_$$$_" + vAlign + "_$$$_" + FreeUtil.ReplaceVar(multiLine
                                                                                                                                                                                                                                                          , args));
        }
Exemplo n.º 14
0
        public override void DoAction(IEventArgs args)
        {
            UnitPosition up = pos.Select(args);

            float       realRadius = FreeUtil.ReplaceFloat(radius, args);
            float       realDamage = FreeUtil.ReplaceFloat(damage, args);
            EUIDeadType realType   = (EUIDeadType)FreeUtil.ReplaceInt(type, args);

            if (damagePara == null)
            {
                damagePara = new FloatPara("damage", realDamage);
                disPara    = new FloatPara("dis", 0f);
                typePara   = new StringPara("type", FreeUtil.ReplaceVar(type, args));
            }

            if (up != null)
            {
                var bombPos   = new Vector3(up.GetX(), up.GetY(), up.GetZ());
                var colliders = Physics.OverlapSphere(bombPos, realRadius,
                                                      UnityLayerManager.GetLayerMask(EUnityLayerName.Player) | UnityLayerManager.GetLayerMask(EUnityLayerName.UserInputRaycast)
                                                      | UnityLayerManager.GetLayerMask(EUnityLayerName.Vehicle) | UnityLayerManager.GetLayerMask(EUnityLayerName.Glass));

                foreach (var collider in colliders)
                {
                    float trueDamage = CalculateBombDamage(collider.transform, bombPos, realDamage, realType);

                    if (Logger.IsDebugEnabled)
                    {
                        Logger.DebugFormat("Process {0}", collider.name);
                    }
                    if (collider.gameObject.layer == UnityLayerManager.GetLayerIndex(EUnityLayerName.Player))
                    {
                        HandlePlayer(collider, args, args.GameContext, trueDamage, bombPos);
                    }
                    if (collider.gameObject.layer == UnityLayerManager.GetLayerIndex(EUnityLayerName.UserInputRaycast))
                    {
                        HandleFracturedObjects(collider.transform, bombPos, trueDamage);
                    }
                    if (collider.gameObject.layer == UnityLayerManager.GetLayerIndex(EUnityLayerName.Vehicle))
                    {
                        HandleVehicle(collider.transform, trueDamage);
                    }
                    if (collider.gameObject.layer == UnityLayerManager.GetLayerIndex(EUnityLayerName.Glass))
                    {
                        HandleGlass(collider.transform);
                    }
                }
            }
        }
Exemplo n.º 15
0
        public static void Build(SimpleProto b, IEventArgs args, string key, string desc, bool show, bool atBottom, Iterable <IFreeComponent> components)
        {
            b.Key = 50;

            b.Bs.Add(show);
            b.Bs.Add(atBottom);
            b.Ks.Add(0);

            if (desc == null)
            {
                desc = "";
            }

            b.Ss.Add(FreeUtil.ReplaceVar(key, args));
            b.Ss.Add(FreeUtil.ReplaceVar(desc, args));
            if (components != null)
            {
                foreach (IFreeComponent com in components)
                {
                    b.Ks.Add(com.GetKey(args));
                    b.Ins.Add(FreeUtil.ReplaceInt(com.GetWidth(args), args));
                    b.Ins.Add(FreeUtil.ReplaceInt(com.GetHeight(args), args));
                    b.Ins.Add(FreeUtil.ReplaceInt(com.GetRelative(args), args));
                    b.Ins.Add(FreeUtil.ReplaceInt(com.GetParent(args), args));
                    b.Fs.Add(FreeUtil.ReplaceFloat(com.GetX(args), args));
                    b.Fs.Add(FreeUtil.ReplaceFloat(com.GetY(args), args));
                    if (com.GetStyle(args) == null)
                    {
                        b.Ss.Add(string.Empty);
                    }
                    else
                    {
                        b.Ss.Add(com.GetStyle(args));
                    }
                    b.Ss.Add(GetAutoString(com, args));
                    if (com.GetEvent(args) != null)
                    {
                        b.Ss.Add(com.GetEvent(args));
                    }
                    else
                    {
                        b.Ss.Add(string.Empty);
                    }

                    SimpleProto child = com.CreateChildren(args);
                    b.Ps.Add(child);
                }
            }
        }
Exemplo n.º 16
0
        public override void DoAction(IEventArgs args)
        {
            int random  = RandomUtil.Random(0, 100);
            int percent = FreeUtil.ReplaceInt(this.percent, args);

            if (random <= percent)
            {
                args.GetDefault().GetParameters().TempUse(new IntPara("roll", random));
                if (action != null)
                {
                    action.Act(args);
                }
                args.GetDefault().GetParameters().Resume("roll");
            }
        }
Exemplo n.º 17
0
        public override string GetStyle(IEventArgs args, string key)
        {
            string spliter = "_$$$_";

            if (StringUtil.IsNullOrEmpty(alpha))
            {
                alpha = "1";
            }
            if (text != null)
            {
                resUrl = text.GetStyle(args).Replace("_$$$_", "|||") + "|||" + FreeUtil.ReplaceInt(text.width, args) + "|||" + FreeUtil.ReplaceInt(text.height, args);
            }
            return(FreeUtil.ReplaceVar(depth, args) + spliter + FreeUtil.ReplaceVar(ptype, args) + spliter + FreeUtil.ReplaceVar(culling, args) + spliter + FreeUtil.ReplaceVar(resUrl, args) + spliter + (model == null ? string.Empty : FreeUtil.ReplaceVar
                                                                                                                                                                                                               (model, args)) + spliter + gtype + spliter + FreeUtil.ReplaceFloat(alpha, args) + spliter + @fixed + spliter + (StringUtil.IsNullOrEmpty(fixPoint) ? "0,0" : FreeUtil.ReplaceVar(fixPoint, args)));
        }
Exemplo n.º 18
0
        public bool Meet(IEventArgs args)
        {
            FreeData fd  = (FreeData)args.GetUnit(player);
            object   obj = ((FreeRuleEventArgs)args).GetEntity(entity);

            if (fd != null && obj != null)
            {
                PlayerEntity   playerEntity = fd.Player;
                FreeMoveEntity objEntity    = (FreeMoveEntity)obj;
                float          yaw          = CommonMathUtil.TransComAngle(playerEntity.orientation.Yaw);
                float          ang          = CommonMathUtil.GetAngle(new Vector2(objEntity.position.Value.x, objEntity.position.Value.z), new Vector2(playerEntity.position.Value.x, playerEntity.position.Value.z));
                return(CommonMathUtil.GetDiffAngle(ang, yaw) <= FreeUtil.ReplaceFloat(angle, args) && Vector3.Distance(playerEntity.position.Value, objEntity.position.Value) <= FreeUtil.ReplaceFloat(distance, args));
            }
            return(false);
        }
Exemplo n.º 19
0
        public override object GetValue(IEventArgs args)
        {
            if (list == null)
            {
                list = new List <string>();
            }
            list.Clear();

            foreach (OnePrefabValue value in values)
            {
                list.Add(value.field + FreeMessageConstant.SpilterField + FreeUtil.ReplaceVar(value.value, args));
            }

            return(StringUtil.GetStringFromStrings(list, FreeMessageConstant.SpliterRecord));
        }
Exemplo n.º 20
0
        private void Initial(IEventArgs args)
        {
            string realExp = FreeUtil.ReplaceVar(exp, args);

            if (StringUtil.IsNullOrEmpty(realExp))
            {
                return;
            }
            // 如果有变量每次重新生成
            if (clause == null || (exp.Contains(FreeUtil.VAR_START) && exp.Contains(FreeUtil.VAR_END)))
            {
                MeetClause <IEventArgs, ParaCondition> temp = new MeetClause <IEventArgs, ParaCondition>(new ExpConditionParser());
                clause = (MeetClause <IEventArgs, ParaCondition>)temp.Parse(realExp);
            }
        }
Exemplo n.º 21
0
        private string EventString(IEventArgs args)
        {
            List <string> list = new List <string>();

            if (events != null)
            {
                foreach (OnePrefabEvent v in events)
                {
                    list.Add(FreeUtil.ReplaceVar(v.field, args) + FreeMessageConstant.SpilterField
                             + FreeUtil.ReplaceVar(v.eventKey, args) + FreeMessageConstant.SpilterField + v.eventType);
                }
            }

            return(StringUtil.GetStringFromStrings(list, FreeMessageConstant.SpliterRecord));
        }
Exemplo n.º 22
0
        public override void DoAction(IEventArgs args)
        {
            if (string.IsNullOrEmpty(player))
            {
                player = "current";
            }

            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            PlayerEntity playerEntity = (PlayerEntity)fr.GetEntity(player);

            IParable item = args.GetUnit("item");

            if (playerEntity != null && item != null)
            {
                EWeaponSlotType type = FreeWeaponUtil.GetSlotType(FreeUtil.ReplaceInt(weaponKey, args));

                SimpleProto message = FreePool.Allocate();
                message.Key = FreeMessageConstant.ChangeAvatar;

                int itemId = FreeUtil.ReplaceInt("{item.itemId}", args);

                if (!delete)
                {
                    playerEntity.WeaponController().SetWeaponPart(type, itemId);

                    message.Ins.Add((int)type);
                    message.Ins.Add(itemId);
                    message.Ks.Add(3);

                    FreeMessageSender.SendMessage(playerEntity, message);
                    //playerEntity.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, message);
                }
                else
                {
                    var part = SingletonManager.Get <WeaponPartsConfigManager>().GetPartType(SingletonManager.Get <WeaponPartSurvivalConfigManager>().GetDefaultPartBySetId(itemId));

                    playerEntity.WeaponController().DeleteWeaponPart(type, part);

                    message.Ins.Add((int)type);
                    message.Ins.Add((int)part);
                    message.Ks.Add(4);

                    FreeMessageSender.SendMessage(playerEntity, message);
                    //playerEntity.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, message);
                }
            }
        }
Exemplo n.º 23
0
        public override void DoAction(IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(key))
            {
                key = BaseEventArgs.DEFAULT;
            }
            IParable unit = args.GetUnit(key);

            if (unit != null)
            {
                IPara sort = unit.GetParameters().Get(sorter);
                if (sort != null)
                {
                    ParaListSet pls = (ParaListSet)sort;
                    if (action != null)
                    {
                        Iterator <ParaList> it = pls.Iterator();
                        int i = 1;
                        while (it.HasNext())
                        {
                            ParaList pl = it.Next();
                            args.TempUse("element", new SimpleParable(pl));
                            args.GetDefault().GetParameters().TempUse(new IntPara("index", i++));
                            if (condition == null || condition.Meet(args))
                            {
                                if (action != null)
                                {
                                    action.Act(args);
                                }
                                if (FreeUtil.ReplaceBool(remove, args))
                                {
                                    it.Remove();
                                }
                            }
                            args.GetDefault().GetParameters().Resume("index");
                            args.Resume("element");
                        }
                        if (i == 1)
                        {
                            if (noneAction != null)
                            {
                                noneAction.Act(args);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 24
0
        public override void DoAction(IEventArgs args)
        {
            PlayerEntity player = GetPlayerEntity(args);

            if (player != null)
            {
                if (!StringUtil.IsNullOrEmpty(weaponKey))
                {
                    int             index       = FreeUtil.ReplaceInt(weaponKey, args);
                    EWeaponSlotType currentSlot = index > 0 ? FreeWeaponUtil.GetSlotType(index) : player.WeaponController().HeldSlotType;
                    player.WeaponController().DestroyWeapon(currentSlot, -1);
                }
                else
                {
                    int index = FreeUtil.ReplaceInt(weaponType, args);
                    if (index > 0)
                    {
                        if (index == (int)EWeaponSubType.Throw)
                        {
                            player.WeaponController().DestroyWeapon(EWeaponSlotType.ThrowingWeapon, -1);
                            player.WeaponController().GrenadeHandler.ClearCache();

                            /*var helper = p.WeaponController().GrenadeHelper;
                             * helper.ClearCache();
                             * p.playerWeaponUpdate.UpdateHeldAppearance = true;*/
                        }
                        else
                        {
                            for (int i = (int)EWeaponSlotType.PrimeWeapon; i < (int)EWeaponSlotType.Length; i++)
                            {
                                var weaponAgent = player.WeaponController().GetWeaponAgent((EWeaponSlotType)i);
                                if (weaponAgent.WeaponConfigAssy.NewWeaponCfg.SubType == index)
                                {
                                    player.WeaponController().DestroyWeapon((EWeaponSlotType)i, -1);
                                }
                            }
                        }
                    }
                    else
                    {
                        for (int i = (int)EWeaponSlotType.PrimeWeapon; i < (int)EWeaponSlotType.Length; i++)
                        {
                            player.WeaponController().DestroyWeapon((EWeaponSlotType)i, -1);
                        }
                    }
                }
            }
        }
Exemplo n.º 25
0
 public static void AuditDataValue(object sender, T1 data, IFreeSql orm, TableInfo table, Dictionary <string, bool> changedDict)
 {
     if (data == null)
     {
         return;
     }
     if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false)
     {
         throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。");
     }
     foreach (var col in table.Columns.Values)
     {
         object val = col.GetValue(data);
         if (orm.Aop.AuditValueHandler != null)
         {
             var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Insert, col, table.Properties[col.CsName], val);
             orm.Aop.AuditValueHandler(sender, auditArgs);
             if (auditArgs.ValueIsChanged)
             {
                 col.SetValue(data, val = auditArgs.Value);
                 if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
                 {
                     changedDict.Add(col.Attribute.Name, true);
                 }
             }
         }
         if (col.Attribute.IsPrimary)
         {
             val = col.GetDbValue(data);
             if (col.Attribute.MapType.NullableTypeOrThis() == typeof(Guid) && (val == null || (Guid)val == Guid.Empty))
             {
                 col.SetValue(data, val = FreeUtil.NewMongodbId());
             }
             else if (col.CsType.NullableTypeOrThis() == typeof(Guid))
             {
                 val = col.GetValue(data);
                 if (val == null || (Guid)val == Guid.Empty)
                 {
                     col.SetValue(data, val = FreeUtil.NewMongodbId());
                 }
             }
         }
         if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
         {
             col.SetValue(data, val = "");
         }
     }
 }
Exemplo n.º 26
0
        protected override void BuildMessage(IEventArgs args)
        {
            builder.Key = FreeMessageConstant.AddChild;

            builder.Ks.Add(5);

            builder.Bs.Add(show);

            builder.Ins.Add(FreeUtil.ReplaceInt(weaponKey, args));

            if (parts == null)
            {
                parts = "";
            }
            builder.Ss.Add(parts);
        }
Exemplo n.º 27
0
 public override void DoAction(IEventArgs args)
 {
     // 如果有变量每次重新生成
     if (op == null || (exp.Contains(FreeUtil.VAR_START) && exp.Contains(FreeUtil.VAR_END)))
     {
         op = ExpSetParser.Parse(FreeUtil.ReplaceVar(exp, args), args);
     }
     try
     {
         op.Op(args);
     }
     catch (Exception e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
     }
 }
Exemplo n.º 28
0
        public override void DoAction(IEventArgs args)
        {
            FreeRuleEventArgs fr     = (FreeRuleEventArgs)args;
            IGameUnit         player = GetPlayer(args);

            if (StringUtil.IsNullOrEmpty(item))
            {
                item = "item";
            }
            if (player != null)
            {
                FreeData fd = (FreeData)player;
                FreeItem fi = (FreeItem)fr.GetUnit(FreeUtil.ReplaceVar(item, args));
                FreeItemManager.UseItem(fd.GetFreeInventory().GetItemPosition(fi), fd, fr);
            }
        }
Exemplo n.º 29
0
        public override void DoAction(IEventArgs args)
        {
            long now = Runtime.CurrentTimeMillis();

            if (now - lastDoTime > (long)FreeUtil.ReplaceInt(interval, args))
            {
                if (!firstDelay || lastDoTime != 0L)
                {
                    if (action != null)
                    {
                        action.Act(args);
                    }
                }
                lastDoTime = now;
            }
        }
Exemplo n.º 30
0
 private void HandleItem(ItemPosition ip, FreeRuleEventArgs fr)
 {
     if (action != null)
     {
         if ("true".Equals(FreeUtil.ReplaceVar(usePosition, fr)))
         {
             fr.TempUse(item, ip);
         }
         else
         {
             fr.TempUse(item, ip.GetKey());
         }
         action.Act(fr);
         fr.Resume(item);
     }
 }