コード例 #1
0
        /* ------------------------------------------------------------------------
         * Final confirmation of character.
         * ------------------------------------------------------------------------ */
        static birth_stage get_confirm_command()
        {
            Player.Player p_ptr = Player.Player.instance;

            string   prompt = "['ESC' to step back, 'S' to start over, or any other key to continue]";
            keypress ke;

            birth_stage next;

            /* Prompt for it */
            Utilities.prt(prompt, Term.instance.hgt - 1, Term.instance.wid / 2 - (prompt.Length / 2));

            /* Buttons */
            Button.button_kill_all();
            Button.button_add("[Continue]", 'q');
            Button.button_add("[ESC]", (char)keycode_t.ESCAPE);
            Button.button_add("[S]", 'S');
            p_ptr.redraw_stuff();

            /* Get a key */
            ke = Utilities.inkey();

            /* Start over */
            if (ke.code == (keycode_t)'S' || ke.code == (keycode_t)'s')
            {
                next = birth_stage.BIRTH_RESET;
            }
            else if (ke.code == (keycode_t)UIEvent.KTRL('X'))
            {
                Game_Command.insert(Command_Code.QUIT);
                next = birth_stage.BIRTH_COMPLETE;
            }
            else if (ke.code == keycode_t.ESCAPE)
            {
                next = birth_stage.BIRTH_BACK;
            }
            else
            {
                Game_Command.insert(Command_Code.ACCEPT_CHARACTER);
                next = birth_stage.BIRTH_COMPLETE;
            }

            /* Buttons */
            Button.button_kill_all();
            p_ptr.redraw_stuff();

            /* Clear prompt */
            Utilities.clear_from(23);

            return(next);
        }
コード例 #2
0
        /*
         * Remove a button
         */
        public static int kill_text(char keypress)
        {
            Player.Player p_ptr = Player.Player.instance;

            int i, j, length;

            /* Find the button */
            for (i = 0; i < button_num; i++)
            {
                if (button_mse[i].key == keypress)
                {
                    break;
                }
            }

            /* No such button */
            if (i == button_num)
            {
                return(0);
            }

            /* Find the length */
            length         = button_mse[i].right - button_mse[i].left + 1;
            button_length -= length;

            /* Move each button up one */
            for (j = i; j < button_num - 1; j++)
            {
                button_mse[j] = button_mse[j + 1];

                /* Adjust length */
                button_mse[j].left  -= length;
                button_mse[j].right -= length;
            }

            /* Wipe the data */
            button_mse[button_num].label = "";
            button_mse[button_num].left  = 0;
            button_mse[button_num].right = 0;
            button_mse[button_num--].key = (char)0;

            /* Redraw */
            p_ptr.redraw |= (Misc.PR_BUTTONS);
            p_ptr.redraw_stuff();

            /* Return the size of the button */
            return(length);
        }