bugfix #30 && random bg in game
This commit is contained in:
@@ -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])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user