コード例 #1
0
        public override bool Handle(Handler handler, HandlerData handlerData)
        {
            var nestedHandler = handler.CreateNestedHandler(Position, Size / OriginalSize);

            return(HandlerVisitors.Exists(hv => handler.Handle(hv, handlerData)) ||
                   Items.Exists(v => v.Handle(nestedHandler, handlerData)));
        }
コード例 #2
0
        public CardView(ContentManager contentManager, CardViewModel cardViewModel)
            : base(cardViewModel, 200, 279)
        {
            this.contentManager = contentManager;

            cardBackgroundImageView = new SpriteView
            {
                PositionX = 0, PositionY = 0, SizeX = 200, SizeY = 279, SourceX = 200, SourceY = 279,
                Texture   = contentManager.Load <Texture2D>($"Card{ ViewModel.Resource }BackgroundImage")
            };

            cardImageView = new SpriteView
            {
                PositionX = 20, PositionY = 56, SizeX = 160, SizeY = 108, SourceX = 160, SourceY = 108,
                Texture   = contentManager.Load <Texture2D>($"Card{ ViewModel.Identifier }Image")
            };

            Items.Add(cardBackgroundImageView);
            Items.Add(cardImageView);

            var dragHandlerVisitor = new DragHandlerVisitor(this);

            HandlerVisitors.Add(dragHandlerVisitor);
        }