Exemple #1
0
        internal unsafe void FunctionStart(string callerName,
                                            int callerHash,
                                            string method,
                                            string parametersName,
                                            int parametersHash,
                                            ComponentType componentType)
        {
            const int SIZEDATA = 6;
            fixed (char* arg1Ptr = callerName, arg2Ptr = method, arg3Ptr = parametersName)
            {
                EventData* dataDesc = stackalloc EventSource.EventData[SIZEDATA];

                dataDesc[0].DataPointer = (IntPtr)arg1Ptr;
                dataDesc[0].Size = (callerName.Length + 1) * sizeof(char); // Size in bytes, including a null terminator. 
                dataDesc[1].DataPointer = (IntPtr)(&callerHash);
                dataDesc[1].Size = sizeof(int);
                dataDesc[2].DataPointer = (IntPtr)(arg2Ptr);
                dataDesc[2].Size = (method.Length + 1) * sizeof(char);
                dataDesc[3].DataPointer = (IntPtr)(arg3Ptr);
                dataDesc[3].Size = (parametersName.Length + 1) * sizeof(char);
                dataDesc[4].DataPointer = (IntPtr)(&parametersHash);
                dataDesc[4].Size = sizeof(int);
                dataDesc[5].DataPointer = (IntPtr)(&componentType);
                dataDesc[5].Size = sizeof(int);

                WriteEventCore(FUNCTIONSTART_ID, SIZEDATA, dataDesc);
            }
        }
        public void ComponentTypeService_GetAsync_ReturnsComponentTypesByIds()
        {
            //Arrange
            var mockDbContextScopeFac = new Mock<IDbContextScopeFactory>();
            var mockDbContextScope = new Mock<IDbContextReadOnlyScope>();
            var mockEfDbContext = new Mock<EFDbContext>();
            mockDbContextScopeFac.Setup(x => x.CreateReadOnly(DbContextScopeOption.JoinExisting)).Returns(mockDbContextScope.Object);
            mockDbContextScope.Setup(x => x.DbContexts.Get<EFDbContext>()).Returns(mockEfDbContext.Object);

            var dbEntry1 = new ComponentType { Id = "dummyEntryId1", CompTypeName = "Name1", CompTypeAltName = "NameAlt1", IsActive_bl = false };
            var dbEntry2 = new ComponentType { Id = "dummyEntryId2", CompTypeName = "Name2", CompTypeAltName = "NameAlt2", IsActive_bl = true };
            var dbEntry3 = new ComponentType { Id = "dummyEntryId3", CompTypeName = "Name3", CompTypeAltName = "NameAlt3", IsActive_bl = true };
            var dbEntries = (new List<ComponentType> { dbEntry1, dbEntry2, dbEntry3 }).AsQueryable();

            var mockDbSet = new Mock<DbSet<ComponentType>>();
            mockDbSet.As<IDbAsyncEnumerable<ComponentType>>().Setup(m => m.GetAsyncEnumerator()).Returns(new MockDbAsyncEnumerator<ComponentType>(dbEntries.GetEnumerator()));
            mockDbSet.As<IQueryable<ComponentType>>().Setup(m => m.Provider).Returns(new MockDbAsyncQueryProvider<ComponentType>(dbEntries.Provider));
            mockDbSet.As<IQueryable<ComponentType>>().Setup(m => m.Expression).Returns(dbEntries.Expression);
            mockDbSet.As<IQueryable<ComponentType>>().Setup(m => m.ElementType).Returns(dbEntries.ElementType);
            mockDbSet.As<IQueryable<ComponentType>>().Setup(m => m.GetEnumerator()).Returns(dbEntries.GetEnumerator());
            mockDbSet.Setup(x => x.Include(It.IsAny<string>())).Returns(mockDbSet.Object);

            mockEfDbContext.Setup(x => x.ComponentTypes).Returns(mockDbSet.Object);

            var compTypeService = new ComponentTypeService(mockDbContextScopeFac.Object, "dummyUserId");

            //Act
            var serviceResult = compTypeService.GetAsync(new string[] { "dummyEntryId3" }).Result;

            //Assert
            Assert.IsTrue(serviceResult.Count == 1);
            Assert.IsTrue(serviceResult[0].CompTypeAltName.Contains("NameAlt3"));

        }
Exemple #3
0
 public Component(Vector2 center, ComponentType type)
 {
     this.myType = type;
     this.currentState = ComponentState.notSelected;
     this.Radius = 50.0f;
     this.Center = center;
 }
 public AddDradisComponentsControl(ComponentType componentType)
 {
     InitializeComponent();
     ComponentNameLabel.Text = componentType.ToString();
     _componentType = componentType;
     requestedNumberComboBox.SelectedIndex = 0;
 }
Exemple #5
0
		public Signal(DateTime datetime, ComponentType sender, SignalType type, SignalSide side, double qty, double strategyPrice, Instrument instrument, string text)
			: base()
		{
			this.BuyColor = Color.Blue;
			this.BuyCoverColor = Color.SkyBlue;
			this.SellColor = Color.Pink;
			this.SellShortColor = Color.Red;
			this.ToolTipEnabled = true;
			this.ToolTipFormat = "dfdfs";

			this.DateTime = datetime;
			this.Sender = sender;
			this.Type = type;
			this.Side = side;
			this.Qty = qty;
			this.StrategyPrice = strategyPrice;
			this.Instrument = instrument;
			this.Price = this.Instrument.Price();
			this.TimeInForce = TimeInForce.GTC;
			this.Text = text;
			this.Strategy = (Strategy)null;
			this.Rejecter = ComponentType.Unknown;
			this.StopPrice = 0.0;
			this.LimitPrice = 0.0;
			this.Status = SignalStatus.New;
		}
 protected static BootstrappingRequest TestRequest(
     string path, 
     ComponentType ctype,
     IEnumerable<CustomProperty> props)
 {
     return new BootstrappingRequest(path, ctype, new Guid(), new Guid(), string.Empty, string.Empty, string.Empty, props);
 }
        public async Task<IEnumerable<ComponentsKey>> GetComputerComponents(string UnitID, ComponentType componentType)
        {
            await getJson();
            switch (componentType)
            {
                case ComponentType.Graphic:
                    {
                        return computers.Where(x => x.UniqueId == UnitID).FirstOrDefault().Components.Graphic;
                    }

                case ComponentType.Cpu:
                    {
                        return computers.Where(x => x.UniqueId == UnitID).FirstOrDefault().Components.Cpu;
                    }

                case ComponentType.Memory:
                    {
                        return computers.Where(x => x.UniqueId == UnitID).FirstOrDefault().Components.Memory;
                    }

                case ComponentType.Storage:
                    {
                        return computers.Where(x => x.UniqueId == UnitID).FirstOrDefault().Components.Storage;
                    }

                default:
                    {
                        throw new Exception("ComponentType undefined");
                    }
            }
        }
Exemple #8
0
 public Component(List<Member> members, List<Bearing> bearings, List<PlateConnector> plateConnectors, ComponentType componentType, string name = "")
 {
     this.Name = name;
     this.Members = members;
     this.Bearings = bearings;
     this.PlateConnectors = plateConnectors;
 }
Exemple #9
0
        /// <summary>
        ///     Adds the components to solution.
        /// </summary>
        /// <param name="sourceService">The source service.</param>
        /// <param name="destinationService">The destination service.</param>
        /// <param name="entityName">Name of the entity.</param>
        /// <param name="solutionComponentType">Type of the solution component.</param>
        /// <param name="componentType">Type of the component.</param>
        /// <param name="destinationDataSourceElement">The destination data source element.</param>
        /// <param name="context">The xrm activity context</param>
        /// <param name="noOfThreads">The no of threads.</param>
        /// <param name="checkManaged">
        ///     if set to <c>true</c> [check if component is managed and exclude from adding to the
        ///     solution].
        /// </param>
        public static void AddComponentsToSolution(string entityName,
            SolutionPackageType solutionComponentType,
            ComponentType componentType,
            XrmActivityContext context,
            bool checkManaged = true)
        {
            var columns = XrmMetadataHelperFunctions.GetNonSystemColumns(context.Source, entityName);

            var sourceEntities = XrmHelperFunctions.RetrieveMultipleByEntityName(
                context.Source, 
                entityName, 
                true,
                columns);

            var destinationEntities = XrmHelperFunctions.RetrieveMultipleByEntityName(
                context.Destination, 
                entityName,
                true,
                columns);

            AddComponentsToSolution(
                sourceEntities,
                destinationEntities,
                solutionComponentType,
                componentType,
                context,
                checkManaged);
        }
Exemple #10
0
        // ComponentType to render
        public static void Draw(GameTime gameTime, ComponentType RenderType)
        {
            // Update the time, create a temp list
            Engine.GameTime = gameTime;
            List<GameScreen> drawing = new List<GameScreen>();

            // Clear the back buffer
            GraphicsDevice.Clear(Color.Black);

            // Populate the temp list if the screen is visible
            foreach (GameScreen screen in GameScreens)
                if (screen.Visible)
                    drawing.Add(screen);

            // BlocksDraw and OverrideDrawBlocked logic
            for (int i = GameScreens.Count - 1; i >= 0; i--)
                if (GameScreens[i].BlocksDraw)
                {
                    if (i > 0)
                        for (int j = i - 1; j >= 0; j--)
                        {
                            if (!GameScreens[j].OverrideDrawBlocked)
                                drawing.Remove(GameScreens[j]);
                        }

                    break;
                }

            // Draw the remaining screens
            foreach (GameScreen screen in drawing)
                if (screen.Initialized)
                    screen.Draw(RenderType);
        }
 public Versions(ComponentType component, string name, string version)
 {
     string[] temp = version.Split(new char[] { '.' });
     this.Component = component;
     this.Name = name;
     this.MajorVersion = temp[0];
     this.MinorVersion = temp[1];
 }
 public ComponentBase(ComponentType type, int x, int y, int ID)
 {
     base.ID = ID;
     this.ComponentType = type;
     this.area = new Rectangle(x, y, 30, 30);
     this.Ports = new List<Port>();
     InitPort();
 }
Exemple #13
0
    public SBAbstractComponent ComponentForType(ComponentType componentType)
    {
        foreach (SBAbstractComponent component in components) {
            if (component.componentType == componentType) return component;
        }

        return null;
    }
Exemple #14
0
        public void AddComponent(Entity entity, ComponentType componentType, IComponent component)
        {
            _componentsByType.EnsureCapacity(componentType.Index+1);
            var components = GetComponentsOfType(componentType);
            components[entity.Id] = component;

            entity.ComponentBits.Set(componentType.Index, true);
        }
Exemple #15
0
 public List<ImAbstractComponent> ComponentsForType(ComponentType type)
 {
     List<ImAbstractComponent> comps = new List<ImAbstractComponent>();
     foreach (string key in components_.Keys) {
         if (components_[key].componentType == type) comps.Add(components_[key]);
     }
     return comps;
 }
Exemple #16
0
        /// <summary>
        /// Creates SolverNodeInfo instance.
        /// </summary>
        /// <param name="type">Type of the component.</param>
        /// <param name="solvableProblems">Collection of solvable problem types.</param>
        /// <param name="numberOfThreads">Number of threads provided by the component.</param>
        public SolverNodeInfo(ComponentType type, ICollection<string> solvableProblems, byte numberOfThreads)
            : base(type, numberOfThreads)
        {
            if (type != ComponentType.ComputationalNode && type != ComponentType.TaskManager)
                throw new ArgumentException("Component type is neither Task Manager nor Computational Node.");

            SolvableProblems = solvableProblems;
        }
Exemple #17
0
 public void RemoveComponent(Entity entity, ComponentType type)
 {
     if (entity.ComponentBits[type.Index])
     {
         _componentsByType[type.Index][entity.Id] = null;
         entity.ComponentBits[type.Index] = false;
     }
 }
Exemple #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphNode"/> class.
 /// </summary>
 /// <param name="nodeType">Type of the node.</param>
 /// <param name="texts">The texts.</param>
 /// <param name="pnt">The PNT.</param>
 /// <param name="sizef">The sizef.</param>
 /// Created by SMK 
 public GraphNode(ComponentType nodeType, string texts, Point pnt, SizeF sizef)
     : base(texts, nodeType, sizef)
 {
     this.sizef = sizef;
     area = new Rectangle(pnt.X, pnt.Y, Convert.ToInt32(sizef.Width) + Config.FUNCTION_DELTA_WIDTH + Config.GRAPH_NODE_TYPE_WIDTH,
                         Config.FUNCTION_HEIGHT_UNIT);
     InitPort();
 }
Exemple #19
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Component"/> class.
		/// </summary>
		/// <param name="ctype">The ctype.</param>
		public Component(ComponentType ctype)
			: this(CreateCppInstance<IComponent>())
		{
			var descriptor = new ComponentDescriptor();
			Native.Construct(ref descriptor, ctype);

			Initialize(descriptor);
		}
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Function"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="name">The name.</param>
 /// <param name="pnt">The PNT.</param>
 /// <param name="sizef">The sizef.</param>
 /// <param name="lstPorts">The LST ports.</param>
 /// Created by SMK
 public Function(ComponentType type, Point pnt, XsltFunction func)
     : base(func.Name, type)
 {
     this.ObjFunction = func;
     area = new Rectangle(pnt.X, pnt.Y, Convert.ToInt32(func.CaptionSizeF.Width + func.TypeSizeF.Width) + Config.FUNCTION_DELTA_WIDTH + Config.IMAGE_SPRITE_WIDTH,
                          Config.FUNCTION_HEIGHT);
      InitPort();
 }
Exemple #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Function"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="name">The name.</param>
 /// <param name="sizef">The sizef.</param>
 /// Created by SMK 
 public Function(ComponentType type, string name, Point pnt, SizeF sizef)
     : base(name, type)
 {
     this.sizef = sizef;
     area = new Rectangle(pnt.X, pnt.Y, Convert.ToInt32(sizef.Width) + Config.FUNCTION_DELTA_WIDTH + Config.FUNCTION_TYPE_WIDTH + Config.IMAGE_SPRITE_WIDTH,
                          Config.FUNCTION_HEIGHT);
     InitPort();
 }
Exemple #22
0
 public bool HasComponent(ComponentType type)
 {
     if (this._components.ContainsKey(type))
     {
         return true;
     }
     return false;
 }
        public MediaConfiguration( ComponentType mediaType, ComponentParameters parameters )
            : base(parameters)
        {
            InitializeComponent();

            _mediaType = mediaType;

            this.Fill();
        }
Exemple #24
0
        public Component GetComponent(ComponentType type)
        {
            if (m_components != null && m_components.ContainsKey(type))
            {
                return m_components[type];
            }

            return null;
        }
 public void AddComponentsToSolution(XrmActivityContext context, string entityName,
     SolutionPackageType packageType,
     ComponentType componentType)
 {
     XrmMetadataDiff.AddComponentsToSolution(
         EntityName.kbarticletemplate,
         SolutionPackageType.Entity,
         ComponentType.KbArticleTemplate,
         context);
 }
Exemple #26
0
 public Bag<IComponent> GetComponentsOfType(ComponentType componentType)
 {
     Bag<IComponent> components = _componentsByType[componentType.Index];
     if (components == null)
     {
         components = new Bag<IComponent>();
         _componentsByType[componentType.Index] = components;
     }
     return components;
 }
 public static IEnumerable<ShipComponent> GetShipComponentsOfType(ComponentType type)
 {
     #if FULL_DEBUG
     if(comp_id_table == null || comp_id_table.Count == 0)
     {
         Debug.LogError("No components in table");
         return null;
     }
     #endif
     return comp_id_table.Keys.Where(comp => comp.CompType == type);
 }
Exemple #28
0
 public static Component CreateComponent(string name, string description, string options, ComponentType type, PowerPoint.Shape shape)
 {
     return new Component()
     {
         DisplayName = name,
         Description = description,
         Options = options,
         Shape = shape,
         CompoType = type,
     };
 }
Exemple #29
0
 public ObjectComponent GetComponent(ComponentType type)
 {
     if (this._components.ContainsKey(type))
     {
         return this._components[type];
     }
     else
     {
         return null;
     }
 }
        protected ComponentBase(string name, IDictionary<string, string> values, ComponentType componentType)
        {
            Index = -1;

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("no name given");
            }

            Name = name;
            ComponentTypeEnum = componentType;
            AssignValues(values);
        }
        public static void Initialize(StockContext context)
        {
            context.Database.EnsureCreated();

            //check if there db was already created
            if (context.Components.Any())
            {
                return;
            }

            var categories = new Category[]
            {
                new Category {
                    Name = "IoT"
                },
                new Category {
                    Name = "Tablet"
                },
                new Category {
                    Name = "PC"
                },
                new Category {
                    Name = "Smartphone"
                }
            };

            foreach (Category c in categories)
            {
                context.Categories.Add(c);
            }

            context.SaveChanges();


            var componentTypes = new ComponentType[]
            {
                new ComponentType {
                    ComponentTypeName = "Photon", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.Available
                },
                new ComponentType {
                    ComponentTypeName = "Electron", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.Available
                },
                new ComponentType {
                    ComponentTypeName = "Samsung Galaxy s7", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.Available
                },
                new ComponentType {
                    ComponentTypeName = "LG G6", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.Available
                },
                new ComponentType {
                    ComponentTypeName = "Lenovo 342", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.Available
                },
                new ComponentType {
                    ComponentTypeName = "Dell XPS 1000", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.Available
                },
                new ComponentType {
                    ComponentTypeName = "Dell Inspiron", ComponentInfo = "", AdminComment = "", Datasheet = "", ImageUrl = "", Manufacturer = "", WikiLink = "", Location = "", Image = new ESImage(), Status = ComponentTypeStatus.ReservedAdmin
                }
            };


            foreach (ComponentType c in componentTypes)
            {
                context.ComponentTypes.Add(c);
            }

            context.SaveChanges();

            var components = new Component[]
            {
                new Component {
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Photon").ComponentTypeID,
                    ComponentNumber = 123, Status = ComponentStatus.ReservedAdmin, AdminComment = "", SerialNo = "123", UserComment = "m", CurrentLoanInformationId = 2612
                },

                /*new Component{ComponentNumber=32, Status=ComponentStatus.Available, AdminComment="", SerialNo="32", UserComment="hdgm", CurrentLoanInformationId=1552 },
                 * new Component{ComponentNumber=54, Status=ComponentStatus.ReservedAdmin, AdminComment="", SerialNo="54", UserComment="mfdg", CurrentLoanInformationId=142 },
                 * new Component{ComponentNumber=234, Status=ComponentStatus.ReservedAdmin, AdminComment="", SerialNo="234", UserComment="mhg", CurrentLoanInformationId=112 },
                 * new Component{ComponentNumber=653, Status=ComponentStatus.ReservedAdmin, AdminComment="", SerialNo="653", UserComment="mdg", CurrentLoanInformationId=162 },
                 * new Component{ComponentNumber=676, Status=ComponentStatus.ReservedAdmin, AdminComment="", SerialNo="676", UserComment="mgh", CurrentLoanInformationId=142 }
                 */
            };


            foreach (Component c in components)
            {
                context.Components.Add(c);
            }

            context.SaveChanges();

            var ctc = new ComponentTypeCategory[]
            {
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "IoT").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Photon").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "IoT").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Electron").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "Smartphone").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Samsung Galaxy s7").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "Smartphone").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "LG G6").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "PC").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Dell XPS 1000").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "PC").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Dell Inspiron").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "PC").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "Lenovo 342").ComponentTypeID
                },
                new ComponentTypeCategory {
                    CategoryID      = categories.Single(c => c.Name == "IoT").CategoryID,
                    ComponentTypeID = componentTypes.Single(ct => ct.ComponentTypeName == "LG G6").ComponentTypeID
                }
            };


            foreach (ComponentTypeCategory c in ctc)
            {
                context.ComponentTypeCategories.Add(c);
            }

            context.SaveChanges();
        }
        protected override void OnCreate()
        {
            for (int i = 0; i < LoadScenesPerFrame; ++i)
            {
                CreateStreamWorld(i);
            }

            m_SynchronousSceneLoadWorld = new World("LoadingWorld (synchronous)", WorldFlags.Streaming);
            AddStreamingWorldSystems(m_SynchronousSceneLoadWorld);

            m_PendingStreamRequests = GetEntityQuery(new EntityQueryDesc()
            {
                All  = new[] { ComponentType.ReadWrite <RequestSceneLoaded>(), ComponentType.ReadWrite <SceneSectionData>(), ComponentType.ReadWrite <ResolvedSectionPath>() },
                None = new[] { ComponentType.ReadWrite <StreamingState>(), ComponentType.ReadWrite <DisableSceneResolveAndLoad>() }
            });

            m_UnloadStreamRequests = GetEntityQuery(new EntityQueryDesc()
            {
                All  = new[] { ComponentType.ReadWrite <StreamingState>() },
                None = new[] { ComponentType.ReadWrite <RequestSceneLoaded>(), ComponentType.ReadWrite <DisableSceneResolveAndLoad>() }
            });

            m_PublicRefFilter = GetEntityQuery
                                (
                ComponentType.ReadWrite <SceneTag>(),
                ComponentType.ReadWrite <PublicEntityRef>()
                                );

            m_SectionData = GetEntityQuery
                            (
                ComponentType.ReadWrite <SceneSectionData>()
                            );

            m_SceneFilter = GetEntityQuery(
                new EntityQueryDesc
            {
                All     = new[] { ComponentType.ReadWrite <SceneTag>() },
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            }
                );
        }
    protected override void OnUpdate()
    {
        var manager = EntityManager;
        var query   = GetEntityQuery(
            ComponentType.ReadOnly <Translation>(),
            ComponentType.ReadOnly <ProcessProjectileCollisionTag>()
            );
        var entities    = query.ToEntityArray(Allocator.TempJob);
        var processData = query.ToComponentDataArray <ProcessProjectileCollisionTag>(Allocator.TempJob);
        var translation = query.ToComponentDataArray <Translation>(Allocator.TempJob);

        for (int i = 0; i < entities.Length; i++)
        {
            if (processData[i].hittedByProjectile && !processData[i].olreadyProceeded)
            {
                var temp = processData[i];
                temp.olreadyProceeded   = true;
                temp.hittedByProjectile = false;
                processData[i]          = temp;
                manager.SetComponentData(entities[i], processData[i]);

                if (manager.HasComponent <HealthComponentData>(entities[i]))
                {
                    var health = manager.GetComponentData <HealthComponentData>(entities[i]);
                    health.value -= processData[i].processData.damage;
                    manager.SetComponentData(entities[i], health);
                }

                switch (processData[i].processData.type)
                {
                case HitProcessingType.REMOVE:
                    manager.DestroyEntity(entities[i]);
                    break;

                case HitProcessingType.SET_ANIMATION:
                    AnimationSetterUtil.SetAnimation(manager, entities[i], processData[i].processData.animation);
                    break;

                case HitProcessingType.REMOVE_WITH_DELAY:
                    DestroyEntityWithDelaySystem.MarkToDestroy(manager, entities[i], processData[i].processData.destroyDelay);
                    break;

                case HitProcessingType.SET_ANIMATION_AND_REMOVE_WITH_DELAY:
                    AnimationSetterUtil.SetAnimation(manager, entities[i], processData[i].processData.animation);
                    DestroyEntityWithDelaySystem.MarkToDestroy(manager, entities[i], processData[i].processData.destroyDelay);
                    break;

                case HitProcessingType.LAUNCH_AS_PROJECTILE:
                    LaunchProjectileSystem.Launch(
                        manager,
                        entities[i],
                        translation[i].Value.ToF2() + processData[i].processData.direction + UnityEngine.Random.Range(-1, 1),
                        processData[i].processData.absoluteProjectileVelocity,
                        processData[i].processData.direction,
                        processData[i].processData.destroyDelay
                        );
                    break;

                case HitProcessingType.SET_ANIMATION_AND_LAUNCH_AS_PROJECTILE:
                    AnimationSetterUtil.SetAnimation(manager, entities[i], processData[i].processData.animation);
                    LaunchProjectileSystem.Launch(
                        manager,
                        entities[i],
                        translation[i].Value.ToF2() + processData[i].processData.direction + UnityEngine.Random.Range(-1, 1),
                        processData[i].processData.absoluteProjectileVelocity,
                        processData[i].processData.direction,
                        processData[i].processData.destroyDelay
                        );
                    break;
                }
            }
        }

        entities.Dispose();
        processData.Dispose();
        translation.Dispose();
    }
Exemple #34
0
 public System_RobotWeaponA(GameWorld world) : base(world)
 {
     ExtraComponentRequirements = new[] { ComponentType.Exclude <DespawningEntity>() };
 }
Exemple #35
0
    protected override void OnUpdate()
    {
        var ecb = ecbSystem.CreateCommandBuffer().ToConcurrent();

        var queries = GetEntityQuery(ComponentType.ReadOnly(typeof(FormationSetup)));

        if (queries.CalculateEntityCount() == 0)
        {
            return;
        }

        //Timer specific
        Job.WithoutBurst().WithCode(() =>
        {
            timer.Start();
        }).Schedule();
        //Timer specific

        NativeArray <FormationSetupData> formationEntityToSetup = new NativeArray <FormationSetupData>(queries.CalculateEntityCount(), Allocator.TempJob);

        float maxSpeed = Blackboard.Instance.MaxSpeed;

        Entities.ForEach((
                             Entity entity,
                             int entityInQueryIndex,
                             ref Formation formation,
                             in FormationSetup formationSetup) =>
        {
            formation.speedFormed = maxSpeed;

            formationEntityToSetup[entityInQueryIndex] = new FormationSetupData()
            {
                entity = entity, formation = formation, setup = formationSetup, count = 1
            };

            ecb.RemoveComponent <FormationSetup>(entityInQueryIndex, entity);
        }).ScheduleParallel();


        //Update leaders
        // Entities.WithoutBurst().WithReadOnly(formationEntityToSetup).ForEach((in FormationLeader formationLeader) =>
        // {
        //     for (int i = 0; i < formationEntityToSetup.Length; i++)
        //     {
        //         if (formationEntityToSetup[i].entity == formationLeader.formationEntity)
        //         {
        //             //TODO Setup
        //             break;
        //         }
        //     }
        // }).Run();

        //Update followers
        Entities.WithDeallocateOnJobCompletion(formationEntityToSetup).ForEach((ref FormationFollower follower, ref Velocity velocity) =>
        {
            for (int i = 0; i < formationEntityToSetup.Length; i++)
            {
                if (formationEntityToSetup[i].entity == follower.formationEntity)
                {
                    var setupData = formationEntityToSetup[i];

                    //Setup position id
                    follower.positionID = setupData.count;
                    setupData.count++;

                    velocity.maxSpeed = setupData.formation.speedFormed;

                    formationEntityToSetup[i] = setupData;
                    break;
                }
            }
        }).Schedule();

        ecbSystem.AddJobHandleForProducer(Dependency);

        //Timer specific
        Job.WithoutBurst().WithCode(() =>
        {
            double ticks        = timer.ElapsedTicks;
            double milliseconds = (ticks / Stopwatch.Frequency) * 1000;
            time = milliseconds;
            timer.Stop();
            timer.Reset();
        }).Schedule();
        timerRecoder.RegisterTimeInMS(time);
        //Timer specific
    }
Exemple #36
0
 protected override void OnCreateManager()
 {
     // Import
     SPHCharacterGroup = GetComponentGroup(ComponentType.ReadOnly(typeof(SPHParticle)), typeof(Position), typeof(SPHVelocity));
     SPHColliderGroup  = GetComponentGroup(ComponentType.ReadOnly(typeof(SPHCollider)));
 }
        public void ReadDefinitions(CircuitDiagramDocument document,
                                    XElement definitions,
                                    ReaderContext context)
        {
            var sources = from el in definitions.Elements()
                          where el.Name == Ns.Document + "src"
                          select el;

            foreach (var source in sources)
            {
                var collection     = ComponentType.UnknownCollection;
                var collectionAttr = source.Attribute("col");
                if (collectionAttr != null)
                {
                    if (!Uri.TryCreate(collectionAttr.Value, UriKind.Absolute, out collection))
                    {
                        context.Log(ReaderErrorCodes.UnableToParseValueAsUri, collectionAttr, collectionAttr.Value);
                    }
                }

                foreach (var componentType in source.Elements().Where(el => el.Name == Ns.Document + "add"))
                {
                    var idAttr = componentType.Attribute("id");
                    if (idAttr == null)
                    {
                        context.Log(ReaderErrorCodes.MissingRequiredAttribute, componentType, "id");
                        continue;
                    }
                    string id = idAttr.Value;

                    var guid           = componentType.GetGuidAttribute(Ns.DocumentComponentDescriptions + "guid", context);
                    var collectionItem = componentType.GetCollectionItemAttribute("item", context);
                    var name           = componentType.GetComponentNameAttribute("name", context);

                    var type = collectionItem != null ? new ComponentType(collection ?? ComponentType.UnknownCollection, collectionItem) : ComponentType.Unknown(name ?? guid.ToString());

                    if (guid.HasValue)
                    {
                        type = new TypeDescriptionComponentType(guid ?? Guid.Empty, type);
                    }

                    context.RegisterComponentType(id, type);
                }
            }
        }
            public override void OnAddComponent(AddComponentOp op)
            {
                var entity = TryGetEntityFromEntityId(op.EntityId);

                Profiler.BeginSample("ExhaustiveRepeated");
                var data = Improbable.Gdk.Tests.ExhaustiveRepeated.Serialization.Deserialize(op.Data.SchemaData.Value.GetFields(), World);

                data.MarkDataClean();
                entityManager.AddComponentData(entity, data);
                entityManager.AddComponent(entity, ComponentType.Create <NotAuthoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >());

                var update = new Improbable.Gdk.Tests.ExhaustiveRepeated.Update
                {
                    Field1  = data.Field1,
                    Field2  = data.Field2,
                    Field3  = data.Field3,
                    Field4  = data.Field4,
                    Field5  = data.Field5,
                    Field6  = data.Field6,
                    Field7  = data.Field7,
                    Field8  = data.Field8,
                    Field9  = data.Field9,
                    Field10 = data.Field10,
                    Field11 = data.Field11,
                    Field12 = data.Field12,
                    Field13 = data.Field13,
                    Field14 = data.Field14,
                    Field15 = data.Field15,
                    Field16 = data.Field16,
                    Field17 = data.Field17,
                };

                var updates = new List <Improbable.Gdk.Tests.ExhaustiveRepeated.Update>
                {
                    update
                };

                var updatesComponent = new Improbable.Gdk.Tests.ExhaustiveRepeated.ReceivedUpdates
                {
                    handle = ReferenceTypeProviders.UpdatesProvider.Allocate(World)
                };

                ReferenceTypeProviders.UpdatesProvider.Set(updatesComponent.handle, updates);
                entityManager.AddComponentData(entity, updatesComponent);

                if (entityManager.HasComponent <ComponentRemoved <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                {
                    entityManager.RemoveComponent <ComponentRemoved <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity);
                }
                else if (!entityManager.HasComponent <ComponentAdded <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                {
                    entityManager.AddComponent(entity, ComponentType.Create <ComponentAdded <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >());
                }
                else
                {
                    LogDispatcher.HandleLog(LogType.Error, new LogEvent(ReceivedDuplicateComponentAdded)
                                            .WithField(LoggingUtils.LoggerName, LoggerName)
                                            .WithField(LoggingUtils.EntityId, op.EntityId.Id)
                                            .WithField("Component", "Improbable.Gdk.Tests.ExhaustiveRepeated")
                                            );
                }

                Profiler.EndSample();
            }
        /// <summary>
        /// Adds a new component to the project.
        /// </summary>
        /// <param name="name">The name of the new component.</param>
        /// <param name="type">The type of component to create.</param>
        /// <param name="content">The VBA code associated to the component.</param>
        /// <param name="selection"></param>
        /// <returns>Returns the <see cref="MockProjectBuilder"/> instance.</returns>
        public MockProjectBuilder AddComponent(string name, ComponentType type, string content, Selection selection = new Selection())
        {
            var component = CreateComponentMock(name, type, content, selection);

            return(AddComponent(component));
        }
            private void ApplyAuthorityChange(Unity.Entities.Entity entity, Authority authority, global::Improbable.Worker.EntityId entityId)
            {
                switch (authority)
                {
                case Authority.Authoritative:
                    if (!entityManager.HasComponent <NotAuthoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                    {
                        LogInvalidAuthorityTransition(Authority.Authoritative, Authority.NotAuthoritative, entityId);
                        return;
                    }

                    entityManager.RemoveComponent <NotAuthoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity);
                    entityManager.AddComponent(entity, ComponentType.Create <Authoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >());

                    // Add event senders
                    break;

                case Authority.AuthorityLossImminent:
                    if (!entityManager.HasComponent <Authoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                    {
                        LogInvalidAuthorityTransition(Authority.AuthorityLossImminent, Authority.Authoritative, entityId);
                        return;
                    }

                    entityManager.AddComponent(entity, ComponentType.Create <AuthorityLossImminent <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >());
                    break;

                case Authority.NotAuthoritative:
                    if (!entityManager.HasComponent <Authoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                    {
                        LogInvalidAuthorityTransition(Authority.NotAuthoritative, Authority.Authoritative, entityId);
                        return;
                    }

                    if (entityManager.HasComponent <AuthorityLossImminent <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                    {
                        entityManager.RemoveComponent <AuthorityLossImminent <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity);
                    }

                    entityManager.RemoveComponent <Authoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity);
                    entityManager.AddComponent(entity, ComponentType.Create <NotAuthoritative <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >());

                    // Remove event senders
                    break;
                }

                List <Authority> authorityChanges;

                if (entityManager.HasComponent <AuthorityChanges <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity))
                {
                    authorityChanges = entityManager.GetComponentData <AuthorityChanges <Improbable.Gdk.Tests.ExhaustiveRepeated.Component> >(entity).Changes;
                }
                else
                {
                    var changes = new AuthorityChanges <Improbable.Gdk.Tests.ExhaustiveRepeated.Component>
                    {
                        Handle = AuthorityChangesProvider.Allocate(World)
                    };
                    AuthorityChangesProvider.Set(changes.Handle, new List <Authority>());
                    authorityChanges = changes.Changes;
                    entityManager.AddComponentData(entity, changes);
                }

                authorityChanges.Add(authority);
            }
 public ComponentStatus(ComponentType type)
 {
     this.Type = type;
 }
        public void ExcelUdfNameIsValidCellReferenceInspection_ReturnsNoResult_NonStandardModule(ComponentType moduleType)
        {
            const string code =
                @"Public Function A1() As Long
    A1 = 42
End Function
";

            Assert.AreEqual(0, InspectionResultCount(code, moduleType));
        }
        internal static int CompareTypes(ComponentType x, ComponentType y)
        {
            var accessModeOrder = SortOrderFromAccessMode(x.AccessModeType).CompareTo(SortOrderFromAccessMode(y.AccessModeType));

            return(accessModeOrder != 0 ? accessModeOrder : String.Compare(x.GetManagedType().Name, y.GetManagedType().Name, StringComparison.InvariantCulture));
        }
Exemple #44
0
 public IVBComponent Add(ComponentType type)
 {
     return(AddInternal(type, "test"));
 }
Exemple #45
0
 public string MapTypeToMessage(ComponentType type) => type.ToString(); // todo : swap to descriptions of type
Exemple #46
0
        void InitializePlayer(uint2 range, int maxLife, float temperature, float thermalDeathPoint)
        {
            player = manager.CreateEntity(ComponentType.Create <Position>(), ComponentType.Create <MeshInstanceRenderer>(), ComponentType.Create <Controlable>(), ComponentType.Create <MoveSpeed>(), ComponentType.Create <PlayerSettings>(), ComponentType.Create <Heading2D>(), ComponentType.Create <SkillElement>());
            var buffer = manager.GetBuffer <SkillElement>(player);

            for (int i = 0; i < this.playerSkills.Length; ++i)
            {
                buffer.Add(new SkillElement((uint)(i + 1), playerSkills[i].CoolTime));
            }
            manager.SetSharedComponentData(player, new MeshInstanceRenderer
            {
                mesh           = RotateSprite(playerSprite),
                material       = playerMaterial,
                castShadows    = ShadowCastingMode.Off,
                receiveShadows = false,
                subMesh        = 0,
            });
            manager.SetComponentData(player, new Position
            {
                Value = new float3(range.x * 0.5f, 0, range.y * 0.5f)
            });
            manager.SetComponentData(player, new PlayerSettings
            {
                Life              = maxLife,
                MaxLife           = maxLife,
                Temperature       = temperature,
                ThermalDeathPoint = thermalDeathPoint,
            });
        }
 public ScalabilityCache(IStorage storage, IIndexStrategy indexStrategy, ComponentType ownerComponent, long minReservedMemoryBytes)
     : base(storage, 3000L, 0.2, ownerComponent, minReservedMemoryBytes)
 {
     m_cachePriority = new LinkedLRUCache <StorageItem>();
     m_offsetMap     = indexStrategy;
 }
Exemple #48
0
 private static bool IsDefaultAttribute(ComponentType componentType, string attributeName, IReadOnlyList <string> attributeValues)
 {
     return(Attributes.IsDefaultAttribute(componentType, attributeName, attributeValues));
 }
Exemple #49
0
        public void ReleaseBlobAsset(EntityManager entityManager, ulong hash)
        {
            var blobAssets = (BlobAssetPtr *)m_BlobAssets->Ptr;

            for (var i = 0; i < m_BlobAssets->Length; i++)
            {
                if (blobAssets[i].Hash != hash)
                {
                    continue;
                }

                var entity = entityManager.CreateEntity(ComponentType.ReadWrite <RetainBlobAssets>(), ComponentType.ReadWrite <RetainBlobAssetPtr>());
                entityManager.SetComponentData(entity, new RetainBlobAssets {
                    FramesToRetainBlobAssets = m_FramesToRetainBlobAssets
                });
                entityManager.SetComponentData(entity, new RetainBlobAssetPtr {
                    BlobAsset = blobAssets[i].Header
                });

                // Entity lifetime will be bound to the SystemStateComponents we added above, we can safely call DestroyEntity(),
                //  it will be actually destroyed when both components will be removed at cleanup.
                entityManager.DestroyEntity(entity);

                m_BlobAssets->RemoveAtSwapBack <BlobAssetPtr>(i);
                return;
            }
        }
Exemple #50
0
 protected override void OnCreate()
 {
     base.OnCreate();
     eq = GetEntityQuery(new ComponentType[] { new ComponentType(typeof(UnityArmatureComponent)),
                                               new ComponentType(typeof(Translation)), ComponentType.ReadWrite <NonUniformScale>() });
     RequireForUpdate(eq);
 }
 public ProjectileLauncher_Update(GameWorld world) : base(world)
 {
     ExtraComponentRequirements = new ComponentType[] { typeof(ServerEntity) };
 }
    void Start()
    {
        entityManager = World.Active.GetOrCreateManager <EntityManager>();
        createFilterTex();
        EntityArchetype zoneArrayArchetype = entityManager.CreateArchetype(typeof(ZoneColorArray), typeof(Position), typeof(Rotation), ComponentType.Create <TransformMatrix>(), ComponentType.Create <MeshInstanceRenderer>());

        CreateZoneArray(zoneArrayArchetype);
        EntityArchetype fireflyArchetype = entityManager.CreateArchetype(typeof(Firefly), typeof(Scale), typeof(Position), typeof(Heading), typeof(MoveSpeed), ComponentType.Create <TransformMatrix>(), ComponentType.Create <MeshInstanceRenderer>());

        Createfirefly(fireflyArchetype);
        EntityArchetype zoneColorArchetype = entityManager.CreateArchetype(typeof(ZoneColor));

        CreateZoneColor(zoneColorArchetype, fireflyArchetype);
    }
Exemple #53
0
 /// <inheritdoc/>
 protected override void OnCreate()
 {
     //These are here to inform the system runner the queries we are interested in. Without these calls, OnUpdate() might not be called
     GetEntityQuery(ComponentType.Exclude <GroundTruthInfo>(), ComponentType.ReadOnly <Labeling>());
     GetEntityQuery(ComponentType.ReadOnly <GroundTruthInfo>(), ComponentType.ReadOnly <Labeling>());
 }
Exemple #54
0
        protected override void OnCreateManager()
        {
            var componentTypes = new ComponentType[] { ComponentType.Create <AnimationSpriteData>(), ComponentType.ReadOnly <PositionData>(),
                                                       ComponentType.ReadOnly <SpriteMeshesData>(), ComponentType.ReadOnly <DistanceFromCameraData>() };

            group = GetComponentGroup(componentTypes);
        }
Exemple #55
0
 protected override void OnCreate()
 {
     m_Group = GetEntityQuery(ComponentType.ReadWrite <InputComponent>());
 }
Exemple #56
0
 protected override ComponentCharacteristic CreateCharacteristic(string name, ComponentType compType)
 {
     return(new BoolCharacteristic(name, compType));
 }
 private static unsafe IEnumerable <ComponentType> ReadOnlyTypes <T>(IntPtr ptr) where T : struct, IRuntimeComponentAccessor
 {
     return(UnsafeUtility.AsRef <T>((void *)ptr).ComponentAccessList.Select(t => ComponentType.ReadOnly(t.TypeIndex)));
 }
Exemple #58
0
 public string MapTypeToCode(ComponentType type) => type.ToString();
 private int InspectionResultCount(string inputCode, ComponentType moduleType)
 => InspectionResultsForModules(("UnderTest", inputCode, moduleType), "Excel").Count();
Exemple #60
0
        public void JobProcessComponentWithEntityGroupCorrect()
        {
            ComponentType[] expectedTypes = { ComponentType.ReadOnly <EcsTestData>(), ComponentType.ReadWrite <EcsTestData2>(), ComponentType.ReadWrite <EcsTestData3>() };

            new Process3Entity().Run(EmptySystem);
            var group = EmptySystem.GetEntityQuery(expectedTypes);

            Assert.AreEqual(1, EmptySystem.EntityQueries.Length);
            Assert.IsTrue(EmptySystem.EntityQueries[0].CompareComponents(expectedTypes));
            Assert.AreEqual(group, EmptySystem.EntityQueries[0]);
        }