using UnityEngine;
using XGame.Framework.Asset;
using XGame.Framework.Quality;
using XGame.Framework.Time;
using XGame.Framework.UI;

namespace XGame.Framework.Map
{
    public class MapModuleBuilder
    {
        public IMapModule Product { get; private set; }
        public void Build(IQualityModule qualityModule, ITimeModule timeModule, IUIModule uiModule)
        {
            var assetModule = new AssetModule();
            var root = CreateRoot();
            var mapModule = new MapModule(assetModule, root);
            var context = new MapContext(qualityModule, timeModule, mapModule, uiModule);
            (mapModule as IMapContextSetter).Context = context;
            Product = mapModule;
        }
        private Transform CreateRoot()
        {
            var go = new GameObject("MapRoot");
            go.transform.SetParent(AppManager.Root, false);
            go.transform.localPosition = new Vector3(0, 100, 0);
            return go.transform;
        }
    }
}