Exemple #1
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Register <Blazorise.Addons, Bulma.Addons>();
     componentMapper.Register <Blazorise.BarToggler, Bulma.BarToggler>();
     componentMapper.Register <Blazorise.BarDropdown, Bulma.BarDropdown>();
     componentMapper.Register <Blazorise.Breadcrumb, Bulma.Breadcrumb>();
     componentMapper.Register <Blazorise.BreadcrumbLink, Bulma.BreadcrumbLink>();
     componentMapper.Register <Blazorise.CardImage, Bulma.CardImage>();
     componentMapper.Register <Blazorise.CardSubtitle, Bulma.CardSubtitle>();
     componentMapper.Register <Blazorise.CheckEdit, Bulma.CheckEdit>();
     componentMapper.Register <Blazorise.DateEdit, Bulma.DateEdit>();
     componentMapper.Register <Blazorise.DropdownDivider, Bulma.DropdownDivider>();
     componentMapper.Register <Blazorise.DropdownMenu, Bulma.DropdownMenu>();
     componentMapper.Register <Blazorise.DropdownToggle, Bulma.DropdownToggle>();
     componentMapper.Register <Blazorise.Field, Bulma.Field>();
     componentMapper.Register <Blazorise.FieldLabel, Bulma.FieldLabel>();
     componentMapper.Register <Blazorise.FieldHelp, Bulma.FieldHelp>();
     componentMapper.Register <Blazorise.FieldBody, Bulma.FieldBody>();
     componentMapper.Register <Blazorise.Fields, Bulma.Fields>();
     componentMapper.Register <Blazorise.FileEdit, Bulma.FileEdit>();
     componentMapper.Register <Blazorise.MemoEdit, Bulma.MemoEdit>();
     componentMapper.Register(typeof(Blazorise.SelectEdit <>), typeof(Bulma.SelectEdit <>));
     componentMapper.Register <Blazorise.Button, Bulma.Button>();
     componentMapper.Register <Blazorise.Tabs, Bulma.Tabs>();
     componentMapper.Register <Blazorise.TextEdit, Bulma.TextEdit>();
     componentMapper.Register(typeof(Blazorise.NumericEdit <>), typeof(Bulma.NumericEdit <>));
     componentMapper.Register <Blazorise.Pagination, Bulma.Pagination>();
 }
Exemple #2
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Register <Blazorise.Addon, Frolic.Addon>();
     componentMapper.Register <Blazorise.BarBrand, Frolic.BarBrand>();
     componentMapper.Register <Blazorise.BarDropdownToggle, Frolic.BarDropdownToggle>();
     componentMapper.Register <Blazorise.BarEnd, Frolic.BarEnd>();
     componentMapper.Register <Blazorise.BarItem, Frolic.BarItem>();
     componentMapper.Register <Blazorise.BarStart, Frolic.BarStart>();
     componentMapper.Register <Blazorise.BarToggler, Frolic.BarToggler>();
     componentMapper.Register <Blazorise.Breadcrumb, Frolic.Breadcrumb>();
     componentMapper.Register <Blazorise.CardText, Frolic.CardText>();
     componentMapper.Register <Blazorise.CardTitle, Frolic.CardTitle>();
     componentMapper.Register <Blazorise.Carousel, Frolic.Carousel>();
     componentMapper.Register(typeof(Blazorise.Check <>), typeof(Frolic.Check <>));
     componentMapper.Register(typeof(Blazorise.Radio <>), typeof(Frolic.Radio <>));
     componentMapper.Register(typeof(Blazorise.Switch <>), typeof(Frolic.Switch <>));
     componentMapper.Register <Blazorise.DisplayHeading, Frolic.DisplayHeading>();
     componentMapper.Register <Blazorise.Dropdown, Frolic.Dropdown>();
     componentMapper.Register <Blazorise.DropdownToggle, Frolic.DropdownToggle>();
     componentMapper.Register <Blazorise.Field, Frolic.Field>();
     componentMapper.Register <Blazorise.Jumbotron, Frolic.Jumbotron>();
     componentMapper.Register <Blazorise.JumbotronSubtitle, Frolic.JumbotronSubtitle>();
     componentMapper.Register <Blazorise.Pagination, Frolic.Pagination>();
     componentMapper.Register <Blazorise.ProgressBar, Frolic.ProgressBar>();
     componentMapper.Register <Blazorise.Progress, Frolic.Progress>();
     componentMapper.Register <Blazorise.Button, Frolic.Button>();
     componentMapper.Register <Blazorise.Tabs, Frolic.Tabs>();
 }
Exemple #3
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Register <Blazorise.Addon, Frolic.Addon>();
     componentMapper.Register <Blazorise.Bar, Frolic.Bar>();
     componentMapper.Register <Blazorise.BarBrand, Frolic.BarBrand>();
     componentMapper.Register <Blazorise.BarDropdownToggle, Frolic.BarDropdownToggle>();
     componentMapper.Register <Blazorise.BarEnd, Frolic.BarEnd>();
     componentMapper.Register <Blazorise.BarItem, Frolic.BarItem>();
     componentMapper.Register <Blazorise.BarMenu, Frolic.BarMenu>();
     componentMapper.Register <Blazorise.BarStart, Frolic.BarStart>();
     componentMapper.Register <Blazorise.BarToggler, Frolic.BarToggler>();
     componentMapper.Register <Blazorise.Breadcrumb, Frolic.Breadcrumb>();
     componentMapper.Register <Blazorise.CardText, Frolic.CardText>();
     componentMapper.Register <Blazorise.CardTitle, Frolic.CardTitle>();
     componentMapper.Register <Blazorise.CheckEdit, Frolic.CheckEdit>();
     componentMapper.Register <Blazorise.Dropdown, Frolic.Dropdown>();
     componentMapper.Register <Blazorise.DropdownToggle, Frolic.DropdownToggle>();
     componentMapper.Register <Blazorise.Field, Frolic.Field>();
     componentMapper.Register <Blazorise.Heading, Frolic.Heading>();
     componentMapper.Register <Blazorise.Pagination, Frolic.Pagination>();
     componentMapper.Register <Blazorise.ProgressBar, Frolic.ProgressBar>();
     componentMapper.Register <Blazorise.ProgressGroup, Frolic.ProgressGroup>();
     componentMapper.Register <Blazorise.SimpleButton, Frolic.SimpleButton>();
     componentMapper.Register <Blazorise.Tabs, Frolic.Tabs>();
 }
 public ICompositeConfiguratorRunnable Init()
 {
     _mapper = new ComponentMapper();
     _services.AddSingleton <IComponentMapper>(_mapper);
     _services.AddTransient <IInstanceInitializer, InstanceInitializer>();
     _services.AddTransient <IComponentInvoker, ComponentInvoker>();
     return(this);
 }
Exemple #5
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Register <Blazorise.Addons, AntDesign.Addons>();
     componentMapper.Register <Blazorise.Addon, AntDesign.Addon>();
     componentMapper.Register <Blazorise.AddonLabel, AntDesign.AddonLabel>();
     componentMapper.Register <Blazorise.AlertMessage, AntDesign.AlertMessage>();
     componentMapper.Register <Blazorise.AlertDescription, AntDesign.AlertDescription>();
     componentMapper.Register <Blazorise.Badge, AntDesign.Badge>();
     componentMapper.Register <Blazorise.Bar, AntDesign.Bar>();
     componentMapper.Register <Blazorise.BarBrand, AntDesign.BarBrand>();
     componentMapper.Register <Blazorise.BarIcon, AntDesign.BarIcon>();
     componentMapper.Register <Blazorise.BarItem, AntDesign.BarItem>();
     componentMapper.Register <Blazorise.BarMenu, AntDesign.BarMenu>();
     componentMapper.Register <Blazorise.BarStart, AntDesign.BarStart>();
     componentMapper.Register <Blazorise.BarEnd, AntDesign.BarEnd>();
     componentMapper.Register <Blazorise.BarDropdown, AntDesign.BarDropdown>();
     componentMapper.Register <Blazorise.BarLink, AntDesign.BarLink>();
     componentMapper.Register <Blazorise.BarDropdownMenu, AntDesign.BarDropdownMenu>();
     componentMapper.Register <Blazorise.BarDropdownItem, AntDesign.BarDropdownItem>();
     componentMapper.Register <Blazorise.BarDropdownToggle, AntDesign.BarDropdownToggle>();
     componentMapper.Register <Blazorise.BarToggler, AntDesign.BarToggler>();
     componentMapper.Register <Blazorise.Breadcrumb, AntDesign.Breadcrumb>();
     componentMapper.Register <Blazorise.BreadcrumbItem, AntDesign.BreadcrumbItem>();
     componentMapper.Register <Blazorise.BreadcrumbLink, AntDesign.BreadcrumbLink>();
     componentMapper.Register(typeof(Blazorise.Check <>), typeof(AntDesign.Check <>));
     componentMapper.Register <Blazorise.Button, AntDesign.Button>();
     componentMapper.Register <Blazorise.CardHeader, AntDesign.CardHeader>();
     componentMapper.Register <Blazorise.CardLink, AntDesign.CardLink>();
     componentMapper.Register <Blazorise.Carousel, AntDesign.Carousel>();
     componentMapper.Register <Blazorise.CloseButton, AntDesign.CloseButton>();
     componentMapper.Register <Blazorise.CollapseHeader, AntDesign.CollapseHeader>();
     componentMapper.Register <Blazorise.Dropdown, AntDesign.Dropdown>();
     componentMapper.Register <Blazorise.DropdownMenu, AntDesign.DropdownMenu>();
     componentMapper.Register <Blazorise.DropdownItem, AntDesign.DropdownItem>();
     componentMapper.Register <Blazorise.DropdownToggle, AntDesign.DropdownToggle>();
     componentMapper.Register <Blazorise.Field, AntDesign.Field>();
     componentMapper.Register <Blazorise.FieldBody, AntDesign.FieldBody>();
     componentMapper.Register <Blazorise.FieldLabel, AntDesign.FieldLabel>();
     componentMapper.Register <Blazorise.FileEdit, AntDesign.FileEdit>();
     componentMapper.Register <Blazorise.Heading, AntDesign.Heading>();
     componentMapper.Register <Blazorise.ListGroup, AntDesign.ListGroup>();
     componentMapper.Register <Blazorise.ModalBackdrop, AntDesign.ModalBackdrop>();
     componentMapper.Register <Blazorise.ModalContent, AntDesign.ModalContent>();
     componentMapper.Register <Blazorise.Progress, AntDesign.Progress>();
     componentMapper.Register(typeof(Blazorise.Select <>), typeof(AntDesign.Select <>));
     componentMapper.Register(typeof(Blazorise.SelectItem <>), typeof(AntDesign.SelectItem <>));
     componentMapper.Register <Blazorise.SelectGroup, AntDesign.SelectGroup>();
     componentMapper.Register(typeof(Blazorise.Radio <>), typeof(AntDesign.Radio <>));
     componentMapper.Register(typeof(Blazorise.Slider <>), typeof(AntDesign.Slider <>));
     componentMapper.Register(typeof(Blazorise.Switch <>), typeof(AntDesign.Switch <>));
     componentMapper.Register <Blazorise.Tabs, AntDesign.Tabs>();
     componentMapper.Register <Blazorise.Tab, AntDesign.Tab>();
     componentMapper.Register <Blazorise.TabPanel, AntDesign.TabPanel>();
     componentMapper.Register <Blazorise.TabsContent, AntDesign.TabsContent>();
     componentMapper.Register <Blazorise.Table, AntDesign.Table>();
     componentMapper.Register <Blazorise.TableRowHeader, AntDesign.TableRowHeader>();
     componentMapper.Register <Blazorise.TextEdit, AntDesign.TextEdit>();
 }
Exemple #6
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Register <Blazorise.Addon, Blazorise.Bootstrap.Addon>();
     componentMapper.Register <Blazorise.BarToggler, Blazorise.Bootstrap.BarToggler>();
     componentMapper.Register <Blazorise.BarDropdown, Blazorise.Bootstrap.BarDropdown>();
     componentMapper.Register <Blazorise.CardSubtitle, Blazorise.Bootstrap.CardSubtitle>();
     componentMapper.Register <Blazorise.CloseButton, Blazorise.Bootstrap.CloseButton>();
     componentMapper.Register <Blazorise.CheckEdit, Blazorise.Bootstrap.CheckEdit>();
     componentMapper.Register <Blazorise.Field, Blazorise.Bootstrap.Field>();
     componentMapper.Register <Blazorise.FieldBody, Blazorise.Bootstrap.FieldBody>();
     componentMapper.Register <Blazorise.FileEdit, Blazorise.Bootstrap.FileEdit>();
     componentMapper.Register <Blazorise.ModalContent, Blazorise.Bootstrap.ModalContent>();
 }
Exemple #7
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Register <Blazorise.Addon, Bootstrap.Addon>();
     componentMapper.Register <Blazorise.BarToggler, Bootstrap.BarToggler>();
     componentMapper.Register <Blazorise.BarDropdown, Bootstrap.BarDropdown>();
     componentMapper.Register <Blazorise.CardTitle, Bootstrap.CardTitle>();
     componentMapper.Register <Blazorise.CardSubtitle, Bootstrap.CardSubtitle>();
     componentMapper.Register <Blazorise.CloseButton, Bootstrap.CloseButton>();
     componentMapper.Register(typeof(Blazorise.Check <>), typeof(Bootstrap.Check <>));
     componentMapper.Register <Blazorise.Field, Bootstrap.Field>();
     componentMapper.Register <Blazorise.FieldBody, Bootstrap.FieldBody>();
     componentMapper.Register <Blazorise.FileEdit, Bootstrap.FileEdit>();
     componentMapper.Register <Blazorise.ModalContent, Bootstrap.ModalContent>();
     componentMapper.Register <Blazorise.Button, Bootstrap.Button>();
     componentMapper.Register(typeof(Blazorise.RadioGroup <>), typeof(Bootstrap.RadioGroup <>));
     componentMapper.Register(typeof(Blazorise.Radio <>), typeof(Bootstrap.Radio <>));
     componentMapper.Register(typeof(Blazorise.Switch <>), typeof(Bootstrap.Switch <>));
 }
        public static Component Execute(this IComponentMapper mapper, ComponentAction?componentAction = null)
        {
            var       action    = componentAction ?? mapper.GetComponentAction();
            Component component = null;

            switch (action)
            {
            case ComponentAction.Map:
                component = mapper.Map();
                break;

            case ComponentAction.Remove:
                component = mapper.Remove();
                break;
            }

            return(component);
        }
        public async Task Invoke(HttpContext context)
        {
            IComponentMapper mapper = _provider.GetService <IComponentMapper>();
            var pathParser          = new PathParser();
            var request             = pathParser.Parse(context.Request);

            var componentType = mapper.GetComponent(request.Component);

            var componentInstance = _provider.GetService(componentType);

            var result = _invoker.Invoke(componentType, request);

            var serialized = JsonConvert.SerializeObject(result);
            var bytes      = Encoding.UTF8.GetBytes(serialized);

            context.Response.ContentType = "application/json";

            await context.Response.Body.WriteAsync(bytes, 0, bytes.Length);
        }
Exemple #10
0
 /// <summary>
 /// Binds a property of the model using the component mapper provided
 /// </summary>
 /// <typeparam name="T">type of the property to be bound</typeparam>
 /// <param name="lamda">lamda to specify the property to be bound</param>
 /// <param name="inputMapper">The mapper that contains the bound configuration</param>
 /// <returns>Current object. This is meant for chaining</returns>
 public ModelHandler <TModel> Bind <T>(Expression <Func <TModel, T> > lamda, IComponentMapper <T> inputMapper)
 {
     if (lamda.Body is MemberExpression mem)
     {
         var member = mem.Member;
         var info   = properties[member.Name];
         mappedCollection.Add(new MappedContext
         {
             Name    = member.Name,
             GetFrom = obj => inputMapper.MappedData = (T)info.GetValue(obj),
             Set     = obj => info.SetValue(obj, inputMapper.MappedData),
             Mapper  = inputMapper
         });
     }
     else
     {
         throw new InvalidOperationException("Invalid lamda provided. Property is expected.");
     }
     return(this);
 }
Exemple #11
0
 public ComponentService(IAppUnitOfWork unitOfWork) : base(unitOfWork,
                                                           new BaseBLLMapper <DAL.App.DTO.ComponentFull, ComponentFull>(), unitOfWork.Components)
 {
     _mapper = new ComponentMapper();
 }
Exemple #12
0
        public static void DropBomb(EntityManager em, int entityLiveId, List <int> actions, List <int> states)
        {
            if (actions.Contains(InputActions.Drop))
            {
                actions.Remove(InputActions.Drop);

                Entity playerEntity   = em.GetEntityByLiveId(entityLiveId);
                int    playerUniqueId = playerEntity.UniqueId;

                // First, we need to figure out if we can actually place a bomb. We might be at our limit.
                IComponentMapper <Bomb> bombs  = em.GetComponentManager <Bomb>(ComponentTypeIds.Bomb);
                int existingBombsForThisPlayer = 0;
                // TODO: The enumerator produces garbage
                foreach (Bomb existingBomb in bombs.EnumerateComponents())
                {
                    if (existingBomb.OwnerUniqueId == playerUniqueId)
                    {
                        existingBombsForThisPlayer++;
                    }
                }

                PlayerInfo player = (PlayerInfo)em.GetComponent(entityLiveId, ComponentTypeIds.Player);
                if (player != null)
                {
                    Placement placementSource = (Placement)em.GetComponent(entityLiveId, ComponentTypeIds.Placement);

                    bool canPlace = (existingBombsForThisPlayer < player.PermittedSimultaneousBombs);
                    if (canPlace)
                    {
                        // Also, if there is already a bomb there, can't place.
                        Point       spot = placementSource.Position.ToInteger();
                        MessageData data = new MessageData(spot.X, spot.Y, ComponentTypeIds.Bomb);
                        em.SendMessage(Messages.QueryComponentAtGrid, ref data, null);
                        canPlace = !data.Handled || (data.Int32 == EntityManager.InvalidEntityUniqueId);
                    }

                    if (canPlace)
                    {
                        bool firstBomb       = (existingBombsForThisPlayer == 0);
                        bool replacedTexture = false;

                        bool   placedLandMine = false;
                        string bombTemplate   = "BasicBomb";
                        if (player.FirstBombLandMine)
                        {
                            bombTemplate    = "LandMineBomb";
                            placedLandMine  = true;
                            replacedTexture = true;
                        }

                        Entity    bombEntity    = em.AllocateForGeneratedContent(bombTemplate, Universe.TopLevelGroupUniqueIdBase);
                        Placement placementBomb = (Placement)em.GetComponent(bombEntity, ComponentTypeIds.Placement);
                        Aspect    aspectBomb    = (Aspect)em.GetComponent(bombEntity, ComponentTypeIds.Aspect);
                        if ((placementBomb != null) && (placementSource != null))
                        {
                            placementBomb.SetPositionWholeNumber(placementSource.Position);
                        }

                        em.SendMessage(bombEntity, Messages.PlaySound, "DropBomb".CRC32Hash(), 0.5f, null);

                        // Set ourselves as the owner of the bomb.
                        Bomb bomb = (Bomb)em.GetComponent(bombEntity, ComponentTypeIds.Bomb);
                        if (bomb != null)
                        {
                            bomb.OwnerUniqueId = playerUniqueId;

                            bomb.State = player.BombState;

                            if (firstBomb)
                            {
                                if (player.FirstBombInfinite)
                                {
                                    bomb.State.Range = GameConstants.InfiniteRange;
                                    // Mark it specially, since this is a power bomb!
                                    aspectBomb.ModelNameId = "BombPower".CRC32Hash();
                                    replacedTexture        = true;
                                }
                                // REVIEW: What about when it's a landmine???
                            }

                            if (player.BombState.IsPassThrough)
                            {
                                aspectBomb.ModelNameId = "BombSpiked".CRC32Hash();
                                replacedTexture        = true;
                            }

                            if (bomb.State.PropagationDirection == PropagationDirection.All)
                            {
                                // Limit the range
                                bomb.State.Range = Math.Min(bomb.State.Range, GameConstants.MaxDangerousBombRange);
                                // And override the model
                                aspectBomb.ModelNameId = "BombDangerous".CRC32Hash();
                                replacedTexture        = true;
                            }

                            // Don't have a countdown if the player can trigger bombs remotely.
                            if (player.RemoteTrigger || placedLandMine)
                            {
                                bomb.Countdown = GameConstants.InfiniteTime;
                            }

                            // Show remote control bombs as different, but only if we don't mark the
                            // bomb differently otherwise.
                            if (player.RemoteTrigger && !replacedTexture)
                            {
                                aspectBomb.ModelNameId = "BombRC".CRC32Hash();
                            }
                        }
                    }
                    else
                    {
                        em.SendMessage(playerEntity, Messages.PlaySound, "Buzzer".CRC32Hash(), 1f, null);
                    }
                }
            }
        }
 private async Task <IList <T> > GetComponentsAsync <T>(ComponentType componentType, IComponentMapper <T> mapper) where T : SystemComponentBase
 {
     return((await unitOfWork.ComponentRepository.ReadAllByTypeAsync((Int32)componentType)).Select(mapper.Map).ToList());
 }
Exemple #14
0
 private static void RegisterComponents(IComponentMapper componentMapper)
 {
     componentMapper.Replace(typeof(Blazorise.Switch <>), typeof(Material.Switch <>));
 }