Adds top seat, player, controls
This commit is contained in:
parent
7183d91d7c
commit
aab6008279
@ -100,3 +100,28 @@
|
|||||||
- if @game.started?
|
- if @game.started?
|
||||||
.inventory-count= @seats[0].player.inventory.count
|
.inventory-count= @seats[0].player.inventory.count
|
||||||
|
|
||||||
|
-# Show player controls if player is owned by current_user
|
||||||
|
- if @seats[0].player.soft_token = current_user.soft_token
|
||||||
|
= form_for @game, play_hand_game_path
|
||||||
|
%ul#inventory
|
||||||
|
- @seats[0].player.inventory.each do |card|
|
||||||
|
%li
|
||||||
|
%label
|
||||||
|
%input{form: "player_controls_" + card.player_id,
|
||||||
|
type: "checkbox",
|
||||||
|
name: "player_card_ids[]",
|
||||||
|
data: {card_name: card.rank.gsub('11','J') .gsub('12','Q') .gsub('13','K') .gsub('14','A') .gsub('15','2') + ' ' + card.suit}, value: card.id}
|
||||||
|
%img{src: "/assets/cards/png/" + (card.rank.gsub('J','jack').gsub('Q','queen').gsub('K','king').gsub('A','ace') + '_of_' + card.suit.downcase + "s.png").gsub('11','jack') .gsub('12','queen') .gsub('13','king') .gsub('14','ace') .gsub('15','2') }
|
||||||
|
-# = image_tag("hi")
|
||||||
|
|
||||||
|
|
||||||
|
%input{type: "submit",
|
||||||
|
value: "Play Hand",
|
||||||
|
name: "commit"}
|
||||||
|
|
||||||
|
%input{disabled: (@game.controlling_player_id == @seats[0].player.id ? nil : "disabled"),
|
||||||
|
type: "submit",
|
||||||
|
value: "Pass",
|
||||||
|
name: "pass"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Rails.application.routes.draw do
|
|||||||
get 'my-inventory'
|
get 'my-inventory'
|
||||||
post 'start'
|
post 'start'
|
||||||
post 'join'
|
post 'join'
|
||||||
patch 'play_hand'
|
post 'play_hand'
|
||||||
end
|
end
|
||||||
resources :seats do
|
resources :seats do
|
||||||
member do
|
member do
|
||||||
|
|||||||
@ -1,69 +1,29 @@
|
|||||||
{/* Show player controls if player is owned by current_user */}
|
<div className="game-seat position-2">
|
||||||
{(this.props.soft_token == this.props.game.current_user_soft_token) && (this.props.game.is_started == true)
|
<Seat
|
||||||
? (<PlayerControls
|
{...this.props.game.seats[1]}
|
||||||
key={this.props.id}
|
game={this.props.game}
|
||||||
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
||||||
game_id={this.props.game.id}
|
current_user={this.props.current_user}
|
||||||
player_id={this.props.id}
|
onSeatSubmit={this.props.onSeatSubmit} />
|
||||||
inventory={this.props.inventory}
|
</div>
|
||||||
controlling_player_id={this.props.game.controlling_player_id} /> )
|
<HandToBeat cards={this.props.game.cards_to_beat} />
|
||||||
:
|
<div className="game-seat position-3">
|
||||||
<div className='inventory'>
|
<Seat
|
||||||
{[...Array(this.props.inventory_count)].map((card, index) => <img key={index} src='/assets/cards/png/back-pink.png' />)}
|
{...this.props.game.seats[2]}
|
||||||
</div>
|
game={this.props.game}
|
||||||
}
|
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
||||||
|
current_user={this.props.current_user}
|
||||||
|
onSeatSubmit={this.props.onSeatSubmit} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="bot">
|
||||||
|
<div className="game-seat position-4">
|
||||||
|
<Seat
|
||||||
|
{...this.props.game.seats[3]}
|
||||||
|
game={this.props.game}
|
||||||
|
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
||||||
|
current_user={this.props.current_user}
|
||||||
|
onSeatSubmit={this.props.onSeatSubmit} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Player
|
|
||||||
game={this.props.game}
|
|
||||||
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
|
||||||
{...this.props.player} />
|
|
||||||
: "Empty" }
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<Seat
|
|
||||||
{...this.props.game.seats[0]}
|
|
||||||
game={this.props.game}
|
|
||||||
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
|
||||||
current_user={this.props.current_user}
|
|
||||||
onSeatSubmit={this.props.onSeatSubmit} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="mid">
|
|
||||||
<div className="game-seat position-2">
|
|
||||||
<Seat
|
|
||||||
{...this.props.game.seats[1]}
|
|
||||||
game={this.props.game}
|
|
||||||
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
|
||||||
current_user={this.props.current_user}
|
|
||||||
onSeatSubmit={this.props.onSeatSubmit} />
|
|
||||||
</div>
|
|
||||||
<HandToBeat cards={this.props.game.cards_to_beat} />
|
|
||||||
<div className="game-seat position-3">
|
|
||||||
<Seat
|
|
||||||
{...this.props.game.seats[2]}
|
|
||||||
game={this.props.game}
|
|
||||||
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
|
||||||
current_user={this.props.current_user}
|
|
||||||
onSeatSubmit={this.props.onSeatSubmit} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="bot">
|
|
||||||
<div className="game-seat position-4">
|
|
||||||
<Seat
|
|
||||||
{...this.props.game.seats[3]}
|
|
||||||
game={this.props.game}
|
|
||||||
onPlayHandSubmit={this.props.onPlayHandSubmit}
|
|
||||||
current_user={this.props.current_user}
|
|
||||||
onSeatSubmit={this.props.onSeatSubmit} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user