Module: RoundsView

Defined in:
lib/views/rounds_view.rb

Class Method Summary collapse

Class Method Details

.display_results(round) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/views/rounds_view.rb', line 11

def display_results(round)
    print "\nYou chose: ".colorize(:light_yellow)
    sleep(0.5)
    puts round.player_selection
    sleep(0.5)
    print "Your opponent chose: ".colorize(:light_yellow)
    sleep(0.5)
    puts round.ai_selection
    sleep(1)
    puts "\nYou #{round.determine_result}".colorize(:light_yellow)
    Sound.new(Round.get_sound(round.result)).play     
end

.input(round:, round_number:) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/views/rounds_view.rb', line 2

def input(round:, round_number:)
    puts "Round: #{round_number}".colorize(:light_yellow)
    TTY::Prompt.new.select("\nPlease choose your desired faction:".colorize(:light_yellow), help: '') do |menu|
        menu.choice "Sith".colorize(:light_red), 0
        menu.choice "Jedi".colorize(:light_cyan), 1
        menu.choice "Ewok".colorize(:light_green), 2
    end
end

.successful_saveObject



24
25
26
27
# File 'lib/views/rounds_view.rb', line 24

def successful_save
    puts "\nRound saved successfully".colorize(:grey)
    TTY::Prompt.new.keypress("\nPress any key to continue".colorize(:light_magenta))
end