Sfoglia il codice sorgente

fix:MapContext支持UIModule

chenbin 1 mese fa
parent
commit
9e2646d56e

+ 4 - 4
Assets/Scripts/Business/Runtime/Launch/FLGameLogic.cs

@@ -94,14 +94,14 @@ namespace FL.Launch
             var timeModule = new TimeModule();
             timeModule.Initialize();
             _timeModule = timeModule;
-            //Map
-            var mapBuilder = new MapModuleBuilder();
-            mapBuilder.Build(qualityModule, timeModule);
-            _mapModule = mapBuilder.Product;
             //UI
             var uiBuilder = new FguiModuleBuilder();
             uiBuilder.Build(qualityModule, _timeModule);
             _uiModule = uiBuilder.Product;
+            //Map
+            var mapBuilder = new MapModuleBuilder();
+            mapBuilder.Build(qualityModule, timeModule, _uiModule);
+            _mapModule = mapBuilder.Product;
             //NodeTree
             var nodeBuild = new NodeTreeBuilder();
             nodeBuild.Build(qualityModule, timeModule, _uiModule, _mapModule, typeof(FLAppNode));

+ 3 - 2
Assets/Scripts/Framework/Runtime/Map/Impl/MapModuleBuilder.cs

@@ -2,18 +2,19 @@
 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)
+        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);
+            var context = new MapContext(qualityModule, timeModule, mapModule, uiModule);
             (mapModule as IMapContextSetter).Context = context;
             Product = mapModule;
         }

+ 5 - 2
Assets/Scripts/Framework/Runtime/Map/MapContext.cs

@@ -1,6 +1,7 @@
 using System;
 using XGame.Framework.Quality;
 using XGame.Framework.Time;
+using XGame.Framework.UI;
 
 namespace XGame.Framework.Map
 {
@@ -13,6 +14,7 @@ namespace XGame.Framework.Map
         public ITimeProxy Time => _timeProxy ?? (_timeProxy = new TimeProxy(_timeModule));
 
         public IMapModule Map { get; private set; }
+        public IUIModule UI { get; private set; }
 
         /// <summary>
         /// 资源加载模块,需要时才创建
@@ -20,16 +22,17 @@ namespace XGame.Framework.Map
         private IMapAssetModule _assetModule;
         public IMapAssetModule Asset => _assetModule ?? (_assetModule = new MapAssetModule(this));
 
-        public MapContext(IQualityModule quality, ITimeModule time, IMapModule map)
+        public MapContext(IQualityModule quality, ITimeModule time, IMapModule map, IUIModule ui)
         {
             Quality = quality;
             _timeModule = time;
             Map = map;
+            UI = ui;
         }
 
         public MapContext Clone()
         {
-            return new MapContext(Quality, _timeModule, Map);
+            return new MapContext(Quality, _timeModule, Map, UI);
         }
         /// <summary>
         /// 取消定时器、清理资源加载监听等