Пример #1
0
        private void ItemView_MouseMove(object sender, MouseEventArgs e)
        {
            int temp  = -1;
            int index = -1;

            foreach (MiniItemViewItem item in items)
            {
                if (item.IsInArea(e.X, e.Y))
                {
                    temp  = item.itemPos;
                    index = item.Id - 1;
                    break;
                }
            }

            if (temp != tar)
            {
                tar = temp;
                if (tar != -1)
                {
                    Image image = HItemBook.GetPreview(UserProfile.InfoBag.Items[tar].Type);
                    tooltip.Show(image, this, (index % 2) * 30 - image.Width + 2, (index / 2) * 35 + 3);
                }
                else
                {
                    tooltip.Hide(this);
                }
            }
        }
Пример #2
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();
            }
        }
Пример #3
0
        void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            Image image = null;

            image = HItemBook.GetPreview(itemid);
            toolTip.Show(image, this, 108, 44);
        }
Пример #4
0
        }                                //中心图片缩放

        public override void ShowTip(ImageToolTip tooltip, Control form, int x, int y)
        {
            var regionType = GetVType();

            if (regionType == PictureRegionCellType.Item)
            {
                Image image = HItemBook.GetPreview(nid);
                tooltip.Show(image, form, x, y);
            }
            else if (regionType == PictureRegionCellType.Gismo)
            {
                Image image = DungeonBook.GetPreview(nid);
                tooltip.Show(image, form, x, y);
            }
            else if (regionType == PictureRegionCellType.People)
            {
                Image image = SamuraiBook.GetPreview(nid);
                tooltip.Show(image, form, x, y);
            }
            else if (regionType == PictureRegionCellType.DungeonItem)
            {
                var   itemConfig = ConfigData.GetDungeonItemConfig(nid);
                Image image      = DrawTool.GetImageByString(itemConfig.Name + "$" + itemConfig.Des, 160);
                tooltip.Show(image, form, x, y);
            }
        }
Пример #5
0
        private void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            Image image = null;

            if (id == 1)
            {//1一定是heroskill
                image = HeroPowerBook.GetPreview(key);
            }
            else
            {
                if (key > 0)
                {
                    var cellType = cellTypeList[id - 2];
                    if (cellType == PictureRegionCellType.Card)
                    {
                        image = CardAssistant.GetCard(key).GetPreview(CardPreviewType.Normal, new int[] { });
                    }
                    else if (cellType == PictureRegionCellType.Item)
                    {
                        image = HItemBook.GetPreview(key);
                    }
                    else if (cellType == PictureRegionCellType.Equip)
                    {
                        Equip equip = new Equip(key);
                        image = equip.GetPreview();
                    }
                }
            }
            if (image != null)
            {
                tooltip.Show(image, this, x, y);
            }
        }
Пример #6
0
        private void ItemView_MouseMove(object sender, MouseEventArgs e)
        {
            int truex = e.X - 6;
            int truey = e.Y - 36;

            if (truex > 5 && truey > 3 && truex < 315 + 5 && truey < 318 + 3)
            {
                int temp = (truex - 8) * 10 / 315 + (truey - 5) * 10 / 318 * 10;
                if (temp != tar)
                {
                    tar = temp;
                    if (baseid + tar < UserProfile.InfoBag.BagCount && UserProfile.InfoBag.Items[baseid + tar].Type != 0)
                    {
                        Image image = HItemBook.GetPreview(UserProfile.InfoBag.Items[baseid + tar].Type);
                        tooltip.Show(image, this, (tar % 10) * 315 / 10 + 42, (tar / 10) * 318 / 10 + 42);
                    }
                    else
                    {
                        tooltip.Hide(this);
                    }
                    Invalidate(new Rectangle(6, 36, 324, 324));
                }
            }
            else
            {
                tar = -1;
                tooltip.Hide(this);
                Invalidate(new Rectangle(6, 36, 324, 324));
            }
        }
Пример #7
0
        public MazeItem(int id, int level)
        {
            mlevel         = level;
            this.Id        = id;
            MazeItemConfig = ConfigData.GetMazeItemConfig(id);
            type           = MazeItemConfig.Type;
            infos          = new int[MazeItemConfig.Info.Length];
            Array.Copy(MazeItemConfig.Info, infos, infos.Length);

            if (type == "ritem")
            {
                type     = "item";
                infos[0] = HItemBook.GetRandRareItemId(HItemRandomGroups.Fight, infos[0]);
            }
            else if (type == "rmon")
            {
                type     = "mon";
                infos[0] = infos[NarlonLib.Math.MathTool.GetRandom(0, infos.Length)];
                infos[1] = 0;
            }
            else if (type == "rresource")
            {
                type     = "resource";
                infos[0] = NarlonLib.Math.MathTool.GetRandom(2, 8);
            }
        }
Пример #8
0
 private void virtualRegion_RegionEntered(int id, int x, int y, int key)
 {
     if (key > 10)
     {
         Image image = HItemBook.GetPreview(key);
         tooltip.Show(image, this, x, y);
     }
 }
Пример #9
0
 private void virtualRegion_RegionEntered(int id, int x, int y, int key)
 {
     if (key > 0)
     {
         Image image = HItemBook.GetPreview(key);
         tooltip.Show(image, this, x + panelBack.Location.X, y + panelBack.Location.Y);
     }
 }
Пример #10
0
 private void virtualRegion_RegionEntered(int info, int mx, int my, int key)
 {
     if (itemId > 0)
     {
         Image image = HItemBook.GetPreview(itemId);
         tooltip.Show(image, parent, mx, my, itemId);
     }
 }
Пример #11
0
        private NpcPieceData CreatePieceMethod(int index)
        {
            NpcPieceData piece = new NpcPieceData();
            int          rare  = MathTool.GetRandom(Math.Max(index / 2, 1), index / 2 + 3);

            piece.Id    = HItemBook.GetRandRareItemId(HItemRandomGroups.Fight, rare);
            piece.Count = MathTool.GetRandom((8 - rare) / 2, 8 - rare);

            return(piece);
        }
Пример #12
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();
        }
Пример #13
0
 private void virtualRegion_RegionEntered(int info, int mx, int my, int key)
 {
     if (info == 1 && productId > 0)
     {
         GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId);
         Image          image          = null;
         var            eid            = HItemBook.GetItemId(gameShopConfig.Item);
         image = HItemBook.GetPreview(eid);
         tooltip.Show(image, parent, mx, my, eid);
     }
 }
Пример #14
0
 private void OnVRegionEntered(int id, int x, int y, int key)
 {
     if (key > 0)
     {
         Image image = HItemBook.GetPreview(key);
         tooltip.Show(image, this, x, y);
     }
     else
     {
         tooltip.Hide(this);
     }
 }
Пример #15
0
        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);
                }
            }
        }
Пример #16
0
 private void virtualRegion_RegionLeft()
 {
     if (productId == 0)
     {
         tooltip.Hide(parent, 0);
     }
     else
     {
         GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId);
         var            eid            = HItemBook.GetItemId(gameShopConfig.Item);
         tooltip.Hide(parent, eid);
     }
 }
Пример #17
0
        private static void DropItems(string[] dropItems, int[] rates, List <int> items)
        {
            int roll = MathTool.GetRandom(100);
            int sum  = 0;

            for (int i = 0; i < dropItems.Length; i++)
            {
                sum += rates[i];
                if (sum > roll)
                {
                    var itemId = HItemBook.GetItemId(dropItems[i]);
                    items.Add(itemId);
                    break;
                }
            }
        }
Пример #18
0
        void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            Image image   = null;
            var   isEquip = ConfigIdManager.IsEquip(itemid);

            if (!isEquip)
            {
                image = HItemBook.GetPreview(itemid);
            }
            else
            {
                Equip equip = new Equip(itemid);
                image = equip.GetPreview();
            }
            toolTip.Show(image, this, 108, 44);
        }
Пример #19
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));
        }
Пример #20
0
 private void virtualRegion_RegionEntered(int id, int x, int y, int key)
 {
     {
         var region = vRegion.GetRegion(id) as PictureRegion;
         if (region != null)
         {
             var regionType = region.GetVType();
             if (regionType == PictureRegionCellType.Item)
             {
                 Image image = HItemBook.GetPreview(key);
                 tooltip.Show(image, parent, x, y);
             }
         }
     }
     {
         var region = vRegion.GetRegion(id) as ImageRegion;
         if (region != null)
         {
             var regionType = region.GetVType();
             if (regionType == ImageRegionCellType.Gold)
             {
                 string resStr = string.Format("黄金:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Food)
             {
                 string resStr = string.Format("食物:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Health)
             {
                 string resStr = string.Format("生命:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Mental)
             {
                 string resStr = string.Format("精神:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
         }
     }
 }
Пример #21
0
 private void virtualRegion_RegionEntered(int info, int mx, int my, int key)
 {
     if (info == 1 && itemId > 0)
     {
         Image image   = null;
         var   isEquip = ConfigIdManager.IsEquip(itemId);
         if (!isEquip)
         {
             image = HItemBook.GetPreview(itemId);
         }
         else
         {
             Equip equip = new Equip(itemId);
             image = equip.GetPreview();
         }
         tooltip.Show(image, parent, mx, my, itemId);
     }
 }
Пример #22
0
        public void RefreshData(object data)//商品id
        {
            var id = (int)data;

            productId = id;
            GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(id);

            bitmapButtonBuy.Visible = id != 0;
            show = id != 0;

            if (id != 0)
            {
                var eid = HItemBook.GetItemId(gameShopConfig.Item);
                vRegion.SetRegionKey(1, eid);
                vRegion.SetRegionType(1, PictureRegionCellType.Item);
            }

            parent.Invalidate(new Rectangle(X, Y, Width, Height));
        }
Пример #23
0
        private void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            lastKey = key;

            if (key > 0)
            {
                var region = vRegion.GetRegion(id);
                if (region != null)
                {
                    Image image = HItemBook.GetPreview(key);
                    tooltip.Show(image, parent, x, y);
                }
            }

            if (id == 20)
            {
                tooltip.Show("不提交", parent, x, y);
            }
        }
Пример #24
0
 private void virtualRegion_RegionEntered(int info, int mx, int my, int key)
 {
     if (info == 1 && productId > 0)
     {
         GameShopConfig gameShopConfig = ConfigData.GetGameShopConfig(productId);
         Image          image          = null;
         var            isEquip        = ConfigIdManager.IsEquip(gameShopConfig.ItemId);
         if (!isEquip)
         {
             image = HItemBook.GetPreview(gameShopConfig.ItemId);
         }
         else
         {
             Equip equip = new Equip(gameShopConfig.ItemId);
             image = equip.GetPreview();
         }
         tooltip.Show(image, parent, mx, my, gameShopConfig.ItemId);
     }
 }
Пример #25
0
        private void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            if (key == 0)
            {
                return;
            }

            Image image = null;

            if (id >= 2)
            {
                image = HItemBook.GetPreview(key);
            }
            else
            {
                Equip equip = new Equip(key);
                image = equip.GetPreview();
            }

            tooltip.Show(image, this, x, y);
        }
Пример #26
0
        public DbMergeData CreateMergeMethod(int mid)
        {
            EquipConfig equipConfig = ConfigData.GetEquipConfig(mid);
            DbMergeData mthds       = new DbMergeData();

            mthds.Target = mid;
            {
                List <IntPair>         mthd         = new List <IntPair>();
                int                    icount       = GetItemCount(equipConfig.Level);
                int                    itrare       = MathTool.GetRandom(Math.Max(1, equipConfig.Quality * 2 - 1), equipConfig.Quality * 2 + 1);//第一个素材品质和装备品质挂钩
                Dictionary <int, bool> existFormula = new Dictionary <int, bool>();
                for (int j = 0; j < icount; j++)
                {
                    IntPair pv = new IntPair();
                    if (j == 0)
                    {
                        pv.Type  = HItemBook.GetRandRareItemId(HItemRandomGroups.Gather, itrare);
                        pv.Value = GetItemCountByEquipLevel(equipConfig.Level, itrare) + 1;
                    }
                    else
                    {
                        int nrare = MathTool.GetRandom(Math.Max(1, itrare - 3), itrare);
                        pv.Type  = HItemBook.GetRandRareItemId(HItemRandomGroups.Fight, nrare);
                        pv.Value = Math.Max(1, GetItemCountByEquipLevel(equipConfig.Level, nrare));
                    }
                    if (existFormula.ContainsKey(pv.Type))
                    {
                        j--;//相当于做redo
                    }
                    else
                    {
                        existFormula.Add(pv.Type, true);
                        mthd.Add(pv);
                    }
                }

                mthds.Set(mthd);
            }
            return(mthds);
        }
Пример #27
0
        private void RewardItem(ref int index)
        {
            if (!string.IsNullOrEmpty(config.RewardItem))
            {
                var itemId = HItemBook.GetItemId(config.RewardItem);
                UserProfile.InfoBag.AddItem(itemId, 1);
                vRegion.AddRegion(new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60,
                                                    PictureRegionCellType.Item, itemId));

                index++;
            }
            if (!string.IsNullOrEmpty(config.RewardDrop))
            {
                var itemList = DropBook.GetDropItemList(config.RewardDrop);
                foreach (var itemId in itemList)
                {
                    UserProfile.InfoBag.AddItem(itemId, 1);
                    vRegion.AddRegion(new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60, PictureRegionCellType.Item, itemId));

                    index++;
                }
            }

            if (!string.IsNullOrEmpty(config.RewardDungeonItemId) && UserProfile.InfoDungeon.DungeonId > 0)
            {
                var itemId = DungeonBook.GetDungeonItemId(config.RewardDungeonItemId);
                UserProfile.InfoDungeon.AddDungeonItem(itemId, config.RewardDungeonItemCount);
                var pictureRegion = new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60,
                                                      PictureRegionCellType.DungeonItem, itemId);
                pictureRegion.Scale = 0.7f;
                var textControl = new RegionTextDecorator(3, 60 - 20, 11, Color.White, true, config.RewardDungeonItemCount.ToString());
                pictureRegion.AddDecorator(textControl);
                pictureRegion.AddDecorator(new RegionBorderDecorator(Color.White));
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Пример #28
0
        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);
            }
        }
Пример #29
0
        private static void DropLevelItems(int[] itemLevelRate, List <int> items)
        {
            int sum = 0;

            foreach (var r in itemLevelRate)
            {
                sum += r;
            }
            int roll = MathTool.GetRandom(sum);
            int rare = 0;

            sum = 0;
            for (int j = 0; j < itemLevelRate.Length; j++)
            {
                sum += itemLevelRate[j];
                if (roll < sum)
                {
                    rare = j + 1;
                    break;
                }
            }

            items.Add(HItemBook.GetRandRareItemId(HItemRandomGroups.Fight, rare));
        }
Пример #30
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            var resultD = NameChecker.CheckName(textBoxName.Text, GameConstants.RoleNameLengthMin, GameConstants.RoleNameLengthMax);

            if (resultD != NameChecker.NameCheckResult.Ok)
            {
                if (resultD == NameChecker.NameCheckResult.NameLengthError)
                {
                    MessageBoxEx.Show("角色名需要在2-6个字之内");
                }
                else if (resultD == NameChecker.NameCheckResult.PunctuationOnly)
                {
                    MessageBoxEx.Show("不能仅包含标点符号");
                }
                return;
            }

            UserProfile.Profile.OnCreate(textBoxName.Text, dna, headId);
            UserProfile.InfoBag.AddItem(HItemBook.GetItemId("xinshoulibao"), 1);//新手礼包
            result = DialogResult.OK;

            TalePlayer.C2SSender.UpdatePlayerInfo(textBoxName.Text, headId);
            Close();
        }