public override void Build(CardDrawing m)
 {
     if (Style == null) return;
     m.OuterElementStyle.BackgroundColor = Style.OuterStyle.BackColor;
     if (Style.OuterStyle.Border != null) {
         if (Style.OuterStyle.Border.Left != null) {
             m.OuterElementStyle.BorderLeftColor = Style.OuterStyle.Border.Left.Color;
             m.OuterElementStyle.BorderLeftStyle = Style.OuterStyle.Border.Left.Style.ToString();
             m.OuterElementStyle.BorderLeftWidth = Style.OuterStyle.Border.Left.Width;
         }
         if (Style.OuterStyle.Border.Top != null) {
             m.OuterElementStyle.BorderTopColor = Style.OuterStyle.Border.Top.Color;
             m.OuterElementStyle.BorderTopStyle = Style.OuterStyle.Border.Top.Style.ToString();
             m.OuterElementStyle.BorderTopWidth = Style.OuterStyle.Border.Top.Width;
         }
         if (Style.OuterStyle.Border.Right != null) {
             m.OuterElementStyle.BorderRightColor = Style.OuterStyle.Border.Right.Color;
             m.OuterElementStyle.BorderRightStyle = Style.OuterStyle.Border.Right.Style.ToString();
             m.OuterElementStyle.BorderRightWidth = Style.OuterStyle.Border.Right.Width;
         }
         if (Style.OuterStyle.Border.Bottom != null) {
             m.OuterElementStyle.BorderBottomColor = Style.OuterStyle.Border.Bottom.Color;
             m.OuterElementStyle.BorderBottomStyle = Style.OuterStyle.Border.Bottom.Style.ToString();
             m.OuterElementStyle.BorderBottomWidth = Style.OuterStyle.Border.Bottom.Width;
         }
     }
 }
        public override void Build(CardDrawing e)
        {
            var em = e.OuterElementStyle;

            em.Padding = string.Format("{0} {0} {0} {0}", ( Radius ).px());
            em.BackgroundColor = Color;
            em.Border = "solid 2px black";
            em.Left = ( em.Left.nopx() - Radius ).px();
            em.Top = ( em.Top.nopx() - Radius ).px();

            /// Window.Alert("good1");

            em.BorderRadius = 15.0.px();
            em.BoxShadow = "4px 4px 2px #333";
        }
Esempio n. 3
0
        /*  private void setStyle(Style style, MyStyle myStyle)
        {
            string item="";
            ExtensionMethods.ForInItem(style);
            {
                if(myStyle[item]!=null)
                {
                    style[item] = myStyle[item];
                }else
                {
                    style[item] = null;
                }
            }
            ExtensionMethods.CloseForIn();
        }*/
        private void styleAppearanceFromSpace(CardDrawing element, int cardIndex, CardGameTableSpace space)
        {
            CardGameAppearance appearance = space.Appearance;
            foreach (var cardGameAppearanceEffect in appearance.Effects) {
                //   cardGameAppearanceEffect.Build(element.Item1);

                switch (cardGameAppearanceEffect.Type) {
                    case EffectType.Bend:

                        var bEffect = (CardGameAppearanceEffectBend) cardGameAppearanceEffect;

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

                        if (( trans ?? "" ).StartsWith("rotate("))
                            element.OuterElementStyle.Transform = ( ( ( -bEffect.Degrees / 2 + bEffect.Degrees / ( space.Pile.Cards.Count - 1 ) * cardIndex ) + trans.NoTransformRotate() ) ).TransformRotate();
                        else
                            element.OuterElementStyle.Transform = appearance.InnerStyle.Rotate.TransformRotate();

                        break;
                }
            }

            element.OuterElementStyle.BackgroundColor = appearance.InnerStyle.BackColor;
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
        //todo fix for show face down cards lol typevalue
        private CardDrawing findCard(CardGameTableSpace wantedSpace, CardGameCard card)
        {
            string id = "dv_card_" + card.Type + "_" + card.Value;
            var space = findSpace(wantedSpace);

            CardDrawing doc;
            if (cards[id] != null) {
                var m = Document.GetElementById(id);
                if (m.ParentNode != ( space.OuterElement )) {
                    m.ParentNode.RemoveChild(m);
                    space.OuterElement.AppendChild(m);
                }

                doc = cards[id];
            } else {
                var sp = Document.CreateElement("div");
                sp.ID = id;
                jQuery.FromElement(space.OuterElement).Append(sp);

                var cardImage = cloneImage(cardImages[drawCard(card)]);
                sp.AppendChild(cardImage);
                sp.Style.Position = "absolute";

                doc = cards[id] = new CardDrawing(sp);
            }

            return doc;
        }
 public override void TearDown(CardDrawing m)
 {
     base.TearDown(m);
 }
 public virtual void Build(CardDrawing m)
 {
     ///Window.Alert("bad1");
 }
 public virtual void TearDown(CardDrawing m)
 {
     ///Window.Alert("bad2");
 }
        public override void TearDown(CardDrawing e)
        {
            /*
            var em = e.OuterElementStyle;

            ///     Window.Alert("good2");

            double paddingRadiusL = em.PaddingLeft.nopx();
            double paddingRadiusT = em.PaddingTop.nopx();
            em.Left = ( em.Left.nopx() - em.PaddingLeft.nopx() ).px();
            em.Top = ( em.Top.nopx() - em.PaddingTop.nopx() ).px();

            for (int i = 0; i < e.OuterElement.ChildNodes.Length; i++) {
                var childNode = e.OuterElement.ChildNodes[i];

                if (childNode.TagName == "DIV") {
                    childNode.Style.Left = ( childNode.Style.Left.nopx() + paddingRadiusL ).px();
                    childNode.Style.Top = ( childNode.Style.Top.nopx() + paddingRadiusT ).px();
                }
            }
            */
        }