Class: GameInfo
- Inherits:
-
Object
- Object
- GameInfo
- Defined in:
- lib/messages/game_info.rb
Instance Attribute Summary collapse
-
#game_flags ⇒ Object
Returns the value of attribute game_flags.
-
#match_current ⇒ Object
Returns the value of attribute match_current.
-
#match_num ⇒ Object
Returns the value of attribute match_num.
-
#score_limit ⇒ Object
Returns the value of attribute score_limit.
-
#time_limit ⇒ Object
Returns the value of attribute time_limit.
Instance Method Summary collapse
-
#initialize(attr = {}) ⇒ GameInfo
constructor
A new instance of GameInfo.
-
#to_a ⇒ Object
basically to_network int array the server sends to the client.
Constructor Details
#initialize(attr = {}) ⇒ GameInfo
Returns a new instance of GameInfo.
8 9 10 11 12 13 14 |
# File 'lib/messages/game_info.rb', line 8 def initialize(attr = {}) @game_flags = attr[:game_flags] || 0 @score_limit = attr[:score_limit] || 0 @time_limit = attr[:time_limit] || 0 @match_num = attr[:match_num] || 0 @match_current = attr[:match_current] || 0 end |
Instance Attribute Details
#game_flags ⇒ Object
Returns the value of attribute game_flags.
6 7 8 |
# File 'lib/messages/game_info.rb', line 6 def game_flags @game_flags end |
#match_current ⇒ Object
Returns the value of attribute match_current.
6 7 8 |
# File 'lib/messages/game_info.rb', line 6 def match_current @match_current end |
#match_num ⇒ Object
Returns the value of attribute match_num.
6 7 8 |
# File 'lib/messages/game_info.rb', line 6 def match_num @match_num end |
#score_limit ⇒ Object
Returns the value of attribute score_limit.
6 7 8 |
# File 'lib/messages/game_info.rb', line 6 def score_limit @score_limit end |
#time_limit ⇒ Object
Returns the value of attribute time_limit.
6 7 8 |
# File 'lib/messages/game_info.rb', line 6 def time_limit @time_limit end |
Instance Method Details
#to_a ⇒ Object
basically to_network int array the server sends to the client
18 19 20 21 22 23 24 |
# File 'lib/messages/game_info.rb', line 18 def to_a Packer.pack_int(@game_flags) + Packer.pack_int(@score_limit) + Packer.pack_int(@time_limit) + Packer.pack_int(@match_num) + Packer.pack_int(@match_current) end |