Class: GamesAndRpgParadise::GUI::LibUI::Gamebook

Inherits:
Object
  • Object
show all
Includes:
GamebookModule, LibuiParadise::Extensions
Defined in:
lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb

Overview

GamesAndRpgParadise::GUI::LibUI::Gamebook

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

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::HEIGHT, GamebookModule::HINT_FOR_THE_BUTTON_WITH_THE_LEFT_ARROW_IMAGE, GamebookModule::LARGE_FONT, 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, GamebookModule::WIDTH

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

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_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(run_already = true) ⇒ Gamebook

#

initialize

#


29
30
31
32
33
34
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 29

def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Instance Method Details

#create_skeletonObject

#

create_skeleton (create tag, skeleton tag)

#


87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 87

def create_skeleton
  # ======================================================================= #
  # === @window
  # ======================================================================= #
  modified_title = "#{title?} - "\
                   "#{File.basename(use_this_file?.to_s).delete_suffix('.yml').tr('_',' ')}"
  @window = ui_padded_main_window(
    modified_title, width?, height?, 0
  )
  create_the_main_buffer
  create_the_entry_containing_the_number_of_the_subsection
end

#create_the_main_bufferObject

#

create_the_main_buffer

#


54
55
56
57
58
59
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 54

def create_the_main_buffer
  # ======================================================================= #
  # === @buffer_holding_the_gamepage_content
  # ======================================================================= #
  @buffer_holding_the_gamepage_content = multiline_entry('')
end

#go_to_this_page(i = 0) ⇒ Object

#

go_to_this_page

#


77
78
79
80
81
82
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 77

def go_to_this_page(i = 0)
  i = i.to_i
  @buffer_holding_the_gamepage_content.set_text(
    content_of?(i)
  )
end

#resetObject

#

reset (reset tag)

#


39
40
41
42
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 39

def reset
  reset_the_shared_module
  title_width_height(TITLE, WIDTH, HEIGHT)
end

#return_the_button_that_allows_the_user_to_go_to_the_specified_pageObject

#

return_the_button_that_allows_the_user_to_go_to_the_specified_page

#


64
65
66
67
68
69
70
71
72
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 64

def return_the_button_that_allows_the_user_to_go_to_the_specified_page
  _ = button('← Go to this page')
  _.on_clicked {
    go_to_this_page(
      @entry_containing_the_number_of_the_subsection.text?
    )
  }
  return _
end

#return_view_buffer_holding_the_gamepage_contentObject

#

return_view_buffer_holding_the_gamepage_content

#


47
48
49
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 47

def return_view_buffer_holding_the_gamepage_content
  return @buffer_holding_the_gamepage_content
end

#runObject

#

run (run tag)

#


103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/games_and_rpg_paradise/gui/libui/gamebook/gamebook.rb', line 103

def run
  menu
  create_skeleton_then_connect_skeleton
  set_use_this_gamebook
  outer_hbox = padded_hbox
  outer_hbox.add_hsep

  go_to_this_page(0) # Set a default page.

  grid = padded_grid
  
  grid.hash_grid(
    @entry_containing_the_number_of_the_subsection,
    { left: 0, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )
  grid.hash_grid(
    return_the_button_that_allows_the_user_to_go_to_the_specified_page,
    { left: 1, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )

  grid.hash_grid(
    text('Gewandheit:'),
    { left: 0, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )
  grid.hash_grid(
    entry('6'),
    { left: 1, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )

  grid.hash_grid(
    text('Stärke:'),
    { left: 0, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )
  grid.hash_grid(
    entry('6'),
    { left: 1, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )

  grid.hash_grid(
    text('Glück:'),
    { left: 0, top: 3, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )
  grid.hash_grid(
    entry('6'),
    { left: 1, top: 3, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )

  grid.hash_grid(
    entry,
    { left: 0, top: 4, xspan: 2, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )
  grid.hash_grid(
    entry,
    { left: 0, top: 5, xspan: 2, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 }
  )

  outer_hbox.minimal(grid)
  outer_hbox.maximal(return_view_buffer_holding_the_gamepage_content, 1)

  most_outer_vbox = vbox
  most_outer_vbox.maximal(outer_hbox)
  most_outer_vbox.minimal(quit_button)

  @window.add(most_outer_vbox)
  @window.intelligent_exit
end