コード例 #1
0
        public void ApplyDesaturation(Tile tile, TransitionDesaturationMode mode)
        {
            switch (mode)
            {
                case TransitionDesaturationMode.ColorFlashlight:
                    Debug.Assert(_colorFlashlightAnimation != null);

                    _colorFlashlightAnimation.SetReferenceParameter("frame", tile.Frame);
                    tile.ApplyDesaturationAnimation(_colorFlashlightAnimation);

                    break;

                case TransitionDesaturationMode.None:
                case TransitionDesaturationMode.Regular:
                    tile.ApplyDesaturationAnimation(tile.IsDesaturated ?
                        CommonAnimations.SlowOffAnimation :
                        CommonAnimations.NormalOnAnimation);

                    break;
            }
        }
コード例 #2
0
ファイル: LayoutManager.cs プロジェクト: RudyChen/composition
        private void CreateTilesWithImagesLayout()
        {
            // Create a grid of tiles.

            for (int row = 0; row < TotalRows; row++)
            {
                for (int col = 0; col < TotalColumns; col++)
                {
                    Tile tile = new Tile(_panningContainer, Border);

                    tile.GridRow = row;
                    tile.GridColumn = col;

                    tile.Size = new Vector2(PictureFrameWidth, PictureFrameHeight);

                    tile.Offset = new Vector3(
                        col * (PictureFrameWidth + Margin),
                        row * (PictureFrameHeight + Margin),
                        0);

                    tile.IsVisible = true;
                    _allTiles.Add(tile);
                    _emptyTileCount++;
                }
            }

            _panningContainer.Size = new Vector2(
                TotalColumns * (PictureFrameWidth + Margin + 2 * Border) - Margin,
                TotalRows * (PictureFrameHeight + Margin + 2 * Border) - Margin);


            // Pick the middle Tile to be the "current" one.

            _currentTileIndex = TotalRows / 2 * TotalColumns + TotalColumns / 2;
        }
コード例 #3
0
ファイル: LayoutManager.cs プロジェクト: RudyChen/composition
        private Tile FindNearestEmptyTile(Tile center)
        {
            // Iterate through all of the tiles, looking for the tile that is the closest to the
            // currently selected tile, measured by distance to the center of each tile:
            // - If none are found, return 'null'.

            Tile found = null;
            float distance = 100000000;
            var centerOffset = center.Offset;
            var centerSize = center.Size;
            centerOffset.X += centerSize.X / 2;
            centerOffset.Y += centerSize.Y / 2;

            foreach (Tile candidate in _allTiles)
            {
                if ((candidate == center) || (candidate.Photo != null))
                {
                    continue;
                }

                var candidateOffset = candidate.Offset;
                var candiateSize = candidate.Size;
                candidateOffset.X += candiateSize.X / 2;
                candidateOffset.Y += candiateSize.Y / 2;

                var delta = candidateOffset - centerOffset;
                float test = delta.Length();
                if (distance > test)
                {
                    found = candidate;
                    distance = test;
                }
            }

            return found;
        }