public static void Postfix(Entity __instance, EntityProperties properties, ICoreAPI api, long InChunkIndex3d)
        {
            if (api.Side.IsClient())
            {
                var healthTree = __instance.WatchedAttributes.GetTreeAttribute("health");
                if (healthTree == null)
                {
                    return;
                }
                float maxHealth = healthTree.GetFloat("maxhealth"), baseMaxHealth = healthTree.GetFloat("basemaxhealth");
                maxHealth = maxHealth == 0 ? baseMaxHealth : 20.0f;

                __instance.WatchedAttributes.RegisterModifiedListener("health", () =>
                {
                    float lastHealth = __instance.WatchedAttributes.GetFloat("fldLastHealth", maxHealth);
                    float health     = healthTree.GetFloat("currenthealth");
                    float dHealth    = lastHealth - health;
                    if (dHealth != 0 && CanCreate((ICoreClientAPI)api, __instance))
                    {
                        new HudElementFloatyDamage(api as ICoreClientAPI, dHealth, __instance.Pos.XYZ);
                    }
                    __instance.WatchedAttributes.SetFloat("fldLastHealth", health);
                });
            }
        }
        public Goomba() : base(new Stats(1, 2, 0, 0, 0))
        {
            Name = "Goomba";

            AIBehavior = new GoombaAI(this);

            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Sleep, new StatusPropertyHolder(100, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Stop, new StatusPropertyHolder(110, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Dizzy, new StatusPropertyHolder(100, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.DEFDown, new StatusPropertyHolder(100, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Poison, new StatusPropertyHolder(100, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Confused, new StatusPropertyHolder(100, 0));

            Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Enemies/Goomba.png");

            AnimManager.SetSpriteSheet(spriteSheet);

            AnimManager.AddAnimation(AnimationGlobals.IdleName, new ReverseAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                     new Animation.Frame(new Rectangle(67, 107, 26, 28), 1000d),
                                                                                     new Animation.Frame(new Rectangle(35, 104, 26, 31), 150d, new Vector2(0, -1)),
                                                                                     new Animation.Frame(new Rectangle(3, 5, 26, 34), 1000d, new Vector2(0, -2))));
            AnimManager.AddAnimation(AnimationGlobals.HurtName, new Animation(spriteSheet,
                                                                              new Animation.Frame(new Rectangle(65, 76, 29, 27), 80d),
                                                                              new Animation.Frame(new Rectangle(2, 109, 27, 26), 80d)));
            AnimManager.AddAnimation(AnimationGlobals.DeathName, new Animation(spriteSheet, new Animation.Frame(new Rectangle(2, 109, 27, 26), 1000d)));

            AnimManager.AddAnimation(AnimationGlobals.RunningName, new ReverseAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                        new Animation.Frame(new Rectangle(129, 73, 28, 30), 150d),
                                                                                        new Animation.Frame(new Rectangle(67, 107, 26, 28), 100d),
                                                                                        new Animation.Frame(new Rectangle(99, 75, 28, 28), 150d)));
        }
        /// <summary>
        /// Método que permite obtener de la base de datos un objeto de Paginación con la lista de todos los datos de Entidad
        /// </summary>
        /// <param name="page">Página Actual</param>
        /// <param name="pageSize">Elementos por Página</param>
        /// <param name="columnName">Nombre de columna a Ordenar</param>
        /// <param name="orderDesc">Booleano de ordenamiento descendente</param>
        /// <returns>Objeto de Paginación con la Lista de Datos de Entidad</returns>
        public IPagedResult <Entity> GetAllPaged(int?page = null, int?pageSize = null, string columnName = null, bool orderDesc = false)
        {
            var entitiesFind = this.FindAll();

            if (columnName != null && !columnName.Equals(string.Empty))
            {
                if (EntityProperties.ContainsPropertyName(typeof(Entity), columnName))
                {
                    if (!orderDesc)
                    {
                        entitiesFind = entitiesFind.CustomOrderBy(columnName);
                    }
                    else
                    {
                        entitiesFind = entitiesFind.CustomOrderByDescending(columnName);
                    }
                }
            }
            if (page.HasValue && pageSize.HasValue)
            {
                return(entitiesFind.GetPaged(page.Value, pageSize.Value));
            }

            return(new PagedResult <Entity>
            {
                RowCount = entitiesFind.Count(),
                Results = entitiesFind.AsEnumerable().ToList()
            });
        }
        protected virtual bool VerifyEntityTypeCondition(
            [NotNull] string entityPropertyName,
            [NotNull] EntityTypeDefinition entityTypeDefinition,
            [NotNull] EntityProperties entityProperties)
        {
            Assert.ArgumentNotNull(entityPropertyName, "entityPropertyName");
            Assert.ArgumentNotNull(entityTypeDefinition, "entityTypeDefinition");
            Assert.ArgumentNotNull(entityProperties, "entityProperties");

            EntityPropertyValue entityProperty = entityProperties[entityPropertyName];

            if (entityProperty == null)
            {
                return(false);
            }

            string entityPropertyValue = entityProperty.Value;

            if (string.IsNullOrEmpty(entityPropertyValue))
            {
                return(false);
            }

            foreach (string entityTypePropertyValue in entityTypeDefinition.Properties[entityPropertyName])
            {
                if (entityPropertyValue == entityTypePropertyValue)
                {
                    return(true);
                }
            }

            return(false);
        }
        public Koopatrol()
        {
            Name = "Koopatrol";

            //Using their TTYD stats
            BattleStats = new Stats(26, 6, 0, 4, 2);

            AIBehavior = new KoopatrolAI(this);

            EntityProperties.AddPayback(SpikedPayback);
            EntityProperties.AddPhysAttribute(Enumerations.PhysicalAttributes.Spiked);

            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Sleep, new StatusPropertyHolder(70d, -1));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Dizzy, new StatusPropertyHolder(105d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Confused, new StatusPropertyHolder(75d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Tiny, new StatusPropertyHolder(90d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Stop, new StatusPropertyHolder(75d, -1));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.DEFDown, new StatusPropertyHolder(95d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Burn, new StatusPropertyHolder(100d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Frozen, new StatusPropertyHolder(70d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Fright, new StatusPropertyHolder(70d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Blown, new StatusPropertyHolder(70d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.KO, new StatusPropertyHolder(95d, 0));
            EntityProperties.AddStatusProperty(Enumerations.StatusTypes.Electrified, new StatusPropertyHolder(80d, 0));

            Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Enemies/Koopatrol.png");

            AnimManager.SetSpriteSheet(spriteSheet);

            AnimManager.AddAnimation(AnimationGlobals.IdleName, new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                  new Animation.Frame(new Rectangle(1, 388, 42, 59), 500d)));
            AnimManager.AddAnimation(AnimationGlobals.RunningName, new ReverseAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                        new Animation.Frame(new Rectangle(1, 388, 42, 59), 100d),
                                                                                        new Animation.Frame(new Rectangle(49, 387, 43, 60), 100d, new Vector2(-1, -1)),
                                                                                        new Animation.Frame(new Rectangle(98, 386, 45, 60), 100d, new Vector2(-2, -2))));
            AnimManager.AddAnimation(AnimationGlobals.HurtName, new Animation(spriteSheet,
                                                                              new Animation.Frame(new Rectangle(5, 325, 40, 50), 250d),
                                                                              new Animation.Frame(new Rectangle(56, 325, 38, 49), 250d)));
            AnimManager.AddAnimation(AnimationGlobals.DeathName, new Animation(spriteSheet,
                                                                               new Animation.Frame(new Rectangle(99, 327, 43, 48), 1000d)));

            AnimManager.AddAnimation(AnimationGlobals.ShelledBattleAnimations.EnterShellName, new Animation(spriteSheet,
                                                                                                            new Animation.Frame(new Rectangle(99, 262, 39, 49), 70d),
                                                                                                            new Animation.Frame(new Rectangle(152, 260, 35, 27), 70d),
                                                                                                            new Animation.Frame(new Rectangle(202, 261, 33, 25), 70d)));
            AnimManager.AddAnimation(AnimationGlobals.ShelledBattleAnimations.ShellSpinName, new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                                               new Animation.Frame(new Rectangle(34, 449, 28, 30), 100d),
                                                                                                               new Animation.Frame(new Rectangle(66, 449, 28, 30), 100d),
                                                                                                               new Animation.Frame(new Rectangle(97, 449, 30, 30), 100d),
                                                                                                               new Animation.Frame(new Rectangle(130, 449, 28, 30), 100d),
                                                                                                               new Animation.Frame(new Rectangle(162, 449, 28, 30), 100d),
                                                                                                               new Animation.Frame(new Rectangle(1, 449, 30, 30), 100d)));
            AnimManager.AddAnimation(AnimationGlobals.ShelledBattleAnimations.ExitShellName, new Animation(spriteSheet,
                                                                                                           new Animation.Frame(new Rectangle(202, 261, 33, 25), 70d),
                                                                                                           new Animation.Frame(new Rectangle(152, 260, 35, 27), 70d),
                                                                                                           new Animation.Frame(new Rectangle(99, 262, 39, 49), 70d)));
            AnimManager.AddAnimation(AnimationGlobals.ShelledBattleAnimations.FlippedName, new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                                             new Animation.Frame(new Rectangle(337, 57, 58, 35), 300d),
                                                                                                             new Animation.Frame(new Rectangle(337, 97, 58, 36), 300d)));
        }
Beispiel #6
0
 public void OnSelectedEntityChanged()
 {
     PrimaryKeyPropertiesIndex = -1;
     EntityPropertiesIndex     = -1;
     EntityProperties.Clear();
     PrimaryKeyProperties.Clear();
 }
        public void UpdateReplicationInvalidIntTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput {
                Name = "update", AllowMultipleObject = false
            };
            var input      = new List <DataEntity>();
            var table      = new DataEntity();
            var columnData = new EntityProperties();

            //create the comparison experssion for selecting the records to update
            operationInput.LookupCondition = new Expression[]
            {
                new ComparisonExpression(ComparisonOperator.Equal,
                                         new ComparisonValue(ComparisonValueType.Constant, "Region"),
                                         new ComparisonValue(ComparisonValueType.Constant, "North"),
                                         null)
            };
            //add the columns to change
            table.ObjectDefinitionFullName = "Customers";
            columnData.Add("CreditOnHold", "5328475903427853943453245324532453425345324523453453453425345324523452342345");
            columnData.Add("ModifiedOn", DateTime.Now);

            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            var operationResult = _rsTargetConnector.ExecuteOperation(operationInput);

            Assert.IsFalse(operationResult.Success[0]);
            Assert.AreEqual(0, operationResult.ObjectsAffected[0]);
        }
        public void UpdateReplicationNullValueValidTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput {
                Name = "update", AllowMultipleObject = false
            };

            var input      = new List <DataEntity>();
            var table      = new DataEntity();
            var columnData = new EntityProperties();

            //create the comparison experssion for selecting the records to update
            operationInput.LookupCondition = new Expression[]
            {
                new ComparisonExpression(
                    ComparisonOperator.IsNull, new ComparisonValue(ComparisonValueType.Constant, "Country"), null, null)
            };

            //add the columns to change
            table.ObjectDefinitionFullName = "Addresses";
            columnData.Add("Country", "USA");
            columnData.Add("ModifiedOn", DateTime.Now);

            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            var operationResult = _rsTargetConnector.ExecuteOperation(operationInput);

            Assert.IsTrue(operationResult.Success[0]);
            Assert.IsTrue(operationResult.ObjectsAffected[0] >= 1);
        }
        private static string ParseWhereClause(EntityProperties properties)
        {
            var whereClause = new StringBuilder();

            if (properties != null && properties.Count > 0)
            {
                whereClause.AppendFormat(" {0} ", WhereKeyword);

                int index = 1;
                foreach (var property in properties)
                {
                    if (property.Value == null)
                    {
                        whereClause.AppendFormat("[{0}] IS NULL", property.Key);
                    }
                    else
                    {
                        var rightComparisonValue = new ComparisonValue(ComparisonValueType.Constant, property.Value);

                        whereClause.AppendFormat("[{0}] = {1}", property.Key,
                                                 GetRightFormattedComparisonValue(rightComparisonValue));
                    }

                    if (index != properties.Count)
                    {
                        whereClause.Append(" AND ");
                    }

                    index++;
                }
            }

            return(whereClause.ToString());
        }
Beispiel #10
0
        public int CreateProp(int model, Vector3 pos, Quaternion rot, int dimension)
        {
            var obj = new EntityProperties
            {
                Position   = pos,
                Rotation   = rot,
                ModelHash  = model,
                Dimension  = dimension,
                Alpha      = 255,
                EntityType = (byte)EntityType.Prop
            };

            int localEntityHash;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Prop,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
        public override void Initialize(EntityProperties properties, JsonObject typeAttributes)
        {
            healthTree = entity.WatchedAttributes.GetTreeAttribute("health");

            if (healthTree == null)
            {
                entity.WatchedAttributes.SetAttribute("health", healthTree = new TreeAttribute());

                BaseMaxHealth = typeAttributes["maxhealth"].AsFloat(20);
                Health        = typeAttributes["currenthealth"].AsFloat(BaseMaxHealth);
                MarkDirty();
                return;
            }

            Health        = healthTree.GetFloat("currenthealth");
            BaseMaxHealth = healthTree.GetFloat("basemaxhealth");

            if (BaseMaxHealth == 0)
            {
                BaseMaxHealth = typeAttributes["maxhealth"].AsFloat(20);
            }

            MarkDirty();
            secondsSinceLastUpdate = (float)entity.World.Rand.NextDouble();    // Randomise which game tick these update, a starting server would otherwise start all loaded entities with the same zero timer
        }
Beispiel #12
0
        private void ChangeToGroundedEntity()
        {
            //Check if the winged entity and its grounded version have entries in the Tattle database
            bool wingedInTattle   = TattleDatabase.HasTattleDescription(Name);
            bool groundedInTattle = TattleDatabase.HasTattleDescription(GroundedEntity.Name);

            //If the winged entity has an entry and the grounded version doesn't, remove its ShowHP property
            if (wingedInTattle == true && groundedInTattle == false)
            {
                this.SubtractShowHPProperty();
            }
            //If the winged entity doesn't have an entry and the grounded version does, add its ShowHP property
            else if (wingedInTattle == false && groundedInTattle == true)
            {
                this.AddShowHPProperty();
            }

            Name = GroundedEntity.Name;

            //Set the vulnerability to the same as the grounded entity. The grounded entity shouldn't have a winged vulnerabilty
            EntityProperties.SetVulnerableDamageEffects(GroundedEntity.EntityProperties.GetVulnerableDamageEffects());

            //Change HeightState
            ChangeHeightState(Enumerations.HeightStates.Grounded);
        }
Beispiel #13
0
        public override void Initialize(EntityProperties properties, ICoreAPI api, long chunkindex3d)
        {
            base.Initialize(properties, api, chunkindex3d);

            if (Itemstack == null || !Itemstack.ResolveBlockOrItem(World))
            {
                Die();
                this.Itemstack = null;
                return;
            }

            // If attribute was modified and resent to client, make sure we still have the resolved thing in memory
            WatchedAttributes.RegisterModifiedListener("itemstack", () => {
                if (Itemstack != null && Itemstack.Collectible == null)
                {
                    Itemstack.ResolveBlockOrItem(World);
                }
                Slot.Itemstack = Itemstack;
            });


            itemSpawnedMilliseconds = World.ElapsedMilliseconds;
            Swimming = FeetInLiquid = World.BlockAccessor.GetBlock(Pos.AsBlockPos).IsLiquid();

            tmpPos.Set(Pos.XInt, Pos.YInt, Pos.ZInt);
            windLoss = World.BlockAccessor.GetDistanceToRainFall(tmpPos) / 4f;
        }
Beispiel #14
0
        public override void Initialize(EntityProperties properties, JsonObject typeAttributes)
        {
            hungerTree = entity.WatchedAttributes.GetTreeAttribute("hunger");

            if (hungerTree == null)
            {
                entity.WatchedAttributes.SetAttribute("hunger", hungerTree = new TreeAttribute());

                Saturation    = typeAttributes["currentsaturation"].AsFloat(1500);
                MaxSaturation = typeAttributes["maxsaturation"].AsFloat(1500);

                SaturationLossDelayFruit     = 0;
                SaturationLossDelayVegetable = 0;
                SaturationLossDelayGrain     = 0;
                SaturationLossDelayProtein   = 0;
                SaturationLossDelayDairy     = 0;

                FruitLevel     = 0;
                VegetableLevel = 0;
                GrainLevel     = 0;
                ProteinLevel   = 0;
                DairyLevel     = 0;

                //FatReserves = configHungerTree["currentfatreserves"].AsFloat(1000);
                //MaxFatReserves = configHungerTree["maxfatreserves"].AsFloat(1000);
            }

            //lastFatReserves = FatReserves;

            listenerId = entity.World.RegisterGameTickListener(SlowTick, 6000);

            UpdateNutrientHealthBoost();
        }
Beispiel #15
0
        public override void Initialize(EntityProperties properties, JsonObject typeAttributes)
        {
            api = entity.World.Api;

            tempTree = entity.WatchedAttributes.GetTreeAttribute("bodyTemp");

            NormalBodyTemperature = typeAttributes["defaultBodyTemperature"].AsFloat(37);

            if (tempTree == null)
            {
                entity.WatchedAttributes.SetAttribute("bodyTemp", tempTree = new TreeAttribute());

                CurBodyTemperature = NormalBodyTemperature + 4;

                // Run this every time a entity spawns so it doesnt freeze while unloaded / offline
                BodyTempUpdateTotalHours    = api.World.Calendar.TotalHours;
                LastWetnessUpdateTotalHours = api.World.Calendar.TotalHours;

                return;
            }

            // Run this every time a entity spawns so it doesnt freeze while unloaded / offline
            BodyTempUpdateTotalHours    = api.World.Calendar.TotalHours;
            LastWetnessUpdateTotalHours = api.World.Calendar.TotalHours;

            bodyTemperatureResistance = entity.World.Config.GetString("bodyTemperatureResistance").ToFloat(0);
        }
 public void OnSelectedEntityChanged()
 {
     ForeignKeyPropertiesIndex = -1;
     EntityPropertiesIndex     = -1;
     EntityProperties.Clear();
     ForeignKeyProperties.Clear();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OfficeDocumentItem"/> class.
 /// </summary>
 /// <param name="property">The property.</param>
 /// <param name="list">The list.</param>
 /// <param name="context">The context.</param>
 public OfficeDocumentItem([NotNull] EntityProperties property, [NotNull] BaseList list, [NotNull] SpContext context)
     : base(property, list, context)
 {
     Assert.ArgumentNotNull(property, "property");
     Assert.ArgumentNotNull(list, "list");
     Assert.ArgumentNotNull(context, "context");
 }
        public override void Initialize(EntityProperties properties, JsonObject aiconfig)
        {
            if (!(entity is EntityAgent))
            {
                entity.World.Logger.Error("The goal ai currently only works on entities inheriting from EntityAgent. Will ignore loading goals for entity {0} ", entity.Code);
                return;
            }

            PathTraverser = new StraightLineTraverser(entity as EntityAgent);

            JsonObject[] goals = aiconfig["aigoals"]?.AsArray();
            if (goals == null)
            {
                return;
            }

            foreach (JsonObject goalConfig in goals)
            {
                string goalCode = goalConfig["code"]?.AsString();
                Type   goalType = null;
                if (!AiGoalRegistry.GoalTypes.TryGetValue(goalCode, out goalType))
                {
                    entity.World.Logger.Error("Goal with code {0} for entity {1} does not exist. Ignoring.", goalCode, entity.Code);
                    continue;
                }

                AiGoalBase goal = (AiGoalBase)Activator.CreateInstance(goalType, (EntityAgent)entity);
                goal.LoadConfig(goalConfig, aiconfig);

                goalManager.AddGoal(goal);
            }
        }
Beispiel #19
0
        public override void OnHeldInteractStop(float secondsUsed, ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel)
        {
            if (byEntity.Attributes.GetInt("aimingCancel") == 1)
            {
                return;
            }

            byEntity.Attributes.SetInt("aiming", 0);
            byEntity.StopAnimation("aim");

            if (secondsUsed < 0.35f)
            {
                return;
            }

            float damage = 1;

            ItemStack stack = slot.TakeOut(1);

            slot.MarkDirty();

            IPlayer byPlayer = null;

            if (byEntity is EntityPlayer)
            {
                byPlayer = byEntity.World.PlayerByUid(((EntityPlayer)byEntity).PlayerUID);
            }
            byEntity.World.PlaySoundAt(new AssetLocation("sounds/player/throw"), byEntity, byPlayer, false, 8);

            EntityProperties type   = byEntity.World.GetEntityType(new AssetLocation("thrownstone-" + Variant["rock"]));
            Entity           entity = byEntity.World.ClassRegistry.CreateEntity(type);

            ((EntityThrownStone)entity).FiredBy         = byEntity;
            ((EntityThrownStone)entity).Damage          = damage;
            ((EntityThrownStone)entity).ProjectileStack = stack;


            float  acc      = (1 - byEntity.Attributes.GetFloat("aimingAccuracy", 0));
            double rndpitch = byEntity.WatchedAttributes.GetDouble("aimingRandPitch", 1) * acc * 0.75;
            double rndyaw   = byEntity.WatchedAttributes.GetDouble("aimingRandYaw", 1) * acc * 0.75;

            Vec3d pos      = byEntity.ServerPos.XYZ.Add(0, byEntity.LocalEyePos.Y, 0);
            Vec3d aheadPos = pos.AheadCopy(1, byEntity.ServerPos.Pitch + rndpitch, byEntity.ServerPos.Yaw + rndyaw);
            Vec3d velocity = (aheadPos - pos) * 0.5;

            entity.ServerPos.SetPos(
                byEntity.ServerPos.BehindCopy(0.21).XYZ.Add(0, byEntity.LocalEyePos.Y, 0)
                );

            entity.ServerPos.Motion.Set(velocity);

            entity.Pos.SetFrom(entity.ServerPos);
            entity.World = byEntity.World;
            ((EntityThrownStone)entity).SetRotation();

            byEntity.World.SpawnEntity(entity);
            byEntity.StartAnimation("throw");

            //byEntity.GetBehavior<EntityBehaviorHunger>()?.ConsumeSaturation(2f);
        }
Beispiel #20
0
        public override void Initialize(EntityProperties properties, ICoreAPI api, long InChunkIndex3d)
        {
            // Temporary code for VS 1.15 dev team to remove previously created "land" salmon which don't have the correct entity
            if (properties.Habitat == EnumHabitat.Underwater && !(this.GetType().Name == "EntityFish"))
            {
                this.Alive = false;
            }

            base.Initialize(properties, api, InChunkIndex3d);

            if (World.Side == EnumAppSide.Server)
            {
                servercontrols = controls;
            }

            WatchedAttributes.RegisterModifiedListener("mountedOn", updateMountedState);

            if (WatchedAttributes["mountedOn"] != null)
            {
                MountedOn = World.ClassRegistry.CreateMountable(WatchedAttributes["mountedOn"] as TreeAttribute);
                if (MountedOn != null)
                {
                    TryMount(MountedOn);
                }
            }
        }
        public EntityProperties UpdateItem([NotNull] EntityProperties properties, [NotNull] string listName)
        {
            Assert.ArgumentNotNull(properties, "properties");
            Assert.ArgumentNotNull(listName, "listName");

            XmlDocument doc = this.GetUpdateCommand(properties);

            if (doc != null)
            {
                XmlNode result = this.ListsWebService.UpdateListItems(listName, doc);

                try
                {
                    this.CheckCorrectUpdate(doc, result);
                }
                catch (Exception)
                {
                }

                var xmlNamespaceManager = new XmlNamespaceManager(result.OwnerDocument.NameTable);
                xmlNamespaceManager.AddNamespace(result.Prefix, result.NamespaceURI);

                XmlNode data = result.SelectSingleNode("/*[local-name()='Result']/*[local-name()='row']");
                if (data != null)
                {
                    return(XmlUtils.LoadProperties(data));
                }
            }

            return(properties);
        }
Beispiel #22
0
        private void CheckMultiply(float dt)
        {
            if (!entity.Alive)
            {
                return;
            }

            callbackId = entity.World.RegisterCallback(CheckMultiply, 3000);

            if (entity.World.Calendar == null)
            {
                return;
            }

            double daysNow = entity.World.Calendar.TotalHours / 24f;

            if (!IsPregnant)
            {
                if (TryGetPregnant())
                {
                    IsPregnant = true;
                    TotalDaysPregnancyStart = daysNow;
                }

                return;
            }



            if (daysNow - TotalDaysPregnancyStart > PregnancyDays)
            {
                Random rand = entity.World.Rand;

                float q = SpawnQuantityMin + (float)rand.NextDouble() * (SpawnQuantityMax - SpawnQuantityMin);
                TotalDaysLastBirth     = daysNow;
                TotalDaysCooldownUntil = daysNow + (MultiplyCooldownDaysMin + rand.NextDouble() * (MultiplyCooldownDaysMax - MultiplyCooldownDaysMin));
                IsPregnant             = false;
                entity.WatchedAttributes.MarkPathDirty("multiply");
                EntityProperties childType = entity.World.GetEntityType(SpawnEntityCode);

                int generation = entity.WatchedAttributes.GetInt("generation", 0);

                while (q > 1 || rand.NextDouble() < q)
                {
                    q--;
                    Entity childEntity = entity.World.ClassRegistry.CreateEntity(childType);

                    childEntity.ServerPos.SetFrom(entity.ServerPos);
                    childEntity.ServerPos.Motion.X += (rand.NextDouble() - 0.5f) / 20f;
                    childEntity.ServerPos.Motion.Z += (rand.NextDouble() - 0.5f) / 20f;

                    childEntity.Pos.SetFrom(childEntity.ServerPos);
                    entity.World.SpawnEntity(childEntity);
                    entity.Attributes.SetString("origin", "reproduction");
                    childEntity.WatchedAttributes.SetInt("generation", generation + 1);
                }
            }

            entity.World.FrameProfiler.Mark("entity-multiply");
        }
        public override void Initialize(EntityProperties properties, JsonObject attributes)
        {
            waterDragValue = 1 - (1 - GlobalConstants.WaterDrag) * (float)attributes["waterDragFactor"].AsDouble(1);

            double airDrag = attributes["airDragFactor"].Exists ? attributes["airDragFactor"].AsDouble(1) : attributes["airDragFallingFactor"].AsDouble(1); // airDragFallingFactor is pre1.15

            airDragValue = 1 - (1 - GlobalConstants.AirDragAlways) * airDrag;

            if (entity.WatchedAttributes.HasAttribute("airDragFactor"))
            {
                airDragValue = 1 - (1 - GlobalConstants.AirDragAlways) * (float)entity.WatchedAttributes.GetDouble("airDragFactor");
            }

            groundDragFactor = 0.3 * (float)attributes["groundDragFactor"].AsDouble(1);

            gravityPerSecond = GlobalConstants.GravityPerSecond * (float)attributes["gravityFactor"].AsDouble(1f);
            if (entity.WatchedAttributes.HasAttribute("gravityFactor"))
            {
                gravityPerSecond = GlobalConstants.GravityPerSecond * (float)entity.WatchedAttributes.GetDouble("gravityFactor");
            }

            if (entity.World.Side == EnumAppSide.Client)
            {
                capi = (entity.World.Api as ICoreClientAPI);
                duringRenderFrame = true;
                capi.Event.RegisterRenderer(this, EnumRenderStage.Before, "passivephysics");
            }
        }
Beispiel #24
0
        public Yux() : base(new Stats(12, 3, 0, 2, 0))
        {
            Name = "Yux";

            ChangeHeightState(HeightStates.Airborne);

            Scale = new Vector2(.3f, .3f);

            EntityProperties.AddStatusProperty(StatusTypes.Sleep, new StatusPropertyHolder(30, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Dizzy, new StatusPropertyHolder(100, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Confused, new StatusPropertyHolder(70, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Tiny, new StatusPropertyHolder(90, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Stop, new StatusPropertyHolder(80, 0));
            EntityProperties.AddStatusProperty(StatusTypes.DEFDown, new StatusPropertyHolder(95, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Burn, new StatusPropertyHolder(0, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Frozen, new StatusPropertyHolder(0, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Fright, new StatusPropertyHolder(0, 0));
            EntityProperties.AddStatusProperty(StatusTypes.Blown, new StatusPropertyHolder(90, 0));
            EntityProperties.AddStatusProperty(StatusTypes.KO, new StatusPropertyHolder(95, 0));

            Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Enemies/Yux.png");

            AnimManager.SetSpriteSheet(spriteSheet);

            AnimManager.AddAnimation(AnimationGlobals.IdleName, new Animation(spriteSheet,
                                                                              new Animation.Frame(new Rectangle(45, 50, 187, 189), 1000d)));
        }
        public int CreateProp(int model, Vector3 pos, Vector3 rot, int dimension)
        {
            var obj = new EntityProperties();

            obj.Position   = pos;
            obj.Rotation   = rot;
            obj.ModelHash  = model;
            obj.Dimension  = dimension;
            obj.Alpha      = 255;
            obj.EntityType = (byte)EntityType.Prop;
            int localEntityHash;

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Prop;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
 public GameplayState(Game game, GameStateManager manager, EntityProperties properties)
     : base(game, manager)
 {
     loadedGame  = true;
     loadedProps = properties == null ? new EntityProperties() : properties;
     hud         = new HUD(this);
 }
Beispiel #27
0
 public EntityInfo(EntityProperties p)
 {
     Cost = p.InitialCost;
     Size = p.Size;
     PopulationProvide = p.PopulationProvide;
     PopulationUse     = p.PopulationUse;
 }
        public override void Initialize(EntityProperties properties, JsonObject attributes)
        {
            base.Initialize(properties, attributes);

            this.attributes = attributes;


            eatAnyway = attributes["eatAnyway"].AsBool(false);


            multiplyTree = entity.WatchedAttributes.GetTreeAttribute("multiply");

            if (entity.World.Side == EnumAppSide.Server)
            {
                if (multiplyTree == null)
                {
                    entity.WatchedAttributes.SetAttribute("multiply", multiplyTree = new TreeAttribute());
                    TotalDaysLastBirth = entity.World.Calendar.TotalHours;

                    double daysNow = entity.World.Calendar.TotalHours / 24f;
                    TotalDaysCooldownUntil = daysNow + (MultiplyCooldownDaysMin + entity.World.Rand.NextDouble() * (MultiplyCooldownDaysMax - MultiplyCooldownDaysMin));
                }

                callbackId = entity.World.RegisterCallback(CheckMultiply, 3000);
            }
        }
Beispiel #29
0
        public override void Initialize(EntityProperties properties, JsonObject typeAttributes)
        {
            healthTree = entity.WatchedAttributes.GetTreeAttribute("health");

            if (healthTree == null)
            {
                entity.WatchedAttributes.SetAttribute("health", healthTree = new TreeAttribute());

                Health        = typeAttributes["currenthealth"].AsFloat(20);
                BaseMaxHealth = typeAttributes["maxhealth"].AsFloat(20);
                UpdateMaxHealth();
                return;
            }

            Health        = healthTree.GetFloat("currenthealth");
            BaseMaxHealth = healthTree.GetFloat("basemaxhealth");

            if (BaseMaxHealth == 0)
            {
                BaseMaxHealth = typeAttributes["maxhealth"].AsFloat(20);
            }


            UpdateMaxHealth();
        }
        private EntityProperties GetPrimaryKeyProperties(DataEntity dataEntity, OleDbMetadataAccess metadataAccess)
        {
            var primaryKeyProperties = new EntityProperties();
            //Use the data entity name to retrieve a list of indexes
            var indexColumns = metadataAccess.GetTableIndexInformation(dataEntity.ObjectDefinitionFullName);

            //Add each of the Primary Keys and their values found in the data entity.
            foreach (DataRow row in indexColumns.Rows)
            {
                if (!Convert.ToBoolean(row["PRIMARY_KEY"]))
                {
                    continue;
                }

                var columnName = row["COLUMN_NAME"].ToString();

                // Check if the priamry key column is included in the data entity.
                if (dataEntity.Properties.ContainsKey(columnName))
                {
                    // Add the key and its value to the primary key list.
                    primaryKeyProperties.Add(columnName, dataEntity.Properties[columnName]);
                }
                else
                {
                    // If the key has not been added set it to null.
                    primaryKeyProperties.Add(columnName, null);
                }
            }

            return(primaryKeyProperties);
        }
Beispiel #31
0
    void Select(EntityProperties properties)
    {
        float radius=tilePrefab.transform.lossyScale.x * properties.currentActionsPoints/GameRules.Instance.gameCost.MoveCost;
        selected.Clear();
        hide = false;
        origin.gameObject.SetActive(!hide);
        //Cache them so we can easily turn
        debugSphere.transform.localScale = new Vector3(radius,radius,radius);
        debugSphere.transform.position = properties.owner.position;

        Collider[] colliders=Physics.OverlapSphere(properties.owner.position, radius,mask.value);
        for (int i = 0; i < colliders.Length; ++i)
        {   
            selected.Add(colliders[i].gameObject);
            colliders[i].gameObject.renderer.material = moveMaterial;
        }
    }
        public void EntityProperties_SerializedClass_CanConvertToEntityProperties()
        {
            // Arrange
            var expectedId = "SomeId";
            var ob = new BasicEntity
            {
                Id = expectedId
            };
            var data = _serializer.PackSingleObject(ob);

            // Act
            var entityProperties = new EntityProperties(data);
            var containsId = entityProperties.ContainsKey("Id");
            string returnedId;
            var isString = entityProperties["Id"].TryGet(out returnedId);

            // Assert
            Assert.True(containsId);
            Assert.True(isString);
            Assert.Equal(expectedId, returnedId);
        }
Beispiel #33
0
 void OnSelection(EntityProperties props)
 {
     if (GameRules.Instance.gameCost.AimedShotCost > props.currentActionsPoints)
     {
         aimedButton.enabled = false;
         aimedButton.SetState(UIButtonColor.State.Disabled, true);
     }
     else
     {
         aimedButton.enabled = true;
         aimedButton.SetState(UIButtonColor.State.Normal, true);
     }
     if (GameRules.Instance.gameCost.SnapShotCost > props.currentActionsPoints)
     {
         snapButton.enabled = false;
         snapButton.SetState(UIButtonColor.State.Disabled, true);
     }
     else
     {
         snapButton.enabled = true;
         snapButton.SetState(UIButtonColor.State.Normal, true);
     }
 }
        private EntityProperties GetPrimaryKeyProperties(DataEntity dataEntity, OleDbMetadataAccess metadataAccess)
        {
            var primaryKeyProperties = new EntityProperties();
            //Use the data entity name to retrieve a list of indexes
            var indexColumns = metadataAccess.GetTableIndexInformation(dataEntity.ObjectDefinitionFullName);

            //Add each of the Primary Keys and their values found in the data entity.
            foreach (DataRow row in indexColumns.Rows)
            {
                if (!Convert.ToBoolean(row["PRIMARY_KEY"]))
                {
                    continue;
                }

                var columnName = row["COLUMN_NAME"].ToString();

                // Check if the priamry key column is included in the data entity.
                if (dataEntity.Properties.ContainsKey(columnName))
                {
                    // Add the key and its value to the primary key list.
                    primaryKeyProperties.Add(columnName, dataEntity.Properties[columnName]);
                }
                else
                {
                    // If the key has not been added set it to null.
                    primaryKeyProperties.Add(columnName, null);
                }
            }

            return primaryKeyProperties;
        }
Beispiel #35
0
        public void UpdateInvalidDateTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "update", AllowMultipleObject = false };

            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();

            //create the comparison experssion for selecting the records to update
            operationInput.LookupCondition = new Expression[]
                                        {
                                            new ComparisonExpression(ComparisonOperator.Equal,
                                                                     new ComparisonValue(ComparisonValueType.Property, "Type"),
                                                                     new ComparisonValue(ComparisonValueType.Constant, "Order"),
                                                                     null)
                                        };
            //add the columns to change
            table.ObjectDefinitionFullName = "SalesOrders";
            columnData.Add("OrderDate", InvalidPropertyValue);
            columnData.Add("ModifiedOn", DateTime.Now);

            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            var operationResult = _sysConnector.ExecuteOperation(operationInput);

            Assert.IsFalse(operationResult.Success[0]);
            Assert.AreEqual(0, operationResult.ObjectsAffected[0]);
        }
Beispiel #36
0
        public void SetWorldTransform(ref IndexedMatrix worldTrans, bool force)
        {
            m_xform = worldTrans;
            // Put the new transform into m_properties
            IndexedQuaternion OrientationQuaternion = m_xform.GetRotation();
            IndexedVector3 LinearVelocityVector = Rigidbody.GetLinearVelocity();
            IndexedVector3 AngularVelocityVector = Rigidbody.GetAngularVelocity();
            m_properties.Position = new Vector3(m_xform._origin.X, m_xform._origin.Y, m_xform._origin.Z);
            m_properties.Rotation = new Quaternion(OrientationQuaternion.X, OrientationQuaternion.Y,
                                                   OrientationQuaternion.Z, OrientationQuaternion.W);
            // A problem with stock Bullet is that we don't get an event when an object is deactivated.
            // This means that the last non-zero values for linear and angular velocity
            // are left in the viewer who does dead reconning and the objects look like
            // they float off.
            // BulletSim ships with a patch to Bullet which creates such an event.
            m_properties.Velocity = new Vector3(LinearVelocityVector.X, LinearVelocityVector.Y, LinearVelocityVector.Z);
            m_properties.RotationalVelocity = new Vector3(AngularVelocityVector.X, AngularVelocityVector.Y, AngularVelocityVector.Z);

            if (force

                || !AlmostEqual(ref m_lastProperties.Position, ref m_properties.Position, POSITION_TOLERANCE)
                || !AlmostEqual(ref m_properties.Rotation, ref m_lastProperties.Rotation, ROTATION_TOLERANCE)
                // If the Velocity and AngularVelocity are zero, most likely the object has
                //    been deactivated. If they both are zero and they have become zero recently,
                //    make sure a property update is sent so the zeros make it to the viewer.
                || ((m_properties.Velocity == ZeroVect && m_properties.RotationalVelocity == ZeroVect)
                    &&
                    (m_properties.Velocity != m_lastProperties.Velocity ||
                     m_properties.RotationalVelocity != m_lastProperties.RotationalVelocity))
                //	If Velocity and AngularVelocity are non-zero but have changed, send an update.
                || !AlmostEqual(ref m_properties.Velocity, ref m_lastProperties.Velocity, VELOCITY_TOLERANCE)
                ||
                !AlmostEqual(ref m_properties.RotationalVelocity, ref m_lastProperties.RotationalVelocity,
                             ANGULARVELOCITY_TOLERANCE)
                )


            {
                // Add this update to the list of updates for this frame.
                m_lastProperties = m_properties;
                if (m_world.LastEntityProperty < m_world.UpdatedObjects.Length)
                    m_world.UpdatedObjects[m_world.LastEntityProperty++]=(m_properties);

                //(*m_updatesThisFrame)[m_properties.ID] = &m_properties;
            }




        }
Beispiel #37
0
        public void InsertExistingRowInvalidTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "create" };

            var input = new List<DataEntity>();
            var table = new DataEntity("Customers");

            var columnData = new EntityProperties();

            //create a DataEntity for the row
            table.ObjectDefinitionFullName = "Customers";
            columnData.Add("CustomerNumber", "ABERDEEN0001");
            columnData.Add("CompanyName", "Aberdeen Inc.");
            columnData.Add("Active", "1");

            //add the row data to the input
            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            //execute the selected operation
            OperationResult operationResult = _sysConnector.ExecuteOperation(operationInput);
            //verify the result is not a success
            Assert.IsFalse(operationResult.Success[0]);
            //verify that a row was added
            Assert.AreEqual(ErrorNumber.DuplicateUniqueKey, operationResult.ErrorInfo[0].Number);
        }
Beispiel #38
0
 private int PhysicsStep2(BulletWorld pWorld, float timeStep, int m_maxSubSteps, float m_fixedTimeStep,
                 out int updatedEntityCount, out EntityProperties[] updatedEntities,
                 out int collidersCount, out CollisionDesc[] colliders)
 {
     int epic = PhysicsStepint(pWorld, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out updatedEntities,
                             out collidersCount, out colliders, m_maxCollisions, m_maxUpdatesPerFrame);
     return epic;
 }
Beispiel #39
0
 private static EntityProperties GetDebugProperties(BulletWorld pWorld, BulletBody pCollisionObject)
 {
     EntityProperties ent = new EntityProperties();
     DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
     CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody;
     IndexedMatrix transform = collisionObject.GetWorldTransform();
     IndexedVector3 LinearVelocity = collisionObject.GetInterpolationLinearVelocity();
     IndexedVector3 AngularVelocity = collisionObject.GetInterpolationAngularVelocity();
     IndexedQuaternion rotation = transform.GetRotation();
     ent.Acceleration = Vector3.Zero;
     ent.ID = (uint)collisionObject.GetUserPointer();
     ent.Position = new Vector3(transform._origin.X,transform._origin.Y,transform._origin.Z);
     ent.Rotation = new Quaternion(rotation.X,rotation.Y,rotation.Z,rotation.W);
     ent.Velocity = new Vector3(LinearVelocity.X, LinearVelocity.Y, LinearVelocity.Z);
     ent.RotationalVelocity = new Vector3(AngularVelocity.X, AngularVelocity.Y, AngularVelocity.Z);
     return ent;
 }
        private static string ParseWhereClause(EntityProperties properties)
        {
            var whereClause = new StringBuilder();
            if (properties != null && properties.Count > 0)
            {
                whereClause.AppendFormat(" {0} ", WhereKeyword);

                int index = 1;
                foreach (var property in properties)
                {
                    if (property.Value == null)
                    {
                        whereClause.AppendFormat("[{0}] IS NULL", property.Key);
                    }
                    else
                    {
                        var rightComparisonValue = new ComparisonValue(ComparisonValueType.Constant, property.Value);

                        whereClause.AppendFormat("[{0}] = {1}", property.Key,
                                                 GetRightFormattedComparisonValue(rightComparisonValue));
                    }

                    if (index != properties.Count)
                    {
                        whereClause.Append(" AND ");
                    }

                    index++;
                }
            }

            return whereClause.ToString();
        }
Beispiel #41
0
    public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
                                            int maxCollisions, ref CollisionDesc[] collisionArray,
                                            int maxUpdates, ref EntityProperties[] updateArray
                                            )
    {

        UpdatedObjects = updateArray;
        UpdatedCollisions = collisionArray;
        /* TODO */
        ConfigurationParameters[] configparms = new ConfigurationParameters[1];
        configparms[0] = parms;
        Vector3 worldExtent = maxPosition;
        m_maxCollisions = maxCollisions;
        m_maxUpdatesPerFrame = maxUpdates;
        specialCollisionObjects = new Dictionary<uint, GhostObject>();

        return new BulletWorldXNA(1, PhysicsScene, BSAPIXNA.Initialize2(worldExtent, configparms, maxCollisions, ref collisionArray, maxUpdates, ref updateArray, null));
    }
 public SqlQueryBuilder(DataEntity operationInput, EntityProperties filterColumns, Globals.QueryType queryType)
 {
     Parse(operationInput, filterColumns, queryType);
 }
        private void Parse(DataEntity input, EntityProperties filterColumns, Globals.QueryType queryType)
        {
            var query = new StringBuilder();

            if (queryType == Globals.QueryType.Upsert)
            {
                var whereClause = ParseWhereClause(filterColumns);
                query.AppendFormat("{0} {3} ({1}{2})", IfKeyword, ParseQueryType(input, Globals.QueryType.Select), whereClause, ExistsKeyword);
                query.AppendFormat("{0}{1}{0}{5}{6}{0}{3}{0}{4}{0}{1}{0}{2}{0}{3}", Environment.NewLine, BeginKeyword,
                    ParseQueryType(input, Globals.QueryType.Insert),
                    EndKeyword, ElseKeyword, ParseQueryType(input, Globals.QueryType.Update), whereClause);
            }
            else
            {
                query.Append(ParseQueryType(input, queryType));
                query.Append(ParseWhereClause(filterColumns));
            }

            _query = query.ToString();
        }
Beispiel #44
0
        public void UpsertingExistingRowInvalidTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "upsert" };

            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();

            //create a DataEntity for the row
            table.ObjectDefinitionFullName = "Customers";

            columnData.Add("CustomerNumber", "ABERDEEN0001");
            columnData.Add("CompanyName", "Aberdeen Inc.");
            columnData.Add("Active", "1");
            columnData.Add("Email", "*****@*****.**");

            //add the row data to the input
            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            //execute the selected operation
            OperationResult operationResult = _sysConnector.ExecuteOperation(operationInput);
            //verify the result is a success
            Assert.IsTrue(operationResult.Success[0]);
            //verify that a row was added
            Assert.AreEqual(1, operationResult.ObjectsAffected[0]);
        }
Beispiel #45
0
 public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
                                         int maxCollisions, ref CollisionDesc[] collisionArray,
                                         int maxUpdates, ref EntityProperties[] updateArray
                                         )
 {
     /* TODO */
     return new BulletWorldXNA(1, null, null);
 }
Beispiel #46
0
    private static EntityProperties GetDebugProperties(object pWorld, object pBody)
    {
        EntityProperties ent = new EntityProperties();
        DiscreteDynamicsWorld world = pWorld as DiscreteDynamicsWorld;
        RigidBody body = pBody as RigidBody;
        IndexedMatrix transform = body.GetWorldTransform();
        IndexedVector3 LinearVelocity = body.GetInterpolationLinearVelocity();
        IndexedVector3 AngularVelocity = body.GetInterpolationAngularVelocity();
        IndexedQuaternion rotation = transform.GetRotation();
        ent.Acceleration = Vector3.Zero;
        ent.ID = (uint)body.GetUserPointer();
        ent.Position = new Vector3(transform._origin.X,transform._origin.Y,transform._origin.Z);
        ent.Rotation = new Quaternion(rotation.X,rotation.Y,rotation.Z,rotation.W);
        ent.Velocity = new Vector3(LinearVelocity.X, LinearVelocity.Y, LinearVelocity.Z);
        ent.RotationalVelocity = new Vector3(AngularVelocity.X, AngularVelocity.Y, AngularVelocity.Z);
        return ent;


    }
Beispiel #47
0
        public void UpdateBooleanValidTest()
        {
            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();
            var operationInput = new OperationInput();
            operationInput.Name = "update";

            operationInput.AllowMultipleObject = false;

            //create a new comparison expression that will only attempt to update one row of data
            operationInput.LookupCondition = new Expression[]
                                        {
                                            new ComparisonExpression(ComparisonOperator.Equal,
                                                                     new ComparisonValue(ComparisonValueType.Property, "ProductNumber"),
                                                                     new ComparisonValue(ComparisonValueType.Constant,"ME256"),
                                                                     null)
                                        };

            table.ObjectDefinitionFullName = "Products";
            //This will only accept a value that has a value of 1, or 0 for TRUE or FALSE
            columnData.Add("Discontinued", 1);

            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            var operationResult = _sysConnector.ExecuteOperation(operationInput);
            //validate the the result was a success
            Assert.IsTrue(operationResult.Success[0]);
            //validate that only one row of data was affected
            Assert.AreEqual(1, operationResult.ObjectsAffected[0]);
        }
Beispiel #48
0
        /// <summary>
        /// Get the table name form the passed in method input
        /// </summary>
        /// <param name="properties">the parameter values</param>
        /// <returns>the name of the table to retrieve</returns>
        private string GetPluginName(EntityProperties properties)
        {
            // validate that an object name has been set
            if (!properties.ContainsKey("PluginName") || string.IsNullOrWhiteSpace(properties["PluginName"].ToString()))
            {
                throw new ArgumentNullException("PluginName", Globals.InputPropertyNotFound);
            }

            var objectName = properties["PluginName"].ToString();

            return objectName;
        }
Beispiel #49
0
        public void InsertUnknownTableInValidTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "create" };

            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();

            //create a DataEntity for the row
            table.ObjectDefinitionFullName = InvalidPropertyValue;
            columnData.Add("RecordId", Guid.NewGuid().ToString());
            columnData.Add("ProductNumber", "134234g");
            columnData.Add("ProductName", "Screwdriver");
            columnData.Add("Type", "FinishGood");
            columnData.Add("UoMSchedule", "65");
            columnData.Add("ListPrice", "65");
            columnData.Add("Cost", "65");
            columnData.Add("StandardCost", "65");
            columnData.Add("QuantityInStock", "65");
            columnData.Add("QuantityOnOrder", "65");
            columnData.Add("Discontinued", "0");
            columnData.Add("CreatedOn", DateTime.Now);
            columnData.Add("ModifiedOn", DateTime.Now);

            //add the row data to the input
            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();
            //execute the selected operation
            OperationResult operationResult = _sysConnector.ExecuteOperation(operationInput);
            //verify the result is not a success
            Assert.IsFalse(operationResult.Success[0]);
            Assert.AreEqual(0, operationResult.ObjectsAffected[0]);
        }
Beispiel #50
0
        /// <summary>
        /// Get the last sync date from the passed in method input
        /// </summary>
        /// <param name="properties">>The parameters of the MethodInput.</param>
        /// <returns>The last sync datetime of the table</returns>
        private DateTime GetLastSyncDate(EntityProperties properties)
        {
            DateTime lastSyncDate = new DateTime();
            DateTime minTime = new DateTime(1753, 1, 1);
            // validate key exists and set its value
            lastSyncDate = !properties.ContainsKey("LastSyncDate") ? minTime : Convert.ToDateTime(properties["LastSyncDate"]);

            if (lastSyncDate < minTime)
            {
                lastSyncDate = minTime;
            }

            // log value
            Logger.Write(Logger.Severity.Debug, Globals.ConnectorName, string.Format("LastSyncDate: {0}{1}", lastSyncDate, Environment.NewLine));

            return lastSyncDate;
        }
Beispiel #51
0
    private static DiscreteDynamicsWorld Initialize2(Vector3 worldExtent,
                        ConfigurationParameters[] o,
                        int mMaxCollisionsPerFrame, ref CollisionDesc[] collisionArray,
                        int mMaxUpdatesPerFrame, ref EntityProperties[] updateArray,
                        object mDebugLogCallbackHandle)
    {
        CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();

        p.angularDamping = BSParam.AngularDamping;
        p.defaultFriction = o[0].defaultFriction;
        p.defaultFriction = o[0].defaultFriction;
        p.defaultDensity = o[0].defaultDensity;
        p.defaultRestitution = o[0].defaultRestitution;
        p.collisionMargin = o[0].collisionMargin;
        p.gravity = o[0].gravity;

        p.linearDamping = BSParam.LinearDamping;
        p.angularDamping = BSParam.AngularDamping;
        p.deactivationTime = BSParam.DeactivationTime;
        p.linearSleepingThreshold = BSParam.LinearSleepingThreshold;
        p.angularSleepingThreshold = BSParam.AngularSleepingThreshold;
        p.ccdMotionThreshold = BSParam.CcdMotionThreshold;
        p.ccdSweptSphereRadius = BSParam.CcdSweptSphereRadius;
        p.contactProcessingThreshold = BSParam.ContactProcessingThreshold;

        p.terrainImplementation = BSParam.TerrainImplementation;
        p.terrainFriction = BSParam.TerrainFriction;

        p.terrainHitFraction = BSParam.TerrainHitFraction;
        p.terrainRestitution = BSParam.TerrainRestitution;
        p.terrainCollisionMargin = BSParam.TerrainCollisionMargin;

        p.avatarFriction = BSParam.AvatarFriction;
        p.avatarStandingFriction = BSParam.AvatarStandingFriction;
        p.avatarDensity = BSParam.AvatarDensity;
        p.avatarRestitution = BSParam.AvatarRestitution;
        p.avatarCapsuleWidth = BSParam.AvatarCapsuleWidth;
        p.avatarCapsuleDepth = BSParam.AvatarCapsuleDepth;
        p.avatarCapsuleHeight = BSParam.AvatarCapsuleHeight;
        p.avatarContactProcessingThreshold = BSParam.AvatarContactProcessingThreshold;

        p.vehicleAngularDamping = BSParam.VehicleAngularDamping;

        p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize;
        p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize;
        p.shouldDisableContactPoolDynamicAllocation = o[0].shouldDisableContactPoolDynamicAllocation;
        p.shouldForceUpdateAllAabbs = o[0].shouldForceUpdateAllAabbs;
        p.shouldRandomizeSolverOrder = o[0].shouldRandomizeSolverOrder;
        p.shouldSplitSimulationIslands = o[0].shouldSplitSimulationIslands;
        p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching;
        p.numberOfSolverIterations = o[0].numberOfSolverIterations;

        p.linksetImplementation = BSParam.LinksetImplementation;
        p.linkConstraintUseFrameOffset = BSParam.NumericBool(BSParam.LinkConstraintUseFrameOffset);
        p.linkConstraintEnableTransMotor = BSParam.NumericBool(BSParam.LinkConstraintEnableTransMotor);
        p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
        p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
        p.linkConstraintERP = BSParam.LinkConstraintERP;
        p.linkConstraintCFM = BSParam.LinkConstraintCFM;
        p.linkConstraintSolverIterations = BSParam.LinkConstraintSolverIterations;
        p.physicsLoggingFrames = o[0].physicsLoggingFrames;
        DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();

        DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
        CollisionDispatcher m_dispatcher = new CollisionDispatcher(cci);


        if (p.maxPersistantManifoldPoolSize > 0)
            cci.m_persistentManifoldPoolSize = (int)p.maxPersistantManifoldPoolSize;
        if (p.shouldDisableContactPoolDynamicAllocation !=0)
            m_dispatcher.SetDispatcherFlags(DispatcherFlags.CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION);
        //if (p.maxCollisionAlgorithmPoolSize >0 )

        DbvtBroadphase m_broadphase = new DbvtBroadphase();
        //IndexedVector3 aabbMin = new IndexedVector3(0, 0, 0);
        //IndexedVector3 aabbMax = new IndexedVector3(256, 256, 256);

        //AxisSweep3Internal m_broadphase2 = new AxisSweep3Internal(ref aabbMin, ref aabbMax, Convert.ToInt32(0xfffe), 0xffff, ushort.MaxValue/2, null, true);
        m_broadphase.GetOverlappingPairCache().SetInternalGhostPairCallback(new GhostPairCallback());

        SequentialImpulseConstraintSolver m_solver = new SequentialImpulseConstraintSolver();

        DiscreteDynamicsWorld world = new DiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, cci);

        world.LastCollisionDesc = 0;
        world.LastEntityProperty = 0;

        world.WorldSettings.Params = p;
        world.SetForceUpdateAllAabbs(p.shouldForceUpdateAllAabbs != 0);
        world.GetSolverInfo().m_solverMode = SolverMode.SOLVER_USE_WARMSTARTING | SolverMode.SOLVER_SIMD;
        if (p.shouldRandomizeSolverOrder != 0)
            world.GetSolverInfo().m_solverMode |= SolverMode.SOLVER_RANDMIZE_ORDER;

        world.GetSimulationIslandManager().SetSplitIslands(p.shouldSplitSimulationIslands != 0);
        //world.GetDispatchInfo().m_enableSatConvex Not implemented in C# port

        if (p.shouldEnableFrictionCaching != 0)
            world.GetSolverInfo().m_solverMode |= SolverMode.SOLVER_ENABLE_FRICTION_DIRECTION_CACHING;

        if (p.numberOfSolverIterations > 0)
            world.GetSolverInfo().m_numIterations = (int) p.numberOfSolverIterations;


        world.GetSolverInfo().m_damping = world.WorldSettings.Params.linearDamping;
        world.GetSolverInfo().m_restitution = world.WorldSettings.Params.defaultRestitution;
        world.GetSolverInfo().m_globalCfm = 0.0f;
        world.GetSolverInfo().m_tau = 0.6f;
        world.GetSolverInfo().m_friction = 0.3f;
        world.GetSolverInfo().m_maxErrorReduction = 20f;
        world.GetSolverInfo().m_numIterations = 10;
        world.GetSolverInfo().m_erp = 0.2f;
        world.GetSolverInfo().m_erp2 = 0.1f;
        world.GetSolverInfo().m_sor = 1.0f;
        world.GetSolverInfo().m_splitImpulse = false;
        world.GetSolverInfo().m_splitImpulsePenetrationThreshold = -0.02f;
        world.GetSolverInfo().m_linearSlop = 0.0f;
        world.GetSolverInfo().m_warmstartingFactor = 0.85f;
        world.GetSolverInfo().m_restingContactRestitutionThreshold = 2;
        world.SetForceUpdateAllAabbs(true);

        //BSParam.TerrainImplementation = 0;
        world.SetGravity(new IndexedVector3(0,0,p.gravity));

        // Turn off Pooling since globals and pooling are bad for threading.
        BulletGlobals.VoronoiSimplexSolverPool.SetPoolingEnabled(false);
        BulletGlobals.SubSimplexConvexCastPool.SetPoolingEnabled(false);
        BulletGlobals.ManifoldPointPool.SetPoolingEnabled(false);
        BulletGlobals.CastResultPool.SetPoolingEnabled(false);
        BulletGlobals.SphereShapePool.SetPoolingEnabled(false);
        BulletGlobals.DbvtNodePool.SetPoolingEnabled(false);
        BulletGlobals.SingleRayCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.SubSimplexClosestResultPool.SetPoolingEnabled(false);
        BulletGlobals.GjkPairDetectorPool.SetPoolingEnabled(false);
        BulletGlobals.DbvtTreeColliderPool.SetPoolingEnabled(false);
        BulletGlobals.SingleSweepCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.BroadphaseRayTesterPool.SetPoolingEnabled(false);
        BulletGlobals.ClosestNotMeConvexResultCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.GjkEpaPenetrationDepthSolverPool.SetPoolingEnabled(false);
        BulletGlobals.ContinuousConvexCollisionPool.SetPoolingEnabled(false);
        BulletGlobals.DbvtStackDataBlockPool.SetPoolingEnabled(false);

        BulletGlobals.BoxBoxCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.CompoundCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.ConvexConcaveCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.ConvexConvexAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.ConvexPlaneAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.SphereBoxCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.SphereSphereCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.SphereTriangleCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.GImpactCollisionAlgorithmPool.SetPoolingEnabled(false);
        BulletGlobals.GjkEpaSolver2MinkowskiDiffPool.SetPoolingEnabled(false);
        BulletGlobals.PersistentManifoldPool.SetPoolingEnabled(false);
        BulletGlobals.ManifoldResultPool.SetPoolingEnabled(false);
        BulletGlobals.GJKPool.SetPoolingEnabled(false);
        BulletGlobals.GIM_ShapeRetrieverPool.SetPoolingEnabled(false);
        BulletGlobals.TriangleShapePool.SetPoolingEnabled(false);
        BulletGlobals.SphereTriangleDetectorPool.SetPoolingEnabled(false);
        BulletGlobals.CompoundLeafCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.GjkConvexCastPool.SetPoolingEnabled(false);
        BulletGlobals.LocalTriangleSphereCastCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.BridgeTriangleRaycastCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.BridgeTriangleConcaveRaycastCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.BridgeTriangleConvexcastCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.MyNodeOverlapCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.ClosestRayResultCallbackPool.SetPoolingEnabled(false);
        BulletGlobals.DebugDrawcallbackPool.SetPoolingEnabled(false);

        return world;
    }
Beispiel #52
0
        /// <summary>
        /// Retrieve the column name used for checking the last date of synchronization on the column
        /// </summary>
        /// <param name="properties">The parameters of the MethodInput.</param>
        /// <returns>string value of the column name</returns>
        private string GetLastModifiedColumnNameFromInput(EntityProperties properties)
        {
            string columnName = string.Empty;

            //check if the column name is specified by checking for the 'ModificationDateFullName' property
            if (properties.ContainsKey("ModificationDateFullName"))
            {
                //set teh column name to the property in the property list
                columnName = properties["ModificationDateFullName"].ToString();
            }

            return columnName;
        }
Beispiel #53
0
    private int PhysicsStepint(BulletWorld pWorld,float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount,
        out  EntityProperties[] updatedEntities, out int collidersCount, out CollisionDesc[] colliders, int maxCollisions, int maxUpdates)
    {
        int numSimSteps = 0;
        Array.Clear(UpdatedObjects, 0, UpdatedObjects.Length);
        Array.Clear(UpdatedCollisions, 0, UpdatedCollisions.Length);
        LastEntityProperty=0;






        LastCollisionDesc=0;

        updatedEntityCount = 0;
        collidersCount = 0;


        if (pWorld is BulletWorldXNA)
        {
            DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;

            world.LastCollisionDesc = 0;
            world.LastEntityProperty = 0;
            numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep);

            PersistentManifold contactManifold;
            CollisionObject objA;
            CollisionObject objB;
            ManifoldPoint manifoldPoint;
            PairCachingGhostObject pairCachingGhostObject;

            m_collisionsThisFrame = 0;
            int numManifolds = world.GetDispatcher().GetNumManifolds();
            for (int j = 0; j < numManifolds; j++)
            {
                contactManifold = world.GetDispatcher().GetManifoldByIndexInternal(j);
                int numContacts = contactManifold.GetNumContacts();
                if (numContacts == 0)
                    continue;

                objA = contactManifold.GetBody0() as CollisionObject;
                objB = contactManifold.GetBody1() as CollisionObject;

                manifoldPoint = contactManifold.GetContactPoint(0);
                //IndexedVector3 contactPoint = manifoldPoint.GetPositionWorldOnB();
               // IndexedVector3 contactNormal = -manifoldPoint.m_normalWorldOnB; // make relative to A

                RecordCollision(this, objA, objB, manifoldPoint.GetPositionWorldOnB(), -manifoldPoint.m_normalWorldOnB, manifoldPoint.GetDistance());
                m_collisionsThisFrame ++;
                if (m_collisionsThisFrame >= 9999999)
                    break;


            }

            foreach (GhostObject ghostObject in specialCollisionObjects.Values)
            {
                pairCachingGhostObject = ghostObject as PairCachingGhostObject;
                if (pairCachingGhostObject != null)
                {
                    RecordGhostCollisions(pairCachingGhostObject);
                }

            }


            updatedEntityCount = LastEntityProperty;
            updatedEntities = UpdatedObjects;

            collidersCount = LastCollisionDesc;
            colliders = UpdatedCollisions;


        }
        else
        {
            //if (updatedEntities is null)
            //updatedEntities = new List<BulletXNA.EntityProperties>();
            //updatedEntityCount = 0;


            //collidersCount = 0;

            updatedEntities = new EntityProperties[0];


            colliders = new CollisionDesc[0];

        }
        return numSimSteps;
    }
        /// <summary>
        /// provides the columns in a format to add to the select statement
        /// </summary>
        /// <param name="properties">columns to add</param>
        /// <returns>colums formated fpor a SQL select statement</returns>
        private string ParseColumns(EntityProperties properties)
        {
            var selectColumns = new StringBuilder();

            // add columns
            if (properties != null && properties.Count > 0)
            {
                foreach (var property in properties)
                {
                    selectColumns.Append(" [");
                    selectColumns.Append(property.Key);
                    selectColumns.Append("],");
                }
                selectColumns.Remove(selectColumns.Length - 1, 1);
            }
            else // all columns
            {
                selectColumns.Append(" *");
            }

            return selectColumns.ToString();
        }
Beispiel #55
0
 public SimMotionState(BSAPIXNA pWorld, uint id, IndexedMatrix starTransform, object frameUpdates)
 {
     IndexedQuaternion OrientationQuaterion = starTransform.GetRotation();
     m_properties = new EntityProperties()
                        {
                            ID = id,
                            Position = new Vector3(starTransform._origin.X, starTransform._origin.Y,starTransform._origin.Z),
                            Rotation = new Quaternion(OrientationQuaterion.X,OrientationQuaterion.Y,OrientationQuaterion.Z,OrientationQuaterion.W)
                        };
     m_lastProperties = new EntityProperties()
     {
         ID = id,
         Position = new Vector3(starTransform._origin.X, starTransform._origin.Y, starTransform._origin.Z),
         Rotation = new Quaternion(OrientationQuaterion.X, OrientationQuaterion.Y, OrientationQuaterion.Z, OrientationQuaterion.W)
     };
     m_world = pWorld;
     m_xform = starTransform;
 }
Beispiel #56
0
        public void UpdateMultipleRowsValidTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "update", AllowMultipleObject = true };

            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();

            //create the comparison experssion for selecting the records to update
            operationInput.LookupCondition = new Expression[]
            {
                new ComparisonExpression(
                    ComparisonOperator.IsNull,new ComparisonValue(ComparisonValueType.Property, "TaxSchedule"), null, null)
            };

            //add the columns to change
            table.ObjectDefinitionFullName = "Addresses";
            columnData.Add("TaxSchedule", "ST-PA");

            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            //execute the selected operaiton
            var operationResult = _sysConnector.ExecuteOperation(operationInput);

            //validate that the operation was success
            Assert.IsTrue(operationResult.Success[0]);
            //validate that multiple rows have been updated
            Assert.IsTrue(operationResult.ObjectsAffected[0] >= 1);
        }
Beispiel #57
0
        public void InsertRowValidTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "create" };

            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();

            //create a DataEntity for the row
            table.ObjectDefinitionFullName = "Products";
            columnData.Add("RecordId", Guid.NewGuid().ToString());
            columnData.Add("ProductNumber", DateTime.Now.GetHashCode());
            columnData.Add("ProductName", "Screwdriver");
            columnData.Add("Type", "FinishGood");
            columnData.Add("UoMSchedule", null);
            columnData.Add("ListPrice", "65");
            columnData.Add("Cost", "65");
            columnData.Add("StandardCost", "65");
            columnData.Add("QuantityInStock", "65");
            columnData.Add("QuantityOnOrder", "65");
            columnData.Add("Discontinued", "0");

            //add the row data to the input
            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            //execute the selected operation
            OperationResult operationResult = _sysConnector.ExecuteOperation(operationInput);
            //verify the result is a success
            Assert.IsTrue(operationResult.Success[0]);
            //verify that a row was added
            Assert.IsTrue(operationResult.ObjectsAffected[0] >= 1);
        }
Beispiel #58
0
        public void UpdateInvalidIntTest()
        {
            //create a new method input and use the appropriate operation name
            OperationInput operationInput = new OperationInput { Name = "update", AllowMultipleObject = false };
            var input = new List<DataEntity>();
            var table = new DataEntity();
            var columnData = new EntityProperties();

            //create the comparison experssion for selecting the records to update
            operationInput.LookupCondition = new Expression[]
                                        {
                                            new ComparisonExpression(ComparisonOperator.Equal,
                                                                     new ComparisonValue(ComparisonValueType.Property, "Region"),
                                                                     new ComparisonValue(ComparisonValueType.Constant, "North"),
                                                                     null)
                                        };
            //add the columns to change
            table.ObjectDefinitionFullName = "Customers";
            columnData.Add("CreditOnHold", "5328475903427853943453245324532453425345324523453453453425345324523452342345");
            columnData.Add("ModifiedOn", DateTime.Now);

            table.Properties = columnData;
            input.Add(table);

            operationInput.Input = input.ToArray();

            var operationResult = _sysConnector.ExecuteOperation(operationInput);
            //validate that the result of the operation was not a success
            Assert.IsFalse(operationResult.Success[0]);
            //validate that no objects have been affected
            Assert.AreEqual(0, operationResult.ObjectsAffected[0]);
        }
Beispiel #59
0
        /// <summary>
        /// Get the value of the specified property
        /// </summary>
        /// <param name="properties">property to search for</param>
        /// <returns>value of the specified property</returns>
        private string GetPropertyValue(string propertyName, EntityProperties properties)
        {
            // validate that an property name has been set
            if (!properties.ContainsKey(propertyName))
            {
                throw new ArgumentNullException(propertyName, Globals.InputPropertyNotFound);
            }

            var objectName = properties[propertyName].ToString();

            return objectName;
        }
Beispiel #60
0
 void UpdateGUI(EntityProperties props)
 {
     actionPointLbl.text = props.currentActionsPoints.ToString();
 }