public void Draw(Graphics g) { SolidBrush sb = new SolidBrush(Color.FromArgb(20, 20, 20)); g.FillRectangle(sb, x + 2, y + 2, width - 4, height - 4); sb.Dispose(); g.DrawRectangle(Pens.Teal, x + 2, y + 2, width - 4, height - 4); if (show) { var equipConfig = ConfigData.GetEquipConfig(equipId); virtualRegion.Draw(g); var cost = GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level); Font ft = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); Brush b = new SolidBrush(Color.FromName(HSTypes.I2QualityColor(equipConfig.Quality))); g.DrawString(equipConfig.Name, ft, b, x + 90, y + 10); b.Dispose(); g.DrawString(string.Format("{0}", cost), ft, Brushes.White, x + 90 + 20, y + 32); ft.Dispose(); g.DrawImage(HSIcons.GetIconsByEName("res3"), x + 90, y + 32 - 3, 18, 18); } }
public void Draw(Graphics g) { g.DrawRectangle(Pens.White, x, y, width - 1, height - 1); if (show) { Font font = new Font("微软雅黑", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); var isEquip = ConfigIdManager.IsEquip(itemId); if (!isEquip) { HItemConfig itemConfig = ConfigData.GetHItemConfig(itemId); Brush brush = new SolidBrush(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare))); g.DrawString(itemConfig.Name, font, brush, x + 50, y + 7); brush.Dispose(); } else { EquipConfig equipConfig = ConfigData.GetEquipConfig(itemId); Brush brush = new SolidBrush(Color.FromName(HSTypes.I2RareColor(equipConfig.Quality))); g.DrawString(equipConfig.Name, font, brush, x + 50, y + 7); brush.Dispose(); } g.DrawString(price.ToString(), font, Brushes.Gold, x + 50, y + 30); g.DrawImage(HSIcons.GetIconsByEName("res" + (priceType + 1)), g.MeasureString(price.ToString(), font).Width + 50 + x, 32 + y, 16, 16); font.Dispose(); virtualRegion.Draw(g); } }
public void Draw(Graphics g) { SolidBrush sb = new SolidBrush(backColor); g.FillRectangle(sb, x, y, width, height); sb.Dispose(); g.DrawRectangle(Pens.White, x, y, width - 1, height - 1); if (show) { HItemConfig itemConfig = ConfigData.GetHItemConfig(itemId); Font font = new Font("微软雅黑", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); Brush brush = new SolidBrush(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare))); g.DrawString(itemConfig.Name, font, brush, x + 57, y + 7); brush.Dispose(); g.DrawString(price.ToString(), font, Brushes.Gold, x + 57, y + 30); g.DrawImage(HSIcons.GetIconsByEName("res1"), g.MeasureString(price.ToString(), font).Width + 57 + x, y + 32, 16, 16); virtualRegion.Draw(g); g.DrawString(itemCount.ToString(), font, Brushes.Black, x + 30, y + 29); g.DrawString(itemCount.ToString(), font, Brushes.White, x + 29, y + 28); font.Dispose(); if (!bitmapButtonBuy.Visible) { font = new Font("微软雅黑", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); g.DrawString("完成", font, Brushes.LightGreen, x + 152, y + 30); font.Dispose(); } } }
public void Effect(Forms.BasePanel panel, HsActionCallback success, HsActionCallback fail) { if (type == "item") { UserProfile.InfoBag.AddItem(infos[0], 1); HItemConfig itemConfig = ConfigData.GetHItemConfig(infos[0]); panel.AddFlowCenter(string.Format("获得{0}x1", itemConfig.Name), HSTypes.I2RareColor(itemConfig.Rare)); } else if (type == "mon") { PeopleBook.Fight(infos[0], "oneline", mlevel + infos[1], new PeopleFightParm(), success, fail, null); return; } else if (type == "gold") { UserProfile.InfoBag.AddResource(GameResourceType.Gold, (uint)infos[0]); panel.AddFlowCenter(string.Format("获得黄金x{0}", infos[0]), HSTypes.I2ResourceColor(0)); } else if (type == "resource") { UserProfile.InfoBag.AddResource((GameResourceType)(infos[0] - 1), 1); panel.AddFlowCenter(string.Format("获得{1}x{0}", 1, HSTypes.I2Resource(infos[0] - 1)), HSTypes.I2ResourceColor(infos[0] - 1)); } string word = MazeItemConfig.Word; if (word != "") { panel.AddFlowCenter(word, "White"); } success(); }
private void virtualRegion_RegionEntered(int id, int x, int y, int key) { if (id >= 20) { if (key > 0) { Image image = BlessBook.GetPreview(key); tooltip.Show(image, parent, x, y); } } else if (id == 10) { Image image = GetPlayerImage(); tooltip.Show(image, parent, 0, 50); } else if (id == 11) { Image image = GetSceneImage(); tooltip.Show(image, parent, width - image.Width, 35); } else if (id < 10) { var resName = HSTypes.I2Resource(id - 1); string resStr = string.Format("{0}:{1}", resName, UserProfile.Profile.InfoBag.Resource.Get((GameResourceType)(id - 1))); Image image = DrawTool.GetImageByString(resStr, 100); tooltip.Show(image, parent, x, y); } }
internal FlowItemInfo(int item_id, Point point, int offX, int offY) : base("", point, -2, "White", offX, offY, 1, 3, 30) { id = item_id; HItemConfig itemConfig = ConfigData.GetHItemConfig(id); word = string.Format("{0}", itemConfig.Name); color = Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)); }
internal void AddResource(GameResourceType type, uint value) { Resource.Add(type, (int)value); if (type > 0) { MainTipManager.AddTip(string.Format("|获得|{0}|{1}||x{2}", HSTypes.I2ResourceColor((int)type), HSTypes.I2Resource((int)type), value), "White"); AchieveBook.CheckByCheckType("resource"); } }
private void MergeWeaponForm_Paint(object sender, PaintEventArgs e) { BorderPainter.Draw(e.Graphics, "", Width, Height); Font font = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); e.Graphics.DrawString(" 试炼 ", font, Brushes.White, Width / 2 - 40, 8); font.Dispose(); if (currentInfo == null) { return; } font = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); e.Graphics.DrawString(timeText, font, Brushes.YellowGreen, 165, 412); font.Dispose(); int targetid = selectPanel.SelectInfo; EquipConfig equipConfig = ConfigData.GetEquipConfig(targetid); font = new Font("微软雅黑", 14 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); e.Graphics.DrawString((GameResourceBook.OutStoneMerge(equipConfig.Quality + 1, equipConfig.Level)).ToString().PadLeft(5, ' '), font, PaintTool.GetBrushByResource((int)GameResourceType.Mercury), 273, 368); e.Graphics.DrawImage(HSIcons.GetIconsByEName("res3"), 333, 370, 24, 24); font.Dispose(); font = new Font("微软雅黑", 10 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); int[] imgOff = { 200, 410, 270, 340 }; int index = 1; foreach (var pair in currentInfo.Methods) { var imgOffX = imgOff[index - 1]; Brush brush = new SolidBrush(Color.FromName(HSTypes.I2RareColor(ConfigData.GetHItemConfig(pair.Type).Rare))); e.Graphics.DrawString(ConfigData.GetHItemConfig(pair.Type).Name, font, brush, imgOffX, 305); brush.Dispose(); var itemCount = itemCounts[index]; bool isEnough = itemCount >= pair.Value; e.Graphics.DrawString(string.Format("{0}/{1}", itemCount, pair.Value), font, isEnough ? Brushes.Lime : Brushes.Red, imgOffX, 325); e.Graphics.DrawLine(isEnough ? Pens.Lime : Pens.Gray, 325, 160, imgOffX + 20, 295); index++; } font.Dispose(); Image border = PicLoader.Read("Border", "itemb1.PNG"); e.Graphics.DrawImage(border, 295 - 10, 100 - 15, 80, 90); border.Dispose(); virtualRegion.Draw(e.Graphics); }
private Image GetTerrainImage(int monType, double[] attrAtk, double[] attrDef) {//todo ControlPlus.TipImage tipData = new ControlPlus.TipImage(); tipData.AddTextNewLine("属性:" + HSTypes.I2Attr(monType), "White", 20); for (int i = 0; i <= 6; i++) { tipData.AddTextNewLine("Vs", "Yellow", 16); tipData.AddImageXY(HSIcons.GetIconsByEName("atr" + i), 0, 0, 32, 32, 23, 20 + i * 16 + 1, 14, 14); // tipData.AddText(string.Format(" AT={0}%",100+attrAtk[i]*100), attrAtk[i]==0?"White": attrAtk[i]>0?"Lime": "Red"); tipData.AddTextOff(string.Format("DF={0}%", 100 + attrDef[i] * 100), attrDef[i] == 0 ? "White" : attrDef[i] > 0 ? "Lime" : "Red", 50); } return(tipData.Image); }
public static Image GetPreview(int id) { HItemConfig hItemConfig = ConfigData.GetHItemConfig(id); if (hItemConfig.Id <= 0) { return(DrawTool.GetImageByString("unknown", 100)); } ControlPlus.TipImage tipData = new ControlPlus.TipImage(PaintTool.GetTalkColor); tipData.AddTextNewLine(hItemConfig.Name, HSTypes.I2RareColor(hItemConfig.Rare), 20); if (hItemConfig.IsUsable) { if (hItemConfig.SubType == (int)HItemTypes.Fight) { tipData.AddTextNewLine(" 战斗中双击使用", "Red"); } else if (hItemConfig.SubType == (int)HItemTypes.Seed) { tipData.AddTextNewLine(" 农场中双击使用", "Red"); } else { tipData.AddTextNewLine(" 双击使用", "Green"); } } if (hItemConfig.Type == (int)HItemTypes.Task) { tipData.AddTextNewLine(" 任务物品", "DarkBlue"); } else if (hItemConfig.Type == (int)HItemTypes.Material) { tipData.AddTextNewLine(string.Format(" 材料(稀有度:{0})", hItemConfig.Rare), "White"); } if (hItemConfig.Attributes != null && hItemConfig.Attributes.Length > 0) { tipData.AddTextNewLine(string.Format(" 特性:{0}", string.Join(",", hItemConfig.Attributes)), "Lime"); } tipData.AddTextNewLine(string.Format(" 等级:{0}", hItemConfig.Level), "White"); tipData.AddTextNewLine("", "White", 8); if (!string.IsNullOrEmpty(hItemConfig.Descript)) { tipData.AddTextLines(hItemConfig.Descript, "White", 20, true); } tipData.AddTextNewLine(string.Format("出售价格:{0}", GameResourceBook.InGoldSellItem(hItemConfig.Rare, hItemConfig.ValueFactor)), "Yellow"); tipData.AddImage(HSIcons.GetIconsByEName("res1")); tipData.AddImageXY(GetHItemImage(id), 8, 8, 48, 48, 7, 24, 32, 32); return(tipData.Image); }
private Image GetAttrPreview(int index) { var equipAttr = GetEquipAttr(index); var attr = GetMonsterAttrByIndex(index); var jobData = GetAttrByIndex(index); ControlPlus.TipImage tipData = new ControlPlus.TipImage(); tipData.AddTextNewLine(HSTypes.I2HeroAttrTip(index), "White", 20); tipData.AddLine(); tipData.AddTextNewLine(string.Format(" 基础属性:{0}", attr), "Lime"); if (jobData > 0) tipData.AddTextNewLine(string.Format(" 职业属性:{0}", jobData), "Pink"); tipData.AddTextNewLine(string.Format(" 来自装备:{0}", equipAttr), "Gold"); return tipData.Image; }
protected override void OnClick(MenuItemData target) { if (target.Type == "decompose") { var equipConfig = ConfigDatas.ConfigData.GetEquipConfig(UserProfile.InfoEquip.Equipoff[EquipIndex].BaseId); MainTipManager.AddTip(string.Format("|分解装备-|{0}|{1}", HSTypes.I2QualityColor(equipConfig.Quality), equipConfig.Name), "White"); UserProfile.Profile.InfoBag.AddResource(GameResourceType.Stone, GameResourceBook.InStoneEquipDecompose(equipConfig.Quality, equipConfig.Level)); UserProfile.InfoEquip.Equipoff[EquipIndex] = new DbEquip(); } else { return; } Form.MenuRefresh(EquipIndex); }
private void DeleteItemByPos(int pos, int num) {//num=0,移除所有 IntPair cell = Items[pos]; var itemConfig = ConfigData.GetHItemConfig(cell.Type); if (num != 0 && cell.Value > num) { cell.Value -= num; MainTipManager.AddTip(string.Format("|扣除物品-|{0}|{1}||x{2}", HSTypes.I2RareColor(itemConfig.Rare), itemConfig.Name, num), "White"); } else { MainTipManager.AddTip(string.Format("|扣除物品-|{0}|{1}||x{2}", HSTypes.I2RareColor(itemConfig.Rare), itemConfig.Name, cell.Value), "White"); cell.Value = 0; cell.Type = 0; } }
public void AddEquip(int id, int minuteLast) { EquipConfig equipConfig = ConfigData.GetEquipConfig(id); MainTipManager.AddTip(string.Format("|获得装备-|{0}|{1}", HSTypes.I2QualityColor(equipConfig.Quality), equipConfig.Name), "White"); for (int i = 0; i < GameConstants.EquipOffCount; i++) { if (Equipoff[i].BaseId == 0) { Equipoff[i].BaseId = id; Equipoff[i].Dura = equipConfig.Durable; Equipoff[i].ExpireTime = minuteLast <= 0 ? 0 : TimeTool.GetNowUnixTime() + minuteLast * 60; return; } } }
public void AddItem(int id, int num) { HItemConfig itemConfig = ConfigData.GetHItemConfig(id); MainTipManager.AddTip(string.Format("|获得物品-|{0}|{1}||x{2}", HSTypes.I2RareColor(itemConfig.Rare), itemConfig.Name, num), "White"); int max = itemConfig.MaxPile; if (max <= 0) { return; } int count = num; for (int i = 0; i < BagCount; i++) { var pickItem = Items[i]; if (pickItem.Type == id && pickItem.Value < max) { if (pickItem.Value + count <= max) { pickItem.Value += count; return; } count -= max - pickItem.Value; pickItem.Value = max; } } for (int i = 0; i < BagCount; i++) { var pickItem = Items[i]; if (pickItem.Type == 0) { if (count <= max) { pickItem.Type = id; pickItem.Value = count; return; } pickItem.Type = id; count -= max; pickItem.Value = max; } } }
private void PopBuyProduct_Load(object sender, EventArgs e) { count = 1; textBoxTotal.Text = (count * itemprice).ToString(); var isEquip = ConfigIdManager.IsEquip(itemid); if (!isEquip) { fontcolor = HSTypes.I2RareColor(ConfigDatas.ConfigData.GetHItemConfig(itemid).Rare); } else { fontcolor = HSTypes.I2QualityColor(ConfigDatas.ConfigData.GetEquipConfig(itemid).Quality); buttonAdd.Enabled = false; buttonMinus.Enabled = false; textBoxCount.ReadOnly = true; } }
public void AddResource(int[] res) { Resource.Gold += res[0]; Resource.Lumber += res[1]; Resource.Stone += res[2]; Resource.Mercury += res[3]; Resource.Carbuncle += res[4]; Resource.Sulfur += res[5]; Resource.Gem += res[6]; for (int i = 0; i < 7; i++) { if (res[i] > 0) { MainTipManager.AddTip(string.Format("|获得|{0}|{1}||x{2}", HSTypes.I2ResourceColor(i), HSTypes.I2Resource(i), res[i]), "White"); } } AchieveBook.CheckByCheckType("resource"); }
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--; } }
private void virtualRegion_RegionEntered(int id, int x, int y, int key) { Image image = null; if (id == 1) { image = DrawTool.GetImageByString("", HSTypes.I2ConstellationTip(constellation), 150, Color.LimeGreen); } else if (id == 2) { image = DrawTool.GetImageByString("", HSTypes.I2InitialAttrTip(type), 140, Color.Gold); } else if (id == 3) { image = DrawTool.GetImageByString("", HSTypes.I2BloodTypeTip(bldType), 150, Color.LimeGreen); } if (image != null) { tooltip.Show(image, this, x + 2, y + 3); } }
public void Draw(Graphics g) { g.DrawRectangle(Pens.White, x, y, width - 1, height - 1); if (show) { colorWord.Draw(g); LevelInfoConfig levelInfoConfig = ConfigData.GetLevelInfoConfig(id); g.DrawImage(LevelInfoBook.GetLevelInfoImage(id), x + 10, y + 10, 64, 64); Image back = PicLoader.Read("Border", "border3.PNG"); g.DrawImage(back, x + 10, y + 10, 64, 64); back.Dispose(); Font font = new Font("微软雅黑", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); Brush brush = new SolidBrush(Color.FromName(HSTypes.I2LevelInfoColor(levelInfoConfig.Type))); g.DrawString(HSTypes.I2LevelInfoType(levelInfoConfig.Type), font, brush, x + 80, y + 30); brush.Dispose(); font.Dispose(); } }
public override Image GetPreview(CardPreviewType type, int[] parms) { const string stars = "★★★★★★★★★★"; ControlPlus.TipImage tipData = new ControlPlus.TipImage(); var cardQual = Config.CardConfigManager.GetCardConfig(CardId).Quality; tipData.AddTextNewLine(spell.SpellConfig.Name, HSTypes.I2QualityColor(cardQual), 20); tipData.AddText(string.Format("Lv{0}({1})", card.Level, spell.SpellConfig.Ename), "MediumAquamarine"); tipData.AddTextNewLine(stars.Substring(10 - spell.SpellConfig.Star), "Yellow", 20); tipData.AddLine(); if (spell.SpellConfig.JobId > 0) { var jobConfig = ConfigData.GetJobConfig(spell.SpellConfig.JobId); tipData.AddTextNewLine(string.Format("(限定职业:{0})", jobConfig.Name), "Red"); } tipData.AddTextNewLine("类型/属性", "Gray"); tipData.AddImage(HSIcons.GetIconsByEName("spl" + (spell.SpellConfig.Type - 200 + 1))); tipData.AddImage(HSIcons.GetIconsByEName("atr" + spell.SpellConfig.Attr)); string des = spell.Descript; tipData.AddTextLines(des, "Cyan", 15, true); if (type == CardPreviewType.Shop) { tipData.AddLine(); tipData.AddTextNewLine("价格", "White"); for (int i = 0; i < 7; i++) { if (parms[i] > 0) { tipData.AddText(" " + parms[i].ToString(), HSTypes.I2ResourceColor(i)); tipData.AddImage(HSIcons.GetIconsByEName("res" + (i + 1))); } } } return(tipData.Image); }
public void Draw(Graphics g) { Image back = PicLoader.Read("System", "ShopItemBack.JPG"); g.DrawImage(back, x, y, width - 1, height - 1); back.Dispose(); if (show) { GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId); string name; string fontcolor; var isEquip = ConfigIdManager.IsEquip(gameShopConfig.ItemId); if (!isEquip) { HItemConfig itemConfig = ConfigData.GetHItemConfig(gameShopConfig.ItemId); name = itemConfig.Name; fontcolor = HSTypes.I2RareColor(itemConfig.Rare); } else { EquipConfig equipConfig = ConfigData.GetEquipConfig(gameShopConfig.ItemId); name = equipConfig.Name; fontcolor = HSTypes.I2QualityColor(equipConfig.Quality); } Font fontsong = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); Brush brush = new SolidBrush(Color.FromName(fontcolor)); g.DrawString(name, fontsong, brush, x + 76, y + 9); brush.Dispose(); var itmConfig = ConfigData.GetHItemConfig(gameShopConfig.ItemId); var price = GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor); g.DrawString(string.Format("{0,3:D}", Math.Max(1, price / GameConstants.DiamondToGold)), fontsong, Brushes.PaleTurquoise, x + 80, y + 37); fontsong.Dispose(); g.DrawImage(HSIcons.GetIconsByEName("res8"), x + 110, y + 35, 16, 16); virtualRegion.Draw(g); } }
private void selectPanel_DrawCell(Graphics g, int info, int xOff, int yOff) { EquipConfig equipConfig = ConfigData.GetEquipConfig(info); g.DrawImage(EquipBook.GetEquipImage(info), 5 + xOff, 5 + yOff, 40, 40); Font font = new Font("微软雅黑", 11.25F * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); SolidBrush sb = new SolidBrush(Color.FromName(HSTypes.I2QualityColor(equipConfig.Quality))); g.DrawString(equipConfig.Name, font, sb, 50 + xOff, 5 + yOff); sb.Dispose(); font.Dispose(); font = new Font("宋体", 10F * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); g.DrawString("Lv" + equipConfig.Level, font, Brushes.DimGray, 50 + xOff + 10, 5 + yOff + 24); font.Dispose(); if (UserProfile.InfoEquip.EquipComposeAvail.Contains(info)) { var img = PicLoader.Read("System", "Learn.PNG"); g.DrawImage(img, xOff + 10, 3 + yOff, img.Width, img.Height); img.Dispose(); } }
public void Draw(Graphics g) { Image back = PicLoader.Read("System", "ShopItemBack.jpg"); g.DrawImage(back, X, Y, Width - 1, Height - 1); back.Dispose(); if (show) { GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId); var eid = HItemBook.GetItemId(gameShopConfig.Item); HItemConfig itemConfig = ConfigData.GetHItemConfig(eid); var name = itemConfig.Name; var fontcolor = HSTypes.I2RareColor(itemConfig.Rare); uint price = GameResourceBook.OutGoldSellItem(itemConfig.Rare, itemConfig.ValueFactor) * 2; if (gameShopConfig.UseDiamond) { price = Math.Max(1, price / GameConstants.DiamondToGold); } Font fontsong = new Font("宋体", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); Brush brush = new SolidBrush(Color.FromName(fontcolor)); g.DrawString(name, fontsong, brush, X + 76, Y + 9); brush.Dispose(); g.DrawString(string.Format("{0,3:D}", price), fontsong, Brushes.PaleTurquoise, X + 80, Y + 37); fontsong.Dispose(); if (gameShopConfig.UseDiamond) { g.DrawImage(HSIcons.GetIconsByEName("res8"), X + 110, Y + 35, 16, 16); } else { g.DrawImage(HSIcons.GetIconsByEName("res1"), X + 110, Y + 35, 16, 16); } vRegion.Draw(g); } }
/// <summary> /// 添加卡牌,外层都会检查cid的合法性,所以里面不用在判断了 /// </summary> /// <param name="cid">卡牌id</param> public DbDeckCard AddCard(int cid) { DbDeckCard card = new DbDeckCard(cid, 1, 0); var cardData = CardConfigManager.GetCardConfig(cid); if (GetCardCount(cid) >= 1) //每张卡其实只能有一份 { var myCard = GetDeckCardById(cid); myCard.AddExp(1); //多余的卡转化为经验值 return(myCard); //每种卡牌只能拥有1张 } Cards.Add(card.BaseId, card); Newcards.Add(card.BaseId); if (Newcards.Count > 10) { Newcards.RemoveAt(0); } AchieveBook.CheckByCheckType("card"); MainTipManager.AddTip(string.Format("|获得卡片-|{0}|{1}", HSTypes.I2QualityColor(cardData.Quality), cardData.Name), "White"); return(card); }
public void DeleteItem(int id, int num) { int count = num; for (int i = 0; i < BagCount; i++) { var pickItem = Items[i]; if (pickItem.Type == id) { if (pickItem.Value > count) { pickItem.Value -= count; break; } count -= pickItem.Value; pickItem.Type = 0; pickItem.Value = 0; } } var itemConfig = ConfigData.GetHItemConfig(id); MainTipManager.AddTip(string.Format("|扣除物品-|{0}|{1}||x{2}", HSTypes.I2RareColor(itemConfig.Rare), itemConfig.Name, num), "White"); }
public static Image GetPreview(int id) { TournamentConfig tournamentConfig = ConfigData.GetTournamentConfig(id); int[] awardData = tournamentConfig.Awards; RLIdValueList resourceData = tournamentConfig.Resource; int wid = 175; int heg = awardData.Length * 16; wid += 5; heg += 5; heg += 16 * 4 + 50; Bitmap bmp = new Bitmap(wid, heg); Graphics g = Graphics.FromImage(bmp); g.FillRectangle(Brushes.Black, 0, 0, wid, heg); g.FillRectangle(new SolidBrush(Color.FromArgb(30, 30, 30)), 0, 0, wid, 18); Pen pen = new Pen(Brushes.Gray, 2); g.DrawRectangle(pen, 1, 1, wid - 3, heg - 3); pen.Dispose(); int y = 3; Font fontsong = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel); Font fontsongB = new Font("宋体", 9 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); g.DrawString("赛事名", fontsongB, Brushes.LightGray, 3, y); g.DrawString(tournamentConfig.Name, fontsong, Brushes.White, 53, y); y += 16; g.DrawString("比赛时间", fontsongB, Brushes.LightGray, 3, y); // g.DrawString(string.Format("{0}-{1}", HSTime.GetByDate(begin_date).ToShortString(), HSTime.GetByDate(end_date).ToShortString()), fontsong, Brushes.LightGreen, 66, y); y += 16; g.DrawString("比赛地图", fontsongB, Brushes.LightGray, 3, y); Image mapback = BattleMapBook.GetMapImage(tournamentConfig.Map, TileConfig.Indexer.DefaultTile); g.DrawImage(mapback, new Rectangle(70, y, 100, 50), new Rectangle(0, 25, 100, 50), GraphicsUnit.Pixel); mapback.Dispose(); y += 50; g.DrawString("等级限制", fontsongB, Brushes.LightGray, 3, y); g.DrawString(string.Format("{0}-{1}", tournamentConfig.MinLevel, tournamentConfig.MaxLevel), fontsong, Brushes.LightPink, 66, y); y += 16; g.DrawString("比赛奖励", fontsongB, Brushes.LightGray, 3, y); y += 16; for (int i = 0; i < awardData.Length; i++) { g.DrawString(string.Format("第{0}名 {1}积分", i + 1, awardData[i].ToString().PadLeft(2, ' ')), fontsong, Brushes.White, 33, y); if (i < resourceData.Count) { if (resourceData[i].Id == 99) { g.DrawString(resourceData[i].Value.ToString().PadLeft(2, ' '), fontsong, Brushes.Cyan, 123, y); g.DrawImage(HSIcons.GetIconsByEName("res8"), 143, y, 16, 16); } else { Brush brush = new SolidBrush(Color.FromName(HSTypes.I2ResourceColor(resourceData[i].Id))); g.DrawString(resourceData[i].Value.ToString().PadLeft(2, ' '), fontsong, brush, 123, y); g.DrawImage(HSIcons.GetIconsByEName("res" + (resourceData[i].Id + 1)), 143, y, 14, 14); brush.Dispose(); } } y += 16; } fontsong.Dispose(); fontsongB.Dispose(); g.Dispose(); return(bmp); }
void hsServer_ReceivedStatus(object sender, HSTypes.HSLogTypes e) { //if (e == HSTypes.HSLogTypes.WaitingForHSClient) // btnStart_Click(btnStart, new EventArgs()); if (e == HSTypes.HSLogTypes.CriticalError) { this.Invoke(new MethodInvoker(() => { btnStart.PerformClick(); })); } }
private void PopBuyProduct_Load(object sender, EventArgs e) { count = 1; textBoxTotal.Text = (count * itemprice).ToString(); fontcolor = HSTypes.I2RareColor(ConfigDatas.ConfigData.GetHItemConfig(itemid).Rare); }
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 static Image GetPreview(int id) { HItemConfig hItemConfig = ConfigData.GetHItemConfig(id); if (hItemConfig.Id <= 0) { return(DrawTool.GetImageByString("unknown", 100)); } ControlPlus.TipImage tipData = new ControlPlus.TipImage(); tipData.AddTextNewLine(hItemConfig.Name, HSTypes.I2RareColor(hItemConfig.Rare), 20); if (hItemConfig.IsUsable) { if (hItemConfig.SubType == HItemTypes.Fight) { tipData.AddTextNewLine(" 战斗中双击使用", "Red"); } else if (hItemConfig.SubType == HItemTypes.Seed) { tipData.AddTextNewLine(" 农场中双击使用", "Red"); } else { tipData.AddTextNewLine(" 双击使用", "Green"); } } else if (hItemConfig.SubType == HItemTypes.Task) { tipData.AddTextNewLine(" 任务物品", "DarkBlue"); } else if (hItemConfig.SubType == HItemTypes.Material) { tipData.AddTextNewLine(string.Format(" 材料(稀有度:{0})", hItemConfig.Rare), "White"); } else { tipData.AddTextNewLine("", "White"); } tipData.AddTextNewLine(string.Format(" 等级:{0}", hItemConfig.Level), "White"); tipData.AddTextNewLine("", "White"); tipData.AddTextLines(hItemConfig.Descript, "White", 20, true); if (hItemConfig.SubType == HItemTypes.RandomCard) { var consumerConfig = ConfigData.GetItemConsumerConfig(hItemConfig.Id); int totalRate = 0; foreach (var rate in consumerConfig.RandomCardRate) { totalRate += rate; } tipData.AddLine(); tipData.AddTextNewLine("抽卡概率", "White"); tipData.AddTextNewLine("", "White"); tipData.AddImage(HSIcons.GetIconsByEName("gem5")); tipData.AddText(string.Format("{0:0}% ", (float)consumerConfig.RandomCardRate[3] * 100 / totalRate), "White"); tipData.AddImage(HSIcons.GetIconsByEName("gem4")); tipData.AddText(string.Format("{0:0}% ", (float)consumerConfig.RandomCardRate[2] * 100 / totalRate), "White"); tipData.AddLine(); } tipData.AddTextNewLine(string.Format("出售价格:{0}", GameResourceBook.InGoldSellItem(hItemConfig.Rare, hItemConfig.ValueFactor)), "Yellow"); tipData.AddImage(HSIcons.GetIconsByEName("res1")); tipData.AddImageXY(GetHItemImage(id), 8, 8, 48, 48, 7, 24, 32, 32); return(tipData.Image); }