|
|
|
@ -64,6 +64,7 @@ function des_event(d, state = null) {
@@ -64,6 +64,7 @@ function des_event(d, state = null) {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case EVENT.USER_JOINED: |
|
|
|
|
case EVENT.LEAVE: |
|
|
|
|
case EVENT.CLEAR: { |
|
|
|
|
break; |
|
|
|
@ -172,6 +173,12 @@ function handle_event(state, context, event, options = {}) {
@@ -172,6 +173,12 @@ function handle_event(state, context, event, options = {}) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (event.type) { |
|
|
|
|
case EVENT.USER_JOINED: { |
|
|
|
|
state.players[event.user_id].online = true; |
|
|
|
|
draw_html(state); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case EVENT.PREDRAW: { |
|
|
|
|
geometry_add_point(state, context, event.user_id, {'x': event.x, 'y': event.y}); |
|
|
|
|
need_draw = true; |
|
|
|
@ -410,8 +417,10 @@ async function handle_message(state, context, d) {
@@ -410,8 +417,10 @@ async function handle_message(state, context, d) {
|
|
|
|
|
const user_id = des_u32(d); |
|
|
|
|
const user_color = des_u32(d); |
|
|
|
|
const user_width = des_u16(d); |
|
|
|
|
const user_online = des_u8(d); |
|
|
|
|
|
|
|
|
|
init_player_defaults(state, user_id, user_color, user_width); |
|
|
|
|
state.players[user_id].online = user_online === 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
des_align(d, 4); |
|
|
|
@ -439,6 +448,8 @@ async function handle_message(state, context, d) {
@@ -439,6 +448,8 @@ async function handle_message(state, context, d) {
|
|
|
|
|
|
|
|
|
|
console.timeEnd('init'); |
|
|
|
|
|
|
|
|
|
draw_html(state); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|