Sha256: d44512756f8ee99fb0aa9f298057175c2cad94478d5d1f3b6e8677bd95d04ba9
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module GameMachine module DefaultHandlers class TeamHandler attr_reader :teams def initialize update_teams end def update_teams @teams = GameMachine::Models::Teams.find('teams') end # Should return a Match object if a match is found, otherwise nil def match!(team_name) GameMachine.logger.info "match! team_name:#{team_name} teams:#{teams}" if team = teams.teams.select {|team| team.name != team_name}.first return GameMachine::Models::StartMatch.new(:team_names => [team_name,team.name]) end nil end # Called when Game Machine has started the match def match_started(match) end # Filter you can apply to the teams list sent to clients # You can add whatever extra fields you want to the TeamsRequest # class on the client and they will show up here. def teams_filter(teams,teams_request) teams end # return true if member has rights to create team def can_create_team?(team_name,member) true end # return true if member has rights to join team def can_add_member?(team_name,member) true end def destroy_on_owner_leave? true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
game_machine-1.0.4 | lib/game_machine/default_handlers/team_handler.rb |
game_machine-1.0.2 | lib/game_machine/default_handlers/team_handler.rb |