MapModuleBuilder.cs 992 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using XGame.Framework.Asset;
  3. using XGame.Framework.Quality;
  4. using XGame.Framework.Time;
  5. using XGame.Framework.UI;
  6. namespace XGame.Framework.Map
  7. {
  8. public class MapModuleBuilder
  9. {
  10. public IMapModule Product { get; private set; }
  11. public void Build(IQualityModule qualityModule, ITimeModule timeModule, IUIModule uiModule)
  12. {
  13. var assetModule = new AssetModule();
  14. var root = CreateRoot();
  15. var mapModule = new MapModule(assetModule, root);
  16. var context = new MapContext(qualityModule, timeModule, mapModule, uiModule);
  17. (mapModule as IMapContextSetter).Context = context;
  18. Product = mapModule;
  19. }
  20. private Transform CreateRoot()
  21. {
  22. var go = new GameObject("MapRoot");
  23. go.transform.SetParent(AppManager.Root, false);
  24. go.transform.localPosition = new Vector3(0, 100, 0);
  25. return go.transform;
  26. }
  27. }
  28. }