//
        private static Bitmap GetImageForPropertyType(ProfilePropertyType propertyType, int index, bool forceAllCreatures)
        {
            if (index >= 0)
            {
                if (propertyType == ProfilePropertyType.Creature)
                {
                    int realIndex = CreatureManager.OnlyActiveCreatures[index].CreatureIndex;
                    return(CreatureManager.GetImage(Heroes3Master.Master, realIndex));
                }
                if (propertyType == ProfilePropertyType.SecondarySkill)
                {
                    return(SecondarySkill.AllSkills[index / 3].GetImage(Heroes3Master.Master, 1 + index % 3));
                }

                if (propertyType == ProfilePropertyType.Spell)
                {
                    return(Spell.AllSpells[index].GetImage(Heroes3Master.Master));
                }

                if (propertyType == ProfilePropertyType.SpecCreature || propertyType == ProfilePropertyType.SpecCreatureStatic)
                {
                    return(CreatureManager.GetImage(Heroes3Master.Master, CreatureManager.IndexesOfFirstLevelCreatures[index]));
                }

                if (propertyType == ProfilePropertyType.SpecCreatureUpgrade)
                {
                    if (!forceAllCreatures)
                    {
                        return(CreatureManager.GetImage(Heroes3Master.Master, CreatureManager.IndexesOfFirstLevelCreatures[index]));
                    }

                    int realIndex = CreatureManager.OnlyActiveCreatures[index].CreatureIndex;
                    return(CreatureManager.GetImage(Heroes3Master.Master, realIndex));
                }

                if (propertyType == ProfilePropertyType.SpecSpell)
                {
                    return(Spell.GetSpellByIndex(Spell.SpecSpellIndexes[index]).GetImage(Heroes3Master.Master));
                }

                if (propertyType == ProfilePropertyType.SpecSecondarySkill)
                {
                    return(SecondarySkill.GetImage(Heroes3Master.Master, SecondarySkill.IndexesOfAllSpecSkills[index], 1));
                }

                if (propertyType == ProfilePropertyType.SpecResource)
                {
                    return(Resource.GetImage(Heroes3Master.Master, index));
                }
            }
            return(null);
        }
예제 #2
0
        private void gridImages_ItemSelected(int value)
        {
            if (PropertyType == ProfilePropertyType.SpecCreatureStatic)
            {
                btnSave.Focus();
            }
            else if (PropertyType == ProfilePropertyType.SpecCreatureUpgrade)
            {
                if (selectedBoxIndex == 0)
                {
                    Box1Creature      = CreatureManager.IndexesOfFirstLevelCreatures[value];
                    pbCreature1.Image = CreatureManager.GetImage(Heroes3Master.Master, Box1Creature);
                }
                else if (selectedBoxIndex == 1)
                {
                    Box2Creature      = CreatureManager.IndexesOfFirstLevelCreatures[value];
                    pbCreature2.Image = CreatureManager.GetImage(Heroes3Master.Master, Box2Creature);
                }
                else if (selectedBoxIndex == 2)
                {
                    Box3Creature      = CreatureManager.OnlyActiveCreatures[value].CreatureIndex;
                    pbCreature3.Image = CreatureManager.GetImage(Heroes3Master.Master, Box3Creature);
                }
            }
            else
            {
                int objId = value;
                if (PropertyType == ProfilePropertyType.SpecCreature)
                {
                    objId = CreatureManager.IndexesOfFirstLevelCreatures[value];
                }
                else if (PropertyType == ProfilePropertyType.SpecSpell)
                {
                    objId = Spell.SpecSpellIndexes[value];
                }
                else if (PropertyType == ProfilePropertyType.SpecSecondarySkill)
                {
                    objId = SecondarySkill.IndexesOfAllSpecSkills[value];
                }

                if (this.ItemSelected != null)
                {
                    this.ItemSelected(objId, 0, 0, 0);
                    Close();
                }
            }
        }
예제 #3
0
        private void UpdateCreatureBoxes()
        {
            if (Box1Creature >= 0)
            {
                pbCreature1.Image = CreatureManager.GetImage(Heroes3Master.Master, Box1Creature);
            }

            if (Box2Creature >= 0)
            {
                pbCreature2.Image = CreatureManager.GetImage(Heroes3Master.Master, Box2Creature);
            }

            if (Box3Creature >= 0)
            {
                pbCreature3.Image = CreatureManager.GetImage(Heroes3Master.Master, Box3Creature);
            }
        }
        //331 288
        public void LoadHero(int heroIndex, Heroes3Master master)
        {
            HeroIndex = heroIndex;
            Hero      = null;
            if (heroIndex > -1 && heroIndex < HeroesManager.HeroesOrder.Length && master != null)
            {
                var hs = HeroesManager.AllHeroes[heroIndex];

                var bckgImage = HeroesManager.GetBackground(master);

                var canvas = new Bitmap(bckgImage);

                var g = Graphics.FromImage(canvas);

                /*    g.InterpolationMode = InterpolationMode.High;
                 *  g.SmoothingMode = SmoothingMode.HighQuality;
                 *  g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                 *  g.CompositingQuality = CompositingQuality.HighQuality;*/

                g.DrawImage(bckgImage, Point.Empty);

                var portrait = master.ResolveWith(HeroesManager.HeroesOrder[hs.ImageIndex]).GetBitmap();
                g.DrawImage(portrait, new Point(4, 3));

                var heroData = HeroExeData.Data[heroIndex];

                var z = Speciality.GetImage(master, heroData.Index);
                g.DrawImage(z, new Point(4, 166));

                Hero = heroData;
                if (heroData.Skill1 != null)
                {
                    g.DrawImage(heroData.Skill1.GetImage(master, heroData.FirstSkillLevel), new Point(5, 213));
                }

                if (heroData.Skill2 != null)
                {
                    g.DrawImage(heroData.Skill2.GetImage(master, heroData.SecondSkillLevel), new Point(148, 213));
                }

                var img1 = CreatureManager.GetImage(master, heroData.Unit1Index);
                g.DrawImage(img1, new Point(5, 262));
                var img2 = CreatureManager.GetImage(master, heroData.Unit2Index);
                g.DrawImage(img2, new Point(68, 262));
                var img3 = CreatureManager.GetImage(master, heroData.Unit3Index);
                g.DrawImage(img3, new Point(129, 262));

                if (heroData.Spell != null)
                {
                    g.DrawImage(heroData.Spell.GetImage(master), 192, 262);
                }

                DrawData(g, heroData);


                //heroData.Class.Stats

                /*
                 *  g.DrawImage(ps.GetSprite(0), new Point(18, 97));
                 *  g.DrawImage(ps.GetSprite(1), new Point(88, 97));
                 *  g.DrawImage(ps.GetSprite(2), new Point(158, 97));
                 *  g.DrawImage(ps.GetSprite(5), new Point(228, 97));
                 */
                g.Dispose();
                PictureBox.Image = canvas;
                CalculateRatio();
            }
        }