Beispiel #1
0
        private void OnVRegionClick(int id, int x, int y, MouseButtons button)
        {
            if (id > 0)//说明是button
            {
                var hasOpen = cardOpenArray[id - 1];
                if (hasOpen == 0)
                {
                    int cardId = UseScard();
                    vRegion.SetRegionKey(id, cardId);
                    var card = UserProfile.InfoCard.AddCard(cardId);
                    if (card.Exp != 0) //不是新卡
                    {
                        IRegionDecorator decorator = new RegionCoverDecorator(Color.FromArgb(150, Color.Black));
                        vRegion.SetRegionDecorator(id, 0, decorator);
                        decorator = new RegionTextDecorator(18, 50, 16, Color.White, true);
                        decorator.SetState("EXP+1");
                        vRegion.SetRegionDecorator(id, 1, decorator);
                    }
                    cardOpenArray[id - 1]        = cardId;
                    coverEffect[id - 1]          = new CoverEffect(EffectBook.GetEffect("transmit"), new Point(cardPos[(id - 1) * 2], cardPos[(id - 1) * 2 + 1]), new Size(120, 150));
                    coverEffect[id - 1].PlayOnce = true;
                    Invalidate();

                    var pos = vRegion.GetRegionPosition(id);
                    OnVRegionEntered(id, pos.X, pos.Y, cardId);
                }
            }
        }
        private void AddBookRegion(int id, int x, int y, int cardId, string text)
        {
            RegionTextDecorator textControl;
            var region = new PictureAnimRegion(id, x, y, 76, 100, PictureRegionCellType.Card, cardId);

            textControl = new RegionTextDecorator(3, 80, 10, Color.Lime, true);
            textControl.SetState(text);
            region.AddDecorator(textControl);
            virtualRegion.AddRegion(region);
        }
Beispiel #3
0
        public static SubVirtualRegion GetResButtonRegion(int index, Point pos, int size, ImageRegionCellType type, int change)
        {
            string iconName    = "";
            Color  borderColor = Color.White;

            CheckResourceType(type, ref iconName, ref borderColor);
            var pictureRegion = new ButtonRegion(index, pos.X, pos.Y, size, size, "iconbg.jpg", "");
            var textControl   = new RegionTextDecorator(3, size - 20, 11, change > 0 ? Color.White : Color.Red, true, change.ToString());

            pictureRegion.AddDecorator(new RegionImageDecorator(HSIcons.GetIconsByEName(iconName), size / 2));
            pictureRegion.AddDecorator(textControl);
            return(pictureRegion);
        }
Beispiel #4
0
        public static SubVirtualRegion GetResShowRegion(int index, Point pos, int size, ImageRegionCellType type, int change)
        {
            string iconName    = "";
            Color  borderColor = Color.White;

            CheckResourceType(type, ref iconName, ref borderColor);
            var pictureRegion = new ImageRegion(index, pos.X, pos.Y, size, size, type, HSIcons.GetIconsByEName(iconName));

            pictureRegion.Scale = 0.5f;
            pictureRegion.Parm  = change.ToString();
            var textControl = new RegionTextDecorator(3, size - 20, 11, change > 0 ? Color.White : Color.Red, true, change.ToString());

            pictureRegion.AddDecorator(textControl);
            pictureRegion.AddDecorator(new RegionBorderDecorator(borderColor));
            return(pictureRegion);
        }
Beispiel #5
0
        public static SubVirtualRegion GetSceneDataRegion(int index, Point pos, int size, ImageRegionCellType type, int change)
        {
            string iconName    = "";
            Color  borderColor = Color.White;

            if (type == ImageRegionCellType.Gold)
            {
                iconName    = "res1";
                borderColor = Color.Gold;
            }
            else if (type == ImageRegionCellType.Food)
            {
                iconName    = "oth7";
                borderColor = Color.GreenYellow;
            }
            else if (type == ImageRegionCellType.Health)
            {
                iconName    = "hatt7";
                borderColor = Color.Red;
            }
            else if (type == ImageRegionCellType.Mental)
            {
                iconName    = "hatt3";
                borderColor = Color.Blue;
            }
            else if (type == ImageRegionCellType.Exp)
            {
                iconName    = "oth5";
                borderColor = Color.Purple;
            }
            var pictureRegion = new ImageRegion(index, pos.X, pos.Y, size, size, type, HSIcons.GetIconsByEName(iconName));

            pictureRegion.Scale = 0.5f;
            pictureRegion.Parm  = change.ToString();
            var textControl = new RegionTextDecorator(3, size - 20, 11, change > 0 ? Color.White : Color.Red, true);

            textControl.SetState(change.ToString());
            pictureRegion.AddDecorator(textControl);
            pictureRegion.AddDecorator(new RegionBorderDecorator(borderColor));
            return(pictureRegion);
        }
        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++;
            }
        }