示例#1
0
        public ImageView(ImageView imageView)
        {
            LeftMargin = imageView.LeftMargin;
            TopMargin = imageView.TopMargin;
            RightMargin = imageView.RightMargin;
            BottomMargin = imageView.BottomMargin;

            Width = imageView.Width;
            Height = imageView.Height;
            Position = imageView.Position;
            Scale = imageView.Scale;
            Offset = imageView.Offset;

            ImageTexture = imageView.ImageTexture;
            ImageRect = imageView.ImageRect;
            ImageScaleMode = imageView.ImageScaleMode;
            IsDirty = imageView.IsDirty;

            Rect = imageView.Rect;
        }
示例#2
0
        private void AddToSet(ImageViewWithFrame imageView)
        {
            Vector3 p = new Vector3(Scale(10), Scale(10));

            var startPosition = Camera.main.WorldToScreenPoint(SpawnMyDeckStartLocation.transform.position);
            startPosition.y = Screen.height - startPosition.y;

            var endPosition = Camera.main.WorldToScreenPoint(SpawnMyDeckEndLocation.transform.position);
            endPosition.y = Screen.height - endPosition.y;

            float controlWidth = endPosition.x - startPosition.x;
            float fullSize = controlWidth / 3.6f;

            GroupControl item = new GroupControl();

            var framedImage = new ImageViewWithFrame();
            framedImage.BigSize = (int)(fullSize * 0.9f);
            framedImage.ImageTexture = imageView.ImageTexture;
            framedImage.FrameTexture = imageView.FrameTexture;
            framedImage.LeftMargin = 0;
            framedImage.RightMargin = (int)(fullSize * 0.05f);
            framedImage.TopMargin = 0;
            framedImage.MeasureSize();

            item.Items.Add(framedImage);

            Rect rect = new Rect();
            rect.x = (int)(p.x + (int)(fullSize * 0.05f) + (fullSize * (x % breakIn)));
            rect.y = (int)(p.y + (((p.y * 2) + framedImage.BigSize) * (int)(x / breakIn)));
            rect.width = framedImage.Rect.width;
            rect.height = framedImage.Rect.height;
            item.Rect = rect;

            var cancelImage = new ImageView();
            cancelImage.Width = cancelImage.Height = (int)(fullSize * 0.22);
            cancelImage.ImageScaleMode = ScaleMode.ScaleToFit;
            cancelImage.Offset.x = (int)(fullSize * 0.74);
            cancelImage.Offset.y = (int)(fullSize * 0.11);
            cancelImage.ImageTexture = MiniCancelTexture;
            cancelImage.MeasureSize();

            // Revert auto scalling stuff in measure size.
            rect = cancelImage.ImageRect;
            rect.x = cancelImage.Offset.x;
            rect.y = cancelImage.Offset.y;
            rect.width = rect.height = cancelImage.Width;
            cancelImage.ImageRect = rect;

            item.Tag = imageView.Tag;
            item.Items.Add(cancelImage);
            selectedCardsImages.Add(item);

            item.MeasureSize();

            selectedCardsScrollContentHeight = item.Rect.y + item.Rect.height;
            ++x;
        }
示例#3
0
        private void AddToSet2(ImageViewWithFrame imageView)
        {
            Vector3 p = new Vector3(Scale(10), Scale(10));

            var startPosition = Camera.main.WorldToScreenPoint(SpawnMyDeckStartLocation.transform.position);
            startPosition.y = Screen.height - startPosition.y;

            var endPosition = Camera.main.WorldToScreenPoint(SpawnMyDeckEndLocation.transform.position);
            endPosition.y = Screen.height - endPosition.y;

            float controlWidth = endPosition.x - startPosition.x;
            float fullSize = controlWidth / 3.6f;

            var framedImage = new ImageViewWithFrame();
            framedImage.BigSize = (int)(fullSize * 0.9f);
            framedImage.ImageTexture = imageView.ImageTexture;
            framedImage.FrameTexture = imageView.FrameTexture;
            framedImage.LeftMargin = p.x + (int)(fullSize * 0.05f) + (fullSize * (x % breakIn));
            framedImage.RightMargin = (int)(fullSize * 0.05f);
            framedImage.TopMargin = p.y + (((p.y * 2) + framedImage.BigSize) * (int)(x / breakIn));
            framedImage.MeasureSize();

            var cancelImage = new ImageView();
            cancelImage.Width = cancelImage.Height = (int)(framedImage.BigSize * 0.12);
            cancelImage.ImageScaleMode = ScaleMode.ScaleToFit;
            cancelImage.LeftMargin = (int)framedImage.LeftMargin + (int)(framedImage.BigSize * 0.85);
            cancelImage.TopMargin = (int)framedImage.TopMargin + Scale(5);
            cancelImage.ImageTexture = MiniCancelTexture;
            cancelImage.MeasureSize();

            selectedCardsImages.Add(framedImage);

            selectedCardsScrollContentHeight = framedImage.TopMargin + framedImage.Rect.height;
            ++x;
        }