예제 #1
0
        public MainMenu()
        {
            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_titleMenu;

            lbl_title = new Label("Main menu");
            lbl_title.center(350);
            lbl_title.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE;

            lnk_newGame = new Link("New Game");
            lnk_newGame.center(405);
            lnk_newGame.selected = newGame;

            lnk_loadGame = new Link("Load Game");
            lnk_loadGame.center(440);
            lnk_loadGame.selected = loadGame;

            lnk_option = new Link("Option");
            lnk_option.center(475);
            lnk_option.selected = options;

            lnk_exit = new Link("Exit");
            lnk_exit.center(510);
            lnk_exit.selected = exit;

            MainWindow.add(lbl_title);
            MainWindow.add(lnk_newGame);
            MainWindow.add(lnk_loadGame);
            MainWindow.add(lnk_option);
            MainWindow.add(lnk_exit);
        }
예제 #2
0
        public DialogYN(Screen display)
            : base(display)
        {
            BackgroundImage = Content.Graphics.Instance.Images.background.bg_dialog;

            size = new Vector2(300, 150);
            pos = new Vector2(Game1.Instance.Window.ClientBounds.Width / 2 - size.X / 2, 100);

            lbl_txt = new Label("");
            lbl_txt.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM;
            lbl_txt.Position = new Vector2(pos.X + 50, pos.Y + 10);
            add(lbl_txt);

            lnk_yes = new Link("Yes");
            lnk_yes.Position = new Vector2(pos.X + 50, pos.Y + 120);
            lnk_yes.selected = com;
            add(lnk_yes);

            lnk_no = new Link("No");
            lnk_no.Position = new Vector2(pos.X + 200, pos.Y + 120);
            lnk_no.selected = com;
            add(lnk_no);

            FocusSideArrowEnabled = true;
        }
예제 #3
0
        public CharCre()
        {
            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_menuless;

            Label lbl_title = new Label("Character Creation");
            lbl_title.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE;
            lbl_title.Position = new Vector2(50, 50);
            MainWindow.add(lbl_title);

            pb_char = new PictureBox();
            pb_char.Image = Content.Graphics.Instance.Images.characters.fighter;
            pb_char.Position = new Vector2(350, 80);
            pb_char.Size = new Vector2(384, 384);
            MainWindow.add(pb_char);

            lbl_name = new Label("Name:");
            lbl_name.Position = new Vector2(110, 180);
            MainWindow.add(lbl_name);

            lbl_class = new Label("Class:");
            lbl_class.Position = new Vector2(120, 240);
            MainWindow.add(lbl_class);

            txt_name = new TextBox(10);
            txt_name.Position = new Vector2(180, 172);
            MainWindow.add(txt_name);

            sel_class = new Select();
            sel_class.Position = new Vector2(175, 240);
            sel_class.add("Fighter");
            sel_class.add("Caster");
            sel_class.add("Healer");
            sel_class.add("Archer");
            sel_class.add("Scout");
            sel_class.selectionChanged = selch;
            MainWindow.add(sel_class);

            Link lnk_con = new Link("Continue");
            lnk_con.Position = new Vector2(150, 300);
            lnk_con.selected = cont;
            MainWindow.add(lnk_con);

            lbl_err = new Label("Name cannot be empty");
            lbl_err.Position = new Vector2(100, 360);
            lbl_err.Color = Color.Red;
            lbl_err.Visible = false;
            MainWindow.add(lbl_err);

            GameState.CurrentState = new GameState();
        }
예제 #4
0
        public Story(String ftid)
        {
            tid = ftid;

            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_menuless;

            lnk_cont = new Link("Continue");
            lnk_cont.Position = new Vector2(75, 450);
            MainWindow.add(lnk_cont);

            txta_test = new TextAnim(Content.Instance.text[tid]);
            txta_test.Position = new Vector2(50, 50);
            txta_test.animate();
            MainWindow.add(txta_test);
        }
예제 #5
0
        public GameOver()
        {
            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_menuless;

            Label lbl_gameOver = new Label("Game Over");
            lbl_gameOver.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL;
            lbl_gameOver.center(100);
            MainWindow.add(lbl_gameOver);

            Link lnk_c = new Link("Contrinue to main screen");
            lnk_c.center(300);
            lnk_c.selected = toMainmenu;
            MainWindow.add(lnk_c);

            Link lnk_q = new Link("Quit Game");
            lnk_q.center(330);
            lnk_q.selected = exitGame;
            MainWindow.add(lnk_q);
        }
예제 #6
0
        public PauseMenu()
        {
            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_menuless;

            yn_exit = new DialogYN(this);
            yn_exit.complete = dialog_ret;
            yn_exit.InputEnabled = false;

            lbl_title = new Label("Pause menu");
            lbl_title.Position = new Vector2(50, 50);
            lbl_title.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE;

            lnk_resumeGame = new Link("Resume Game");
            lnk_resumeGame.Position = new Vector2(150, 125);
            lnk_resumeGame.selected = resumeGame;
            MainWindow.add(lnk_resumeGame);

            lnk_loadGame = new Link("Load Game");
            lnk_loadGame.Position = new Vector2(150, 175);
            lnk_loadGame.selected = loadGame;

            lnk_saveGame = new Link("Save Game");
            lnk_saveGame.Position = new Vector2(150, 225);
            lnk_saveGame.selected = saveGame;

            lnk_option = new Link("Option");
            lnk_option.Position = new Vector2(150, 275);
            lnk_option.selected = options;

            lnk_exit = new Link("Exit to Main Menu");
            lnk_exit.Position = new Vector2(150, 325);
            lnk_exit.selected = exit;

            MainWindow.add(lbl_title);
            MainWindow.add(lnk_loadGame);
            MainWindow.add(lnk_saveGame);
            MainWindow.add(lnk_option);
            MainWindow.add(lnk_exit);
        }
예제 #7
0
        public DialogTxt(Screen display)
            : base(display)
        {
            BackgroundImage = Content.Graphics.Instance.Images.background.bg_dialog;

            size = new Vector2(300, 150);
            pos = new Vector2(Game1.Instance.Window.ClientBounds.Width / 2 - size.X / 2, 100);

            lbl_text = new Label("");
            lbl_text.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM;
            lbl_text.Position = new Vector2(pos.X + 50, pos.Y + 10);
            add(lbl_text);

            txt = new TextBox(15);
            txt.Position = new Vector2(pos.X + 50, pos.Y + 50);
            txt.HasFocus = true;
            add(txt);

            lnk_enter = new Link("Enter");
            lnk_enter.Position = new Vector2(pos.X + 50, pos.Y + 100);
            lnk_enter.selected = sel;
            add(lnk_enter);
        }
예제 #8
0
        public Options()
        {
            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_menuless;

            lbl_options = new Label("Options");
            lbl_options.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE;
            lbl_options.Position = new Vector2(50, 50);
            MainWindow.add(lbl_options);

            lbl_volume = new Label("Music Volume:");
            lbl_volume.Position = new Vector2(260, 180);
            MainWindow.add(lbl_volume);

            lbl_soundEffects = new Label("Sound Effects:");
            lbl_soundEffects.Position = new Vector2(260, 240);
            MainWindow.add(lbl_soundEffects);

            sel_volume = new Select();
            sel_volume.Position = new Vector2(402, 180);
            for (int i = 0; i <= 10; i++)
                sel_volume.add(i.ToString());
            sel_volume.selectionChanged = volumeChange;
            sel_volume.Selection = (int)MediaPlayer.Volume * 10;
            MainWindow.add(sel_volume);

            sel_soundEffects = new Select();
            sel_soundEffects.Position = new Vector2(400, 240);
            sel_soundEffects.add("On");
            sel_soundEffects.add("Off");
            sel_soundEffects.selectionChanged = sfxChange;
            MainWindow.add(sel_soundEffects);

            lnk_goBack = new Link("Go Back");
            lnk_goBack.Position = new Vector2(325, 300);
            lnk_goBack.selected = goBack;
            MainWindow.add(lnk_goBack);
        }
예제 #9
0
        public UnitCreation(Army a)
        {
            MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_bigMenu;

            sel = 0;

            choosing = false;

            army = a;

            lbl_unitCre = new Label("Unit Creation");
            lbl_unitCre.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE;
            lbl_unitCre.Position = new Vector2(50, 30);
            MainWindow.add(lbl_unitCre);

            lbl_chooseLdr = new Label("Available Characters");
            lbl_chooseLdr.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD;
            lbl_chooseLdr.Position = new Vector2(400, 90);
            MainWindow.add(lbl_chooseLdr);

            txt_unitName = new TextBox(10);
            txt_unitName.Position = new Vector2(130, 150);
            MainWindow.add(txt_unitName);

            lnk_choose = new Link("Choose Leader");
            lnk_choose.Position = new Vector2(130, 210);
            lnk_choose.selected = choose;
            MainWindow.add(lnk_choose);

            lnk_create = new Link("Create Unit");
            lnk_create.Position = new Vector2(130, 270);
            lnk_create.selected = create;
            MainWindow.add(lnk_create);

            menu_leader = new Menu(10);
            menu_leader.Position = new Vector2(400, 90);
            foreach(Character c in army.Standby)
            {
                menu_leader.add(new Link(c.Name));
            }
            menu_leader.TabStop = false;
            MainWindow.add(menu_leader);

            lbl_err = new Label("You must name your new unit!");
            lbl_err.Position = new Vector2(90, 330);
            lbl_err.Color = Color.Red;
            lbl_err.Visible = false;
            MainWindow.add(lbl_err);

            lbl_v = new Label("V");
            lbl_v.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL;
            lbl_v.Position = new Vector2(50, 440);
            lbl_v.Visible = false;
            MainWindow.add(lbl_v);

            lbl_vAction = new Label("View Character");
            lbl_vAction.Position = new Vector2(80, 440);
            lbl_vAction.Visible = false;
            MainWindow.add(lbl_vAction);

            lbl_enter = new Label("ENTER");
            lbl_enter.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL;
            lbl_enter.Position = new Vector2(50, 470);
            lbl_enter.Visible = false;
            MainWindow.add(lbl_enter);

            lbl_enterAction = new Label("");
            lbl_enterAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM;
            lbl_enterAction.Position = new Vector2(120, 470);
            lbl_enterAction.Visible = false;
            MainWindow.add(lbl_enterAction);

            lbl_esc = new Label("ESC");
            lbl_esc.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL;
            lbl_esc.Position = new Vector2(50, 500);
            MainWindow.add(lbl_esc);

            lbl_escAction = new Label("Go Back");
            lbl_escAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM;
            lbl_escAction.Position = new Vector2(100, 500);
            MainWindow.add(lbl_escAction);
        }
예제 #10
0
        public void add(Link l)
        {
            if (lnkls.Count == 0)
            {
                l.HasFocus = true;
                selTxt = l.Text;
            }

            if(l.Font == null)
                l.Font = sf;

            l.Position = new Vector2(Position.X, (int)(Position.Y + ((lnkls.Count % numy) * fheigth) + 25));

            lnkls.Add(l);
        }
예제 #11
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (lbl_battleOutcome.Visible)
            {
                // The battle is over, player sees the outcome
                return;
            }

            if (ai.Active)
            {
                // The AI is doing his work, silly player not interfere
                ai.Update(gameTime);
                return;
            }

            if (targetMode)
            {
                // Player is selecting a target for character's action
                if (InputHandler.keyReleased(Keys.Down) || InputHandler.keyReleased(Keys.Up))
                {
                    // Focus on next/previous target
                    map.CurLs.Clear();
                    foreach (Point c in targetableChar)
                    {
                        map.changeCurp(this, new EventArgObject(c));
                        if (c == targetableChar[menu_actions.Selected])
                        {
                            map.CurLs.Add(p, Content.Graphics.Instance.Images.gui.cursorRed);
                        }
                        else
                            map.CurLs.Add(p, Content.Graphics.Instance.Images.gui.cursor);
                    }
                    map.changeCurp(this, new EventArgObject(targetableChar[menu_actions.Selected]));
                    showCharLabels();
                }
                if (InputHandler.keyReleased(Keys.Enter))
                {
                    // Target confirmed
                    Character m=cmap.get(scp.X, scp.Y);
                    Character t=cmap.get(p.X, p.Y);

                    String dmg;

                    lbl_actionTaken.Text = "";

                    //Character execute his action and action label is displayed
                    if (m is Fighter)
                        dmg = ((Fighter)m).attack(t);
                    else if (m is Archer)
                        dmg = ((Archer)m).attack(t);
                    else if (m is Scout)
                        dmg = ((Scout)m).attack(t);
                    else if (m is Healer)
                    {
                        dmg = ((Healer)m).heal(t).ToString();
                        lbl_actionTaken.Text = "Heal";
                    }
                    else if (m is Caster)
                    {
                        dmg = ((Caster)m).attack(t, selectedSpell);
                        lbl_actionTaken.Text = selectedSpell.Name;
                    }
                    else
                        dmg = "Cant"; //missingno

                    if (lbl_actionTaken.Text == "")
                        lbl_actionTaken.Text = "Attack";

                    // Damage label is displayed
                    lbl_dmg.Text = dmg;
                    lbl_dmg.Position = new Vector2(p.X * 64 - map.getTlc.X * 64 + 10, p.Y * 64 - map.getTlc.Y * 64 + 20);
                    lbl_dmg.visibleTemp(500);
                    lbl_actionTaken.visibleTemp(500);

                    // Character gains EXP
                    if (dmg != "miss" || dmg != "Cant")
                    {
                        if (m is Healer)
                            cmap.get(scp.X, scp.Y).gainExp(cmap.get(p.X, p.Y));

                        if (t.stats.hp <= 0)
                        {
                            // Enemy got killed
                            cmap.get(scp.X, scp.Y).gainExp(cmap.get(p.X, p.Y));

                            enemy.delete(t.Position.X, t.Position.Y);

                            cmap.set(p.X, p.Y, null);
                            cmap.update(map);

                            if (goal.Type == Objective.Objective_Type.DEFEAT_BOSS && t == goal.Char)
                            {
                                // Enemy killed was a boss
                                region.win = true;

                                lbl_battleOutcome.Text = "VICTORY!";
                                lbl_battleOutcome.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL;
                                lbl_battleOutcome.visibleTemp(2000);

                                MainWindow.InputEnabled = false;
                                return;
                            }

                            if (enemy.Characters.Count == 0)
                            {
                                // Enemy killed was the last one remaining
                                if (goal.Type == Objective.Objective_Type.DEFEAT_UNIT && enemy == goal.Unit)
                                    region.win = true;

                                lbl_battleOutcome.Text = "VICTORY!";
                                lbl_battleOutcome.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL;
                                lbl_battleOutcome.visibleTemp(2000);

                                MainWindow.InputEnabled = false;
                                return;
                            }
                        }
                    }

                    map.changeCurp(this, new EventArgObject(scp));

                    lbl_enterAction.Text = "Select Unit";

                    lbl_escAction.Text = "Cancel Move";
                    lbl_esc.Visible = false;
                    lbl_escAction.Visible = false;

                    freemode = true;
                    map.ArrowEnabled = true;
                    map.Enabled = true;

                    lbl_v.Visible = true;
                    lbl_vAction.Visible = true;

                    lbl_e.Visible = true;
                    lbl_eAction.Visible = true;

                    cmap.get(p.X, p.Y).stats.movement = 0;
                    lbl_move.Text = cmap.get(scp.X, scp.Y).stats.movement.ToString();
                    lbl_moved.Visible = true;

                    map.TabStop = true;
                    map.HasFocus = true;

                    menu_actions.clear();
                    menu_actions.add(new Link("Attack"));
                    menu_actions.add(new Link("Spell"));
                    menu_actions.add(new Link("Items"));
                    menu_actions.add(new Link("Wait"));

                    lbl_actions.Visible = false;
                    menu_actions.Visible = false;
                    menu_actions.Enabled = false;
                    menu_actions.ArrowEnabled = false;
                    menu_actions.HasFocus = false;

                    actionMode = false;
                    targetMode = false;
                    itemMode = false;

                    map.CurLs.Clear();
                }
                if (InputHandler.keyReleased(Keys.Escape))
                {
                    // Player cancel's the character's action
                    hideCharLabels();
                    targetMode = false;

                    menu_actions.clear();
                    menu_actions.add(new Link("Attack"));
                    menu_actions.add(new Link("Spell"));
                    menu_actions.add(new Link("Items"));
                    menu_actions.add(new Link("Wait"));

                    map.changeCurp(this, new EventArgObject(scp));

                    setEnabled();

                    map.CurLs.Clear();
                }
            }
            else if (itemMode)
            {
                // Player is selecting an item to use
                if (InputHandler.keyReleased(Keys.Enter))
                {
                    // Confirm selected item
                    if (!menu_actions.getLink(menu_actions.Selected).Enabled)
                        return;

                    itemMode = false;
                    freemode = true;

                    // Character uses item
                    Item i = ally.Inventory.getConsumable()[menu_actions.Selected];

                    Character c = cmap.get(scp.X, scp.Y);

                    if (i.Name == "The Prophet's Amulet" && region.RegionName == "Umbilicus")
                    {
                        Story s = new Story("Amulet");
                        s.Done = prophet_sret;

                        StateManager.Instance.goForward(s);
                    }
                    else
                        c.consume(i);

                    // Item is removed from inventory
                    ally.Inventory.Items.Remove(i);

                    // Action & damage labels are displayed
                    lbl_actionTaken.Text = i.Name;
                    lbl_actionTaken.center();
                    lbl_actionTaken.visibleTemp(1000);

                    lbl_dmg.Text = "hp: " + i.Effect.hp + "\nmana: " + i.Effect.mp;
                    lbl_dmg.Position = new Vector2(scp.X * 64 - map.getTlc.X * 64 + 10, scp.Y * 64 - map.getTlc.Y * 64 + 20);
                    lbl_dmg.visibleTemp(1000);

                    lbl_enterAction.Text = "Select Unit";

                    lbl_escAction.Text = "Cancel Move";
                    lbl_esc.Visible = false;
                    lbl_escAction.Visible = false;

                    freemode = true;
                    map.ArrowEnabled = true;
                    map.Enabled = true;

                    lbl_v.Visible = true;
                    lbl_vAction.Visible = true;

                    lbl_e.Visible = true;
                    lbl_eAction.Visible = true;

                    cmap.get(p.X, p.Y).stats.movement--;
                    lbl_move.Text = cmap.get(scp.X, scp.Y).stats.movement.ToString();
                    lbl_moved.Visible = true;

                    map.changeCurp(this, new EventArgObject(scp));

                    map.TabStop = true;
                    map.HasFocus = true;

                    menu_actions.clear();
                    menu_actions.add(new Link("Attack"));
                    menu_actions.add(new Link("Spell"));
                    menu_actions.add(new Link("Items"));
                    menu_actions.add(new Link("Wait"));

                    lbl_actions.Visible = false;
                    menu_actions.Visible = false;
                    menu_actions.Enabled = false;
                    menu_actions.ArrowEnabled = false;
                    menu_actions.HasFocus = false;

                    actionMode = false;
                    targetMode = false;
                    itemMode = false;

                    map.CurLs.Clear();
                }
                if (InputHandler.keyReleased(Keys.Escape))
                {
                    // Player cancel's the character's action
                    hideCharLabels();
                    targetMode = false;

                    menu_actions.clear();
                    menu_actions.add(new Link("Attack"));
                    menu_actions.add(new Link("Spell"));
                    menu_actions.add(new Link("Items"));
                    menu_actions.add(new Link("Wait"));

                    map.changeCurp(this, new EventArgObject(scp));

                    setEnabled();

                    map.CurLs.Clear();
                }
            }
            else if (spellMode)
            {
                // Player is selecting a spell for the character to cast
                if (InputHandler.keyReleased(Keys.Enter))
                {
                    // Confirm spell selection
                    if (!menu_actions.getLink(menu_actions.Selected).Enabled)
                        return;

                    spellMode = false;
                    targetMode = true;

                    Caster cc = (Caster)cmap.get(scp.X, scp.Y);

                    selectedSpell = cc.getCastableSpells().getSpell(menu_actions.SelectedText);

                    targetMode = true;

                    menu_actions.clear();
                    foreach (Point point in targetableChar)
                    {
                        menu_actions.add(new Link(cmap.get(point.X, point.Y).Name));
                    }

                    map.CurLs.Clear();
                    foreach (Point c in targetableChar)
                    {
                        map.changeCurp(this, new EventArgObject(c));
                        if (c == targetableChar[menu_actions.Selected])
                            map.CurLs.Add(p, Content.Graphics.Instance.Images.gui.cursorRed);
                        else
                            map.CurLs.Add(p, Content.Graphics.Instance.Images.gui.cursor);
                    }

                    map.changeCurp(this, new EventArgObject(targetableChar[0]));
                    showCharLabels();
                }
            }
            else if (actionMode)
            {
                // Player is selecting what action the character is going to do
                if (InputHandler.keyReleased(Keys.Enter))
                {
                    // Action confirmed
                    if (!menu_actions.getLink(menu_actions.Selected).Enabled)
                        // Not an available action
                        return;

                    if (menu_actions.SelectedText == "Spell")
                    {
                        // Spell selected
                        Caster c = (Caster)cmap.get(scp.X, scp.Y);

                        menu_actions.clear();

                        Link l;

                        foreach (Spell sp in c.getCastableSpells().toList())
                        {
                            l = new Link(sp.Name);

                            if (c.stats.mana < sp.ManaCost)
                                disableLink(l);

                            menu_actions.add(l);
                        }

                        setEnabled();

                        spellMode = true;
                    }
                    else if (menu_actions.SelectedText == "Items")
                    {
                        // Items selected
                        menu_actions.clear();

                        foreach (Item i in ally.Inventory.getConsumable())
                            menu_actions.add(new Link(i.Name));

                        itemMode = true;
                    }
                    else if (menu_actions.SelectedText == "Attack" || menu_actions.SelectedText == "Heal")
                    {
                        // Attack or Heal selected
                        targetMode = true;

                        menu_actions.clear();
                        foreach (Point point in targetableChar)
                        {
                            menu_actions.add(new Link(cmap.get(point.X, point.Y).Name));
                        }

                        map.CurLs.Clear();
                        foreach (Point c in targetableChar)
                        {
                            map.changeCurp(this, new EventArgObject(c));
                            if (c == targetableChar[menu_actions.Selected])
                                map.CurLs.Add(p, Content.Graphics.Instance.Images.gui.cursorRed);
                            else
                                map.CurLs.Add(p, Content.Graphics.Instance.Images.gui.cursor);
                        }

                        map.changeCurp(this, new EventArgObject(targetableChar[0]));
                        showCharLabels();
                    }
                    else
                    {
                        // Derp?
                        lbl_enterAction.Text = "Select Unit";

                        lbl_escAction.Text = "Cancel Move";
                        lbl_esc.Visible = false;
                        lbl_escAction.Visible = false;

                        freemode = true;
                        map.ArrowEnabled = true;
                        map.Enabled = true;

                        lbl_v.Visible = true;
                        lbl_vAction.Visible = true;

                        lbl_e.Visible = true;
                        lbl_eAction.Visible = true;

                        cmap.get(p.X, p.Y).stats.movement = 0;
                        lbl_move.Text = cmap.get(scp.X, scp.Y).stats.movement.ToString();
                        lbl_moved.Visible = true;

                        map.TabStop = true;
                        map.HasFocus = true;

                        lbl_actions.Visible = false;
                        menu_actions.Visible = false;
                        menu_actions.Enabled = false;
                        menu_actions.ArrowEnabled = false;
                        menu_actions.HasFocus = false;

                        actionMode = false;
                    }
                }

                if (InputHandler.keyReleased(Keys.Escape))
                {
                    // Cancel and go back to character's movement
                    lbl_enterAction.Text = "Confirm Move";
                    lbl_escAction.Text = "Cancel Move";

                    map.TabStop = true;
                    map.HasFocus = true;

                    lbl_actions.Visible = false;
                    menu_actions.Visible = false;
                    menu_actions.Enabled = false;
                    menu_actions.ArrowEnabled = false;
                    menu_actions.HasFocus = false;

                    actionMode = false;
                }
            }
            else if (!freemode)
            {
                // Player is currently moving a character
                if (InputHandler.keyReleased(Keys.Up))
                {
                    Point cp = scp;

                    moveChar(new Point(cp.X, --cp.Y));
                }

                if (InputHandler.keyReleased(Keys.Down))
                {
                    Point cp = scp;

                    moveChar(new Point(cp.X, ++cp.Y));
                }

                if (InputHandler.keyReleased(Keys.Left))
                {
                    Point cp = scp;

                    moveChar(new Point(--cp.X, cp.Y));
                }

                if (InputHandler.keyReleased(Keys.Right))
                {
                    Point cp = scp;

                    moveChar(new Point(++cp.X, cp.Y));
                }

                if (InputHandler.keyReleased(Keys.Escape))
                {
                    // Cancel character's movement
                    lbl_enterAction.Text = "Select Unit";

                    lbl_esc.Visible = false;
                    lbl_escAction.Visible = false;

                    cmap.get(scp.X, scp.Y).stats.movement++;
                    moveChar(returnP);
                    cmap.get(scp.X, scp.Y).stats.movement = (int)cmap.get(scp.X, scp.Y).stats.traits.spd / 10;
                    lbl_move.Text = cmap.get(scp.X, scp.Y).stats.movement.ToString();

                    freemode = true;
                    map.ArrowEnabled = true;
                    map.Enabled = true;

                    lbl_v.Visible = true;
                    lbl_vAction.Visible = true;

                    lbl_e.Visible = true;
                    lbl_eAction.Visible = true;
                }

                if (InputHandler.keyReleased(Keys.Enter))
                {
                    // Confirm character's movement
                    lbl_enterAction.Text = "Select Action";
                    lbl_escAction.Text = "Cancel Action";

                    map.TabStop = false;
                    map.HasFocus = false;

                    menu_actions.clear();

                    Character c = cmap.get(scp.X, scp.Y);

                    if (!(c is Healer))
                        menu_actions.add(new Link("Attack"));

                    if (c is Healer)
                        menu_actions.add(new Link("Heal"));
                    else
                        menu_actions.add(new Link("Spell"));

                    menu_actions.add(new Link("Items"));
                    menu_actions.add(new Link("Wait"));

                    setEnabled();

                    lbl_actions.Visible = true;
                    menu_actions.Visible = true;
                    menu_actions.Enabled = true;
                    menu_actions.ArrowEnabled = true;
                    menu_actions.HasFocus = true;

                    actionMode = true;
                }
            }
            else
            {
                //Freemode
                cmap.update(map);

                if (InputHandler.keyReleased(Keys.V) && lbl_v.Visible)
                {
                    // View Character Infos
                    StateManager.Instance.goForward(new CharManage(cmap.get(p.X, p.Y), null));
                }

                if (InputHandler.keyReleased(Keys.E))
                {
                    // End turn
                    foreach (Character c in ally.Characters)
                    {
                        c.stats.movement = (int)c.stats.traits.spd / 10;
                    }

                    if (cmap.isChar(p.X, p.Y))
                    {
                        lbl_moved.Visible = false;
                        lbl_move.Text = cmap.get(p.X, p.Y).stats.movement.ToString();
                    }

                    endTurnP = p;

                    lbl_armyTurn.Text = "ENEMY TURN";
                    lbl_armyTurn.Color = Color.Red;
                    lbl_armyTurn.center();
                    lbl_armyTurn.visibleTemp(1000);

                    MainWindow.InputEnabled = false;
                }
            }
        }
예제 #12
0
 /// <summary>
 /// Disables a link
 /// </summary>
 /// <param name="l">The link control to be disabled</param>
 private void disableLink(Link l)
 {
     l.Enabled = false;
     l.GEnable=false;
 }
예제 #13
0
        private void list()
        {
            m.clear();

            String s;

            foreach (String str in Directory.EnumerateFiles(".\\save\\", "*.save"))
            {
                s = Path.GetFileNameWithoutExtension(str);
                Link l = new Link(s);
                l.selected = load;
                m.add(l);
            }

            if (m.Count == 0)
            {
                lbl_d.Visible = false;
                lbl_del.Visible = false;

                lbl_enter.Visible = false;
                lbl_enterAction.Visible = false;
            }
            else
            {
                lbl_d.Visible = true;
                lbl_del.Visible = true;

                lbl_enter.Visible = true;
                lbl_enterAction.Visible = true;
            }
        }
예제 #14
0
        private void list()
        {
            m.clear();

            ns=new Link("New save");
            ns.selected = newSave;
            m.add(ns);

            Link l;
            String s;

            foreach (String str in Directory.EnumerateFiles(".\\save\\", "*.save"))
            {
                s = Path.GetFileNameWithoutExtension(str);
                l = new Link(s);
                l.selected = save;
                m.add(l);
            }
            if (m.Count <= 1 || m.Selected == 0)
            {
                lbl_d.Visible = false;
                lbl_del.Visible = false;
            }
            else
            {
                lbl_d.Visible = true;
                lbl_del.Visible = true;
            }
        }