Пример #1
0
        public Card(CardTypes cardType)
        {
            Type = cardType;

            var location = string.Format("../../../Assets/{0}.jpg", Type.ToString());

            Name     = Type.ToString();
            Size     = new Size(135, 200);
            Image    = Image.FromFile(location);
            SizeMode = PictureBoxSizeMode.StretchImage;
            Click   += new EventHandler(Card_Click);
        }
Пример #2
0
 public void SetCard(CardTypes type, float cardreachseconds)
 {
     Type             = type;
     gameObject.name  = type.ToString();
     CardReachSeconds = cardreachseconds;
     gameObject.transform.SetParent(OwnerSet.transform);
 }
Пример #3
0
            /// <summary>
            /// Gets the supported card types based on a provided card type list. If no card type list is provided, return the full supported list.
            /// </summary>
            /// <param name="chosenCardTypes">The provided card types.</param>
            /// <returns>The supported card types.</returns>
            public static string GetSupportedCardTypes(string chosenCardTypes)
            {
                string[] chosenCardTypeArray = CardTypes.ToArray(chosenCardTypes);

                if (chosenCardTypeArray == null || chosenCardTypeArray.Length == 0)
                {
                    // Return the full list of supported card types
                    return(CardTypes.ToString(CardTypes.supportedCardTypes));
                }
                else
                {
                    // Filter unsupported card types
                    var supportedChosenCardTypes = new List <string>();

                    foreach (var chosenCardType in chosenCardTypeArray)
                    {
                        foreach (var supportedCardType in CardTypes.supportedCardTypes)
                        {
                            if (supportedCardType.Equals(chosenCardType, StringComparison.OrdinalIgnoreCase))
                            {
                                supportedChosenCardTypes.Add(supportedCardType);
                            }
                        }
                    }

                    return(CardTypes.ToString(supportedChosenCardTypes.ToArray()));
                }
            }
Пример #4
0
            public CardTypeFinder(CardTypes cardType)
            {
                CardType      = cardType;
                MarkerPattern = null;

                var attr = CardMarkerAttribute.GetFrom <CardTypes>(cardType.ToString());

                if (attr != null)
                {
                    Marker        = attr.Marker;
                    MarkerPattern = attr.MarkerPattern;
                }
            }
Пример #5
0
        public static string GetViewName(this CardTypes type)
        {
            switch (type)
            {
            case CardTypes.CASH:
                return("Cash");

            case CardTypes.DISCOUNT:
                return("Discount");

            case CardTypes.GIFT:
                return("Gift");

            case CardTypes.MEMBER_CARD:
                return("Member");

            default:
                throw new NotSupportedException(type.ToString());
            }
        }
Пример #6
0
        static void Lab4()
        {
            //GameFacade facade = new GameFacade();
            //var board = facade.CreateGame("Simple", 3, 4);

            CardTypes card = CardTypes.Eight | CardTypes.Four;

            Console.WriteLine(card.ToString());


            //Boxing:
            int    forBoxing = 5;
            object boxed     = forBoxing;

            //Unboxing
            int forUnboxing = (int)forBoxing;

            OverridedObject obj = new OverridedObject();

            Console.WriteLine(obj.ToString());

            // differentParams
            var rtable = new RecordsTable();

            int vint = 4;
            int rint = 4;

            rtable.GetNumberOfRecords(vint, ref rint, out var oint);

            Console.WriteLine(vint);
            Console.WriteLine(rint);
            Console.WriteLine(oint);

            SimpleCard c1 = "test";

            SimpleCard c2 = (SimpleCard)1;


            Console.ReadLine();
        }
Пример #7
0
        public static ICardCoupon DeserializeSpecificCardCoupon(this string json, CardTypes type)
        {
            ICardCoupon cardCoupon = null;

            switch (type)
            {
            case CardTypes.CASH:
                cardCoupon = json.DeserializeToObject <CashCoupon>();
                break;

            case CardTypes.DISCOUNT:
                cardCoupon = json.DeserializeToObject <DiscountCoupon>();
                break;

            case CardTypes.GENERAL_COUPON:
                cardCoupon = json.DeserializeToObject <GeneralCoupon>();
                break;

            case CardTypes.GIFT:
                cardCoupon = json.DeserializeToObject <GiftCoupon>();
                break;

            case CardTypes.GROUPON:
                cardCoupon = json.DeserializeToObject <Groupon>();
                break;

            case CardTypes.MEMBER_CARD:
                cardCoupon = json.DeserializeToObject <MemberCard>();
                break;
            }
            if (cardCoupon != null)
            {
                cardCoupon.CardType = type;
                return(cardCoupon);
            }
            throw new NotSupportedException(type.ToString());
        }
Пример #8
0
        public static string TextOf(this CardTypes type)
        {
            switch (type)
            {
            case CardTypes.CASH:
                return("代金券");

            case CardTypes.DISCOUNT:
                return("折扣券");

            case CardTypes.GENERAL_COUPON:
                return("通用券");

            case CardTypes.GIFT:
                return("礼品券");

            case CardTypes.GROUPON:
                return("团购券");

            case CardTypes.MEMBER_CARD:
                return("会员卡");
            }
            throw new NotSupportedException("No support with type " + type.ToString());
        }
Пример #9
0
 public static string GetName(CardTypes cardType)
 {
     return(cardType.ToString());
 }
Пример #10
0
 public override string ToString()
 {
     return(string.Concat(CardTypes.ToString(), "-", Value));
 }
Пример #11
0
        public void ShowDialog(string cardName, string cardDescription, int cardPoints, int cardId, CardTypes cardType)
        {
            Label cardTypeLabel = new Label()
            {
                Text = cardType.ToString(), Width = 200
            };
            MetroLabel name = new MetroLabel()
            {
                Width = 460, Height = 20, TabIndex = 0, TabStop = true, Text = cardName
            };
            MetroTextBox description = new MetroTextBox()
            {
                Width = 460, Height = 350, TabIndex = 0, TabStop = true, Text = cardDescription, ReadOnly = true, Multiline = true
            };
            var numericUpDown = new MetroLabel()
            {
                Width = 50, Height = 20, TabIndex = 0, TabStop = true, Text = cardPoints.ToString()
            };
            var result = DialogResult;

            using (var form = new DialogForm(new FormInfo("View Card", 485, 600)))
            {
                MetroLabel nameLabel = new MetroLabel()
                {
                    Height = 20, Text = "Card Name"
                };

                name.Left = 4;

                description.Left = 4;

                MetroLabel descriptionLabel = new MetroLabel()
                {
                    Text = "Card Description", Width = 110
                };

                MetroButton close = new MetroButton()
                {
                    Text = "close", TabIndex = 1, TabStop = true
                };
                ;
                close.Click += (sender, e) =>
                {
                    form.DialogResult = DialogResult.OK;
                    form.Close();
                };

                var propertiesLayout = new FlowLayoutPanel();
                propertiesLayout.Size          = new System.Drawing.Size(485, 30);
                propertiesLayout.FlowDirection = FlowDirection.LeftToRight;
                var pointsLabel = new MetroLabel()
                {
                    Text = "Points"
                };

                propertiesLayout.Controls.Add(pointsLabel);
                propertiesLayout.Controls.Add(numericUpDown);
                propertiesLayout.Controls.Add(cardTypeLabel);


                var flowLayoutVertical = new FlowLayoutPanel();

                flowLayoutVertical.FlowDirection = FlowDirection.TopDown;
                flowLayoutVertical.Location      = new System.Drawing.Point(0, 60);
                flowLayoutVertical.Size          = new System.Drawing.Size(485, 600);
                flowLayoutVertical.Controls.Add(nameLabel);
                flowLayoutVertical.Controls.Add(name);
                flowLayoutVertical.Controls.Add(descriptionLabel);
                flowLayoutVertical.Controls.Add(description);
                flowLayoutVertical.Controls.Add(propertiesLayout);
                var buttonLayoutPanel = new FlowLayoutPanel
                {
                    FlowDirection = FlowDirection.RightToLeft,
                    Top           = 420,
                    Left          = 4,
                    Width         = 460
                };
                buttonLayoutPanel.Controls.Add(close);
                flowLayoutVertical.Controls.Add(buttonLayoutPanel);
                form.Controls.Add(flowLayoutVertical);
                //TODO build form
                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.ControlBox      = false;
                result = form.ShowDialog();
            }
        }