resource

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2022 License: BSD-3-Clause Imports: 5 Imported by: 25

Documentation

Index

Constants

View Source
const UriScheme = "res://"

Variables

This section is empty.

Functions

func GetTypeFromID

func GetTypeFromID(id string) (string, error)

func RegisterLoader

func RegisterLoader(resourceType string, loader Loader) error

RegisterManager registers a resource manager for the specified type

Types

type Config

type Config struct {
	ID   string          `json:"id"`
	Data json.RawMessage `json:"data"`
}

type Loader

type Loader interface {
	LoadResource(config *Config) (*Resource, error)
}

func GetLoader

func GetLoader(resourceType string) Loader

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(resources map[string]*Resource) *Manager

func (*Manager) CleanupResources

func (m *Manager) CleanupResources()

func (*Manager) GetResource

func (m *Manager) GetResource(id string) *Resource

func (*Manager) SetResource added in v1.1.0

func (m *Manager) SetResource(id string, res *Resource)

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

func New

func New(resType string, resObj interface{}) *Resource

func (*Resource) Object

func (r *Resource) Object() interface{}

func (*Resource) Type

func (r *Resource) Type() string

type ResourcesConfig

type ResourcesConfig struct {
	Resources []*Config `json:"resources"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL