예제 #1
0
        private CardPack CreateCardPackModel(SSCasino_DBContext dbCasino, int cardPackId = 0, SiteHelpers.SampleSizes sampleSize = SiteHelpers.SampleSizes.FullDeck)
        //================================================================================================================
        // Retrieve a pack of cards based on the given pack id
        //
        // Parameters
        //      dbCasino:   Open Connection to the database
        //      cardPackId: (optional) Unique identifier for a card pack
        //      sampleSize: (optional) Number of cards to load
        //
        // Returns
        //      A full or partial pack of cards
        //================================================================================================================
        {
            // Create the model
            CardPack model = new CardPack();

            switch (sampleSize)
            {
            case SiteHelpers.SampleSizes.FourCardSample:
                string[] fourSampleCards = SiteHelpers.FourCardSampleCards.Split(' ');
                if (dbCasino.CardPacks.Any(e => e.CardPackId == cardPackId))
                {
                    model          = dbCasino.CardPacks.Where(e => e.CardPackId == cardPackId).FirstOrDefault();
                    model.CardDeck = dbCasino.PlayingCardsView.Where(e => ((e.CardPackId == cardPackId) && (fourSampleCards.Contains(e.CardCode)))).OrderBy(e => e.CardSuitOrder).ToList();
                }
                else
                {
                    model          = dbCasino.CardPacks.Where(e => e.DefaultPack == 1).FirstOrDefault();
                    model.CardDeck = dbCasino.PlayingCardsView.Where(e => ((e.DefaultPack == 1) && (fourSampleCards.Contains(e.CardCode)))).OrderBy(e => e.CardSuitOrder).ToList();
                }
                break;

            case SiteHelpers.SampleSizes.SixCardSample:
                string[] sixSampleCards = SiteHelpers.SixCardSampleCards.Split(' ');
                if (dbCasino.PlayingCardsView.Any(e => e.CardPackId == cardPackId))
                {
                    model          = dbCasino.CardPacks.Where(e => e.CardPackId == cardPackId).FirstOrDefault();
                    model.CardDeck = dbCasino.PlayingCardsView.Where(e => ((e.CardPackId == cardPackId) && (sixSampleCards.Contains(e.CardCode)))).OrderBy(e => e.CardSuitOrder).ToList();
                }
                else
                {
                    model          = dbCasino.CardPacks.Where(e => e.DefaultPack == 1).FirstOrDefault();
                    model.CardDeck = dbCasino.PlayingCardsView.Where(e => ((e.DefaultPack == 1) && (sixSampleCards.Contains(e.CardCode)))).OrderBy(e => e.CardSuitOrder).ToList();
                }
                break;

            case SiteHelpers.SampleSizes.FullDeck:
                if (dbCasino.PlayingCardsView.Any(e => e.CardPackId == cardPackId))
                {
                    model = dbCasino.CardPacks.Include("CardDeck").Where(e => e.CardPackId == cardPackId).FirstOrDefault();
                }
                else
                {
                    model = dbCasino.CardPacks.Include("CardDeck").Where(e => e.DefaultPack == 1).FirstOrDefault();
                }
                break;
            }

            return(model);
        }
예제 #2
0
        private async void setDeck(CardPack cp)
        {
            this._Deck = cp;
            await Task.Delay(50);

            this._client.SetVisibleDeckName(this._Deck.PackName);
        }
예제 #3
0
        public ActionResult ShufflerControlPanel_ChangeCardPack()
        //================================================================================================================
        // This action is invoked when a new card pack is selected.
        //
        // Event Arguments
        //      arg_CardPackId: Unique id of a card pack
        //
        // Returns
        //      The card examples view
        //================================================================================================================
        {
            // Retrieve the id of the new card pack
            int      cardPackId = !string.IsNullOrEmpty(Request.Params[ARG_CARD_PACK_ID]) ? int.Parse(Request.Params[ARG_CARD_PACK_ID]) : 0;
            CardPack model      = null;

            SSCasino_DBContext dbCasino = null;

            try
            {
                // Connect the the database
                // Create a card pack model for the specified card pack
                dbCasino = new SSCasino_DBContext();
                model    = CreateCardPackModel(dbCasino, cardPackId: cardPackId);
            }
            finally
            {
                if (dbCasino != null)
                {
                    dbCasino.Dispose();
                }
            }

            return(PartialView("_Shuffler_CardExamplesCBP", model));
        }
예제 #4
0
파일: Player.cs 프로젝트: mdorval/sushigo
 /// <summary>
 /// Called when the card pack has reached the player's hand
 /// </summary>
 /// <param name="gameobject">cardPack</param>
 public void OnCardPackDrawn(GameObject gameobject)
 {
     cardPack = gameobject.GetComponent <CardPack>();
     gameobject.SetActive(false);
     SetNewState(PlayerState.ChoosingCard);
     DealHand(cardPack.Cards());
 }
예제 #5
0
        public static CardPack GetCardPack(int id)
        {
            log.Info("ShopAdministration - GetCardPack(id)");
            CardPack cardPack = null;

            if (id < 1)
            {
                throw new ArgumentException("invalid pack id", nameof(id));
            }

            try
            {
                using (var context = new clonestoneEntities())
                {
                    cardPack = context.AllCardPacks.FirstOrDefault(x => x.ID == id);
                }
            }
            catch (Exception ex)
            {
                log.Error("ShopAdministration - GetCardPack(id) - Exception", ex);
                if (ex.InnerException != null)
                {
                    log.Error("ShopAdministration - GetCardPack(id) - Exception (inner)", ex.InnerException);
                }

                Debugger.Break();
                throw ex;
            }

            return(cardPack);
        }
예제 #6
0
파일: Player.cs 프로젝트: mdorval/sushigo
    /// <summary>
    /// Starts the pass of the pack
    /// </summary>
    /// <returns>If there was cards left to pass</returns>
    public bool PassCardPack()
    {
        SetNewState(PlayerState.Passing);
        if (handCards.Count == 0)
        {
            SetNewState(PlayerState.WaitingToPlay);
            endOfRound = true;
            return(false);
        }
        endOfRound = false;
        if (cardPack == null)
        {
            GameObject gameObj = Instantiate(Deck.Instance().cardPackPrefab, handPosition.transform);
            cardPack = gameObj.GetComponent <CardPack>();
        }
        cardPack.SetCards(handCards);
        Player  neighbor = Deck.Instance().GetNeighbor(this);
        Vector3 targetPosition;

        if (Deck.Instance().PassingLeft())
        {
            cardPack.gameObject.transform.rotation = transform.rotation;
            targetPosition = transform.position;
        }
        else
        {
            cardPack.gameObject.transform.rotation = neighbor.gameObject.transform.rotation;
            targetPosition = neighbor.transform.position;
        }
        cardPack.gameObject.SetActive(true);
        MoveRequest request = new MoveRequest(targetPosition, neighbor.gameObject, this.OnCardPackPassed, 24);

        cardPack.SetMoveRequest(request);
        return(true);
    }
예제 #7
0
        private static void RecordShuffleResult(CardPack cardPack, ShuffleTypes shuffleType, int shuffleNo, ICollection <ShuffleResult> shuffleResults)
        //================================================================================================================
        // Add the given shuffle results to the collection
        //
        // Parameters
        //      cardPack:       Shuffled pack of cards
        //      shuffleResults: Collection of shuffle results
        //================================================================================================================
        {
            // Create a new shuffle result
            ShuffleResult shuffleResult = new ShuffleResult
            {
                ShuffleType = shuffleType,
                ShuffleNo   = shuffleNo
            };

            // Loop through each card in the deck
            foreach (PlayingCard card in cardPack.CardDeck)
            {
                // The shuffle pattern is determined by building a string fom the card codes
                shuffleResult.ShufflePattern += card.CardCode.Substring(0, 1);
            }

            // Add the shuffle result to the collection
            shuffleResults.Add(shuffleResult);
        }
예제 #8
0
        public List <Card> GetCardsWithParameters(String searchText, String artist, String type, String order, String oracle, String colors, String language)
        {
            var query       = "q=";
            var requisition = "https://api.scryfall.com/cards/search?";

            var fullUrl =
                requisition +
                order +
                query +
                searchText +
                type +
                artist +
                oracle +
                colors +
                language;

            var cardPack = new CardPack();

            try
            {
                cardPack = (CardPack) new GetJson().GetCardPackObject(fullUrl);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Wrong request ! " + ex.Message, "Error");
            }
            return(cardPack.Cards);
        }
예제 #9
0
        //写存档
        public Dictionary <Card, string> WriteSet(string file, Card[] cards, string cardpack_db, bool rarity = true)
        {
//			MessageBox.Show(""+cfg.replaces.Keys[0]+"/"+cfg.replaces[cfg.replaces.Keys[0]]);
            Dictionary <Card, string> list = new Dictionary <Card, string>();
            string pic = cfg.imagepath;

            using (FileStream fs = new FileStream(file,
                                                  FileMode.Create, FileAccess.Write))
            {
                StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
                sw.WriteLine(cfg.head);
                foreach (Card c in cards)
                {
                    string jpg = GetCardImagePath(pic, c);
                    if (!string.IsNullOrEmpty(jpg))
                    {
                        list.Add(c, jpg);
                        jpg = Path.GetFileName(jpg);
                    }
                    CardPack cardpack = DataBase.findPack(cardpack_db, c.id);
                    if (c.IsType(CardType.TYPE_SPELL) || c.IsType(CardType.TYPE_TRAP))
                    {
                        sw.WriteLine(getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL), cardpack, rarity));
                    }
                    else
                    {
                        sw.WriteLine(getMonster(c, jpg, cardpack, rarity));
                    }
                }
                sw.WriteLine(cfg.end);
                sw.Close();
            }

            return(list);
        }
예제 #10
0
        //================================================================================================================
        //================================================================================================================
        #endregion  // Constants

        #region Shuffling
        //================================================================================================================
        //================================================================================================================

        public static ShuffledPackage ShuffleCards(CardPack cardPack, ShuffleTypes shuffleType, int shuffleCount, bool recordResults)
        //================================================================================================================
        // Shuffle the given pack of cards the specified nyumber of times using the given algorithm
        //
        // Parameters
        //      cardPack:      Reference to a pack of cards
        //      shuffleType:   Shuffling alroithm to use
        //      shuffleCount:  Number of times to shuffle
        //      recordResults: Flag, record the results of each shuffle
        //
        // Returns
        //      a shuufled package
        //================================================================================================================
        {
            ShuffledPackage shuffledPackage;

            if (shuffleType == ShuffleTypes.FisherYates)
            {
                shuffledPackage = ShuffleCards_FisherYates(cardPack, shuffleCount, recordResults);
            }
            else
            {
                shuffledPackage = ShuffleCards_Naive(cardPack, shuffleCount, recordResults);
            }

            return(shuffledPackage);
        }
예제 #11
0
 public void LoadCardPack(String fileName)
 {
     using (FileStream loadFile = new FileStream(fileName, FileMode.Open, FileAccess.Read))
     {
         DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(CardPack));
         this.CardPackItem = (CardPack)serializer.ReadObject(loadFile);
     }
 }
예제 #12
0
 public CardPack GetSelectedItem()
 {
     if (CardPackList_SelectedIndex == -1)
     {
         return(null);
     }
     return(CardPack.CardPackList()[this.CardPackList_SelectedIndex].Item1);
 }
예제 #13
0
파일: Player.cs 프로젝트: mdorval/sushigo
    /// <summary>
    /// Starts drawing the next turn's card pack from the table
    /// </summary>
    public void DrawCardPack()
    {
        SetNewState(PlayerState.Drawing);
        MoveRequest request = new MoveRequest(handPosition.transform.position, this.gameObject, this.OnCardPackDrawn, 24);

        cardPack = this.GetComponentInChildren <CardPack>();
        cardPack.SetMoveRequest(request);
    }
예제 #14
0
 private void SetDefaultCardPackage()
 {
     if (GameSettings.CardPackage == null)
     {
         CardPack cp = CardPackages.Packages.FirstOrDefault().Value;
         GameSettings.CardPackage = cp;
         GameSettings.FieldWidth  = cp.MaxWidth;
         GameSettings.FieldHeight = cp.MaxHeight;
     }
 }
예제 #15
0
 private void Execute_ImportCardPack()
 {
     System.Windows.Forms.OpenFileDialog loadDialog = new System.Windows.Forms.OpenFileDialog();
     loadDialog.Filter = "Card Pack Zip (*.lcpz)|*.lcpz|Any File (*.*)|*.*";
     loadDialog.Title = "Import card pack zip";
     if (loadDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         CardPack.ImportCardPack(loadDialog.FileName);
     }
 }
예제 #16
0
        public Game()
        {
            _deck = new CardPack();
            _deck.Shuffle();

            FaceUp   = new List <Card> [13];
            FaceDown = new List <Card> [13];

            Deal();
        }
예제 #17
0
        private static ShuffledPackage ShuffleCards_FisherYates(CardPack cardPack, int shuffleCount, bool recordResults)
        //================================================================================================================
        // Shuffle the given pack of cards using the Fisher-Yates algorithm
        //
        // Parameters
        //      cardPack:      Reference to a pack of cards
        //      shuffleCount:  Number of times to shuffle
        //      recordResults: Flag, record the results of each shuffle
        //
        // Returns
        //      A shuffled package
        //================================================================================================================
        {
            // Create a shuffled package and a random number generator
            ShuffledPackage shuffledPackage = new ShuffledPackage();

            // Shuffle the card pack the specified number of times
            int randomIndex;
            int cardsInPack;

            for (int i = 1; i <= shuffleCount; i++)
            {
                // get the number of cards in the deck
                // Create a random number generator
                cardsInPack = cardPack.CardDeck.Count;
                RNGCryptoServiceProvider randomProvider = new RNGCryptoServiceProvider();

                // Shuffle the deck
                int packBottom = cardsInPack;
                while (packBottom > 1)
                {
                    // Get a random number between 0 and the bottom of the pack
                    randomIndex = GetRandomNumber(randomProvider, packBottom);

                    // Decrement the bottom of the pack (zero based collections)
                    packBottom--;

                    //Swap the playing card at the random index with the playing card at the bottom of the pack
                    PlayingCard selectedCard = cardPack.CardDeck[randomIndex];
                    cardPack.CardDeck[randomIndex] = cardPack.CardDeck[packBottom];
                    cardPack.CardDeck[packBottom]  = selectedCard;
                }

                // Record the shuffle result
                if (recordResults)
                {
                    RecordShuffleResult(cardPack, SiteHelpers.ShuffleTypes.FisherYates, i, shuffledPackage.ShuffleResults);
                }
            }

            // After all the shuffling is complete assign the final card pack
            shuffledPackage.CardPack = cardPack;

            return(shuffledPackage);
        }
예제 #18
0
 public void SetVisibleDeckName(String name)
 {
     deck = new CardPack()
     {
         PackName = name
     };
     this.NotifyServer(new EventDataType()
     {
         ClientName = "Server", EventMessage = "CardPackChanged"
     });
 }
예제 #19
0
 public void StartGame(CardPack cp)
 {
     deck         = cp;
     status       = ServerStatus.InGame;
     clientScores = new Dictionary <string, int>();
     foreach (var client in clients.Keys)
     {
         clientScores.Add(client, 0);
     }
     NextTurn();
 }
예제 #20
0
 public void SaveCardPack(String fileName)
 {
     // this.CardPackItem.PackName = fileName.Split('\\').Last().Split('.')[0];
     // using (FileStream saveFile = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
     // {
     //     DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(CardPack));
     //     serializer.WriteObject(saveFile, this.CardPackItem);
     // }
     this.CardPackItem.PackName = fileName;
     CardPack.SaveCardPackToFile(this.CardPackItem);
 }
예제 #21
0
        //怪兽,pendulum怪兽
        string getMonster(Card c, string img, bool isPendulum, CardPack cardpack = null, bool rarity = true)
        {
            StringBuilder sb = new StringBuilder();

            string[] types = GetTypes(c);
            string   race  = GetRace(c.race);

            sb.AppendLine(TAG_CARD + ":");
            sb.AppendLine(GetLine(TAG_CARDTYPE, types[0]));
            sb.AppendLine(GetLine(TAG_NAME, reItalic(c.name)));
            sb.AppendLine(GetLine(TAG_ATTRIBUTE, GetAttribute(c.attribute)));
            sb.AppendLine(GetLine(TAG_LEVEL, GetStar(c.level)));
            sb.AppendLine(GetLine(TAG_IMAGE, img));
            sb.AppendLine(GetLine(TAG_TYPE1, cn2tw(race)));
            sb.AppendLine(GetLine(TAG_TYPE2, cn2tw(types[1])));
            sb.AppendLine(GetLine(TAG_TYPE3, cn2tw(types[2])));
            sb.AppendLine(GetLine(TAG_TYPE4, cn2tw(types[3])));
            if (cardpack != null)
            {
                sb.AppendLine(GetLine(TAG_NUMBER, cardpack.pack_id));
                if (rarity)
                {
                    sb.AppendLine(GetLine(TAG_RARITY, cardpack.getMseRarity()));
                }
            }
            if (isPendulum)            //P怪兽
            {
                string text = GetDesc(c.desc, cfg.regx_monster);
                if (string.IsNullOrEmpty(text))
                {
                    text = c.desc;
                }
                sb.AppendLine("	" + TAG_TEXT + ":");
                //sb.AppendLine(cfg.regx_monster + ":" + cfg.regx_pendulum);
                sb.AppendLine("		"+ ReText(reItalic(text)));
                sb.AppendLine(GetLine(TAG_PENDULUM, "medium"));
                sb.AppendLine(GetLine(TAG_PSCALE1, ((c.level >> 0x18) & 0xff).ToString()));
                sb.AppendLine(GetLine(TAG_PSCALE2, ((c.level >> 0x10) & 0xff).ToString()));
                sb.AppendLine("	" + TAG_PEND_TEXT + ":");
                sb.AppendLine("		"+ ReText(reItalic(GetDesc(c.desc, cfg.regx_pendulum))));
            }
            else            //一般怪兽
            {
                sb.AppendLine("	" + TAG_TEXT + ":");
                sb.AppendLine("		"+ ReText(reItalic(c.desc)));
            }
            sb.AppendLine(GetLine(TAG_ATK, (c.atk < 0) ? UNKNOWN_ATKDEF : c.atk.ToString()));
            sb.AppendLine(GetLine(TAG_DEF, (c.def < 0) ? UNKNOWN_ATKDEF : c.def.ToString()));

            sb.AppendLine(GetLine(TAG_CODE, c.idString));
            return(sb.ToString());
        }
        public ActionResult Buy(int idCardPack)
        {
            var dbCardPack = ShopManager.GetCardPackById(idCardPack);

            CardPack cardPack = new CardPack();

            cardPack.ID        = dbCardPack.ID;
            cardPack.PackName  = dbCardPack.PackName;
            cardPack.NumCards  = dbCardPack.NumCards;
            cardPack.PackPrice = dbCardPack.PackPrice;

            return(View(cardPack));
        }
예제 #23
0
        private static ShuffledPackage ShuffleCards_Naive(CardPack cardPack, int shuffleCount, bool recordResults)
        //================================================================================================================
        // Shuffle the given pack of cards using the naive algorithm
        //
        // Parameters
        //      cardPack:      Reference to a pack of cards
        //      shuffleCount:  Number of times to shuffle
        //      recordResults: Flag, record the results of each shuffle
        //
        // Returns
        //      A shuffled package
        //================================================================================================================
        {
            // Create a shuffled package
            ShuffledPackage shuffledPackage = new ShuffledPackage();

            // Shuffle the card pack the specified number of times
            int randomIndex;
            int cardsInPack;

            for (int i = 1; i <= shuffleCount; i++)
            {
                // get the number of cards in the deck
                // Create a random number generator
                cardsInPack = cardPack.CardDeck.Count;
                Random randomNumberGen = new Random();

                // Shuffle the deck
                for (int cardIndex = 0; cardIndex <= (cardsInPack - 1); cardIndex++)
                {
                    // Get a random number between 0 and the number of cards in the deck
                    randomIndex = randomNumberGen.Next(0, (cardsInPack - 1));

                    // Swap the card at the current index with the card at the random index
                    PlayingCard selectedCard = cardPack.CardDeck[randomIndex];
                    cardPack.CardDeck[randomIndex] = cardPack.CardDeck[cardIndex];
                    cardPack.CardDeck[cardIndex]   = selectedCard;
                }

                // Record the shuffle result
                if (recordResults)
                {
                    RecordShuffleResult(cardPack, SiteHelpers.ShuffleTypes.Naive, i, shuffledPackage.ShuffleResults);
                }
            }

            // After all the shuffling is complete assign the final card pack
            shuffledPackage.CardPack = cardPack;

            return(shuffledPackage);
        }
        public ActionResult EditAktivCardpack(int id)
        {
            CardPack dbCardPack = ShopManager.GetCardPackById(id);

            CardPackViewModel viewCardPack = new CardPackViewModel();

            viewCardPack.IDCardPack   = dbCardPack.ID;
            viewCardPack.PacketName   = dbCardPack.PackName;
            viewCardPack.Anzahlkarten = dbCardPack.NumCards;
            viewCardPack.Preis        = dbCardPack.PackPrice;
            viewCardPack.Aktiv        = (bool)dbCardPack.Aktiv;

            return(View(viewCardPack));
        }
예제 #25
0
 static public void SaveCardPackToFile(CardPack deck)
 {
     try
     {
         CardPack.SaveCardPackToFile(deck);
     }
     catch (ArgumentException)
     {
         System.Windows.Forms.MessageBox.Show(GlobalLanguage.Instance.GetDict()["CouldNotSaveCardPack"],
                                              GlobalLanguage.Instance.GetDict()["SaveError"],
                                              System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
         return;
     }
 }
예제 #26
0
 static public void ImportCardPack(String sourceFile)
 {
     try
     {
         CardPack.ImportCardPack(sourceFile);
     }
     catch (InvalidDataException)
     {
         System.Windows.Forms.MessageBox.Show(GlobalLanguage.Instance.GetDict()["InvalidDataException"],
                                              GlobalLanguage.Instance.GetDict()["InvalidDataException"], System.Windows.Forms.MessageBoxButtons.OK,
                                              System.Windows.Forms.MessageBoxIcon.Exclamation);
         return;
     }
 }
예제 #27
0
        private void GetNamedCards(String text)
        {
            var cardPack = new CardPack();

            try
            {
                cardPack = (CardPack) new GetJson().GetCardPackObject(text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Wrong request ! " + ex.Message, "Error");
            }
            PopulateCards(cardPack.Cards);
        }
        public static void UpdateCardPackAktiv(int idCardpack, bool?aktiv)
        {
            using (var db = new CardGame_v2Entities())
            {
                //suchen cardpack anhand der id
                CardPack gefundenesPaket = db.AllCardPacks.Find(idCardpack);

                gefundenesPaket.Aktiv = aktiv;

                //db.Entry(gefundenesPaket).State = EntityState.Modified;

                db.SaveChanges();
            }
        }
        public ActionResult Rechnung(int id)
        {
            //TODO brauche noch den aktuellen Preises des Packs - Card oder Diamanten, und die bezeichnung des Packs
            RechnungVM rvm      = new RechnungVM();
            CardPack   cardpack = ShopManager.GetCardPackById(id);
            var        user     = UserManager.GetUserByEmail(User.Identity.Name);

            rvm.Vorname  = user.FirstName;
            rvm.Nachname = user.LastName;
            rvm.Pack     = cardpack.PackName;
            //rvm.Preis = ;


            return(View(rvm));
        }
예제 #30
0
 private void loadGoodsWeightFromXml(SecurityElement element, CardPack cp)
 {
     if (element.Children != null)
     {
         foreach (SecurityElement element2 in element.Children)
         {
             string str;
             if (((str = element2.Tag) != null) && (str == "Goods"))
             {
                 GoodsWeight item = new GoodsWeight {
                     GoodsId = StrParser.ParseHexInt(element2.Attribute("GoodsId"), 0),
                     Weight  = StrParser.ParseDecInt(element2.Attribute("Weight"), 0)
                 };
                 cp.GoodsWeights.Add(item);
             }
         }
     }
 }
예제 #31
0
        //怪兽,pendulum怪兽
        string getMonster(Card c, string img, bool isPendulum,CardPack cardpack=null,bool rarity=true)
        {
            StringBuilder sb = new StringBuilder();
            string[] types = GetTypes(c);
            string race = GetRace(c.race);
            sb.AppendLine(TAG_CARD + ":");
            sb.AppendLine(GetLine(TAG_CARDTYPE, types[0]));
            sb.AppendLine(GetLine(TAG_NAME, reItalic(c.name)));
            sb.AppendLine(GetLine(TAG_ATTRIBUTE, GetAttribute(c.attribute)));
            sb.AppendLine(GetLine(TAG_LEVEL, GetStar(c.level)));
            sb.AppendLine(GetLine(TAG_IMAGE, img));
            sb.AppendLine(GetLine(TAG_TYPE1, cn2tw(race)));
            sb.AppendLine(GetLine(TAG_TYPE2, cn2tw(types[1])));
            sb.AppendLine(GetLine(TAG_TYPE3, cn2tw(types[2])));
            sb.AppendLine(GetLine(TAG_TYPE4, cn2tw(types[3])));
            if(cardpack!=null){
                sb.AppendLine(GetLine(TAG_NUMBER, cardpack.pack_id));
                if(rarity){
                    sb.AppendLine(GetLine(TAG_RARITY, cardpack.getMseRarity()));
                }
            }
            if (isPendulum)//P怪兽
            {
                string text = GetDesc(c.desc, cfg.regx_monster);
                if (string.IsNullOrEmpty(text))
                    text = c.desc;
                sb.AppendLine("	" + TAG_TEXT + ":");
                //sb.AppendLine(cfg.regx_monster + ":" + cfg.regx_pendulum);
                sb.AppendLine("		" + ReText(reItalic(text)));
                sb.AppendLine(GetLine(TAG_PENDULUM, "medium"));
                sb.AppendLine(GetLine(TAG_PSCALE1, ((c.level >> 0x18) & 0xff).ToString()));
                sb.AppendLine(GetLine(TAG_PSCALE2, ((c.level >> 0x10) & 0xff).ToString()));
                sb.AppendLine("	" + TAG_PEND_TEXT + ":");
                sb.AppendLine("		" + ReText(reItalic(GetDesc(c.desc, cfg.regx_pendulum))));
            }
            else//一般怪兽
            {
                sb.AppendLine("	" + TAG_TEXT + ":");
                sb.AppendLine("		" + ReText(reItalic(c.desc)));
            }
            sb.AppendLine(GetLine(TAG_ATK, (c.atk < 0) ? UNKNOWN_ATKDEF : c.atk.ToString()));
            sb.AppendLine(GetLine(TAG_DEF, (c.def < 0) ? UNKNOWN_ATKDEF : c.def.ToString()));

            sb.AppendLine(GetLine(TAG_CODE, c.idString));
            return sb.ToString();
        }
예제 #32
0
 //魔法陷阱
 string getSpellTrap(Card c, string img, bool isSpell,CardPack cardpack=null,bool rarity=true)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendLine(TAG_CARD + ":");
     sb.AppendLine(GetLine(TAG_CARDTYPE, isSpell ? "spell card" : "trap card"));
     sb.AppendLine(GetLine(TAG_NAME, reItalic(c.name)));
     sb.AppendLine(GetLine(TAG_ATTRIBUTE, isSpell ? "spell" : "trap"));
     sb.AppendLine(GetLine(TAG_LEVEL, GetSpellTrapSymbol(c, isSpell)));
     sb.AppendLine(GetLine(TAG_IMAGE, img));
     if(cardpack!=null){
         sb.AppendLine(GetLine(TAG_NUMBER, cardpack.pack_id));
         if(rarity){
             sb.AppendLine(GetLine(TAG_RARITY, cardpack.getMseRarity()));
         }
     }
     sb.AppendLine("	" + TAG_TEXT + ":");
     sb.AppendLine("		" + ReText(reItalic(c.desc)));
     sb.AppendLine(GetLine(TAG_CODE, c.idString));
     return sb.ToString();
 }