Merge branch 'master' into turns
This commit is contained in:
commit
69e1a3fcea
14
client/src/components/login.component.jsx
Normal file → Executable file
14
client/src/components/login.component.jsx
Normal file → Executable file
@ -1,7 +1,7 @@
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
|
||||||
function renderLogin({ account, submitLogin }) {
|
function renderLogin({ account, submitLogin, submitRegister}) {
|
||||||
if (account) return <div>{JSON.stringify(account)}</div>;
|
if (account) return <div>{JSON.stringify(account)}</div>;
|
||||||
|
|
||||||
const details = {
|
const details = {
|
||||||
@ -42,12 +42,24 @@ function renderLogin({ account, submitLogin }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="field">
|
<div className="field">
|
||||||
<p className="control">
|
<p className="control">
|
||||||
|
<button
|
||||||
|
className="button inverted"
|
||||||
|
type="submit"
|
||||||
|
onClick={() => submitLogin("ntr", "grepgrepgrep")}>
|
||||||
|
Default
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className="button inverted"
|
className="button inverted"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => submitLogin(details.name, details.password)}>
|
onClick={() => submitLogin(details.name, details.password)}>
|
||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className="button inverted"
|
||||||
|
type="submit"
|
||||||
|
onClick={() => submitRegister(details.name, details.password)}>
|
||||||
|
Register
|
||||||
|
</button>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
6
client/src/components/login.container.jsx
Normal file → Executable file
6
client/src/components/login.container.jsx
Normal file → Executable file
@ -8,8 +8,10 @@ const addState = connect(
|
|||||||
function submitLogin(name, password) {
|
function submitLogin(name, password) {
|
||||||
return ws.sendAccountLogin(name, password);
|
return ws.sendAccountLogin(name, password);
|
||||||
}
|
}
|
||||||
|
function submitRegister(name, password) {
|
||||||
return { account: state.account, submitLogin };
|
return ws.sendAccountRegister(name, password);
|
||||||
|
}
|
||||||
|
return { account: state.account, submitLogin, submitRegister };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
7
client/src/socket.jsx
Normal file → Executable file
7
client/src/socket.jsx
Normal file → Executable file
@ -24,7 +24,7 @@ function createSocket(store) {
|
|||||||
|
|
||||||
// Connection opened
|
// Connection opened
|
||||||
ws.addEventListener('open', function wsOpen(event) {
|
ws.addEventListener('open', function wsOpen(event) {
|
||||||
send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
//send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen for messages
|
// Listen for messages
|
||||||
@ -101,6 +101,10 @@ function createSocket(store) {
|
|||||||
send({ method: 'account_login', params: { name, password } });
|
send({ method: 'account_login', params: { name, password } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendAccountRegister(name, password) {
|
||||||
|
send({ method: 'account_create', params: { name, password } });
|
||||||
|
}
|
||||||
|
|
||||||
function sendCrypSpawn(name) {
|
function sendCrypSpawn(name) {
|
||||||
send({ method: 'cryp_spawn', params: { name } });
|
send({ method: 'cryp_spawn', params: { name } });
|
||||||
}
|
}
|
||||||
@ -148,6 +152,7 @@ function createSocket(store) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
sendAccountLogin,
|
sendAccountLogin,
|
||||||
|
sendAccountRegister,
|
||||||
sendCombatPve,
|
sendCombatPve,
|
||||||
sendCrypSpawn,
|
sendCrypSpawn,
|
||||||
sendItemUse,
|
sendItemUse,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user