demo
This commit is contained in:
@@ -66,6 +66,7 @@ function registerEvents(registry, events) {
|
||||
const PASSWORD_INPUT = '<input className="input" type="password" placeholder="password" />';
|
||||
const LOGIN_BUTTON = '<button type="submit">Login</button>';
|
||||
const REGISTER_BUTTON = '<button type="submit">Register</button>';
|
||||
const DEMO_BUTTON = '<button type="submit">Demo</button>';
|
||||
|
||||
const ws = registry.get('ws');
|
||||
|
||||
@@ -81,6 +82,10 @@ function registerEvents(registry, events) {
|
||||
ws.sendAccountCreate(USERNAME, PASSWORD);
|
||||
}
|
||||
|
||||
function submitDemo() {
|
||||
ws.sendAccountDemo();
|
||||
}
|
||||
|
||||
const existing = document.querySelector('#login'); // Selector of your toast
|
||||
if (existing) toast.hide({}, existing, 'reconnect');
|
||||
|
||||
@@ -101,6 +106,7 @@ function registerEvents(registry, events) {
|
||||
buttons: [
|
||||
[LOGIN_BUTTON, submitLogin], // true to focus
|
||||
[REGISTER_BUTTON, submitRegister], // true to focus
|
||||
[DEMO_BUTTON, submitDemo], // true to focus
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ function createSocket(events) {
|
||||
send({ method: 'account_create', params: { name, password } });
|
||||
}
|
||||
|
||||
function sendAccountDemo() {
|
||||
send({ method: 'account_demo', params: {} });
|
||||
}
|
||||
|
||||
function sendAccountCryps() {
|
||||
send({ method: 'account_cryps', params: {} });
|
||||
}
|
||||
@@ -186,7 +190,7 @@ function createSocket(events) {
|
||||
|
||||
if (!account) events.loginPrompt();
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
||||
// send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -216,6 +220,7 @@ function createSocket(events) {
|
||||
return {
|
||||
sendAccountLogin,
|
||||
sendAccountCreate,
|
||||
sendAccountDemo,
|
||||
sendAccountCryps,
|
||||
sendAccountItems,
|
||||
sendGameState,
|
||||
|
||||
Reference in New Issue
Block a user