Class: GamesAndRpgParadise::GUI::Gtk::LoneWolf::CreateNewCharacter
- Inherits:
-
Gtk::BaseModuleBox
- Object
- Gtk::BaseModuleBox
- GamesAndRpgParadise::GUI::Gtk::LoneWolf::CreateNewCharacter
show all
- Defined in:
- lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb
Overview
GamesAndRpgParadise::GUI::Gtk::LoneWolf::CreateNewCharacter
Constant Summary
collapse
- TITLE =
'Create a new character for the lone-wolf gamebook series.'
- WIDTH =
'15% or minimum 150px'
- HEIGHT =
'15% or minimum 100px'
- USE_THIS_FONT =
:dejavu_condensed_20
- ARRAY_MAPPING_FROM_NUMBER_TO_THIS_CHARACTER_VALUE =
#
ARRAY_MAPPING_FROM_NUMBER_TO_THIS_CHARACTER_VALUE
This is actually a Hash.
#
{
'0': :combat_skill,
'1': :endurance,
'2': :equipment,
'3': :weapons,
'4': :tai_disciplines,
'5': :meals,
'6': :laumspur,
'7': :quivers,
'8': :arrows,
'9': :n_gold_coins
}
Class Method Summary
collapse
-
.run(i = ARGV) ⇒ Object
# === GamesAndRpgParadise::GUI::Gtk::LoneWolf::CreateNewCharacter.run ========================================================================= #.
Instance Method Summary
collapse
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ CreateNewCharacter
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 65
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::LoneWolf::CreateNewCharacter.run
#
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 309
def self.run(
i = ARGV
)
require 'gtk_paradise/run'
_ = ::GamesAndRpgParadise::GUI::Gtk::LoneWolf::CreateNewCharacter.new(i)
r = ::Gtk.run
r << _
r.automatic_size_then_automatic_title
r.enable_quick_exit
r.top_left_then_run
end
|
Instance Method Details
#border_size? ⇒ Boolean
120
121
122
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 120
def border_size?
4
end
|
#character? ⇒ Boolean
228
229
230
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 228
def character?
@character
end
|
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 156
def connect_skeleton
abort_on_exception
@grid1 = default_grid
grid1 = @grid1
grid1.pad8px
grid1.set_column_spacing(12)
grid1.set_row_spacing(12)
= centered_text('Describe the character next')
.use_this_font = :dejavu_condensed_28
.make_bold
.darkblue
minimal(, 12)
_ = GamesAndRpgParadise.project_base_directory?+'images/die.png'
widget1 = hbox
entry1 = create_entry
if File.exist? _
clickable_die_image1 = create_eventbox(create_image(_))
end
clickable_die_image1.on_clicked {
entry1.set_text(
(GamesAndRpgParadise.silently_roll_this_die('1D10') + 10).to_s
)
}
widget1.maximal(entry1)
widget1.minimal(clickable_die_image1)
widget2 = hbox
entry2 = create_entry
if File.exist? _
clickable_die_image2 = create_eventbox(create_image(_))
end
clickable_die_image2.on_clicked {
entry2.set_text(
(GamesAndRpgParadise.silently_roll_this_die('1D10') + 20).to_s
)
}
widget2.maximal(entry2)
widget2.minimal(clickable_die_image2)
left_right_entry('COMBAT SKILL', widget1, entry1)
left_right_entry('ENDURANCE', widget2, entry2)
left_right_entry('Equipment', text_view)
left_right_entry('Tai disciplines', text_view)
left_right_entry('Meals')
left_right_entry('Laumspur')
left_right_entry('Quivers')
left_right_entry('Arrows')
left_right_entry('Weapons', text_view)
left_right_entry('n gold coins')
button1 = button('_Save')
button1.clear_background
button1.on_hover(:lightblue)
button1.set_name('button1')
button1.on_clicked {
do_save_the_dataset
}
grid1.full_row(button1)
grid1.hcenter
minimal(grid1, 6)
end
|
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
127
128
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 127
def create_skeleton
end
|
#do_save_the_dataset ⇒ Object
#
do_save_the_dataset (save tag)
#
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 235
def do_save_the_dataset
@character = GamesAndRpgParadise::Gamebook::LoneWolf::Character.new
@array_all_entries.each_with_index {|entry, index|
_ = entry.text?
unless _.empty?
mapped_value = ARRAY_MAPPING_FROM_NUMBER_TO_THIS_CHARACTER_VALUE[index.to_s.to_sym]
@character.send(
(mapped_value.to_s+'=').to_sym,
_
)
case mapped_value when :combat_skill
@character.set_current_combat_skill(_)
when :endurance
@character.set_max_endurance(_)
end
end
}
if shall_we_report_the_dataset?
@character.report
end
_result = @character.do_save
return _result
end
|
#endurance? ⇒ Boolean
281
282
283
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 281
def endurance?
@character.endurance? if @character
end
|
#left_right_entry(i, use_this_widget_for_the_right_side = create_entry, this_is_the_entry = nil) ⇒ Object
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 133
def left_right_entry(
i,
use_this_widget_for_the_right_side = create_entry,
this_is_the_entry = nil )
if use_this_widget_for_the_right_side.is_a?(::Gtk::TextView)
use_this_widget_for_the_right_side = create_scrolled_window(use_this_widget_for_the_right_side)
use_this_widget_for_the_right_side.pad5px
use_this_widget_for_the_right_side.width_height(250, 150)
end
the_text = left_aligned_text(i.to_s)
@grid1.left(the_text)
@grid1.right(use_this_widget_for_the_right_side) if this_is_the_entry.nil?
this_is_the_entry = use_this_widget_for_the_right_side
end
the_entry = this_is_the_entry
@array_all_entries << the_entry
end
|
#n_gold_coins? ⇒ Boolean
295
296
297
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 295
def n_gold_coins?
@character.n_gold_coins? if @character
end
|
#padding? ⇒ Boolean
113
114
115
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 113
def padding?
6
end
|
#report ⇒ Object
#
report (report tag)
We delegate onto the base Character class here.
#
274
275
276
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 274
def report
@character.report if @character
end
|
#reset ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 80
def reset
reset_the_internal_variables
infer_the_namespace
@configuration = [true, __dir__, namespace?]
title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
@array_all_entries = []
use_gtk_paradise_project_css_file
more_CSS_then_apply_it '
#button1 {
border: 2px solid darkblue;
border-radius: 10px;
}
'
@shall_we_report_the_dataset = true
infer_the_size_automatically
end
|
#run ⇒ Object
302
303
304
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 302
def run
super()
end
|
#set_n_gold_coins(i) ⇒ Object
Also known as:
set_n_gold
288
289
290
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 288
def set_n_gold_coins(i)
@character.set_n_gold_coins(i) if @character
end
|
#shall_we_report_the_dataset? ⇒ Boolean
#
shall_we_report_the_dataset?
#
106
107
108
|
# File 'lib/games_and_rpg_paradise/gui/gtk3/gamebook/lone_wolf/create_new_character.rb', line 106
def shall_we_report_the_dataset?
@shall_we_report_the_dataset
end
|