Exemple #1
0
 public Picture(Image img, ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
     : base(editor, color, thickness, panel)
 {
     init(panel, p);
     Img = img;
     moveEndHandleToImageSize();
 }
Exemple #2
0
        public Arrow(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
        {
            sp = (ArrowSettingsPanel)settingsPanel;

            sp.chkUseShadow.Checked = bool.Parse(element.GetAttribute("shadow", ""));
            sp.setArrowType(int.Parse(element.GetAttribute("ShapeArrowType", "")));
        }
Exemple #3
0
 public ScreenShot(ScreenshotEditor editor, Bitmap shot)
     : base(editor, Color.Black, 0, null)
 {
     this.shot    = shot;
     shotUnwarped = new Bitmap(shot);
     BackgroundTransformator.Instance.SettingsChanged += transformationSettingsChanged;
 }
Exemple #4
0
            public TextView(TextShape t, ScreenshotEditor editor) : base(t)
            {
                this.t      = t;
                this.editor = editor;

                editor.addSettingsChangeListener(this);
                setFont(editor.CurrentViewParameters);
            }
Exemple #5
0
        public Arrow(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            addHandle("start", p);
            addHandle("end", p);

            sp = (ArrowSettingsPanel)panel;
        }
Exemple #6
0
        public Pencil(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            points.Add(p);
            prevPoint = p;

            sp = panel as ShadowSettingsPanel;
        }
        public RectangleShape(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            addHandle("start", p);
            addHandle("end", p);

            sp = (ShadowAndFillingSettingsPanel)panel;
        }
Exemple #8
0
        public Censor(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            addHandle("start", p);
            addHandle("end", p);

            sp = (CensorSettingsPanel)panel;
            sp.SettingsChanged += shapeSettingsChanged;
        }
Exemple #9
0
        public Oval(ScreenshotEditor editor, Color color, int thickness, PointF p, bool opaque, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            isOpaque = opaque;
            addHandle("start", p);
            addHandle("end", p);

            sp = (ShadowSettingsPanel)panel;
        }
Exemple #10
0
        public MagnifyingGlass(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, p, true, panel)
        {
            view = null;

            sp = (MagnifierSettingsPanel)panel;

            sp.SettingsChanged += settingsChanged;
        }
        public static Shape createShape(ScreenshotEditor editor, bool cropBoxActive, XPathNavigator element)
        {
            string type = element.GetAttribute("type", "");
            Shape  s    = null;

            switch (type)
            {
            case "Arrow":
                s = new Arrow(editor, element);
                break;

            case "CropBox":
                s = new CropBox(editor, element, cropBoxActive);
                break;

            case "Censor":
                s = new Censor(editor, element);
                break;

            case "Line":
                s = new Line(editor, element);
                break;

            case "Oval":
                s = new Oval(editor, element);
                break;

            case "MagnifyingGlass":
                s = new MagnifyingGlass(editor, element);
                break;

            case "Pencil":
                s = new Pencil(editor, element);
                break;

            case "Picture":
                s = new Picture(editor, element);
                break;

            case "PonyVille":
                s = new PonyVille(editor, element);
                break;

            case "RectangleShape":
                s = new RectangleShape(editor, element);
                break;

            case "TextShape":
                s = new TextShape(editor, element);
                break;

            default:
                break;
            }
            return(s);
        }
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();

        scrollpos = EditorGUILayout.BeginScrollView(scrollpos, GUIStyle.none, GUI.skin.verticalScrollbar);
        List <SceneAsset> m_SceneAssets = new List <SceneAsset>();
        string            folderName    = Application.dataPath + "/Scenes/WorldMap/";
        var dirInfo      = new DirectoryInfo(folderName);
        var allFileInfos = dirInfo.GetFiles("*.unity", SearchOption.AllDirectories);

        foreach (var fileInfo in allFileInfos)
        {
            SceneAsset sa = AssetDatabase.LoadAssetAtPath <SceneAsset>("Assets/Scenes/WorldMap/" + fileInfo.Name);
            m_SceneAssets.Add(sa);
        }

        foreach (var sa in m_SceneAssets)
        {
            sceneAsset = EditorGUILayout.ObjectField("", sa, typeof(SceneAsset), true) as SceneAsset;
        }
        EditorGUILayout.EndScrollView();

        EditorGUILayout.BeginVertical();
        if (GUILayout.Button("Take Screenshot"))
        {
            ScreenshotEditor.takeScreenshot();
            GUIUtility.ExitGUI();
        }
        if (GUILayout.Button("Add Scenes to Build"))
        {
            AddAllWorldScenes();
            GUIUtility.ExitGUI();
        }
        if (GUILayout.Button("Update Scene Data"))
        {
            AtlasSceneManager.getSceneData();
        }
        if (GUILayout.Button("Toggle Neighbors"))
        {
            MapEditor.toggleNeighbors();
            GUIUtility.ExitGUI();
        }
        if (GUILayout.Button("Open Map Editor"))
        {
            Object mapEditor = AssetDatabase.LoadAssetAtPath("Assets/Scenes/MapEditor.lnk", typeof(Object));
            AssetDatabase.OpenAsset(mapEditor);
            GUIUtility.ExitGUI();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
    }
Exemple #13
0
        public Pencil(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
        {
            sp = settingsPanel as ShadowSettingsPanel;

            sp.chkUseShadow.Checked = bool.Parse(element.GetAttribute("shadow", ""));
            XPathNodeIterator it = element.Clone().Select("points/point");

            while (it.MoveNext())
            {
                float x = float.Parse(it.Current.GetAttribute("x", ""));
                float y = float.Parse(it.Current.GetAttribute("y", ""));
                points.Add(new PointF(x, y));
            }
        }
Exemple #14
0
        public TextShape(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            setColorAndThickness();

            addHandle("start", p);
            p.X += 100;
            p.Y += TextHeight;
            addHandle("end", p);

            sp = panel as TextSettingsPanel;

            sp.SettingsChanged += sp_SettingsChanged;
        }
Exemple #15
0
        public PonyVille(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            psp = (PonySettingsPanel)panel;
            psp.SettingsChanged += settingsChanged;

            RectangleF rect = new RectangleF(p, RandomSize);

            prevPoint = p;

            prevThickness = thickness;

            Element e = new Element(rect, PonyVilleView.generateElementBitmap(this, rect.Size, editor.CurrentViewParameters));

            elements.Add(e);
            PonyVilleView.drawElement(editor.CanvasGraphics, e, editor.CurrentViewParameters);
        }
Exemple #16
0
        private void init(ScreenshotEditor editor, ShapeSettingsPanel panel, Color color, int thickness)
        {
            this.editor   = editor;
            settingsPanel = panel;

            editor.addSettingsChangeListener(this);
            if (panel != null)
            {
                settingsPanel.SettingsChanged += shapeSettingsChanged;
            }

            setColor(color);
            lastColor = color;

            Thickness = lastThickness = thickness;

            handles = new Dictionary <string, PointF>();
        }
Exemple #17
0
        protected Shape(ScreenshotEditor editor, XPathNavigator element, ShapeSettingsPanel panel)
        {
            int a         = int.Parse(element.GetAttribute("color.a", ""));
            int r         = int.Parse(element.GetAttribute("color.r", ""));
            int g         = int.Parse(element.GetAttribute("color.g", ""));
            int b         = int.Parse(element.GetAttribute("color.b", ""));
            int thickness = int.Parse(element.GetAttribute("thickness", ""));

            init(editor, panel, Color.FromArgb(a, r, g, b), thickness);
            XPathNodeIterator it = element.Clone().Select("handles/handle");

            while (it.MoveNext())
            {
                string name = it.Current.GetAttribute("name", "");
                float  x    = float.Parse(it.Current.GetAttribute("x", ""));
                float  y    = float.Parse(it.Current.GetAttribute("y", ""));
                addHandle(name, new PointF(x, y));
            }
        }
Exemple #18
0
        public CropBox(ScreenshotEditor editor, bool editing, ShapeSettingsPanel panel)
            : base(editor, Color.Black, 20, panel)
            //: base(editor, getOppositeColor(editor.BackgroundColor), 20, null)
        {
            rightHit = false;

            Size s = editor.Screenshot.Size;
            //s.Width += ConfigDialog.Instance.GrabMargin;
            //s.Height += ConfigDialog.Instance.GrabMargin;
            int w = s.Width;
            int h = s.Height;

// ReSharper disable PossibleLossOfFraction
            addHandle("start", new PointF(-w / 2, -h / 2));
            addHandle("end", new PointF(w / 2, h / 2));
// ReSharper restore PossibleLossOfFraction

            Editing = editing;

            sp = (CropShapeSettingsPanel)panel;
        }
Exemple #19
0
        public TextShape(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
        {
            sp = (TextSettingsPanel)settingsPanel;
            sp.SettingsChanged += sp_SettingsChanged;
            setColorAndThickness();
            sp.trckOutlineWidth.Value   = int.Parse(element.GetAttribute("outlineWidth", ""));
            sp.chkUseShadow.Checked     = bool.Parse(element.GetAttribute("shadow", ""));
            sp.chkOpaqueOutline.Checked = bool.Parse(element.GetAttribute("opaqueOutline", ""));
            string fontStyle  = element.GetAttribute("fontStyle", "");
            string fontFamily = element.GetAttribute("fontFamily", "");

            XPathNodeIterator it = element.Clone().Select("text");

            it.MoveNext();
            text = it.Current.Value;

            FontStyle style = (FontStyle)Enum.Parse(typeof(FontStyle), fontStyle);

            sp.buttonFont.Font = new Font(fontFamily, 14, style, GraphicsUnit.Pixel, 0);

            fromXml = true;
        }
Exemple #20
0
        public Picture(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
        {
            sp = (PictureSettingsPanel)settingsPanel;
            sp.ProportionsTypeChanged += sp_ProportionsTypeChanged;
            sp.chkUseShadow.Checked    = bool.Parse(element.GetAttribute("shadow", ""));
            sp.chkUseBorder.Checked    = bool.Parse(element.GetAttribute("border", ""));
            sp.radioOriginal.Checked   = bool.Parse(element.GetAttribute("useOriginalSize", ""));
            if (!sp.radioOriginal.Checked)
            {
                sp.radioConstrain.Checked = true;
            }
            XPathNodeIterator it = element.Clone().Select("image");

            it.MoveNext();
            string b64 = it.Current.Value;

            byte[]       array = Convert.FromBase64String(b64);
            MemoryStream ms    = new MemoryStream(array);

            Img     = new Bitmap(ms);
            fromXml = true;
        }
Exemple #21
0
        public PonyVille(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
        {
            psp = (PonySettingsPanel)settingsPanel;
            psp.SettingsChanged += settingsChanged;
            bool heart = element.GetAttribute("ponytype", "").Equals("heart");

            psp.radioHeart.Checked = heart;
            psp.radioStar.Checked  = !heart;

            prevThickness = Thickness;

            XPathNodeIterator it = element.Clone().Select("ponies/pony");

            while (it.MoveNext())
            {
                float      x    = float.Parse(it.Current.GetAttribute("x", ""));
                float      y    = float.Parse(it.Current.GetAttribute("y", ""));
                int        w    = int.Parse(it.Current.GetAttribute("w", ""));
                int        h    = int.Parse(it.Current.GetAttribute("h", ""));
                RectangleF rect = new RectangleF(x, y, w, h);
                elements.Add(new Element(rect, PonyVilleView.generateElementBitmap(this, rect.Size, editor.CurrentViewParameters)));
            }
        }
Exemple #22
0
 public Oval(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
     : this(editor, color, thickness, p, false, panel)
 {
 }
Exemple #23
0
 public CropBox(ScreenshotEditor editor, XPathNavigator element, bool editing) : base(editor, element, createSettingsPanel())
 {
     sp      = settingsPanel as CropShapeSettingsPanel;
     Editing = editing;
 }
Exemple #24
0
 public Censor(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
 {
     sp = settingsPanel as CensorSettingsPanel;
     sp.SettingsChanged += shapeSettingsChanged;
 }
Exemple #25
0
 public Oval(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
 {
     sp = settingsPanel as ShadowSettingsPanel;
     init(element);
 }
Exemple #26
0
 internal Oval(ScreenshotEditor editor, XPathNavigator element, ShapeSettingsPanel sp, bool opaque) : base(editor, element, sp)
 {
     this.sp  = settingsPanel as ShadowSettingsPanel;
     isOpaque = opaque;
     init(element);
 }
Exemple #27
0
 protected Shape(ScreenshotEditor editor, Color color, int thickness, ShapeSettingsPanel panel)
 {
     init(editor, panel, color, thickness);
 }
 public RectangleShape(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel())
 {
     sp = (ShadowAndFillingSettingsPanel)settingsPanel;
     sp.chkUseShadow.Checked = bool.Parse(element.GetAttribute("shadow", ""));
     sp.chkFill.Checked      = bool.Parse(element.GetAttribute("filled", ""));
 }
Exemple #29
0
 public Picture(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
     : base(editor, color, thickness, panel)
 {
     init(panel, p);
 }
Exemple #30
0
 public MagnifyingGlass(ScreenshotEditor editor, XPathNavigator element) : base(editor, element, createSettingsPanel(), true)
 {
     sp = (MagnifierSettingsPanel)settingsPanel;
     sp.trckZoom.Value       = int.Parse(element.GetAttribute("zoom", ""));
     sp.chkUseShadow.Checked = bool.Parse(element.GetAttribute("shadow", ""));
 }