TestMainMapView.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using FL.Battle.Components;
  2. using FL.Map.TestMainMap;
  3. using UnityEngine;
  4. using XGame.Framework.Components;
  5. using XGame.Framework.Map;
  6. using XGame.Framework.ObjectCollection;
  7. using XGame.Framework.Time;
  8. namespace FL.Map
  9. {
  10. public static partial class MapKeys
  11. {
  12. private static MapKey _TestMainMap;
  13. public static MapKey TestMainMap => _TestMainMap ?? (_TestMainMap = new MapKey("TestMainMap", typeof(TestMainMapView)));
  14. }
  15. public class TestMainMapView : MapView<TestMainMapVM>, IEntitiesContext, IMapUIContext, IVfxContext
  16. {
  17. public IMapAssetModule Asset => Context.Asset;
  18. public ITimeModule Time => Context.Time;
  19. public VfxComponent Vfx => GetComponent<VfxComponent>();
  20. public MapUIComponent MapUI => GetComponent<MapUIComponent>();
  21. #region
  22. Transform IVfxContext.WorldTr => VM.VfxRoot;
  23. Transform IVfxContext.CenterTr => VM.VfxRoot;
  24. Transform IVfxContext.CastTr => VM.VfxRoot;
  25. #endregion
  26. protected override void AddComponent(IComponentGroup group)
  27. {
  28. group.Add(new EntitiesComponent());
  29. group.Add(new MapUIComponent());
  30. group.Add(new VfxComponent());
  31. }
  32. protected override TestMainMapVM CtreatViewModel(IObjectCollector collector)
  33. {
  34. return new TestMainMapVM(collector);
  35. }
  36. protected override void OnDispose()
  37. {
  38. }
  39. }
  40. }