Class: GamesAndRpgParadise::GUI::Gtk::Gamebook

Inherits:
Gtk::BaseModuleBox
  • Object
show all
Includes:
GamesAndRpgParadise::GUI::GamebookModule
Defined in:
lib/games_and_rpg_paradise/gui/gtk3/gamebook/gamebook.rb

Overview

GamesAndRpgParadise::GUI::Gtk::Gamebook

Constant Summary

Constants included from GamesAndRpgParadise::GUI::GamebookModule

GamesAndRpgParadise::GUI::GamebookModule::DIRECTORY_FOR_THE_GAMEBOOKS, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_FIRE, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_FIRE_COMPLETED, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_LIGHT, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_LIGHT_COMPLETED, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_SOLARIS, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_SOLARIS_COMPLETED, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_SPIRIT, GamesAndRpgParadise::GUI::GamebookModule::FILE_CIRCLE_OF_SPIRIT_COMPLETED, GamesAndRpgParadise::GUI::GamebookModule::FILE_RAUMSCHIFF_IMAGE, GamesAndRpgParadise::GUI::GamebookModule::FILE_RED_SIX_SIDED_DIE, GamesAndRpgParadise::GUI::GamebookModule::HASH_DESIGNATED_KEY_COMBINATIONS, GamesAndRpgParadise::GUI::GamebookModule::HEIGHT, GamesAndRpgParadise::GUI::GamebookModule::HINT_FOR_THE_BUTTON_WITH_THE_LEFT_ARROW_IMAGE, GamesAndRpgParadise::GUI::GamebookModule::LARGE_FONT, GamesAndRpgParadise::GUI::GamebookModule::PATH_TO_THE_DIE_IMAGE, GamesAndRpgParadise::GUI::GamebookModule::PATH_TO_THE_MINUS_SYMBOL_IMAGE, GamesAndRpgParadise::GUI::GamebookModule::PATH_TO_THE_PLUS_SYMBOL_IMAGE, GamesAndRpgParadise::GUI::GamebookModule::REGEX_FOR_FINDING_THE_NAME_OF_AN_OPPONENT, GamesAndRpgParadise::GUI::GamebookModule::SMALLER_FONT, GamesAndRpgParadise::GUI::GamebookModule::SMALLEST_FONT, GamesAndRpgParadise::GUI::GamebookModule::TITLE, GamesAndRpgParadise::GUI::GamebookModule::USE_N_CLICKABLE_BUTTONS, GamesAndRpgParadise::GUI::GamebookModule::USE_THESE_CSS_RULES, GamesAndRpgParadise::GUI::GamebookModule::USE_THIS_FONT, GamesAndRpgParadise::GUI::GamebookModule::USE_THIS_GAMEBOOK, GamesAndRpgParadise::GUI::GamebookModule::WIDTH

Constants included from Base::ExtensionsForAGamebook

Base::ExtensionsForAGamebook::DIRECTORY_FOR_THE_GAMEBOOKS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GamesAndRpgParadise::GUI::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(commandline_arguments = ARGV, run_already = true) ⇒ Gamebook

#

initialize

#


35
36
37
38
39
40
41
42
43
44
45
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/gamebook.rb', line 35

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:vertical)
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.run(i = ARGV) ⇒ Object

#

GamesAndRpgParadise::GUI::Gtk::Gamebook.run

#


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/gamebook.rb', line 120

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::GamesAndRpgParadise::GUI::Gtk::Gamebook.new(i)
  r = ::Gtk.run
  r << _
  _.set_parent_widget(r)
  _.enable_these_key_combinations(HASH_DESIGNATED_KEY_COMBINATIONS)
  r.add_context_menu_with_the_default_accel_group
  r.on_button_press_event { |widget, event|
    if ::Gtk.right_mouse_click?(event) # right mouse click event.
      _.context_menu?.popup_based_on_this_event(event)
    end
  }
  r.automatic_size_then_automatic_title
  r.enable_quick_exit
  r.maximize
  r.top_left_then_run
end

Instance Method Details

#delayed_click_on_the_widget_switchterObject

#

delayed_click_on_the_widget_switchter

#


110
111
112
113
114
115
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/gamebook.rb', line 110

def delayed_click_on_the_widget_switchter
  Thread.new {
    sleep(25) # Set a 25 seconds delay, to simulate "auto-play functionality".
    widget_switcher?.do_click
  }
end

#resetObject

#

reset (reset tag)

#


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/gamebook.rb', line 50

def reset
  reset_the_internal_variables
  infer_the_namespace
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, namespace?]
  # ======================================================================= #
  # === Set the title, width, height and the font in use.
  # ======================================================================= #
  title_width_height_font(TITLE, WIDTH, HEIGHT, @use_this_font)
  infer_the_size_automatically
  reset_the_shared_module # Reset the shared module next.
  # ======================================================================= #
  # === @path_to_the_file_config_yml
  #
  # Designate the path to the config.yml file.
  # ======================================================================= #
  set_path_to_the_file_config_yml(:default)
  # ======================================================================= #
  # Next we will load the dataset for the gamebook. This must come
  # AFTER the method invocation set_path().
  # ======================================================================= #
  load_the_dataset_for_the_gamebook
end

#runObject

#

run (run tag)

#


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
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/gamebook.rb', line 79

def run
  menu # Should come before super().
  consider_loading_the_config_yml_file
  create_skeleton
  connect_skeleton
  handle_CSS # All CSS parts will be handled here.
  consider_renaming_the_entries_and_do_more_after_loading_the_gamebook_dataset
  do_focus_on_the_text_view
  let_the_entry_containing_the_number_of_the_subsection_respond_to_enter_events
  handle_game_book_specific_hooks_next
  visit_this_page(@starting_page)
  consider_adding_all_relevant_information_from_the_character
  sync_the_fonts
  focus_on_the_first_tab
  # ========================================================================= #
  # The next clause was used in the past, before July 2023, to automatically
  # open the underlying .yml file that powers the gamebook at hand - on
  # a roebe system (aka on my home system). Since as of July 2023, though,
  # as the quality of the gamebook-code improved, I will do so only
  # manually, via a button, rather than the automatic open-action below.
  # For reference purposes, the code, as well as the above explanation,
  # will be retained.
  #
  # do_open_the_current_yaml_file_in_the_editor if is_on_roebe?
  # ========================================================================= #
  delayed_click_on_the_widget_switchter
end