bugfix #30 && random bg in game
This commit is contained in:
@@ -81,8 +81,8 @@ header section div > a {
|
||||
text-decoration: none;
|
||||
border: 1px solid #658fb8;
|
||||
color: #FFFFFF;
|
||||
padding: 25px 100px;
|
||||
margin-top: 20px;
|
||||
padding: 25px 150px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
-webkit-box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
|
||||
|
||||
|
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 456 KiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
@@ -181,13 +181,13 @@ class MineSeeker extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
wInit(session, data, gridClient) {
|
||||
wInit(session, gridServer, gridClient) {
|
||||
this.setState({session: session});
|
||||
|
||||
/** save session to GridControl */
|
||||
/** render grid fields - #12 */
|
||||
/** render grid fields - @see #12 */
|
||||
this.refs.gridControl.setState({
|
||||
grid: this.state.gameInherited ? JSON.parse(Base64.decode(data))['grid'] : gridClient,
|
||||
grid: this.state.gameInherited ? gridServer : gridClient,
|
||||
channel: this.state.channel,
|
||||
desc: {
|
||||
buddy: <div>
|
||||
@@ -317,10 +317,8 @@ class MineSeeker extends React.Component {
|
||||
/** Create Websocket w/ Bahnhof.js */
|
||||
let websocket = WS.connect(
|
||||
this.state.env === 'dev'
|
||||
// ? "ws://mine.dev:6450"
|
||||
// : "ws://www.mineseeker.ninja:6450"
|
||||
? "ws://mine.dev:6450"
|
||||
: (this.state.ssl === 'true' ? "wss" : "ws") + "://system7.ddns.net:443/"
|
||||
: (this.state.ssl === 'true' ? "wss" : "ws") + "://www.mineseeker.party:6450/"
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -346,8 +344,23 @@ class MineSeeker extends React.Component {
|
||||
(data) => {
|
||||
this.state.env === 'dev' && console.info('RPC has been called');
|
||||
|
||||
this.wInit(session, data, gridClient);
|
||||
this.subscribe(this.state.gameInherited && JSON.parse(Base64.decode(data))['users']);
|
||||
let serverData = data[0] !== true
|
||||
? JSON.parse(Base64.decode(data))
|
||||
: data;
|
||||
|
||||
/** Check the grid if the user is inherited @see #30 */
|
||||
if ((this.state.gameInherited && null !== serverData.grid) || !this.state.gameInherited) {
|
||||
this.wInit(session, serverData.grid, gridClient);
|
||||
this.subscribe(this.state.gameInherited && serverData.users);
|
||||
} else {
|
||||
this.refs.gridControl.setState({
|
||||
overlay: true,
|
||||
overlayTitle: "This channel does not exists!",
|
||||
overlaySubTitle: <a href={"/play"} target="_self">Restart game!</a>
|
||||
});
|
||||
|
||||
console.error("This channel does not exists!");
|
||||
}
|
||||
},
|
||||
(error, desc) => this.state.env === 'dev' && console.error(["RPC Error", error, desc])
|
||||
);
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
'@MineSeekerBundle/Resources/public/css/style.mineseeker.css' %}
|
||||
<link rel="stylesheet" media="screen" href="{{ asset_url }}" type="text/css"/>
|
||||
{% endstylesheets %}
|
||||
|
||||
<style type="text/css">
|
||||
.mine-container {
|
||||
background: url('/bundles/mineseeker/images/bg-mineseeker-{{ random(1) }}-outbg.jpg') no-repeat;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
|
||||
@@ -56,10 +56,13 @@ class MineseekerRpc implements RpcInterface
|
||||
*/
|
||||
public function connectGame(ConnectionInterface $connection, WampRequest $request, array $params)
|
||||
{
|
||||
$grid = $this->getGrid($params);
|
||||
$users = null !== $grid ? $this->getUsers($params) : null;
|
||||
|
||||
return base64_encode(json_encode(
|
||||
array(
|
||||
'grid' => $this->getGrid($params),
|
||||
'users' => $this->getUsers($params)
|
||||
'grid' => $grid,
|
||||
'users' => $users
|
||||
)
|
||||
));
|
||||
}
|
||||
@@ -77,14 +80,17 @@ class MineseekerRpc implements RpcInterface
|
||||
|
||||
$grid = $this->em
|
||||
->getRepository('MineSeekerBundle:PlayedGame')
|
||||
->findOneByGameAssoc($gameAssoc)
|
||||
->getGrid();
|
||||
->findOneByGameAssoc($gameAssoc);
|
||||
|
||||
foreach ($grid->getGridRow()->toArray() as $row) {
|
||||
$getsee[] = $row->getGridCol();
|
||||
if (null !== $grid) {
|
||||
foreach ($grid->getGrid()->getGridRow()->toArray() as $row) {
|
||||
$getsee[] = $row->getGridCol();
|
||||
}
|
||||
|
||||
return $getsee;
|
||||
}
|
||||
|
||||
return $getsee;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user