private Image GetPlayerImage() { ControlPlus.TipImage tipData = new ControlPlus.TipImage(); tipData.AddTextNewLine(string.Format("Lv{0}", player.Level), "LightBlue", 20); tipData.AddTextNewLine("能量回复比率", "White"); tipData.AddTextNewLine(string.Format("LP {0}", player.EnergyGenerator.RateLp.ToString().PadLeft(3, ' ')), "Gold"); tipData.AddBar(100, player.EnergyGenerator.RateLp, Color.Yellow, Color.Gold); tipData.AddTextNewLine(string.Format("PP {0}", player.EnergyGenerator.RatePp.ToString().PadLeft(3, ' ')), "Red"); tipData.AddBar(100, player.EnergyGenerator.RatePp, Color.Pink, Color.Red); tipData.AddTextNewLine(string.Format("MP {0}", player.EnergyGenerator.RateMp.ToString().PadLeft(3, ' ')), "Blue"); tipData.AddBar(100, player.EnergyGenerator.RateMp, Color.Cyan, Color.Blue); player.TrapHolder.GenerateImage(tipData, player is HumanPlayer); var rival = player.Rival as Player; if (rival.HasHolyWord("witcheye")) { tipData.AddLine(); tipData.AddTextNewLine("手牌", "White"); for (int i = 0; i < 10; i++) { var card = player.CardManager.GetDeckCardAt(i); if (card.CardId > 0) { var cardConfig = CardConfigManager.GetCardConfig(card.CardId); tipData.AddTextNewLine("-", "White"); tipData.AddImage(CardAssistant.GetCardImage(card.CardId, 20, 20)); tipData.AddText(string.Format("{0}({1}★)Lv{2}", cardConfig.Name, cardConfig.Star, card.Level), HSTypes.I2QualityColor(cardConfig.Quality)); } } } return(tipData.Image); }
public CardProductMarkTypes GetSellMark() { CardProductMarkTypes mark = CardProductMarkTypes.Null; var cardData = CardConfigManager.GetCardConfig(WeaponConfig.Id); if (cardData.Quality == CardQualityTypes.Legend) { mark = CardProductMarkTypes.Only; } else if (cardData.Quality < CardQualityTypes.Excel && MathTool.GetRandom(10) > 7) { mark = CardProductMarkTypes.Sale; } else { int roll = MathTool.GetRandom(10); if (roll == 0) { mark = CardProductMarkTypes.Hot; } else if (roll == 1) { mark = CardProductMarkTypes.Gold; } } return(mark); }
private void DrawOnCardView(Graphics g, int cid, int x, int y, bool isSelected) { CardAssistant.DrawBase(g, cid, x, y, cardWidth, cardHeight); if (isSelected) { var brushes = new SolidBrush(Color.FromArgb(130, Color.Yellow)); g.FillRectangle(brushes, x, y, cardWidth, cardHeight); brushes.Dispose(); } var cardConfigData = CardConfigManager.GetCardConfig(cid); Font font = new Font("宋体", 5 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); g.DrawString(("★★★★★★★★★★").Substring(10 - cardConfigData.Star), font, Brushes.Yellow, x + 3, y + 3); font.Dispose(); var quality = cardConfigData.Quality + 1; g.DrawImage(HSIcons.GetIconsByEName("gem" + quality), x + cardWidth / 2 - 8, y + cardHeight - 20, 16, 16); var jobId = cardConfigData.JobId; if (jobId > 0) { var jobConfig = ConfigData.GetJobConfig(jobId); Brush brush = new SolidBrush(Color.FromName(jobConfig.Color)); g.FillRectangle(brush, x + cardWidth - 24, y + 4, 20, 20); g.DrawImage(HSIcons.GetIconsByEName("job" + jobConfig.JobIndex), x + cardWidth - 24, y + 4, 20, 20); brush.Dispose(); } }
private void PeopleDeckViewForm_Click(object sender, EventArgs e) { if (tar != -1) { sel = tar; PeopleConfig peopleConfig = ConfigData.GetPeopleConfig(people[tar]); cardDetail.SetInfo(-1); DeckCard[] cards = DeckBook.GetDeckByName(peopleConfig.Emethod, peopleConfig.Level); nlClickLabel1.ClearLabel(); foreach (DeckCard card in cards) { CardConfigData ccd = CardConfigManager.GetCardConfig(card.BaseId); if (ccd.Id == 0) { continue; } var name = CardConfigManager.GetCardConfig(card.BaseId).Name; string cardstr = string.Format("{0}", name); nlClickLabel1.AddLabel(cardstr, card); } Invalidate(new Rectangle(65, 35, cardWidth * xCount + 200, 630)); nlClickLabel1.Invalidate(); } }
public int Compare(DeckCard cx, DeckCard cy) { if (cx.BaseId <= 0 && cy.BaseId <= 0) { return(0); } if (cx.BaseId <= 0) { return(1); } if (cy.BaseId <= 0) { return(-1); } var cardX = CardConfigManager.GetCardConfig(cx.BaseId); var cardY = CardConfigManager.GetCardConfig(cy.BaseId); if (cardX.Type != cardY.Type) { return(cardX.Type.CompareTo(cardY.Type)); } if (cardX.Star != cardY.Star) { return(cardX.Star.CompareTo(cardY.Star)); } if (cardX.Quality != cardY.Quality) { return(cardX.Quality.CompareTo(cardY.Quality)); } return(cx.BaseId.CompareTo(cy.BaseId)); }
public static Image GetPreview(int id) { var powerConfig = ConfigData.GetHeroPowerConfig(id); ControlPlus.TipImage tipData = new ControlPlus.TipImage(); tipData.AddTextNewLine(powerConfig.Name, "White", 20); tipData.AddLine(); tipData.AddTextNewLine("英雄技能", "Red"); tipData.AddTextLines(powerConfig.Des, "Lime", 15, true); tipData.AddLine(); var cost = CardConfigManager.GetCardConfig(powerConfig.CardId).Cost; tipData.AddTextNewLine("消耗:", "White"); if (powerConfig.Type == (int)CardTypes.Monster) { tipData.AddText(cost + "LP", "Yellow"); } else if (powerConfig.Type == (int)CardTypes.Weapon) { tipData.AddText(cost + "PP", "Red"); } else { tipData.AddText(cost + "MP", "Blue"); } return(tipData.Image); }
private void MessageBoxEx_Paint(object sender, PaintEventArgs e) { if (img != null) { e.Graphics.DrawImage(img, 38, 32, 100, 100); var deck = UserProfile.InfoCard.Decks[selectPage]; for (int i = 0; i < deck.CardIds.Length; i++) { int x = i % 6; int y = i / 6; var cardId = deck.CardIds[i]; e.Graphics.DrawImage(CardAssistant.GetCardImage(cardId, 100, 100), x * 20 + 150, y * 20 + 35, 20, 20); var cardJob = CardConfigManager.GetCardConfig(cardId).JobId; if (cardJob > 0 && cardJob != UserProfile.InfoBasic.Job) { var brush = new SolidBrush(Color.FromArgb(150, Color.Red)); e.Graphics.FillRectangle(brush, x * 20 + 150, y * 20 + 35, 20, 20); brush.Dispose(); e.Graphics.DrawRectangle(Pens.Red, x * 20 + 150, y * 20 + 35, 20, 20); } } } Font font = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); e.Graphics.DrawString(string.Format("地形:{0}", tile == 0 ? "默认" : ConfigDatas.ConfigData.GetTileConfig(tile).Cname), font, Brushes.White, 63, 117); font.Dispose(); }
public void Draw(Graphics g) { Image back = PicLoader.Read("System", "CardBack2.JPG"); g.DrawImage(back, x, y, width - 1, height - 1); back.Dispose(); if (show) { // g.FillRectangle(PaintTool.GetBrushByAttribute(CardConfigManager.GetCardConfig(product.Cid).Attr), x + 10, y + 12, 70 - 2, 90 - 2); virtualRegion.Draw(g); CardAssistant.DrawBase(g, product.Cid, x + 12, y + 14, 64, 84); if (coverEffect != null) { coverEffect.Draw(g); } if ((CardProductMarkTypes)product.Mark != CardProductMarkTypes.Null) { Image marker = PicLoader.Read("System", string.Format("Mark{0}.PNG", (int)product.Mark)); g.DrawImage(marker, x + 28, y + 12, 50, 51); marker.Dispose(); } var cardConfigData = CardConfigManager.GetCardConfig(product.Cid); var quality = cardConfigData.Quality + 1; g.DrawImage(HSIcons.GetIconsByEName("gem" + quality), x + width / 2 - 8, y + height - 44, 16, 16); } }
private void MainForm_Load(object sender, EventArgs e) { string version = FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion; Text = string.Format("幻兽传说卡片版 v{0}", version); try { ConfigData.LoadData(); Scene.Instance = new Scene(tabPageGame, tabPageGame.Width, tabPageGame.Height); SystemMenuManager.Load(tabPageGame.Width, tabPageGame.Height); MainTipManager.Init(tabPageGame.Height); PanelManager.Init(tabPageGame.Width, tabPageGame.Height); CardConfigManager.Init(); DbSerializer.Init(); WorldInfoManager.Load(); } catch (Exception ex) { NLog.Warn(ex); Close(); } tabPageLogin.BackgroundImage = PicLoader.Read("System", "LogBack.JPG"); textBoxName.Text = WorldInfoManager.LastAccountName; ChangePage(0); myCursor.ChangeCursor("default"); Scene.Instance.Init(); workThread = new Thread(TimeGo); workThread.IsBackground = true; workThread.Start(); }
private void panelBattle_MouseClick(object sender, MouseEventArgs e) { if (BattleManager.Instance.PlayerManager.LeftPlayer == null) { return; } if (isGamePaused) { return; } int cardSize = BattleManager.Instance.MemMap.CardSize; if (e.Button == MouseButtons.Left) { if (leftSelectCard != null && (myCursor.Name == "summon" || myCursor.Name == "equip" || myCursor.Name == "cast" || myCursor.Name == "sidekick")) { int result; if ((result = BattleManager.Instance.PlayerManager.LeftPlayer.CheckUseCard(leftSelectCard, BattleManager.Instance.PlayerManager.LeftPlayer, BattleManager.Instance.PlayerManager.RightPlayer)) != HSErrorTypes.OK) { BattleManager.Instance.FlowWordQueue.Add(new FlowErrInfo(result, new Point(mouseX, mouseY), 0, 0), false); return; } LiveMonster lm = BattleLocationManager.GetPlaceMonster(mouseX, mouseY); if (myCursor.Name == "summon" && lm == null) { var pos = new Point(mouseX / cardSize * cardSize, mouseY / cardSize * cardSize); BattleManager.Instance.PlayerManager.LeftPlayer.UseMonster(leftSelectCard, pos); } else if (myCursor.Name == "equip" && lm != null) { BattleManager.Instance.PlayerManager.LeftPlayer.UseWeapon(lm, leftSelectCard); } else if (myCursor.Name == "sidekick" && lm != null) { BattleManager.Instance.PlayerManager.LeftPlayer.UseSideKick(lm, leftSelectCard); } else if (myCursor.Name == "cast") { BattleManager.Instance.PlayerManager.LeftPlayer.DoSpell(lm, leftSelectCard, e.Location); } var cardData = CardConfigManager.GetCardConfig(leftSelectCard.CardId); UserProfile.Profile.OnUseCard(cardData.Star, 0, cardData.TypeSub); cardsArray1.DisSelectCard(); } } else if (e.Button == MouseButtons.Right) { leftSelectCard = null; cardsArray1.DisSelectCard(); } }
public void AddRandomCard(IMonster mon, int type, int lv) { int cardId = CardConfigManager.GetRandomTypeCard(type); if (cardId != 0) { CardManager.AddCard(cardId, lv, 0); AddCardReason(mon, Frag.AddCardReason.RandomCard); } }
public void AddRandomCardRace(IMonster mon, int race, int lv) { var cardId = CardConfigManager.GetRandomRaceCard(race); if (cardId != 0) { CardManager.AddCard(cardId, lv, 0); AddCardReason(mon, Frag.AddCardReason.RandomCard); } }
public void AddRandomCardJob(IMonster mon, int job, int lv) { var cardId = CardConfigManager.GetRandomJobCard(job); if (cardId != 0) { CardManager.AddCard(cardId, lv, 0); AddCardReason(mon, Frag.AddCardReason.RandomCard); } }
public void SetInfo(DeckCard dcard) { cid = dcard.BaseId; level = dcard.Level; lastCell = -1; skills = new List <MonsterSkill>(); string effectName = ""; if (cid > 0) { card = CardAssistant.GetCard(cid); virtualRegion.SetRegionKey(3, CardConfigManager.GetCardConfig(cid).Quality + 1); var jobId = CardConfigManager.GetCardConfig(cid).JobId; if (jobId > 0) { jobId = ConfigData.GetJobConfig(jobId).JobIndex; } virtualRegion.SetRegionKey(4, jobId); card.SetData(dcard); if (card.GetCardType() == CardTypes.Monster) { MonsterCard monsterCard = card as MonsterCard; if (monsterCard != null) { CheckMonster(monsterCard, ref effectName); } } } string nowEffectName = ""; if (coverEffect != null) { nowEffectName = coverEffect.Name; } if (effectName != nowEffectName) { if (effectName == "") { coverEffect = null; } else { coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(X + 20, Y + 20), new Size(160, 180)); } } tooltip.Hide(parent); if (Invalidate != null) { Invalidate(); } }
public void DiscoverCardRace(IMonster mon, int race, int lv, string dtype) { List <int> cardIds = new List <int>(); for (int i = 0; i < GameConstants.DiscoverCardCount; i++) { int cardId = CardConfigManager.GetRandomRaceCard(race); cardIds.Add(cardId); } DiscoverCard(mon, cardIds.ToArray(), lv, (DiscoverCardActionType)Enum.Parse(typeof(DiscoverCardActionType), dtype)); }
private static void MakeLoad(string name, int level) { int cardLevel = ConfigData.GetLevelExpConfig(level).TowerLevel; var deck = new List <DeckCard>(); StreamReader sr = new StreamReader(DataLoader.Read("Deck", string.Format("{0}.txt", name))); int[] starCount = { 0, 0, 0, 0, 0, 0, 0, 0 }; //1-7 for (int i = 0; i < GameConstants.DeckCardCount; i++) { var line = sr.ReadLine(); if (line == null) { break; } if (line.Contains("//")) { int index = line.IndexOf("//"); //去除注释 line = line.Substring(0, index); } string[] datas = line.Split('='); int cardId = 0; string tpStr = datas[0].Trim(); string valStr = datas[1].Trim(); if (tpStr == "Id") { cardId = int.Parse(valStr); } else if (tpStr == "Rand") { var infos = valStr.Split('|'); string catalog = infos[0]; var keyId = int.Parse(infos[1]); string pickMethod = "atwill"; if (infos.Length > 2) { pickMethod = infos[2]; } cardId = CheckRandom(catalog, keyId, pickMethod, starCount); } else { throw new ApplicationException("card type error " + tpStr + "@" + name); } starCount[CardConfigManager.GetCardConfig(cardId).Star]++; var card = new DeckCard(cardId, (byte)cardLevel, 0); deck.Add(card); } sr.Close(); deckCacheDict[name] = deck.ToArray(); }
public void SummonRandomAttr(string type, int attr) { int cardId; while (true) { cardId = CardConfigManager.GetRandomAttrCard(attr); if (CardConfigManager.GetCardConfig(cardId).Type == CardTypes.Monster) { break; } } Summon(type, cardId, 1); }
private static int CheckRandom(string catalog, int keyId, string pickMethod, int[] starCount) { CardConfigManager.RandomCardSelectorDelegate randMethod = null; if (catalog == "race") { randMethod = CardConfigManager.GetRandomRaceCard; } else if (catalog == "attr") { randMethod = CardConfigManager.GetRandomAttrCard; } else if (catalog == "type") { randMethod = CardConfigManager.GetRandomTypeCard; } else { randMethod = CardConfigManager.GetRandomCard; } var toPick = new List <CardConfigData>(); for (int i = 0; i < 3; i++)//每次从3张牌选 { toPick.Add(CardConfigManager.GetCardConfig(randMethod(keyId, -1))); } if (pickMethod == "small") { toPick.Sort((a, b) => a.Star - b.Star); return(toPick[0].Id); } else if (pickMethod == "big") { toPick.Sort((a, b) => b.Star - a.Star); return(toPick[0].Id); } else if (pickMethod == "fitb") { toPick.Sort((a, b) => (starCount[a.Star] - FitBigDesire[a.Star]) / (FitBigDesire[a.Star] * 10 + 1) - (starCount[b.Star] - FitBigDesire[b.Star]) / (FitBigDesire[b.Star] * 10 + 1)); return(toPick[0].Id); } else if (pickMethod == "fits") { toPick.Sort((a, b) => (starCount[a.Star] - FitSmallDesire[a.Star]) / (FitSmallDesire[a.Star] * 10 + 1) - (starCount[b.Star] - FitSmallDesire[b.Star]) / (FitSmallDesire[b.Star] * 10 + 1)); return(toPick[0].Id); } return(toPick[0].Id); }
private int UseScard() { var itemConfig = ConfigData.GetItemConsumerConfig(itemId); var type = itemConfig.RandomCardCatalog[1]; var info = itemConfig.RandomCardCatalog[2]; if (type == 1) { return(CardConfigManager.GetRateCard(itemConfig.RandomCardRate, CardConfigManager.GetRandomAttrCard, info)); } if (type == 2) { return(CardConfigManager.GetRateCard(itemConfig.RandomCardRate, CardConfigManager.GetRandomTypeCard, info)); } return(CardConfigManager.GetRateCard(itemConfig.RandomCardRate, CardConfigManager.GetRandomCard, 0)); }
public int AddCard(DeckCard card) { int firstBlank = -1; int count = 0; var cardConfig = CardConfigManager.GetCardConfig(card.BaseId); int newCardJob = cardConfig.JobId; for (int i = 0; i < GameConstants.DeckCardCount; i++) { var dcard = CardIds[i]; if (dcard == -1 && firstBlank == -1) { firstBlank = i; } else if (dcard != -1) { var tCard = UserProfile.InfoCard.GetDeckCardById(dcard); if (tCard.BaseId == card.BaseId) { count++; } int cardJob = CardConfigManager.GetCardConfig(tCard.BaseId).JobId; if (newCardJob > 0 && cardJob > 0 && newCardJob != cardJob) { return(HSErrorTypes.CardJobTwice); } } } if (cardConfig.Quality == CardQualityTypes.Legend && count >= GameConstants.CardLimitLegend) { return(HSErrorTypes.DeckCardTypeLimitLegend); } if (cardConfig.Quality != CardQualityTypes.Legend && count >= GameConstants.CardLimit) { return(HSErrorTypes.DeckCardTypeLimit); } if (firstBlank == -1) { return(HSErrorTypes.DeckIsFull); } SetCardAt(firstBlank, card.BaseId); return(HSErrorTypes.OK); }
public static void DrawBase(Graphics g, int cid, int x, int y, int width, int height) { int xDiff = width / 15; int yDiff = height / 15; Image img = GetCardImage(cid, width, height); var cardData = CardConfigManager.GetCardConfig(cid); int attr = cardData.Attr;//属性决定包边颜色 g.FillRectangle(PaintTool.GetBrushByAttribute(attr), x + 1, y + 1, width - 2, height - 2); g.DrawImage(img, x + 2 + xDiff, y + 2 + yDiff, width - 4 - xDiff * 2, height - 4 - yDiff * 2); string cardBorder = GetCardBorder(cardData); var imgBack = PicLoader.Read("Border", cardBorder); g.DrawImage(imgBack, x + 2, y + 2, width - 4, height - 4); imgBack.Dispose(); }
private void MessageBoxEx_Paint(object sender, PaintEventArgs e) { if (sel >= 0) { DeckCard card = new DeckCard(UserProfile.InfoCard.GetDeckCardById(activeCids[sel])); e.Graphics.DrawImage(CardAssistant.GetCardImage(card.BaseId, 100, 100), 38, 62, 100, 100); Font font = new Font("Arial", 7 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); const string stars = "★★★★★★★★★★"; int star = CardConfigManager.GetCardConfig(card.BaseId).Star; e.Graphics.DrawString(stars.Substring(10 - star), font, Brushes.Yellow, 38, 62); e.Graphics.DrawString(string.Format("{0:00}", card.Level), font, Brushes.Gold, 38, 150); e.Graphics.FillRectangle(Brushes.Wheat, 53, 153, card.Exp * 80 / ExpTree.GetNextRequiredCard(card.Level), 5); e.Graphics.DrawRectangle(Pens.WhiteSmoke, 53, 153, 80, 5); font.Dispose(); } }
private static bool UseFightItem(ItemConsumerConfig itemConfig) { var player = BattleManager.Instance.PlayerManager.LeftPlayer; if (itemConfig.GainLp > 0) { player.AddLp(itemConfig.GainLp); } if (itemConfig.GainPp > 0) { player.AddPp(itemConfig.GainPp); } if (itemConfig.GainMp > 0) { player.AddMp(itemConfig.GainMp); } if (itemConfig.DirectDamage > 0) { player.DirectDamage += itemConfig.DirectDamage; } if (itemConfig.FightRandomCardType > 0) { int cardId = CardConfigManager.GetRandomTypeCard(itemConfig.FightRandomCardType); var card = new ActiveCard(new DeckCard(cardId, 1, 0)); player.CardManager.AddCard(card); } if (!string.IsNullOrEmpty(itemConfig.HolyWord)) { player.AddHolyWord(itemConfig.HolyWord); } if (itemConfig.AttrAddAfterSummon != null && itemConfig.AttrAddAfterSummon.Length > 0) { player.AddMonsterAddon(itemConfig.AttrAddAfterSummon); } if (itemConfig.AddTowerHp > 0) { player.AddTowerHp(itemConfig.AddTowerHp); } return(true); }
public void Update(DeckCard[] dcards) { int[] starCount = new [] { 0, 0, 0, 0, 0, 0, 0 }; string[] typeArray = new string[] { "直伤", "范围", "控制", "辅助", "铺场", "防御" }; int[] typeCount = new[] { 0, 0, 0, 0, 0, 0 }; foreach (var deckCard in dcards) { if (deckCard.BaseId == 0) { continue; } starCount[deckCard.Star - 1]++; var cardData = CardConfigManager.GetCardConfig(deckCard.BaseId); if (cardData.Remark.Contains("直伤")) { typeCount[0]++; } if (cardData.Remark.Contains("范围")) { typeCount[1]++; } if (cardData.Remark.Contains("状态")) { typeCount[2]++; } if (cardData.Remark.Contains("治疗") || cardData.Remark.Contains("能量") || cardData.Remark.Contains("手牌")) { typeCount[3]++; } if (cardData.Remark.Contains("召唤")) { typeCount[4]++; } if (cardData.Remark.Contains("防御")) { typeCount[5]++; } } chartStar.SetData(new[] { "1", "2", "3", "4", "5", "6", "7" }, starCount); chartType.SetData(typeArray, typeCount); }
public RandomPlayer(int id, bool isLeft, bool isplayerControl) : base(isplayerControl, isLeft) { PeopleId = id; PeopleConfig peopleConfig = ConfigData.GetPeopleConfig(id); Level = peopleConfig.Level; Job = UserProfile.InfoBasic.Job; EnergyGenerator.SetRateNpc(peopleConfig); DeckCard[] cd = new DeckCard[GameConstants.DeckCardCount]; for (int i = 0; i < GameConstants.DeckCardCount; i++) { cd[i] = new DeckCard(CardConfigManager.GetRandomCard(0, -1), 1, 0); } Cards = new ActiveCards(cd); InitBase(); }
private void DropItemViewerForm_Click(object sender, EventArgs e) { if (tar != -1) { sel = tar; HItemConfig itemConfig = ConfigData.GetHItemConfig(items[tar]); const string stars = "★★★★★★★★★★"; itemDesStr = string.Format("{0}({2}){1}", itemConfig.Name, itemConfig.Descript, stars.Substring(10 - itemConfig.Rare)); Invalidate(new Rectangle(65, cardHeight * yCount + 37 + 21, 500, 20)); nlClickLabel1.ClearLabel(); int[] cardIds = CardPieceBook.GetCardIdsByItemId(items[tar]); foreach (int cid in cardIds) { var name = CardConfigManager.GetCardConfig(cid).Name; nlClickLabel1.AddLabel(name, cid); } nlClickLabel1.Invalidate(); } }
private void CreateCards() { DeckCard[] cds = DeckBook.GetDeckByName("rookie", 1); int index = 0; foreach (DeckCard cd in cds) { if (CardConfigManager.GetCardConfig(cd.BaseId).Id == 0) { continue; } var dcard = UserProfile.InfoCard.AddCard(cd.BaseId); UserProfile.InfoCard.SelectedDeck.SetCardAt(index++, dcard.BaseId); } #region 把所有基础卡牌都给玩家 foreach (var cd in ConfigData.MonsterDict.Values) { if (cd.Remark.Contains("基本") && UserProfile.InfoCard.GetCardCount(cd.Id) == 0) { UserProfile.InfoCard.AddCard(cd.Id); } } foreach (var cd in ConfigData.WeaponDict.Values) { if (cd.Remark.Contains("基本") && UserProfile.InfoCard.GetCardCount(cd.Id) == 0) { UserProfile.InfoCard.AddCard(cd.Id); } } foreach (var cd in ConfigData.SpellDict.Values) { if (cd.Remark.Contains("基本") && UserProfile.InfoCard.GetCardCount(cd.Id) == 0) { UserProfile.InfoCard.AddCard(cd.Id); } } #endregion }
private void CardBagForm_Paint(object sender, PaintEventArgs e) { BorderPainter.Draw(e.Graphics, "", Width, Height); for (int i = 0; i < cardCount; i++) { var pickCardId = cardOpenArray[i]; int tx = cardPos[i * 2]; int ty = cardPos[i * 2 + 1]; if (pickCardId > 0) { CardAssistant.DrawBase(e.Graphics, pickCardId, tx, ty, 120, 150); var cardConfigData = CardConfigManager.GetCardConfig(pickCardId); Font fontStar = new Font("宋体", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); e.Graphics.DrawString(("★★★★★★★★★★").Substring(10 - cardConfigData.Star), fontStar, Brushes.Yellow, tx + 5, ty + 10); fontStar.Dispose(); var quality = cardConfigData.Quality + 1; e.Graphics.DrawImage(HSIcons.GetIconsByEName("gem" + quality), tx + 50, ty + 125, 20, 20); } else { var imgBack = PicLoader.Read("System", "CardBack.JPG"); e.Graphics.DrawImage(imgBack, tx, ty, 120, 150); } if (coverEffect[i] != null) { coverEffect[i].Draw(e.Graphics); } } vRegion.Draw(e.Graphics); Font font = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); e.Graphics.DrawString("卡 包", font, Brushes.White, Width / 2 - 40, 8); font.Dispose(); }
public void RemoveCardPiece(int id, bool returnResource) { DbDeckCard dc; if (Cards.TryGetValue(id, out dc)) { if (dc.Exp == 0) { return; } if (returnResource) { var cardData = CardConfigManager.GetCardConfig(dc.BaseId); MainTipManager.AddTip(string.Format("|分解卡片-|{0}|{1}", HSTypes.I2QualityColor(cardData.Quality), cardData.Name), "White"); int qual = CardConfigManager.GetCardConfig(dc.BaseId).Quality + 1; UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gem, GameResourceBook.OutGemCardDecompose(qual)); } dc.Exp--; } }
public void ChangeDeck(DeckCard[] decks) { dcards = decks; Array.Sort(dcards, new CompareDeckCardByStar()); monsterCount = weaponCount = spellCount = 0; foreach (var deckCard in decks) { var cardX = CardConfigManager.GetCardConfig(deckCard.BaseId); if (cardX.Type == CardTypes.Monster) { monsterCount++; } if (cardX.Type == CardTypes.Weapon) { weaponCount++; } if (cardX.Type == CardTypes.Spell) { spellCount++; } } }