// --- Constructors --- public AttackDecisionGui(GSGameplay pmGState, ref GameExt pmGame, ref BattleMap pmMap) { gstate= pmGState; game= pmGame; map= pmMap; background= new Control(game); leftPanel= new Control(game); rightPanel= new Control(game); lpName= new Label(game); lpStats= new Label[8]; for(int i= 0; i< lpStats.Length; i++) lpStats[i]= new Label(game); rpName= new Label(game); rpStats= new Label[8]; for(int i= 0; i< rpStats.Length; i++) rpStats[i]= new Label(game); accuracyLbl= new Label(game); accuracy= new Label(game); critLbl= new Label(game); crit= new Label(game); dmgLbl= new Label(game); dmg= new Label(game); commit= new Button(game); cancel= new Button(game); }
// --- Constructors --- public EnemyUnitGui(GSGameplay pmGState, ref GameExt pmGame, ref BattleMap pmMap) { gstate= pmGState; game= pmGame; map= pmMap; set= new Control(game); skills= new Button(game); stats= new Button(game); exit= new Button(game); tick= 0; }
// --- Constructors --- public PlayerUnitGui(GSGameplay pmGState, ref GameExt pmGame, ref BattleMap pmMap) { gstate= pmGState; game= pmGame; map= pmMap; set= new Control(game); move= new Button(game); skills= new Button(game); stats= new Button(game); end= new Button(game); exit= new Button(game); tick= 0; refd= false; }
// --- Constructors --- public UnitLevelUpGui(ref GameExt pmGame, ref BattleMap pmMap) { game= pmGame; map= pmMap; background= new Control(game); name= new Label(game); level= new Label(game); statsLbl= new Label[8]; stats= new Button[8]; for(int i= 0; i< statsLbl.Length; i++) { statsLbl[i]= new Label(game); stats[i]= new Button(game); } isOpened= false; unit= null; }
// Opens up the skills gui public void open(ref int[] pmSelUnit) { // Variables List<SkillInfo> skillSet= map.teams.items[pmSelUnit[0]].units.items[pmSelUnit[1]].getAvailableSkills(); Button[] skillSetGui= new Button[skillSet.size]; if(gstate.isPlayer) { gstate.playerUnitGui.isEnabled= false; gstate.playerUnitGui.refd= true; } else gstate.enemyUnitGui.isEnabled= false; set.children.clear(); selUnit= pmSelUnit; game.inputArgs.setMousePosition(game, new Point(322, 48)); for(int i= 0; i< skillSetGui.Length; i++) { skillSetGui[i]= skillSet.items[i].createButton(ref game); skillSetGui[i].bounds= new Rectangle(228, 32+32*i, 188, 32); skillSetGui[i].border.size= 1; if(i> 0) skillSetGui[i].border.top.size= 0; if(i<skillSetGui.Length-1) skillSetGui[i].border.bottom.size= 0; skillSetGui[i].onMouseClick+= clicked; skillSetGui[i].onKeyboardPressed+= pressed; skillSetGui[i].onGamepadPressed+= pressed; skillSetGui[i].onInputNoFocus+= pressedNoFocus; skillSetGui[i].onFocus+= focused; skillSetGui[i].onUnfocus+= unfocused; skillSetGui[i].onInput+= tickUp; if(skillSet.items[i].isEnabled && gstate.isPlayer) skillSetGui[i].isEnabled= (skillSet.items[i].manaCost<= map.teams.items[selUnit[0]].units.items[selUnit[1]].mana); else skillSetGui[i].isEnabled= false; set.addChild(skillSetGui[i]); } game.gui.open("skills_menu"); }
// 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; }