2022-11-11 12:42:11 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-11-13 07:54:46 +00:00
|
|
|
require_relative '../packer'
|
2022-11-11 12:42:11 +00:00
|
|
|
|
|
|
|
class GameInfo
|
|
|
|
attr_accessor :game_flags, :score_limit, :time_limit, :match_num, :match_current
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# basically to_network
|
|
|
|
# int array the server sends to the client
|
|
|
|
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
|
|
|
|
end
|