space.go 450 B

1234567891011121314151617181920212223
  1. package app
  2. type Space struct {
  3. packetDispatcher PacketDispatcher
  4. }
  5. func NewSpace() *Space {
  6. return new(Space)
  7. }
  8. func (this *Space) HasPacketDispatcher() bool {
  9. return this.packetDispatcher != nil
  10. }
  11. func (this *Space) PacketDispatcher() PacketDispatcher {
  12. return this.packetDispatcher
  13. }
  14. func (this *Space) Bind(object interface{}) {
  15. if packetDispatcher, ok := object.(PacketDispatcher); ok {
  16. this.packetDispatcher = packetDispatcher
  17. }
  18. }