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(); }
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 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); } }
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)); }
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); }
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); }
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 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; } }
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 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); } }
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); } }
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"); }
private void PopBuyProduct_Load(object sender, EventArgs e) { count = 1; textBoxTotal.Text = (count * itemprice).ToString(); fontcolor = HSTypes.I2RareColor(ConfigDatas.ConfigData.GetHItemConfig(itemid).Rare); }
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); }
private void ItemForm_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 (!show) { return; } if (isDirty) { tempImage.Dispose(); tempImage = new Bitmap(324, 324); Graphics g = Graphics.FromImage(tempImage); Image img = PicLoader.Read("System", "ItemBackDown.jpg"); g.DrawImage(img, 0, 0, 324, 324); img.Dispose(); font = new Font("Aril", 11 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel); for (int i = 0; i < CellCountPerPage; i++) { if (baseid + i < UserProfile.InfoBag.BagCount) { IntPair thing = UserProfile.InfoBag.Items[baseid + i]; if (thing.Type != 0) { var itemConfig = ConfigData.GetHItemConfig(thing.Type); g.DrawImage(HItemBook.GetHItemImage(thing.Type), (i % 10) * 31.2f + 5, (i / 10) * 31.8f + 3, 30.0f, 30.0f); g.DrawString(thing.Value.ToString(), font, Brushes.Black, (i % 10) * 31.2f + 8, (i / 10) * 31.8f + 14); g.DrawString(thing.Value.ToString(), font, thing.Value == itemConfig.MaxPile ? Brushes.Tomato : Brushes.White, (i % 10) * 31.2f + 7, (i / 10) * 31.8f + 13); var pen = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2); g.DrawRectangle(pen, (i % 10) * 31.2f + 5, (i / 10) * 31.8f + 3, 30.0f, 30.0f); pen.Dispose(); } } else { g.DrawImage(HSIcons.GetIconsByEName("oth3"), (i % 10) * 31.2f + 8, (i / 10) * 31.8f + 4, 24.0f, 24.0f); } } font.Dispose(); g.Dispose(); isDirty = false; } e.Graphics.DrawImage(tempImage, 6, 36); Brush brush = new SolidBrush(Color.FromArgb(150, Color.Yellow)); for (int i = 0; i < itemCdRate.Length; i++) { if (itemCdRate[i] > 0) { e.Graphics.FillRectangle(brush, (i % 10) * 31.2f + 5 + 6, (i / 10) * 31.8f + 3 + 36, 30, 30 * (100 - itemCdRate[i]) / 100); } } brush.Dispose(); int rect = tar; if (rect >= 0) { if (baseid + rect < UserProfile.InfoBag.BagCount) { SolidBrush yellowbrush = new SolidBrush(Color.FromArgb(80, Color.Yellow)); e.Graphics.FillRectangle(yellowbrush, (rect % 10) * 31.2f + 11, (rect / 10) * 31.8f + 39, 30.0f, 30.0f); yellowbrush.Dispose(); Pen yellowpen = new Pen(Brushes.Yellow, 2); e.Graphics.DrawRectangle(yellowpen, (rect % 10) * 31.2f + 11, (rect / 10) * 31.8f + 39, 30.0f, 30.0f); yellowpen.Dispose(); } else { int tpoff = rect; while (tpoff >= 0 && baseid + tpoff >= UserProfile.InfoBag.BagCount) { e.Graphics.DrawImage(HSIcons.GetIconsByEName("oth4"), (tpoff % 10) * 31.2f + 14, (tpoff / 10) * 31.8f + 40, 24f, 24f); tpoff--; } } } }
public override void Draw(Graphics g) { if (nid > 0) { Image img = null; HsActionCallback action = null; if (type == PictureRegionCellType.Npc) { img = SceneBook.GetSceneNpcImage(nid); } else if (type == PictureRegionCellType.Item) { img = DataType.Items.HItemBook.GetHItemImage(nid); action = () => { var itemConfig = ConfigData.GetHItemConfig(nid); var pen = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2); g.DrawRectangle(pen, X, Y, Width, Height); pen.Dispose(); }; } else if (type == PictureRegionCellType.Equip) { img = DataType.Equips.EquipBook.GetEquipImage(nid); action = () => { var equipConfig = ConfigData.GetEquipConfig(nid); var pen = new Pen(Color.FromName(HSTypes.I2QualityColor(equipConfig.Quality)), 2); g.DrawRectangle(pen, X, Y, Width, Height); pen.Dispose(); }; } else if (type == PictureRegionCellType.Card) { img = DataType.Cards.CardAssistant.GetCardImage(nid, 60, 60); action = () => { var cardData = CardConfigManager.GetCardConfig(nid); string cardBorder = DataType.Cards.CardAssistant.GetCardBorder(cardData); g.DrawImage(PicLoader.Read("Border", cardBorder), X, Y, Width, Height); }; } else if (type == PictureRegionCellType.SkillAttr) { img = DataType.HeroSkills.HeroSkillAttrBook.GetHeroSkillAttrImage(nid); } else if (type == PictureRegionCellType.Achieve) { img = DataType.Achieves.AchieveBook.GetAchieveImage(nid); } else if (type == PictureRegionCellType.People) { img = DataType.Peoples.PeopleBook.GetPersonImage(nid); } else if (type == PictureRegionCellType.HeroSkill) { img = DataType.HeroSkills.HeroPowerBook.GetImage(nid); } else if (type == PictureRegionCellType.CardQual) { img = HSIcons.GetIconsByEName("gem" + nid); } else if (type == PictureRegionCellType.Job) { img = HSIcons.GetIconsByEName("job" + nid); action = () => { var jobConfig = ConfigData.GetJobConfig(nid + JobConfig.Indexer.NewBie); Pen pen = new Pen(Color.FromName(jobConfig.Color)); g.DrawRectangle(pen, X, Y, Width, Height); pen.Dispose(); }; } else if (type == PictureRegionCellType.Bless) { img = DataType.Blesses.BlessBook.GetBlessImage(nid); } else if (type == PictureRegionCellType.SceneQuest) { img = SceneBook.GetSceneQuestImage(nid); } if (img != null) { if (Scale == 1) { g.DrawImage(img, X, Y, Width, Height); } else { int realWidth = (int)(Width * Scale); int realHeight = (int)(Height * Scale); g.DrawImage(img, X + (Width - realWidth) / 2, Y + (Height - realHeight) / 2, realWidth, realHeight); } } if (action != null) { action(); } } foreach (IRegionDecorator decorator in decorators) { decorator.Draw(g, X, Y, Width, Height); } }
public override void Draw(Graphics g) { if (nid > 0) { Image img = null; HsActionCallback preAction = null; HsActionCallback action = null; if (type == PictureRegionCellType.Item) { img = HItemBook.GetHItemImage(nid); action = () => { var itemConfig = ConfigData.GetHItemConfig(nid); var pen = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2); g.DrawRectangle(pen, X, Y, Width, Height); pen.Dispose(); }; } else if (type == PictureRegionCellType.Gismo) { img = DungeonBook.GetGismoImage(nid); } else if (type == PictureRegionCellType.People) { img = HSIcons.GetImage("Samurai", nid); preAction = () => { var peopleConfig = ConfigData.GetSamuraiConfig(nid); var brush = new SolidBrush(Color.FromName(HSTypes.I2QualityColorD(peopleConfig.Quality))); g.FillRectangle(brush, X + 3, Y + 3, Width - 6, Height - 6); brush.Dispose(); }; } else if (type == PictureRegionCellType.SceneQuest) { img = SceneQuestBook.GetSceneQuestImageScene(nid); } else if (type == PictureRegionCellType.DungeonItem) { img = DungeonBook.GetDungeonItemImage(nid); } if (preAction != null) { preAction(); } if (img != null) { if (Scale == 1) { if (Enabled) { g.DrawImage(img, X, Y, Width, Height); } else { g.DrawImage(img, new Rectangle(X, Y, Width, Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray); } } else { int realWidth = (int)(Width * Scale); int realHeight = (int)(Height * Scale); g.DrawImage(img, X + (Width - realWidth) / 2, Y + (Height - realHeight) / 2, realWidth, realHeight); } } if (action != null) { action(); } } foreach (IRegionDecorator decorator in decorators) { decorator.Draw(g, X, Y, Width, Height); } }
public void AddItem(int id, int num) { HItemConfig itemConfig = ConfigData.GetHItemConfig(id); if (itemConfig.Id == 0) { return; } 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; count = 0; break; } else { count -= max - pickItem.Value; pickItem.Value = max; } } } if (count > 0) { for (int i = 0; i < BagCount; i++) { var pickItem = Items[i]; if (pickItem.Type == 0) { pickItem.Type = id; if (count <= max) { pickItem.Value = count; count = 0; break; } else { pickItem.Value = max; count -= max; } } } } if (num > count) { MainTipManager.AddTip(string.Format("|获得物品-|{0}|{1}||x{2}", HSTypes.I2RareColor(itemConfig.Rare), itemConfig.Name, num - count), "White"); UserProfile.InfoRecord.AddRecordById(RecordInfoConfig.Indexer.ItemGet, 1); } }