コード例 #1
0
        public void Draw(Graphics g, bool enable)
        {
            Image back = PicLoader.Read("System", "ItemGrid.JPG");

            g.DrawImage(back, x + 3, y + 3, 32, 32);
            back.Dispose();

            if (itemPos >= 0)
            {
                Font font   = new Font("Aril", 11 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
                int  itemId = UserProfile.InfoBag.Items[itemPos].Type;
                if (enable)
                {
                    g.DrawImage(HItemBook.GetHItemImage(itemId), x + 3, y + 3, 32, 32);
                }
                else
                {
                    Rectangle ret = new Rectangle(x + 3, y + 3, 32, 32);
                    g.DrawImage(HItemBook.GetHItemImage(itemId), ret, 0, 0, 64, 64, GraphicsUnit.Pixel, HSImageAttributes.ToGray);
                }

                int count = UserProfile.InfoBag.Items[itemPos].Value;
                g.DrawString(count.ToString(), font, Brushes.Black, x + 4, y + 4);
                g.DrawString(count.ToString(), font, Brushes.White, x + 3, y + 3);

                if (percent > 1)
                {
                    Brush brush = new SolidBrush(Color.FromArgb(200, Color.Black));
                    g.FillRectangle(brush, x, y, 35, 35 * percent / 100);
                    brush.Dispose();
                }

                font.Dispose();
            }
        }
コード例 #2
0
        internal override void Draw(Graphics g)
        {
            g.DrawImage(HItemBook.GetHItemImage(id), position.X, position.Y, 20, 20);

            g.DrawString(word, font, Brushes.Black, position.X + 23, position.Y + 1);
            Brush brush = new SolidBrush(color);

            g.DrawString(word, font, brush, position.X + 21, position.Y);
            brush.Dispose();
        }
コード例 #3
0
ファイル: MazeItem.cs プロジェクト: jayrulez/TOMClassic
        public void DrawIcon(Graphics g, Rectangle dest, int frame)
        {
            string moveicon = "";

            switch (type)
            {
            case "mon": moveicon = ConfigData.GetPeopleConfig(infos[0]).Figue; break;

            case "resource": moveicon = string.Format("res{0}", infos[0]); break;

            case "gold": moveicon = "res1"; break;

            case "task": moveicon = "trap1"; break;
            }

            if (moveicon != "")
            {
                Image moveImage = MazeBook.GetMoveImage(moveicon);
                if (moveImage != null)
                {
                    int       wid        = moveImage.Width / 4;
                    Rectangle targetRect = new Rectangle(dest.X + (38 - wid) / 2, dest.Y, wid, moveImage.Height);
                    g.DrawImage(moveImage, targetRect, wid * frame, 0, wid, moveImage.Height, GraphicsUnit.Pixel);
                    if (type == "mon")
                    {
                        int  lv   = mlevel + infos[1];
                        Font font = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                        g.DrawString("lv" + lv, font, Brushes.Maroon, targetRect.X + 6, targetRect.Y + 28);
                        g.DrawString("lv" + lv, font, Brushes.White, targetRect.X + 5, targetRect.Y + 27);
                        font.Dispose();
                    }
                }
            }
            else
            {
                Rectangle smallDest = new Rectangle(dest.X + 7, dest.Y + 7, dest.Width - 14, dest.Height - 14);
                if (type == "block")
                {
                    Image block = PicLoader.Read("Map", "block.PNG");
                    g.DrawImage(block, smallDest);
                    block.Dispose();
                }
                else if (type == "item")
                {
                    g.DrawImage(HItemBook.GetHItemImage(infos[0]), smallDest, 4, 4, 56, 56, GraphicsUnit.Pixel);
                }
                else
                {
                    g.DrawImage(HSIcons.GetIconsByEName("res1"), smallDest, 0, 0, 32, 32, GraphicsUnit.Pixel);
                }
            }
        }
コード例 #4
0
        private void pictureBoxBuy_Click(object sender, EventArgs e)
        {
            if (UserProfile.InfoBag.GetBlankCount() <= 0)
            {
                parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagIsFull), "Red");
                return;
            }

            var  gameShopConfig = ConfigData.GetGameShopConfig(productId);
            var  eid            = HItemBook.GetItemId(gameShopConfig.Item);
            var  itmConfig      = ConfigData.GetHItemConfig(eid);
            var  goldPrice      = GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor) * 2;
            bool buyFin         = false;

            if (gameShopConfig.UseDiamond)
            {
                var diamondPrice = (int)Math.Max(1, goldPrice / GameConstants.DiamondToGold);
                if (UserProfile.InfoBag.PayDiamond(diamondPrice))
                {
                    UserProfile.InfoBag.AddItem(eid, 1);
                    buyFin = true;
                }
                else
                {
                    parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughDimond), "Red");
                }
            }
            else
            {
                if (UserProfile.InfoBag.HasResource(GameResourceType.Gold, goldPrice))
                {
                    UserProfile.InfoBag.SubResource(GameResourceType.Gold, goldPrice);
                    UserProfile.InfoBag.AddItem(eid, 1);
                    buyFin = true;
                }
                else
                {
                    parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughResource), "Red");
                }
            }

            if (buyFin)
            {
                parent.AddFlowCenter("+1", "Lime", HItemBook.GetHItemImage(eid));
            }
            //PopBuyProduct.Show(eid, (int)Math.Max(1, itemPrice / GameConstants.DiamondToGold));
        }
コード例 #5
0
ファイル: TalkEventItemPay.cs プロジェクト: realeternia/FEWin
        private void CalculateRequire()
        {
            int            index = 1;
            List <IntPair> items;

            if (config.PayKey == null || config.PayKey.Length == 0)
            {
                items = ArraysUtils.GetSubArray(UserProfile.InfoBag.GetItemCountByType((int)HItemTypes.Material), 0, 13);
            }
            else
            {
                string pickKey = config.PayKey[MathTool.GetRandom(config.PayKey.Length)];
                items = ArraysUtils.GetSubArray(UserProfile.InfoBag.GetItemCountByAttribute(pickKey), 0, 13);
            }
            for (int i = 0; i < items.Count; i++)
            {
                var region = new ButtonRegion(index, pos.X + 3 + 20 + (index - 1) % 7 * 70, pos.Y + 3 + 25 + (index - 1) / 7 * 70, 60, 60, HItemBook.GetHItemImage(items[i].Type));
                region.SetKeyValue(items[i].Type);
                region.AddDecorator(new RegionTextDecorator(37, 42, 12, Color.White, true, items[i].Value.ToString()));
                vRegion.AddRegion(region);
                index++;
            }

            var button = new ButtonRegion(20, pos.X + 3 + 20 + (index - 1) % 7 * 70, pos.Y + 3 + 25 + (index - 1) / 7 * 70, 60, 60, "iconbg.jpg", "");

            button.AddDecorator(new RegionImageDecorator(HSIcons.GetIconsByEName("rot7"), 60 / 2));
            vRegion.AddRegion(button);
        }
コード例 #6
0
ファイル: ItemForm.cs プロジェクト: realeternia/FEWin
        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--;
                    }
                }
            }
        }
コード例 #7
0
        private void MonsterSkillViewForm_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, 320, 8);
            font.Dispose();
            Font fontblack = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);

            font = new Font("宋体", 10 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
            e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(245, 244, 242)), 65, cardHeight * yCount + 35, cardWidth * xCount, 93);
            e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(190, 175, 160)), 65, cardHeight * yCount + 35, cardWidth * xCount, 20);
            e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(190, 175, 160)), 65, cardHeight * yCount + 75, cardWidth * xCount, 20);
            e.Graphics.DrawString("说明", fontblack, Brushes.White, 65, cardHeight * yCount + 37);
            if (!string.IsNullOrEmpty(itemDesStr))
            {
                e.Graphics.DrawString(itemDesStr, font, Brushes.SaddleBrown, 65 + 5, cardHeight * yCount + 37 + 21);
            }
            e.Graphics.DrawString("掉落怪物", fontblack, Brushes.White, 65, cardHeight * yCount + 77);
            font.Dispose();
            fontblack.Dispose();

            cardDetail.Draw(e.Graphics);



            if (show)
            {
                int pages     = totalCount / cardCount + 1;
                int cardLimit = (page < pages - 1) ? cardCount : (totalCount % cardCount);
                int former    = cardCount * page + 1;
                if (isDirty)
                {
                    tempImage.Dispose();
                    tempImage = new Bitmap(cardWidth * xCount, cardHeight * yCount);
                    Graphics g = Graphics.FromImage(tempImage);
                    for (int i = former - 1; i < former + cardLimit - 1; i++)
                    {
                        g.DrawImage(HItemBook.GetHItemImage(items[i]), (i % xCount) * cardWidth, ((i / xCount) % yCount) * cardHeight, cardWidth, cardHeight);
                    }
                    g.Dispose();
                    isDirty = false;
                }
                e.Graphics.DrawImage(tempImage, 65, 35);

                if (sel != -1 && sel < totalCount)
                {
                    SolidBrush yellowbrush = new SolidBrush(Color.FromArgb(80, Color.Lime));
                    int        x           = (sel % xCount) * cardWidth + 65;
                    int        y           = ((sel / xCount) % yCount) * cardHeight + 35;
                    e.Graphics.FillRectangle(yellowbrush, x, y, cardWidth, cardHeight);
                    yellowbrush.Dispose();

                    Pen yellowpen = new Pen(Brushes.Lime, 3);
                    e.Graphics.DrawRectangle(yellowpen, x, y, cardWidth, cardHeight);
                    yellowpen.Dispose();
                }
                if (tar != -1 && tar < totalCount)
                {
                    int        x           = (tar % xCount) * cardWidth + 65;
                    int        y           = ((tar / xCount) % yCount) * cardHeight + 35;
                    SolidBrush yellowbrush = new SolidBrush(Color.FromArgb(80, Color.Yellow));
                    e.Graphics.FillRectangle(yellowbrush, x, y, cardWidth, cardHeight);
                    yellowbrush.Dispose();

                    Pen yellowpen = new Pen(Brushes.Yellow, 3);
                    e.Graphics.DrawRectangle(yellowpen, x, y, cardWidth, cardHeight);
                    yellowpen.Dispose();
                }
            }
        }
コード例 #8
0
ファイル: PictureRegion.cs プロジェクト: realeternia/FEWin
        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);
            }
        }