Skip to content

Instantly share code, notes, and snippets.

@dam13n
Created December 22, 2014 05:29
Show Gist options
  • Save dam13n/e6f2461ac79ee2b26375 to your computer and use it in GitHub Desktop.
Save dam13n/e6f2461ac79ee2b26375 to your computer and use it in GitHub Desktop.
class HomeController < UIViewController
include BW::KVO
def viewWillAppear(animated)
super
end
def viewDidLoad
super
# @start = "blah"
rmq.stylesheet = HomeControllerStylesheet
rmq(self.view).apply_style :root_view
rmq.append(UIImageView, :main_image)
rmq.append(UIButton, :add_players_button)
rmq.append(UIButton, :add_players_button).on(:tap) do |_|
add_players_view(self)
end
@start = rmq.append(UIButton, :start_game_button).on(:tap) do |_|
if Player.count >= 3
start_game(self)
else
App.alert('5 players minimum required to start a game.')
end
end
# rmq.append(UIView, :login_form).tap do |q|
# @email = q.append(UITextField, :email).get
# @password = q.append(UITextField, :password).get
# @add =
# end
# end
# BW::Media.play_modal("bitrap.mp3")
end
# def start_game(sender)
# q = Dispatch::Queue.new('muskotage')
# # background task
# q.async do
# Dispatch::Queue.main.sync do
# new_game_started = NewGameService.new(self, {}).process
# # AddPlayersService.new(self, {}).process
# end
# puts "new_game_starting"
# end
# end
def add_players_view(sender)
self.presentViewController(
UINavigationController.alloc.initWithRootViewController(PlayerListController.new),
animated: true,
completion: nil
)
# self.navigationController.pushViewController(PlayerListController.new, animated: true)
end
# def login(sender)
# self.presentViewController(
# UINavigationController.alloc.initWithRootViewController(LoginController.new),
# animated: true,
# completion: nil
# )
# end
# def refresh_display
# self.view.reloadData
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment