Class: Cliptic::Interface::Menu_With_Stats

Inherits:
Menu show all
Defined in:
lib/cliptic/interface.rb

Constant Summary

Constants included from Chars

Chars::Block, Chars::HL, Chars::LL, Chars::LS, Chars::LU, Chars::MS, Chars::Nums, Chars::RL, Chars::RS, Chars::RU, Chars::TD, Chars::TL, Chars::TR, Chars::TU, Chars::Tick, Chars::VL, Chars::XX

Instance Attribute Summary collapse

Attributes inherited from Menu

#height, #selector

Attributes inherited from Menu_Box

#bot_b, #draw_bars, #logo, #title, #top_b

Attributes inherited from Windows::Window

#centered_x, #centered_y, #col, #line, #x, #y

Instance Method Summary collapse

Methods inherited from Menu

#back, #choose_opt, #ctrls, #redraw, #show

Methods inherited from Menu_Box

#add_title, #draw, #line

Methods inherited from Windows::Window

#add_str, #bold, #clear, #color, #draw, #move, #refresh, #reset_attrs, #setpos, #standend, #standout, #time_str, #wrap_str

Methods included from Chars

small_num

Constructor Details

#initialize(height: opts.length+6, sel: Selector) ⇒ Menu_With_Stats

Returns a new instance of Menu_With_Stats.



220
221
222
223
224
# File 'lib/cliptic/interface.rb', line 220

def initialize(height:opts.length+6, sel:Selector, **)
  super(height:height, sel:sel, sel_opts:opts, 
        tick:->{update_stats})
  @stat_win = Stat_Window.new(line:line+height)
end

Instance Attribute Details

#stat_winObject (readonly)

Returns the value of attribute stat_win.



219
220
221
# File 'lib/cliptic/interface.rb', line 219

def stat_win
  @stat_win
end

Instance Method Details

#enterObject



232
233
234
235
236
237
# File 'lib/cliptic/interface.rb', line 232

def enter
  hide
  Main::Player::Game.new(date:stat_date).play
  reset_pos
  show
end

#hideObject



228
229
230
231
# File 'lib/cliptic/interface.rb', line 228

def hide
  super
  stat_win.clear
end

#reset_posObject



238
239
240
241
# File 'lib/cliptic/interface.rb', line 238

def reset_pos
  super
  stat_win.move(line:line+height)
end

#update_statsObject



225
226
227
# File 'lib/cliptic/interface.rb', line 225

def update_stats
  stat_win.show(date:stat_date)
end