You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jordanorelli/hyperstone/bit"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Context struct {
|
|
|
|
Namespace
|
|
|
|
entities map[int]Entity
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewContext() *Context {
|
|
|
|
return &Context{entities: make(map[int]Entity)}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Context) CreateEntity(id int, r bit.Reader) {
|
|
|
|
classId := int(c.readClassId(r))
|
|
|
|
r.ReadBits(17) // ???
|
|
|
|
classV := int(bit.ReadVarInt(r))
|
|
|
|
className := c.classIds[classId]
|
|
|
|
class := c.Class(className, classV)
|
|
|
|
e := class.New()
|
|
|
|
e.Read(r)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Context) UpdateEntity(id int, r bit.Reader) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Context) DeleteEntity(id int) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Context) LeaveEntity(id int) {
|
|
|
|
|
|
|
|
}
|