Пример #1
0
        public void SaveCard(BoardSaveCardRequestDto card)
        {
            var entity = new CARD {
                EMAIL       = this.UserEmail,
                BOARD_SEQ   = card.boardSeq,
                LIST_SEQ    = card.listSeq,
                CARD_SEQ    = card.seq,
                CARD_TITLE  = card.title,
                DESCRIPTION = card.description,
                PREV_CARD   = card.prevSeq
            };
            var findCard = _context.CARD.Find(this.UserEmail, entity.BOARD_SEQ, entity.LIST_SEQ, entity.CARD_SEQ);

            if (findCard == null)
            {
                _context.CARD.Add(entity);
            }
            else
            {
                findCard.CARD_TITLE  = entity.CARD_TITLE;
                findCard.DESCRIPTION = entity.DESCRIPTION;
                findCard.PREV_CARD   = entity.PREV_CARD;
                _context.CARD.Update(findCard);
            }
            _context.SaveChanges();
        }
Пример #2
0
        static void Main(string[] args)
        {
            CONFIG.Load();

            CARD.Open();

            int[] d = new int[5];

            d[0] = FUNC.ToInt32(0x27, 0x26, 0x13, 0x1A);
            d[1] = FUNC.ToInt32(0x04, 0x04, 0x0C, 0x00);
            d[2] = 0;
            d[3] = 0;
            d[4] = 0;

            CARD.SendCMD(1, 1, 1, 0x10, d, 100);

            Console.WriteLine("选择工作模式:1 有线 2 无线");
            int mode = -1;

            int.TryParse(Console.ReadLine(), out mode);
            switch (mode)
            {
            case 1: Test1(); break;

            case 2: Test2(); break;
            }

            CARD.Close();
        }
Пример #3
0
    IEnumerator InitializeAllCards()
    {
        FULLDECK = new CARD[CARDS_AMOUNT];

        int curcard = 0;

        foreach (CARD.SUIT suit in Enum.GetValues(typeof(CARD.SUIT)))
        {
            foreach (CARD.VALUE value in Enum.GetValues(typeof(CARD.VALUE)))
            {
                FULLDECK [curcard] = new CARD {
                    thisSuit = suit, thisValue = value
                };
                FULLDECK [curcard].ID = curcard;
                curcard++;
            }
        }
        yield return(new WaitForSeconds(1));

        shufflecardref.ShuffleFullDeck();
        //shufflecardref.MakePair ();

        float leftmarge = 0;

        for (int i = 0; i < 52; i++)
        {
            GameObject Cardgo;
            Cardgo     = (GameObject)Instantiate(ReversCardPrefab, new Vector3(FullDeckSP.transform.position.x - leftmarge, FullDeckSP.transform.position.y, FullDeckSP.transform.position.z + leftmarge), FullDeckSP.transform.rotation);
            leftmarge += MargeLeftPile;

            yield return(new WaitForSeconds(DelayBetweenSpawnCard));
        }
    }
Пример #4
0
 public static void addNewCard(CARD card)
 {
     using (var dtbEntity = new QLTVEntities1())
     {
         dtbEntity.CARDS.Add(card);
         dtbEntity.SaveChanges();
     }
 }
Пример #5
0
 public static void addNewCard(CARD card)
 {
     using (var dtbEntity = new QLTVEntities1())
     {
         dtbEntity.CARDS.Add(card);
         dtbEntity.SaveChanges();
         MessageBox.Show("Add successfully!");
     }
 }
        public static Card GenerateCardWithout(VALUE[] restrictedValues, string withColor)
        {
            Card result;

            do
            {
                result = CARD.GetRandomCard();
            } while (EqualValues(result, restrictedValues) || result.Color != withColor);
            return(result);
        }
        public static Card GenerateCardWithout(VALUE[] restrictedValues)
        {
            Card result;

            do
            {
                result = CARD.GetRandomCard();
            } while (EqualValues(result, restrictedValues));
            return(result);
        }
        public static Card GenerateCardsWithout(string[] restrictedColors)
        {
            Card result;

            do
            {
                result = CARD.GetRandomCard();
            } while (EqualColors(result, restrictedColors));
            return(result);
        }
Пример #9
0
        private static void Test2()
        {
            do
            {
                try
                {
                    Console.WriteLine("输入:串口ID 地址 命令 [数据 接收次数]");
                    string[] s = Console.ReadLine().Split(',', ' ');

                    if (s[0] == "")
                    {
                        break;
                    }

                    int  id   = Convert.ToByte(s[0]);
                    byte addr = Convert.ToByte(s[1], 16);
                    byte cmd  = Convert.ToByte(s[2], 16);
                    int  data = (s.Length > 3) ? Convert.ToInt32(s[3], 16) : 0;
                    int  cnt  = (s.Length > 4) ? Convert.ToInt32(s[4]) : 1;

                    TCardRecv recv = new TCardRecv();

                    CARD.SendCMD(id, addr, cmd, data, 100);

                    for (int i = 0; i < cnt; i++)
                    {
                        DateTime d1 = DateTime.Now;

                        bool bl = CARD.ReadData(id, recv, 200);

                        TimeSpan t = new TimeSpan(DateTime.Now.Ticks - d1.Ticks);

                        Console.Write(t.TotalMilliseconds.ToString("0ms:").PadRight(8, ' '));

                        if (bl)
                        {
                            Console.Write(recv.ToString());

                            string js = System.Text.Encoding.Default.GetString(recv.Data);

                            Console.WriteLine("     " + js);
                        }
                        else
                        {
                            Console.WriteLine("读取超时");
                        }
                    }
                    Console.WriteLine();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            } while (true);
        }
Пример #10
0
        // Four of a Kind: Four cards of the same value.
        // Not impl: Each of the four in a different suit.
        // TD TH TS TC KC
        public bool IsFourOfAkind()
        {
            bool isFound = false;

            if (stackedValues[0].Count() == 4)
            {
                isFound           = true;
                highestCardInRank = stackedValues[0].FirstOrDefault();
            }
            return(isFound);
        }
Пример #11
0
        // Flush: All cards of the same suit.
        // JS 9S QS TS KS
        public bool IsFlush()
        {
            bool isFound = false;

            if (stackedSuits.Count == 1)
            {
                isFound           = true;
                highestCardInRank = GetHighestCard();
            }
            return(isFound);
        }
Пример #12
0
        // One Pair: Two cards of the same value.
        // and three unmatched cards.
        // 5H 5C 6S 7S KD
        public bool IsOnePair()
        {
            bool isFound = false;

            if (stackedValues.Count == 4)
            {
                isFound           = true;
                highestCardInRank = stackedValues[0].FirstOrDefault();
            }
            return(isFound);
        }
Пример #13
0
        // Two Pairs: Two different (value) pairs.
        // 5H 5D KS 7S KD
        public bool IsTwoPairs()
        {
            bool isFound = false;

            if (stackedSuits.Count() > 1 && stackedValues[0].Count() == 2 && stackedValues[1].Count() == 2)
            {
                isFound           = true;
                highestCardInRank = stackedValues[1].FirstOrDefault(); // Options: _5 or _K
            }
            return(isFound);
        }
Пример #14
0
        // Full House: Three of a (value) kind and a pair.
        // 7C 7H 7S TD TC
        public bool IsFullHouse()
        {
            bool isFound = false;

            if (stackedValues.Count() == 2)
            {
                isFound           = true;
                highestCardInRank = stackedValues[0].FirstOrDefault();
            }
            return(isFound);
        }
Пример #15
0
        // Straight Flush: All cards are consecutive values of same suit.
        // 3S 4S 5S 6S 7S
        public bool IsStraightFlush()
        {
            bool isFound = false;

            if (IsFlush() && IsFiveConsecutiveValues())
            {
                isFound           = true;
                highestCardInRank = GetHighestCard();
            }
            return(isFound);
        }
Пример #16
0
 public void savecard()
 {
     if (PASSFLAG && NUMBERFLAG && month.value != 0 && year.value != 0)
     {
         if (!File.Exists(path))
         {
             using (StreamWriter save = File.CreateText(path))
             {
                 save.WriteLine("UserName" + "," + "Numbercard" + "," + "Passcard" + "," + "Month" + "," + "Year");
                 save.WriteLine(currentusername + ',' + numbercard.text + ',' + passcard.text + ',' + month.options[month.value].text + ',' + year.options[year.value].text);
             }
         }
         else
         {
             using (StreamWriter save = File.AppendText(path))
             {
                 save.WriteLine(currentusername + ',' + numbercard.text + ',' + passcard.text + ',' + month.options[month.value].text + ',' + year.options[year.value].text);
             }
         }
         window1.SetActive(false);
         window2.SetActive(true);
         list.Clear();
         System.IO.StreamReader file = new System.IO.StreamReader(path);
         line = file.ReadLine();
         while ((line = file.ReadLine()) != null)
         {
             linecol = line.Split(',');
             if (linecol[0] == currentusername)
             {
                 optioncards = +1;
                 Debug.Log(linecol[1]);
                 list.Add(linecol[1]);
             }
         }
         file.Close();
         Debug.Log(list);
         CARD.AddOptions(list);
         list1           = CARD.options;
         CARD.value      = list1.Count;
         countcard       = list1.Count;
         numbercard.text = "";
         passcard.text   = "";
         month.value     = 0;
         year.value      = 0;
         if (ColorUtility.TryParseHtmlString("#635E5E", out color))
         {
             numbercard.GetComponent <Image>().color = color;
             passcard.GetComponent <Image>().color   = color;
             month.GetComponent <Image>().color      = color;
             year.GetComponent <Image>().color       = color;
         }
     }
 }
Пример #17
0
        // Three of a Kind: Three cards of the same value.
        // Not Impl: plus Two unmatched cards.
        // 5S 5C KS 5D QD
        public bool IsThreeOfAKind()
        {
            bool isFound = false;

            if (stackedValues[0].Count() == 3
                //&& stackedSuits.Count() == 3
                )
            {
                isFound           = true;
                highestCardInRank = stackedValues[0].FirstOrDefault();
            }
            return(isFound);
        }
Пример #18
0
        public bool IsFiveConsecutiveValues()
        {
            int cardSeqMatchCnt = 1;
            var firstCardName   = GetLowestCard();
            int idxFirstCard    = allCardValuesInOrder.IndexOf(firstCardName);

            for (int idx = 1; idx < numCards; idx++)
            {
                if (idx >= orderedUniqueValues.Count() || idxFirstCard + idx >= allCardValuesInOrder.Count())
                {
                    break;
                }
                CARD cardInHand   = (CARD)Enum.Parse(typeof(CARD), orderedUniqueValues[idx].ToString());
                CARD refCardInSeq = (CARD)Enum.Parse(typeof(CARD), allCardValuesInOrder[idxFirstCard + idx].ToString());
                if (cardInHand.Equals(refCardInSeq))
                {
                    cardSeqMatchCnt++;
                }
            }
            return(cardSeqMatchCnt == numCards);
        }
Пример #19
0
        public Hand(string[] fiveCardHand)
        {
            if (fiveCardHand.Count() != numCards)
            {
                throw new IllegalNumberOfCards();
            }
            refHand = fiveCardHand;
            allCardValuesInOrder = GetStandardCardValues();

            fiveCards = (from v in GetCardValues(fiveCardHand.ToList()) select GetEnumFromString("_" + v)).ToArray();
            fiveSuits = (from s in GetCardSuits(fiveCardHand.ToList()) select(SUIT) Enum.Parse(typeof(SUIT), s.ToString())).ToArray();

            stackedValues = fiveCards.GroupBy(t => t.ToString()).OrderByDescending(u => u.Count()).ToList();
            stackedSuits  = fiveSuits.GroupBy(t => t.ToString()).OrderByDescending(u => u.Count()).ToList();

            orderedUniqueValues = new List <CARD>(fiveCards.Distinct().ToList());
            orderedUniqueValues.Sort();

            highestCardInRank = orderedUniqueValues.Last();
            bestRankForHand   = FindBestHand();
        }
Пример #20
0
 // Start is called before the first frame update
 void Start()
 {
     path  = Application.dataPath + "/CardFromUsers";
     path1 = Application.dataPath + "/holdcurrentname";
     path4 = Application.dataPath + "/SUCCESFULLBUY";
     path3 = Application.dataPath + "/tickets";
     System.IO.StreamReader file = new System.IO.StreamReader(path1);
     line1           = file.ReadLine();
     currentusername = line1;
     file.Close();
     if (File.Exists(path))
     {
         System.IO.StreamReader file1 = new System.IO.StreamReader(path);
         line = file1.ReadLine();
         while ((line = file1.ReadLine()) != null)
         {
             linecol = line.Split(',');
             if (linecol[0] == currentusername)
             {
                 windowflag = true;
                 list.Add(linecol[1]);
             }
         }
         if (windowflag)
         {
             CARD.AddOptions(list);
             window2.SetActive(true);
             List <Dropdown.OptionData> list1 = CARD.options;
             CARD.value = list1.Count;
         }
         else
         {
             window1.SetActive(true);
         }
     }
     else
     {
         window1.SetActive(true);
     }
 }
Пример #21
0
        public bool IsBetterThan(Hand player2Hand)
        {
            HAND comparisonHandRanking  = player2Hand.GetRank();
            CARD comparisonHiCardInRank = player2Hand.GetHighestCardInRank();

            bool isCurrentRankBest = false;

            if (bestRankForHand != comparisonHandRanking)
            {
                isCurrentRankBest = bestRankForHand > comparisonHandRanking;
                //if (isCurrentRankBest)
                //    DisplayHandRanking(player2Hand, comparisonHandRanking, comparisonHiCardInRank, isCurrentRankBest);
            }
            else
            {
                isCurrentRankBest = highestCardInRank > comparisonHiCardInRank;
                //if (isCurrentRankBest)
                //    DisplayCardRanking(player2Hand, comparisonHandRanking, comparisonHiCardInRank, isCurrentRankBest);
            }

            return(isCurrentRankBest);
        }
Пример #22
0
        public static Boolean crearCarta(string nombre, string descripcion, string color, string ini, string fin, int prioridad, int tipo)
        {
            KanbanEntities ke = new KanbanEntities();

            if (prioridad <= 0)
            {
                return(false);
            }
            CARD li = new CARD();

            li.FECHAFINAL = fin;
            if (ini != null)
            {
                li.FECHAINICIO = ini;
            }
            li.NOMBRE      = nombre;
            li.DESCRIPCION = descripcion;
            li.COLOR       = color;
            li.PRIORIDAD   = prioridad;
            li.TIPO        = tipo;
            ke.AddToCARDS(li);
            return(true);
        }
Пример #23
0
        private void btnAddReader_Click(object sender, EventArgs e)
        {
            READER reader = new READER();
            CARD   card   = new CARD();

            var tempReader = Connection.db.READERS.Count();


            reader.idReader   = tempIDReader + tempReader;
            reader.nameReader = txtFirstName.Text + txtLastName.Text;
            reader.idClass    = cbbClass.SelectedValue.ToString();
            if (cbbSex.SelectedText == "Male")
            {
                reader.sex = false;
            }
            else
            {
                reader.sex = true;
            }
            reader.birthday = Convert.ToDateTime(dtpBirthday.Text);
            reader.address  = txtAddress.Text;
            ReaderDAL.addNewReader(reader);
        }
Пример #24
0
        private void DisplayCardRanking(Hand player2Hand, HAND comparisonHandRanking, CARD comparisonHiCardInRank, bool isCurrentRankBest)
        {
            string output = string.Format("{0} [{1,12}:{2,1}] {3,1}{4} [{5,12}:{6,1}] {7}",
                                          GetHand(), bestRankForHand, highestCardInRank.ToString()[1],
                                          highestCardInRank > comparisonHiCardInRank ? ">" :
                                          (highestCardInRank < comparisonHiCardInRank ? "<" : "="),
                                          player2Hand.GetHand(), comparisonHandRanking, comparisonHiCardInRank.ToString()[1],
                                          isCurrentRankBest ? "WIN" : ""
                                          );

            Console.WriteLine(output);
        }