2014-08-27 15:24:03 -04:00
|
|
|
c = require 'schemas/schemas'
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
spriteMouseEventSchema = c.object {required: ['sprite', 'thang', 'originalEvent', 'canvas']},
|
|
|
|
sprite: {type: 'object'}
|
|
|
|
thang: {type: 'object'}
|
|
|
|
originalEvent: {type: 'object'}
|
|
|
|
canvas: {type: 'object'}
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
module.exports = # /app/lib/surface
|
|
|
|
'camera:dragged': c.object {}
|
|
|
|
|
|
|
|
'camera:zoom-in': c.object {}
|
|
|
|
|
|
|
|
'camera:zoom-out': c.object {}
|
|
|
|
|
|
|
|
'camera:zoom-to': c.object {required: ['pos']},
|
|
|
|
pos: c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
|
|
|
duration: {type: 'number', minimum: 0}
|
|
|
|
|
|
|
|
'camera:zoom-updated': c.object {required: ['camera', 'zoom', 'surfaceViewport']},
|
|
|
|
camera: {type: 'object'}
|
|
|
|
zoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
|
|
|
|
surfaceViewport: {type: 'object'}
|
|
|
|
|
|
|
|
'camera:set-camera': c.object {},
|
|
|
|
pos: c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
|
|
|
thangID: {type: 'string'}
|
|
|
|
zoom: {type: 'number'}
|
|
|
|
duration: {type: 'number', minimum: 0}
|
|
|
|
bounds: c.array {maxItems: 2, minItems: 2},
|
|
|
|
c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
|
|
|
|
|
|
|
'sprite:speech-updated': c.object {required: ['sprite', 'thang']},
|
|
|
|
sprite: {type: 'object'}
|
2014-08-28 01:23:24 -04:00
|
|
|
thang: {type: ['object', 'null']}
|
2014-09-03 19:14:33 -04:00
|
|
|
blurb: {type: ['string', 'null', 'undefined']}
|
2014-08-27 15:24:03 -04:00
|
|
|
message: {type: 'string'}
|
|
|
|
mood: {type: 'string'}
|
2014-08-27 21:43:17 -04:00
|
|
|
responses: {type: ['array', 'null', 'undefined']}
|
2014-08-27 15:24:03 -04:00
|
|
|
spriteID: {type: 'string'}
|
|
|
|
sound: {type: ['null', 'undefined', 'object']}
|
|
|
|
|
|
|
|
'level:sprite-dialogue': c.object {required: ['spriteID', 'message']},
|
2014-09-03 19:14:33 -04:00
|
|
|
blurb: {type: ['string', 'null', 'undefined']}
|
2014-08-27 15:24:03 -04:00
|
|
|
message: {type: 'string'}
|
|
|
|
mood: {type: 'string'}
|
2014-08-27 21:43:17 -04:00
|
|
|
responses: {type: ['array', 'null', 'undefined']}
|
2014-08-27 15:24:03 -04:00
|
|
|
spriteID: {type: 'string'}
|
|
|
|
sound: {type: ['null', 'undefined', 'object']}
|
|
|
|
|
|
|
|
'sprite:dialogue-sound-completed': c.object {}
|
|
|
|
|
|
|
|
'level:sprite-clear-dialogue': c.object {}
|
|
|
|
|
|
|
|
'surface:gold-changed': c.object {required: ['team', 'gold']},
|
|
|
|
team: {type: 'string'}
|
|
|
|
gold: {type: 'number'}
|
|
|
|
goldEarned: {type: 'number'}
|
|
|
|
|
|
|
|
'surface:coordinate-selected': c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
2014-08-28 17:00:54 -04:00
|
|
|
z: {type: 'number'}
|
2014-08-27 15:24:03 -04:00
|
|
|
|
|
|
|
'surface:coordinates-shown': c.object {}
|
|
|
|
|
|
|
|
'sprite:loaded': c.object {},
|
|
|
|
sprite: {type: 'object'}
|
|
|
|
|
|
|
|
'surface:choose-point': c.object {required: ['point']},
|
|
|
|
point: c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
2014-08-28 20:08:05 -04:00
|
|
|
z: {type: 'number'}
|
2014-08-27 15:24:03 -04:00
|
|
|
|
|
|
|
'surface:choose-region': c.object {required: ['points']},
|
|
|
|
points: c.array {minItems: 2, maxItems: 2},
|
|
|
|
c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
2014-08-28 20:08:05 -04:00
|
|
|
z: {type: 'number'}
|
2014-08-27 15:24:03 -04:00
|
|
|
|
|
|
|
'surface:new-thang-added': c.object {required: ['thang', 'sprite']},
|
|
|
|
thang: {type: 'object'}
|
|
|
|
sprite: {type: 'object'}
|
|
|
|
|
|
|
|
'surface:sprite-selected': c.object {required: ['thang', 'sprite']},
|
|
|
|
thang: {type: ['object', 'null', 'undefined']}
|
|
|
|
sprite: {type: ['object', 'null', 'undefined']}
|
|
|
|
spellName: {type: ['string', 'null', 'undefined']}
|
|
|
|
originalEvent: {type: ['object', 'null', 'undefined']}
|
|
|
|
worldPos: {type: ['object', 'null', 'undefined']}
|
|
|
|
|
|
|
|
'sprite:thang-began-talking': c.object {},
|
|
|
|
thang: {type: 'object'}
|
|
|
|
|
|
|
|
'sprite:thang-finished-talking': c.object {},
|
|
|
|
thang: {type: 'object'}
|
|
|
|
|
|
|
|
'sprite:highlight-sprites': c.object {},
|
|
|
|
thangIDs: c.array {}, {type: 'string'}
|
2014-08-28 12:27:42 -04:00
|
|
|
delay: {type: ['number', 'null', 'undefined']}
|
2014-08-27 15:24:03 -04:00
|
|
|
|
|
|
|
'sprite:move': c.object {required: ['spriteID', 'pos']},
|
|
|
|
spriteID: {type: 'string'}
|
|
|
|
pos: c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
2014-08-28 12:27:42 -04:00
|
|
|
z: {type: 'number'}
|
2014-08-27 15:24:03 -04:00
|
|
|
duration: {type: 'number', minimum: 0}
|
|
|
|
|
|
|
|
'sprite:mouse-down': spriteMouseEventSchema
|
|
|
|
'sprite:clicked': spriteMouseEventSchema
|
|
|
|
'sprite:double-clicked': spriteMouseEventSchema
|
|
|
|
'sprite:dragged': spriteMouseEventSchema
|
|
|
|
'sprite:mouse-up': spriteMouseEventSchema
|
|
|
|
|
|
|
|
'surface:frame-changed': c.object {required: ['frame', 'world', 'progress']},
|
|
|
|
frame: {type: 'number', minimum: 0}
|
|
|
|
world: {type: 'object'}
|
|
|
|
progress: {type: 'number', minimum: 0, maximum: 1}
|
|
|
|
selectedThang: {type: ['object', 'null', 'undefined']}
|
|
|
|
|
|
|
|
'surface:playback-ended': c.object {}
|
|
|
|
|
|
|
|
'surface:playback-restarted': c.object {}
|
|
|
|
|
|
|
|
'surface:mouse-moved': c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
|
|
|
|
|
|
|
'surface:stage-mouse-down': c.object {required: ['onBackground', 'x', 'y', 'originalEvent']},
|
|
|
|
onBackground: {type: 'boolean'}
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
|
|
|
originalEvent: {type: 'object'}
|
|
|
|
worldPos: {type: ['object', 'null', 'undefined']}
|
|
|
|
|
2014-08-27 20:26:56 -04:00
|
|
|
'surface:stage-mouse-up': c.object {required: ['onBackground', 'originalEvent']},
|
2014-08-27 15:24:03 -04:00
|
|
|
onBackground: {type: 'boolean'}
|
2014-08-27 21:05:18 -04:00
|
|
|
x: {type: ['number', 'undefined']}
|
|
|
|
y: {type: ['number', 'undefined']}
|
2014-08-27 15:24:03 -04:00
|
|
|
originalEvent: {type: 'object'}
|
|
|
|
|
2014-08-27 21:05:18 -04:00
|
|
|
'surface:mouse-scrolled': c.object {required: ['deltaX', 'deltaY', 'canvas']},
|
2014-08-27 15:24:03 -04:00
|
|
|
deltaX: {type: 'number'}
|
|
|
|
deltaY: {type: 'number'}
|
|
|
|
screenPos: c.object {required: ['x', 'y']},
|
|
|
|
x: {type: 'number'}
|
|
|
|
y: {type: 'number'}
|
|
|
|
canvas: {type: 'object'}
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
'surface:ticked': c.object {required: ['dt']},
|
|
|
|
dt: {type: 'number'}
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
'surface:mouse-over': c.object {}
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
'surface:mouse-out': c.object {}
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
'sprite:echo-all-wizard-sprites': c.object {required: ['payload']},
|
|
|
|
payload: c.array {}, {type: 'object'}
|
2014-04-11 08:22:49 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
'self-wizard:created': c.object {required: ['sprite']},
|
|
|
|
sprite: {type: 'object'}
|
2014-08-24 19:09:06 -04:00
|
|
|
|
2014-08-27 15:24:03 -04:00
|
|
|
'self-wizard:target-changed': c.object {required: ['sprite']},
|
|
|
|
sprite: {type: 'object'}
|
|
|
|
|
|
|
|
'surface:flag-appeared': c.object {required: ['sprite']},
|
|
|
|
sprite: {type: 'object'}
|
|
|
|
|
|
|
|
'surface:remove-selected-flag': c.object {}
|
2014-08-24 19:09:06 -04:00
|
|
|
|
2014-09-04 23:10:04 -04:00
|
|
|
'surface:remove-flag': c.object {required: ['color']},
|
2014-08-27 15:24:03 -04:00
|
|
|
color: {type: 'string'}
|