Ejemplo n.º 1
0
        public static CardGameAppearance FromJson(CardGameAppearance json)
        {
            CardGameAppearance ap = new CardGameAppearance();
            ap.InnerStyle = CardGameAppearanceStyleItem.FromJson(json.InnerStyle);
            ap.OuterStyle = CardGameAppearanceStyleItem.FromJson(json.OuterStyle);
            ap.Effects = new List<CardGameAppearanceEffect>();
            if (json.Effects != null) {
                foreach (var effect in json.Effects) {
                    ap.Effects.Add(CardGameAppearanceEffect.FromJson(effect));
                }
            }

            return ap;
        }
Ejemplo n.º 2
0
 public CardGameTableSpace(CardGameTableSpaceOptions options)
 {
     Vertical = !options.Vertical ? false : options.Vertical;
     X = options.X == 0 ? 0 : options.X;
     Y = options.Y == 0 ? 0 : options.Y;
     Width = options.Width == 0 ? 0 : options.Width;
     Height = options.Height == 0 ? 0 : options.Height;
     Pile = options.Pile;
     //Rotate = options.Rotate == 0 ? 0 : options.Rotate;
     Visible = !options.Visible ? true : options.Visible;
     StackCards = !options.StackCards ? false : options.StackCards;
     DrawCardsBent = !options.DrawCardsBent ? true : options.DrawCardsBent;
     Name = options.Name ?? "TableSpace";
     SortOrder = options.SortOrder;
     NumerOfCardsHorizontal = options.NumerOfCardsHorizontal == 0 ? 1 : options.NumerOfCardsHorizontal;
     NumerOfCardsVertical = options.NumerOfCardsVertical == 0 ? 1 : options.NumerOfCardsVertical;
     ResizeType = options.ResizeType;
     //Rotate = ExtensionMethods.eval("options.rotate? options.rotate : 0");
     Appearance = new CardGameAppearance();
 }
Ejemplo n.º 3
0
        private void styleAppearance(CardDrawing element, CardGameAppearance appearance)
        {
            foreach (var cardGameAppearanceEffect in appearance.Effects) {
                cardGameAppearanceEffect.Build(element);
                //new object().debugger();
                cardGameAppearanceEffect.TearDown(element);
            }

            //rotate
            string trans = element.OuterElementStyle.Transform;

            if (( trans ?? "" ).StartsWith("rotate("))
                element.OuterElementStyle.Transform = string.Format("rotate({0}deg)", appearance.InnerStyle.Rotate + int.Parse(trans.Replace("rotate(", "").Replace("deg)", ""))); //todo regex??
            else
                element.OuterElementStyle.Transform = string.Format("rotate({0}deg)", appearance.InnerStyle.Rotate);

            element.OuterElementStyle.BackgroundColor = appearance.InnerStyle.BackColor;
        }
Ejemplo n.º 4
0
 private CardGameAppearance fixAppearance(CardGameAppearance appearance)
 {
     return CardGameAppearance.FromJson(appearance);
 }
Ejemplo n.º 5
0
 public CardGameCard(int value, int type)
 {
     Value = value;
     Type = type;
     Appearance = new CardGameAppearance();
 }