Class: GamesAndRpgParadise::GUI::Jruby::Gamebook
- Inherits:
-
JFrame
- Object
- JFrame
- GamesAndRpgParadise::GUI::Jruby::Gamebook
- Includes:
- GamebookModule, GamesAndRpgParadise::Gamebooks, SwingParadise::AWT, SwingParadise::BaseModule
- Defined in:
- lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb
Overview
GamesAndRpgParadise::GUI::Jruby::Gamebook
Constant Summary collapse
- WIDTH =
#
WIDTH
#
1500
- HEIGHT =
#
HEIGHT
#
1000
- FILE_LEFT_ARROW_IMAGE =
#
FILE_LEFT_ARROW_IMAGE
#
GamesAndRpgParadise.project_base_directory?+ 'images/misc/left_arrow_for_exit_icon.png'
- LARGE_FONT =
#
LARGE_FONT
#
Font.new('Sans serif', Font::PLAIN, 28)
- MEDIUM_FONT =
#
MEDIUM_FONT
#
Font.new('Sans serif', Font::PLAIN, 25)
- MEDIUM_FONT_MONOSPACE =
#
MEDIUM_FONT_MONOSPACE
#
Font.new('Monospace', Font::PLAIN, 25)
- SMALL_FONT =
#
SMALL_FONT
#
Font.new('Sans serif', Font::PLAIN, 22)
Constants included from GamebookModule
GamebookModule::DIRECTORY_FOR_THE_GAMEBOOKS, GamebookModule::FILE_CIRCLE_OF_FIRE, GamebookModule::FILE_CIRCLE_OF_FIRE_COMPLETED, GamebookModule::FILE_CIRCLE_OF_LIGHT, GamebookModule::FILE_CIRCLE_OF_LIGHT_COMPLETED, GamebookModule::FILE_CIRCLE_OF_SOLARIS, GamebookModule::FILE_CIRCLE_OF_SOLARIS_COMPLETED, GamebookModule::FILE_CIRCLE_OF_SPIRIT, GamebookModule::FILE_CIRCLE_OF_SPIRIT_COMPLETED, GamebookModule::FILE_RAUMSCHIFF_IMAGE, GamebookModule::FILE_RED_SIX_SIDED_DIE, GamebookModule::HASH_DESIGNATED_KEY_COMBINATIONS, GamebookModule::HINT_FOR_THE_BUTTON_WITH_THE_LEFT_ARROW_IMAGE, GamebookModule::PATH_TO_THE_DIE_IMAGE, GamebookModule::PATH_TO_THE_MINUS_SYMBOL_IMAGE, GamebookModule::PATH_TO_THE_PLUS_SYMBOL_IMAGE, GamebookModule::REGEX_FOR_FINDING_THE_NAME_OF_AN_OPPONENT, GamebookModule::SMALLER_FONT, GamebookModule::SMALLEST_FONT, GamebookModule::TITLE, GamebookModule::USE_N_CLICKABLE_BUTTONS, GamebookModule::USE_THESE_CSS_RULES, GamebookModule::USE_THIS_FONT, GamebookModule::USE_THIS_GAMEBOOK
Constants included from Base::ExtensionsForAGamebook
Base::ExtensionsForAGamebook::DIRECTORY_FOR_THE_GAMEBOOKS
Constants included from CommonExtensions
CommonExtensions::CONTROL_C_CODE, CommonExtensions::N
Instance Method Summary collapse
-
#create_the_skeleton ⇒ Object
# === create_the_skeleton ========================================================================= #.
-
#gamebook_dataset? ⇒ Boolean
# === gamebook_dataset? ========================================================================= #.
-
#initialize ⇒ Gamebook
constructor
# === initialize ========================================================================= #.
-
#max_entries? ⇒ Boolean
# === max_entries?.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#return_content_of_this_page(i = @entry1.text?) ⇒ Object
# === return_content_of_this_page ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
Methods included from GamebookModule
#actionsheet_label?, #add_default_number_of_selbstlenkraketen, #add_n_meals, #add_to_the_path_traversal_history, #append_to_the_equipment_buffer, #append_to_the_main_buffer, #array_path_traversal_history?, #autoload_the_default_character, #automatically_pick_up_items?, #available_kai_disciplines?, #border_size?, #buffer_containing_the_kai_disciplines?, #buffer_holding_the_gamepage_content?, #button_number, #clear_the_history, #clear_the_main_page, #combat_ratio, #comments?, #connect_skeleton, #consider_adding_all_relevant_information_from_the_character, #consider_loading_the_config_yml_file, #consider_readjusting_the_gold_entry, #consider_renaming_the_entries_and_do_more_after_loading_the_gamebook_dataset, #content_of?, #context_menu?, #continue_with_this_gamebook, #cover_image_URL?, #create_ausrüstung_und_waffen_label, #create_ausrüstung_und_waffen_widget, #create_button_box, #create_entry_for_the_dice, #create_entry_for_the_die_roll_result, #create_entry_max_endurance, #create_everything_pertaining_to_the_main_buffer, #create_skeleton, #create_spinbutton_for_geld, #create_stärke_label, #create_text_containing_the_gewandheitspunkte_label, #create_text_keeping_the_gamebook_title, #create_the_context_menu, #create_the_default_gamebooks_character, #create_the_entries, #create_the_entry_containing_the_number_of_the_subsection, #create_the_equipment_widget, #create_the_left_frame, #create_the_main_image, #create_the_main_text_buffer, #create_the_main_text_buffer_and_then_create_the_main_text_view, #create_the_main_text_view, #create_the_right_frame, #create_the_sourceview_containing_the_content_of_the_gamebook_entry, #create_the_special_image, #create_the_stärke_entry, #create_the_text_containing_the_money_label, #create_the_weapons_widget, #create_the_widget_switcher, #create_widget_for_glück_entry, #current_combat_skill_value?, #current_endurance_from_the_widget?, #current_endurance_of_the_opponent?, #current_glück_value?, #current_page?, #current_stärke?, #dataset_for_the_gamebook?, #dataset_has_this_page?, #deduct, #deduct_n_endurance_points, #deduct_one_point_from_luck, #die_icon?, #disable_this_button, #do_clear_the_main_text_buffer, #do_debug, #do_focus_on_the_text_view, #do_handle_the_on_click_action_for_the_main_event_box, #do_open_the_current_yaml_file_in_the_editor, #do_pop_up_the_create_new_character_widget, #do_popup_game_over_message, #do_save_the_character, #do_show_info_how_to_use_this_widget, #does_the_main_sourceview_exist?, #does_this_gamebook_use_a_cover_image?, #empty_the_label_containing_the_name_of_the_opponent, #enemy_CS?, #entry_current_combat_skill?, #entry_for_the_dice?, #entry_gewandheitspunkte?, #entry_stärke?, #equipment_buffer_content?, #exits_from?, #fantasy_lone_wolf?, #fantasy_widget?, #focus_on_the_first_tab, #gamebook_title?, #handle_CSS, #handle_game_book_specific_hooks_next, #handle_the_situation_caused_bei_Versuch_dein_Glück, #hide_all_buttons, #indicate_to_the_user_that_the_lower_entry_is_important, #initialize_a_new_lone_wolf_character, #is_DSA_widget?, #is_grey_star_the_wizard?, #is_the_game_over?, #largest_font?, #let_the_entry_containing_the_number_of_the_subsection_respond_to_enter_events, #load_the_dataset_for_the_gamebook, #main_buffer_exists?, #main_entry?, #max_endurance?, #max_id?, #max_stärke?, #menu, #n_alether_potions?, #n_arrows?, #n_gold?, #n_laumspur_potions?, #n_meals?, #n_quivers?, #name_of_the_gamebook?, #obtain_entry, #obtain_this_page_number, #opponent_endurance_entry?, #padding?, #parse_the_current_page_to_determine_the_enemy, #path_to_the_file_config_yml?, #pick_another_font, #project_base_directory?, #reset_the_game_state_to_the_default, #reset_the_shared_module, #return_actionsheet_widget, #return_admin_panel, #return_ausrüstung_und_waffen_widget, #return_create_new_character_widget, #return_event_box_for_the_circle_of_fire, #return_event_box_for_the_circle_of_light, #return_event_box_for_the_circle_of_solaris, #return_event_box_for_the_circle_of_spirit, #return_event_box_for_the_die_image, #return_geld_widget, #return_grid_containing_GE_ST_and_GL, #return_image_to_the_six_sided_die, #return_kai_disciplines_widget_for_the_one_lone_wolf_series, #return_left_aligned_bold_text, #return_left_arrow_widget, #return_main_button, #return_max_allowed_id_string, #return_n_alether_potions, #return_n_arrows_widget, #return_n_laumspur_tränke, #return_n_meals, #return_n_quivers_widget, #return_notes_widget, #return_proper_tooltip_for_the_combo_box_containing_all_kai_disciplines, #return_quivers_and_arrows_widget, #return_raumschiff_widget, #return_scrolled_window_containing_the_special_image, #return_the_button_box, #return_the_event_box_containing_the_new_game_icon, #return_the_event_box_for_the_special_image, #return_the_left_side_widget, #return_the_outer_frame, #return_the_widget_containing_information_about_the_enemy, #return_the_widget_switcher, #return_widget_containing_the_available_gamebooks, #return_widget_containing_usage_information, #return_widget_for_gewandheitspunkte_entry, #return_widget_for_gewandheitspunkte_text, #return_widget_for_glück_entry, #return_widget_for_glück_text, #return_widget_for_stärke_entry, #return_widget_for_stärke_text, #return_widget_for_stärkepillen_entry, #return_widget_for_stärkepillen_text, #return_widget_save_the_character, #revert_the_CSS_rules_of_the_lower_entry_again, #roll_n_die, #roll_the_die, #science_fiction_theme?, #scrolled_window_for_the_equipment_buffer?, #set_combat_skill_entry, #set_current_combat_skill_entry, #set_current_endurance, #set_current_endurance_of_the_enemy, #set_current_stärke, #set_entry_containing_the_die, #set_equipment_buffer, #set_kai_disciplines, #set_main_buffer_content, #set_main_entry_to, #set_max_gold, #set_max_id, #set_max_stärke, #set_maximal_endurance, #set_n_arrows, #set_n_gold, #set_n_meals, #set_n_quivers, #set_path_to_the_file_config_yml, #set_rename_equipment_widget, #set_rename_gewandheit_entry_to, #set_rename_gold_entry_to, #set_rename_stärke_entry_to, #set_starting_page, #set_the_title_of_the_gamebook_onto_the_corresponding_widget, #set_the_value_for_stärke_on_the_proper_entry, #set_theme, #set_use_this_file, #set_use_this_gamebook, #show_help, #smaller_font?, #smallest_font?, #sourceview_containing_the_content_of_the_gamebook_entry?, #spinbutton_for_geld?, #switch_to_the_no_border_for_the_die_image, #switch_to_the_red_border_for_the_die_image, #sync_the_fonts, #text_containing_the_gewandheit_label?, #text_containing_the_money_label?, #text_containing_the_stärke_label?, #text_view_holding_the_gamepage_content?, #the_button_was_clicked_for_this_subpage, #the_character_dies, #the_exits_of_this_page_number_must_be_determined_next, #the_game_is_now_over, #the_opponent_endurance_entry_is_now_black, #the_opponent_endurance_entry_is_now_red, #theme?, #try_to_regenerate_n_hp, #update_the_equipment_widget, #update_the_gold_coins_widget, #use_this_file?, #use_which_font?, #verbose_download_this_remote_image_into_that_assumed_local_path, #visit_this_page, #weapons_buffer?, #widget_switcher?, #yaml_file?
Methods included from Base::ExtensionsForAGamebook
#available_gamebooks?, #io_download, #roll_this_die, use_gtk?, #use_gtk?, #wget, #yaml_gamebooks_dir?
Methods included from Base::Extensions::CommandlineArguments
#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments
Methods included from CommonExtensions
#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into
Constructor Details
#initialize ⇒ Gamebook
#
initialize
#
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 74 def initialize super('Gamebook') reset setSize(WIDTH, HEIGHT) create_the_skeleton # ======================================================================= # # Use a flow-layout: # ======================================================================= # getContentPane.setLayout(FlowLayout.new) # ======================================================================= # # The textarea - this one will contain the content of the gamebook # page at hand: # ======================================================================= # @textarea = jtextarea(35, 30) @textarea.set_text(return_content_of_this_page) @textarea.font = MEDIUM_FONT @textarea.setMargin(insets(12)) @textarea.pad8px scrolled_window = JScrollPane.new(@textarea) scrolled_window.horizontal_always scrolled_window.vertical_always scrolled_window.is_visible panel = JPanel.new # This is an instance of Java::JavaxSwing::JPanel. panel.set_font(MEDIUM_FONT) panel.add(scrolled_window) add(panel) left_arrow_image = ImageIcon.new(FILE_LEFT_ARROW_IMAGE) # picLabel = JLabel.new(ImageIcon.new(myPicture)); # add(left_arrow_image) = ('Visit the page') .hint = "ABC" .on_clicked { this_page = @entry1.text?.to_i e 'DEBUG: Visiting this page next: '+this_page.to_s if this_page.to_i > max_entries? this_page = max_entries?.to_i end @textarea.set_text(return_content_of_this_page(this_page)) } .tooltip = HINT_FOR_THE_BUTTON_WITH_THE_LEFT_ARROW_IMAGE add(@entry1) add() exit_on_close top_left show_all run end |
Instance Method Details
#create_the_skeleton ⇒ Object
#
create_the_skeleton
#
144 145 146 147 148 149 150 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 144 def create_the_skeleton @entry1 = entry @entry1.font = MEDIUM_FONT @entry1.center @entry1.text = '0' @entry1.setColumns(4) end |
#gamebook_dataset? ⇒ Boolean
#
gamebook_dataset?
#
166 167 168 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 166 def gamebook_dataset? GamesAndRpgParadise::Gamebooks.load_dataset(for_this_gamebook: 13) end |
#max_entries? ⇒ Boolean
#
max_entries?
This method will return how many entries we have in the given gamebook at hand maximum.
#
158 159 160 161 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 158 def max_entries? max = @dataset[0].keys.max return max end |
#reset ⇒ Object
#
reset (reset tag)
#
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 130 def reset #reset_the_internal_variables # ======================================================================= # # === @dataset # # Obtain the dataset of the gamebooks. # ======================================================================= # @dataset = gamebook_dataset? # reset_the_shared_module end |
#return_content_of_this_page(i = @entry1.text?) ⇒ Object
#
return_content_of_this_page
#
173 174 175 176 177 178 179 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 173 def return_content_of_this_page( i = @entry1.text? ) i = i.to_i target = @dataset[0][i] return target['content'] end |
#run ⇒ Object
#
run
#
184 185 186 187 |
# File 'lib/games_and_rpg_paradise/gui/jruby/gamebook/gamebook.rb', line 184 def run is_visible default_close end |