Documentation ¶
Overview ¶
Package unblock decodes blockly style story files into tapestry commands.
Index ¶
- func Decode(dst typeinfo.Instance, topBlock string, reg Creator, msg json.RawMessage) (err error)
- func DecodeBlock(dst typeinfo.Instance, reg Creator, top *BlockInfo) (err error)
- type BlockInfo
- func (bi *BlockInfo) CountFields(term string) (retStart, retCnt int)
- func (bi *BlockInfo) CountInputs(term string) (retStart, retCnt int)
- func (bi *BlockInfo) ReadInput(idx int) (ret Input, err error)
- func (bi *BlockInfo) SliceFields(term string) js.MapSlice
- func (bi *BlockInfo) SliceInputs(term string) js.MapSlice
- type Comment
- type Creator
- type File
- type Icons
- type Input
- type TopBlocks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockInfo ¶
type BlockInfo struct { Id string `json:"id"` Type string `json:"type"` ExtraState map[string]int `json:"extraState"` Icons Icons `json:"icons"` Inputs js.MapSlice `json:"inputs"` Fields js.MapSlice `json:"fields"` Next *Input `json:"next"` }
a stored blockly block recursive in the sense that inputs can contain other blocks note while in shape definitions fields are stored inside of inputs; in block data fields get stored separate from inputs, keyed by field name.
func (*BlockInfo) CountFields ¶
func (*BlockInfo) CountInputs ¶
return the number of term# formatted inputs
func (*BlockInfo) SliceFields ¶
return the number of term# formatted fields
type Comment ¶
type Comment struct { Text string `json:"text"` Pinned bool `json:"pinned"` Height int `json:"height"` Width int `json:"width"` }
this is how blockly handles comments fix? move to make part of the mutation ( as extra data )
type Creator ¶
func MakeBlockCreator ¶
type File ¶
type File struct {
TopBlocks `json:"blocks"`
}
describes a blockly file https://developers.google.com/blockly/guides/configure/web/serialization?hl=en
type Icons ¶
type Icons struct {
Comment *Comment `json:"comment"`
}
blockly stores comments inside of the icon representing the comment