1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-05 09:47:18 -05:00
OpenDiablo2/d2core/d2asset/d2asset.go
gravestench 271673851a
Added RecordManager implementation to remove d2datadict singletons (#736)
* Added RecordManager implementation to remove d2datadict singletons

* fix object lookup test
2020-09-19 14:33:40 -04:00

29 lines
824 B
Go

package d2asset
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2cache"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2loader"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2config"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2records"
)
// NewAssetManager creates and assigns all necessary dependencies for the AssetManager top-level functions to work correctly
func NewAssetManager(config *d2config.Configuration) (*AssetManager, error) {
manager := &AssetManager{
d2loader.NewLoader(config),
d2cache.CreateCache(tableBudget),
d2cache.CreateCache(animationBudget),
d2cache.CreateCache(fontBudget),
d2cache.CreateCache(paletteBudget),
d2cache.CreateCache(paletteTransformBudget),
&d2records.RecordManager{},
}
err := manager.init()
if err != nil {
return nil, err
}
return manager, nil
}