public void RemovePicture(PictureCanvas canvas)
 {
     pictures.Remove(canvas);
     canvas.gameObject.SetActive(false);
     Destroy(canvas.gameObject);
     PictureRemoved?.Invoke(canvas);
 }
    private void PictureRemoved(PictureCanvas canvas)
    {
        PictureItem item = pictures[canvas];

        pictures.Remove(canvas);
        item.gameObject.SetActive(false);
        Destroy(item.gameObject);
    }
    private void PictureAdded(PictureCanvas canvas)
    {
        PictureItem item = Instantiate(refPictureItemPrefab, contentHolder.transform).GetComponent <PictureItem>();

        pictures.Add(canvas, item);
        item.canvas = canvas;
        item.ChangeVisibilityButton();
        PictureNameUpdated(canvas);
    }
    public void ChangeName(PictureCanvas canvas)
    {
        Keyboard keyboard = Keyboard.Show(canvas.PicName);

        keyboard.OnAccepted += (text) =>
        {
            UpdateName(canvas, text);
            keyboard.Close();
        };
        keyboard.OnCancelled += () => keyboard.Close();
    }
    public void AddRefPicture()
    {
        var script = UIController.Instance.ShowRefPicture();

        script.OnAccepted += (text) =>
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }
            PictureCanvas canvas = UIController.Instance.ShowPictureCanvas();
            pictures.Add(canvas);
            canvas.SetPicture(text);
            PictureAdded?.Invoke(canvas);
            script.Close();
        };
    }
Exemplo n.º 6
0
        /// <summary>
        /// Initialise the browser.
        /// </summary>
        /// <param name="picture"></param>
        public PictureBrowser(Picture picture)
        {
            Picture = picture;
            Canvas  = new PictureCanvas(picture);
            Canvas.Visual.DitherBlend = BlendColorsDefault;

            InitializeComponent();
            SetStipplingSpitButtonImage();

            instructionTrackBar.Width   = Math.Max(picture.Instructions.Count, 200);
            instructionTrackBar.Maximum = picture.Instructions.Count;
            instructionTrackBar.Value   = picture.Instructions.Count;

            this.picture.Width  = (int)(Canvas.Resolution.X * 4 / 1.333);
            this.picture.Height = Canvas.Resolution.Y * 4;

            Layer = PictureLayer.Visual;
        }
Exemplo n.º 7
0
        public override void Draw(ICanvas canvas)
        {
            canvas.SaveState();

            IPattern pattern;

            using (var picture = new PictureCanvas(0, 0, 12, 12))
            {
                picture.StrokeColor = Colors.LimeGreen;

                picture.StrokeSize        = 1f;
                picture.StrokeDashPattern = null;
                picture.DrawLine(0, 12, 12, 0);

                pattern = AddPictureAsPattern(picture.Picture, 12, 12);
            }

            canvas.SetFillPaint(pattern.AsPaint(), 0, 0, 0, 0);
            canvas.FillRectangle(50, 50, 500, 500);

            canvas.RestoreState();
        }
 private void PictureNameUpdated(PictureCanvas canvas)
 {
     pictures[canvas].PicName = canvas.PicName;
 }
 public void PicturesHidden(PictureCanvas canvas)
 {
     pictures[canvas].ChangeVisibilityButton();
 }
 public void UpdateName(PictureCanvas canvas, string name)
 {
     canvas.PicName = name;
     PictureNameUpdated?.Invoke(canvas);
 }
 public void HidePicture(PictureCanvas canvas)
 {
     canvas.visible = !canvas.visible;
     canvas.gameObject.SetActive(!canvas.gameObject.activeSelf);
     PictureHidden?.Invoke(canvas);
 }