Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uhyo/masao-js
Utilities for Canvas Masao.
https://github.com/uhyo/masao-js
canvas-masao masao masao-json-format
Last synced: about 1 month ago
JSON representation
Utilities for Canvas Masao.
- Host: GitHub
- URL: https://github.com/uhyo/masao-js
- Owner: uhyo
- Created: 2015-08-31T16:08:12.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-03-03T14:21:15.000Z (over 5 years ago)
- Last Synced: 2024-09-06T21:16:16.982Z (2 months ago)
- Topics: canvas-masao, masao, masao-json-format
- Language: TypeScript
- Size: 228 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# masao v0.1.12
```sh
npm install masao
````masao` is a utility package for handling the Canvas Masao params.
`masao.format` api can handle masao-json-format up to version: *draft-4*.
# API
## masao.param.getDefaultValue(key)
Returns the default value for param `key`.## masao.param.validateParam(params[, options])
Validates a param object `params`. Returns boolean value.* options.version (string; valid version string; default: `"kani2"`) Version of Masao.
* options.maxLength (number; default: `Infinity`) Restricts length of a string value.
* options.allowExtraneous (boolean; default: `true`) Allows `params` to have an extraneous field.
* options.allowNulls (boolean; default: `true`) Allows some params to be null.## masao.param.cutDefault(params)
Returns a new object where any field is the same, except the case that its value is the default value.## masao.param.addDefaults(params[, options])
Returns a new object with omitted default params attached.* options.version (string; valid version string) Version of masao.
* options.nomaps (boolean) Do not add map and layer params.
* options.noresources (boolean) Do not add resource params.## masao.param.sanitize(params[, version])
Returns a new object where extraneous fields are cut off.## masao.param.cutUnadvancedData(params)
Deletes all params that are unused when 'advanced-map' data is used, and return new object.## masao.format.load(obj)
Load masao-json-format object and returns new object that is upgraded to *draft-4*.Throws when it reads invalidly formatted object.
## masao.format.make(options)
Makes masao-json-format object.## masao.playlog.parse(buf)
Parses Buffer as a masao-playlog-format object and returns an object in the following form:{
score: 100, //eventual score
stage: 1 //the last stage that is passed
}Throws if the data is invalid.
## masao.load.html(buf)
Extract masao-json-format game object for given HTML string.
Requires JavaScript APIs on browsers.
Returns Promise.## masao.customParts.customPartsProperties
Dictonary of available custom properties for each chip code.```js
customPartsProperties = {
5100: {
walk_speed: {
type: 'integer',
unit: 'px/f',
description: '歩く速度',
default: 3,
},
},
/* ... */
};
```# License
MIT