[longomatch] Update players to the new design



commit 4b0910a8af0a8fbac04fcbcf99fff15fe5ae42f5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Oct 21 13:37:50 2014 +0200

    Update players to the new design

 LongoMatch.Core/StyleConf.cs                     |   21 ++---
 LongoMatch.Drawing/CanvasObjects/PlayerObject.cs |  112 ++++++++++------------
 data/images/Makefile.am                          |    9 +--
 data/images/player/arrow-in.svg                  |   49 ++++++++++
 data/images/player/arrow-out.svg                 |   49 ++++++++++
 data/images/player/away-in.svg                   |   10 --
 data/images/player/away-number.svg               |    8 --
 data/images/player/away-out.svg                  |   10 --
 data/images/player/background.svg                |    7 --
 data/images/player/home-in.svg                   |   10 --
 data/images/player/home-number.svg               |    8 --
 data/images/player/home-out.svg                  |   10 --
 12 files changed, 161 insertions(+), 142 deletions(-)
---
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
index 19d0aa7..b3c709e 100644
--- a/LongoMatch.Core/StyleConf.cs
+++ b/LongoMatch.Core/StyleConf.cs
@@ -74,20 +74,17 @@ namespace LongoMatch.Core.Common
                public const string TimelineSelectionLeft = 
"hicolor/scalable/actions/longomatch-timeline-select-left.svg";
                public const string TimelineSelectionRight = 
"hicolor/scalable/actions/longomatch-timeline-select-right.svg";
                
-               public const string PlayerBackground = "player/background.svg";
-               public const string PlayerHomeNumber = "player/home-number.svg";
-               public const string PlayerAwayNumber = "player/away-number.svg";
-               public const string PlayerHomeIn = "player/home-in.svg";
-               public const string PlayerAwayIn = "player/away-in.svg";
-               public const string PlayerHomeOut = "player/home-out.svg";
-               public const string PlayerAwayOut = "player/away-out.svg";
+               public const string PlayerArrowOut = "player/arrow-out.svg";
+               public const string PlayerArrowIn = "player/arrow-in.svg";
                public const string PlayerPhoto = "player/photo.svg";
                public const int PlayerLineWidth = 2;
-               public const int PlayerNumberHeight  = 17;
-               public const int PlayerNumberWidth  = 26;
-               public const int PlayerNumberOffset  = 17;
-               public const int PlayerArrowOffset = 14; 
-               public const int PlayerArrowSize = 20; 
+               public const int PlayerSize  = 60;
+               public const int PlayerNumberSize  = 20;
+               public const int PlayerArrowSize = PlayerNumberSize;
+               public const int PlayerNumberX  = 0;
+               public const int PlayerNumberY  = 60 - PlayerLineWidth - PlayerNumberSize + 1;
+               public const int PlayerArrowX = PlayerNumberX;
+               public const int PlayerArrowY = PlayerNumberY - PlayerArrowSize + 1;
                
                public const string SubsLock = "hicolor/scalable/actions/longomatch-player-swap-lock.svg";
                public const string SubsUnlock = "hicolor/scalable/actions/longomatch-player-swap-unlock.svg";
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayerObject.cs 
b/LongoMatch.Drawing/CanvasObjects/PlayerObject.cs
index 0e09b33..6f1fa64 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayerObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayerObject.cs
@@ -15,34 +15,26 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
-using System;
+using System.IO;
+using LongoMatch.Core.Common;
 using LongoMatch.Core.Interfaces.Drawing;
 using LongoMatch.Core.Store;
-using LongoMatch.Core.Interfaces;
-using LongoMatch.Core.Common;
 using LongoMatch.Core.Store.Drawables;
-using LongoMatch.Drawing.Widgets;
-using System.IO;
 
 namespace LongoMatch.Drawing.CanvasObjects
 {
        public class PlayerObject: CanvasButtonObject, ICanvasSelectableObject
        {
                static ISurface Photo;
-               static ISurface Background;
-               static ISurface HomeNumber;
-               static ISurface AwayNumber;
-               static ISurface HomeOut;
-               static ISurface AwayOut;
-               static ISurface HomeIn;
-               static ISurface AwayIn;
+               static ISurface ArrowOut;
+               static ISurface ArrowIn;
                static bool surfacesCached = false;
 
                public PlayerObject ()
                {
                        Init ();
                }
-               
+
                public PlayerObject (Player player, Point position = null)
                {
                        Player = player;
@@ -53,12 +45,12 @@ namespace LongoMatch.Drawing.CanvasObjects
                        get;
                        set;
                }
-               
+
                public bool Playing {
                        get;
                        set;
                }
-               
+
                public Player Player {
                        get;
                        set;
@@ -95,7 +87,7 @@ namespace LongoMatch.Drawing.CanvasObjects
                                return Size;
                        }
                }
-               
+
                public Team Team {
                        get;
                        set;
@@ -120,38 +112,39 @@ namespace LongoMatch.Drawing.CanvasObjects
                public override void Draw (IDrawingToolkit tk, Area area)
                {
                        Point zero, start, p;
-                       double numberWidth, numberHeight;
+                       double numberSize;
                        double size, scale;
-                       ISurface number, sin, sout;
+                       ISurface arrowin, arrowout;
 
                        if (Player == null)
                                return;
 
                        zero = new Point (0, 0);
-                       size = Background.Height - StyleConf.PlayerLineWidth;
-                       scale = (double) Width / Background.Height; 
+                       size = StyleConf.PlayerSize;
+                       scale = (double)Width / size; 
                        
                        if (Team == Team.LOCAL) {
-                               number = HomeNumber;
-                               sin = HomeIn;
-                               sout = HomeOut;
+                               arrowin = ArrowIn;
+                               arrowout = ArrowOut;
                        } else {
-                               number = AwayNumber;
-                               sin = AwayIn;
-                               sout = AwayOut;
+                               arrowin = ArrowOut;
+                               arrowout = ArrowIn;
                        }
 
                        tk.Begin ();
                        start = new Point (Size / 2, Size / 2);
                        tk.TranslateAndScale (Position - start, new Point (scale, scale));
 
-                       if (!UpdateDrawArea (tk, area, new Area (zero, Background.Height, 
Background.Height))) {
-                               tk.End();
+                       if (!UpdateDrawArea (tk, area, new Area (zero, size, size))) {
+                               tk.End ();
                                return;
-                       };
+                       }
+                       ;
 
                        /* Background */
-                       tk.DrawSurface (Background, zero);
+                       tk.FillColor = Config.Style.PaletteBackgroundDark;
+                       tk.LineWidth = 0;
+                       tk.DrawRectangle (zero, StyleConf.PlayerSize, StyleConf.PlayerSize);
                        
                        /* Image */
                        if (Player.Photo != null) {
@@ -159,50 +152,55 @@ namespace LongoMatch.Drawing.CanvasObjects
                        } else {
                                tk.DrawSurface (Photo, zero);
                        }
-                       numberHeight = StyleConf.PlayerNumberHeight;
-                       numberWidth = StyleConf.PlayerNumberWidth;
-                       p = new Point (StyleConf.PlayerNumberOffset, size - numberHeight);
-                       
-                       /* Draw background */
-                       tk.DrawSurface (number, zero);
+
+                       /* Bottom line */
+                       p = new Point (0, size - StyleConf.PlayerLineWidth);
+                       tk.FillColor = Color;
+                       tk.DrawRectangle (p, size, 3);
                        
                        /* Draw Arrow */
                        if (SubstitutionMode && (Highlighted || Active)) {
                                ISurface arrow;
-                               
+                               Point ap;
+
                                if (Playing) {
-                                       arrow = sout;
+                                       arrow = arrowout;
                                } else {
-                                       arrow = sin;
+                                       arrow = arrowin;
                                }
-                               tk.DrawSurface (arrow, new Point (Background.Width / 2 - arrow.Width / 2,
-                                                                 Background.Height / 2 - arrow.Height / 2));
+                               ap = new Point (StyleConf.PlayerArrowX, StyleConf.PlayerArrowY);
+                               tk.DrawRectangle (ap, StyleConf.PlayerArrowSize, StyleConf.PlayerArrowSize);
+                               tk.DrawSurface (arrow, ap);
                        }
                        
                        /* Draw number */
+                       p = new Point (StyleConf.PlayerNumberX, StyleConf.PlayerNumberY);
+                       tk.FillColor = Color;
+                       tk.DrawRectangle (p, StyleConf.PlayerNumberSize, StyleConf.PlayerNumberSize);
+                       
                        tk.FillColor = Color.White;
                        tk.StrokeColor = Color.White;
                        tk.FontWeight = FontWeight.Normal;
                        if (Player.Number >= 100) {
-                               tk.FontSize = (int)(size / 4);
+                               tk.FontSize = 14;
                        } else {
-                               tk.FontSize = (int)(size / 3);
+                               tk.FontSize = 18;
                        }
-                       tk.DrawText (p, numberWidth, numberHeight, Player.Number.ToString ());
+                       tk.DrawText (p, StyleConf.PlayerNumberSize, StyleConf.PlayerNumberSize,
+                                    Player.Number.ToString ());
                        
-                       /* Selection line */
                        if (Active) {
-                               tk.LineStyle = LineStyle.Normal;
-                               tk.LineWidth = StyleConf.PlayerLineWidth;
-                               tk.FillColor = null;
-                               tk.StrokeColor = Config.Style.PaletteActive;
-                               tk.DrawRoundedRectangle (zero, size + 1, size + 1, StyleConf.PlayerLineWidth);
+                               Color c = Color.Copy ();
+                               c.A = (byte)(c.A * 60 / 100);
+                               tk.FillColor = c;
+                               tk.DrawRectangle (zero, size, size);
                        }
                        
                        tk.End ();
                }
-               
-               void Init (Point pos = null) {
+
+               void Init (Point pos = null)
+               {
                        if (pos == null) {
                                pos = new Point (0, 0);
                        }
@@ -218,13 +216,8 @@ namespace LongoMatch.Drawing.CanvasObjects
                {
                        if (!surfacesCached) {
                                Photo = CreateSurface (StyleConf.PlayerPhoto);
-                               Background = CreateSurface (StyleConf.PlayerBackground);
-                               HomeNumber = CreateSurface (StyleConf.PlayerHomeNumber);
-                               AwayNumber = CreateSurface (StyleConf.PlayerAwayNumber);
-                               HomeOut = CreateSurface (StyleConf.PlayerHomeOut);
-                               AwayOut = CreateSurface (StyleConf.PlayerAwayOut);
-                               HomeIn = CreateSurface (StyleConf.PlayerHomeIn);
-                               AwayIn = CreateSurface (StyleConf.PlayerAwayIn);
+                               ArrowOut = CreateSurface (StyleConf.PlayerArrowOut);
+                               ArrowIn = CreateSurface (StyleConf.PlayerArrowIn);
                                surfacesCached = true;
                        }
                }
@@ -233,7 +226,6 @@ namespace LongoMatch.Drawing.CanvasObjects
                {
                        return Config.DrawingToolkit.CreateSurface (Path.Combine (Config.ImagesDir, name), 
false);
                }
-
        }
 }
 
diff --git a/data/images/Makefile.am b/data/images/Makefile.am
index 3f1a9fa..9299e27 100644
--- a/data/images/Makefile.am
+++ b/data/images/Makefile.am
@@ -6,11 +6,6 @@ nobase_dist_images_DATA = Makefile.am \
        fields/field-half.svg \
        longomatch-dark-bg.svg \
        longomatch-light-bg.svg \
-       player/away-in.svg \
-       player/away-number.svg \
-       player/away-out.svg \
-       player/background.svg \
-       player/home-in.svg \
-       player/home-number.svg \
-       player/home-out.svg \
+       player/arrow-in.svg \
+       player/arrow-out.svg \
        player/photo.svg
diff --git a/data/images/player/arrow-in.svg b/data/images/player/arrow-in.svg
new file mode 100644
index 0000000..8003854
--- /dev/null
+++ b/data/images/player/arrow-in.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   version="1.1"
+   id="Layer_1"
+   x="0px"
+   y="0px"
+   width="20"
+   height="20"
+   viewBox="0 0 20 20"
+   enable-background="new 0 0 26 20"
+   xml:space="preserve"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="arrow-out.svg"><metadata
+     id="metadata8"><rdf:RDF><cc:Work
+         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; 
/><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+     id="defs6" /><sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1139"
+     inkscape:window-height="627"
+     id="namedview4"
+     showgrid="false"
+     inkscape:zoom="21.986719"
+     inkscape:cx="12.31777"
+     inkscape:cy="10"
+     inkscape:window-x="257"
+     inkscape:window-y="77"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="Layer_1" /><path
+     id="reply_3_"
+     d="M 12.49987,6.7256274 V 2.9756001 c 0,-0.2558787 0.153684,-0.4844533 0.39162,-0.5819681 
0.07645,-0.030425 0.153683,-0.044467 0.233255,-0.044467 0.165385,0 0.33233,0.06787 0.454029,0.1942494 l 
6.176194,6.7644036 c 0.191909,0.1934692 0.252758,0.3580741 0.244177,0.542182 0.01248,0.168505 
-0.107657,0.39942 -0.234816,0.5297 l -0.0094,0.01092 -6.176194,6.766743 c -0.121698,0.124819 
-0.288644,0.19347 -0.454029,0.19347 -0.07957,0 -0.156803,-0.0156 -0.233255,-0.04759 -0.237936,-0.09361 
-0.39162,-0.323748 -0.39162,-0.578847 V 12.972808 C 0.425945,12.972808 0.014043,17.068428 0,17.34927 
0.014082,7.3239779 12.49987,6.7256274 12.49987,6.7256274 z"
+     inkscape:connector-curvature="0"
+     style="fill:#f6f6f6" /></svg>
\ No newline at end of file
diff --git a/data/images/player/arrow-out.svg b/data/images/player/arrow-out.svg
new file mode 100644
index 0000000..3738bdb
--- /dev/null
+++ b/data/images/player/arrow-out.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   version="1.1"
+   id="Layer_1"
+   x="0px"
+   y="0px"
+   width="20"
+   height="20"
+   viewBox="0 0 20 20"
+   enable-background="new 0 0 26 20"
+   xml:space="preserve"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="arrow-out.svg"><metadata
+     id="metadata8"><rdf:RDF><cc:Work
+         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; /></cc:Work></rdf:RDF></metadata><defs
+     id="defs6" /><sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1139"
+     inkscape:window-height="627"
+     id="namedview4"
+     showgrid="false"
+     inkscape:zoom="21.986719"
+     inkscape:cx="12.31777"
+     inkscape:cy="10"
+     inkscape:window-x="257"
+     inkscape:window-y="77"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="Layer_1" /><path
+     id="reply_3_"
+     d="M 7.5001694,6.7256274 V 2.9756001 c 0,-0.2558787 -0.153684,-0.4844533 -0.39162,-0.5819681 
-0.07645,-0.030425 -0.153683,-0.044467 -0.233255,-0.044467 -0.165385,0 -0.33233,0.06787 -0.454029,0.1942494 L 
0.2450714,9.307818 C 0.05316237,9.5012872 -0.00768663,9.6658921 8.9436971e-4,9.85 -0.01158563,10.018505 
0.10855137,10.24942 0.2357104,10.3797 l 0.0094,0.01092 6.176194,6.766743 c 0.121698,0.124819 0.288644,0.19347 
0.454029,0.19347 0.07957,0 0.156803,-0.0156 0.233255,-0.04759 0.237936,-0.09361 0.39162,-0.323748 
0.39162,-0.578847 v -3.751588 c 12.0738856,0 12.4857876,4.09562 12.4998306,4.376462 C 19.985957,7.3239779 
7.5001694,6.7256274 7.5001694,6.7256274 z"
+     inkscape:connector-curvature="0"
+     style="fill:#f6f6f6" /></svg>
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]