Example #1
0
        // --- Methods ---
        // Creates a particle
        public override Particle createParticle(GameExt game)
        {
            // Variables
            Particle	p=	new Particle(game);

            p.texture=	game.textures.get("particle_ember");
            if(Start.rng.Next(0, 2)== 0)
                p.color=	game.getColor("#3183c5");
            else
                p.color=	game.getColor("#cd4120");

            return p;
        }
Example #2
0
        // --- Methods ---
        // Creates an icon of the passive's info
        public Control createIcon(GameExt game)
        {
            // Variable
            Control	ctrl=	new Control(game);
            Label	nameLbl=	new Label(game);

            ctrl.backColorStates.normal=	game.getColor("white");
            ctrl.texStates.normal=	icon;
            ctrl.setState(ControlState.Normal);
            ctrl.canHover=	false;

            ctrl.tooltip=	new Tooltip(game);
            ctrl.tooltip.font=	game.fonts.get("default_font");
            ctrl.tooltip.text=	getTooltipText();
            ctrl.tooltip.size=	new Point(488, 96);
            ctrl.tooltip.backColorStates.normal=	game.getColor("paleturquoise");
            ctrl.tooltip.setState(ControlState.Normal);
            ctrl.tooltip.border.size=	1;
            ctrl.tooltip.xPad=	-ctrl.tooltip.size.X;
            ctrl.tooltip.yPad=	24;

            nameLbl.text=	name+":";
            nameLbl.bounds.X=	16;
            nameLbl.bounds.Y=	8;

            ctrl.tooltip.addChild(nameLbl);

            return ctrl;
        }
Example #3
0
        // --- Methods ---
        // Creates a particle
        public override Particle createParticle(GameExt game)
        {
            // Variables
            Particle	p=	new Particle(game);

            p.texture=	game.textures.get("particle_ember");
            p.color=	game.getColor("yellow");

            return p;
        }
Example #4
0
        // Creates a button from the information provided
        public Button createButton(ref GameExt game)
        {
            // Variables
            Button	btn=	new Button(game);
            Label	mcLbl=	new Label(game);
            Label	nameLbl=	new Label(game);

            btn.backColorStates=	new ControlStateItems<Color>(
                game.getColor("white"),
                game.getColor("dimgray"),
                game.getColor("white"),
                game.getColor("white"),
                btn
            );
            btn.text=	name;
            btn.tag=	tag;

            btn.tooltip=	new Tooltip(game);
            btn.tooltip.font=	game.fonts.get("default_font");
            btn.tooltip.text=	getTooltipText();
            btn.tooltip.size=	new Point(488, 96);
            btn.tooltip.backColorStates.normal=	game.getColor("paleturquoise");
            btn.tooltip.setState(ControlState.Normal);
            btn.tooltip.border.size=	1;
            btn.tooltip.xPad=	-14;
            btn.tooltip.yPad=	16;

            mcLbl.text=	"Cost: "+manaCost+" mana";
            mcLbl.bounds.X=	16;
            mcLbl.bounds.Y=	btn.tooltip.size.Y-(int)(btn.font.MeasureString("g").Y+8);
            mcLbl.font=	game.fonts.get("default_font");

            nameLbl.text=	name+":";
            nameLbl.bounds.X=	16;
            nameLbl.bounds.Y=	8;
            nameLbl.font=	game.fonts.get("default_font");

            btn.tooltip.addChild(mcLbl);
            btn.tooltip.addChild(nameLbl);

            return btn;
        }
Example #5
0
        // Opens up the unit stat gui
        public void open(ref int[] selUnit, ref GameExt game, ref BattleMap map)
        {
            // Variables
            List<PassiveInfo>	passivesInfo=	map.teams.items[selUnit[0]].units.items[selUnit[1]].getAvailablePassives();
            Control[]	passivesIcon=	new Control[map.teams.items[selUnit[0]].units.items[selUnit[1]].prof.currPassives.Length];
            int	d=	0;

            // Unit's name
            unitName.text=	map.teams.items[selUnit[0]].units.items[selUnit[1]].name;

            // Unit's profession
            unitProf.text=	"  "+map.teams.items[selUnit[0]].units.items[selUnit[1]].prof.Name;

            // Unit's level
            unitLv.text=	"Lv "+map.teams.items[selUnit[0]].units.items[selUnit[1]].level;
            unitLv.bounds=	new Rectangle(game.Window.ClientBounds.Width-16-(int)(unitLv.font.MeasureString(unitLv.text).X), 40, 0, 0);

            // Unit's experience
            unitExp.text=	"Exp "+map.teams.items[selUnit[0]].units.items[selUnit[1]].exp.ToString("D5");
            unitExp.bounds=	new Rectangle(game.Window.ClientBounds.Width-16-(int)(unitExp.font.MeasureString(unitExp.text).X), unitProf.bounds.Y, 0, 0);

            // Unit's HP
            hpBar.progress=	(float)(getUnitStat(ref selUnit, ref map, "hp"))/(float)(getUnitStat(ref selUnit, ref map, "maxhp"));
            hpLbl.text=	"HP   "+spaceOutHPMEvenly(getUnitStat(ref selUnit, ref map, "hp"), getUnitStat(ref selUnit, ref map, "maxhp"));

            // Unit's mana
            manaBar.progress=	(float)(getUnitStat(ref selUnit, ref map, "mana"))/(float)(getUnitStat(ref selUnit, ref map, "maxmana"));
            manaLbl.text=	"Mana "+spaceOutHPMEvenly(getUnitStat(ref selUnit, ref map, "mana"), getUnitStat(ref selUnit, ref map, "maxmana"));

            if(hpBar.progress< 0.2f)
                hpBar.progressColorStates.normal=	game.getColor("crimson");
            else if(hpBar.progress< 0.5f)
                hpBar.progressColorStates.normal=	game.getColor("yellow");
            else
                hpBar.progressColorStates.normal=	game.getColor("royalblue");
            hpBar.setState(ControlState.Normal);

            if(manaBar.progress< 0.2f)
                manaBar.progressColorStates.normal=	game.getColor("crimson");
            else if(manaBar.progress< 0.5f)
                manaBar.progressColorStates.normal=	game.getColor("yellow");
            else
                manaBar.progressColorStates.normal=	game.getColor("royalblue");
            manaBar.setState(ControlState.Normal);

            atk.text=	"Atk  "+spaceOutEvenly(getUnitStat(ref selUnit, ref map, "atk"));
            def.text=	"Def  "+spaceOutEvenly(getUnitStat(ref selUnit, ref map, "def"));
            mag.text=	"Mag  "+spaceOutEvenly(getUnitStat(ref selUnit, ref map, "mag"));
            res.text=	"Res  "+spaceOutEvenly(getUnitStat(ref selUnit, ref map, "res"));
            spd.text=	"Spd  "+spaceOutEvenly(getUnitStat(ref selUnit, ref map, "spd"));
            move.text=	"Move "+spaceOutEvenly(getUnitStat(ref selUnit, ref map, "move"));

            passives.children.clear();
            for(int i= 0; i< passivesInfo.size; i++)
            {
                if(!map.teams.items[selUnit[0]].units.items[selUnit[1]].hasPassive(passivesInfo.items[i].tag))
                    continue;

                passivesIcon[d]=	passivesInfo.items[i].createIcon(game);
                passivesIcon[d].bounds=	new Rectangle(passivesLbl.bounds.X+passivesLbl.bounds.Width+8+32*d, hpBar.bounds.Y, 16, 16);
                passives.addChild(passivesIcon[d]);
                d++;
            }

            if(gstate.isPlayer)
            {
                gstate.playerUnitGui.isEnabled=	false;
                gstate.playerUnitGui.refd=	true;
            }
            else
                gstate.enemyUnitGui.isEnabled=	false;

            game.gui.open("stats_menu");
        }
Example #6
0
 // --- Static Methods ---
 // Gets the represented color of the tile
 public static new Color getRepresentedColor(GameExt game)
 {
     return game.getColor("forestgreen");
 }
Example #7
0
 // --- Static Methods ---
 // Gets the represented color of the tile
 public static Color getRepresentedColor(GameExt game)
 {
     return game.getColor("white");
 }