Пример #1
0
 private SpaceDrawing findSpace(CardGameTableSpace space)
 {
     string id = "dv_space_" + space.Name;
     if (spaces[id] != null)
         return spaces[id];
     else {
         var sp = Document.CreateElement("div");
         sp.ID = id;
         sp.Style.Position = "absolute";
         jQuery.Select("#dvGame").Append(sp);
         return spaces[id] = new SpaceDrawing(sp);
     }
 }
Пример #2
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;
        }
Пример #3
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;
        }