protected BaseScreen(ITagContainer diContainer, BlockFlags blockFlags) : base(diContainer.GetTag <DefaultEcs.World>(), CreateEntityContainer, useBuffer: false) { this.blockFlags = blockFlags; zzContainer = diContainer.GetTag <IZanzarahContainer>(); zanzarah = diContainer.GetTag <Zanzarah>(); ui = diContainer.GetTag <UI>(); preload = ui.GetTag <UIPreloader>(); uiWorld = ui.GetTag <DefaultEcs.World>(); World.SetMaxCapacity <TComponent>(1); openSubscription = World.Subscribe <TMessage>(HandleOpen); addedSubscription = World.SubscribeComponentAdded <TComponent>(HandleAdded); removedSubscription = World.SubscribeComponentRemoved <TComponent>(HandleRemoved); }
public UI(ITagContainer diContainer) { tagContainer = new TagContainer().FallbackTo(diContainer); zzContainer = GetTag <IZanzarahContainer>(); zzContainer.OnResize += HandleResize; time = GetTag <GameTime>(); var resourceFactory = GetTag <ResourceFactory>(); graphicsDevice = GetTag <GraphicsDevice>(); projectionBuffer = resourceFactory.CreateBuffer( // Buffer has to be multiple of 16 bytes big even though we only need 8 new BufferDescription(sizeof(float) * 4, BufferUsage.UniformBuffer)); HandleResize(); AddTag(this); AddTag(ecsWorld = new DefaultEcs.World()); AddTag(new resources.UIBitmap(this)); AddTag(new resources.UITileSheet(this)); AddTag(Preload = new systems.ui.UIPreloader(this)); CursorEntity = ecsWorld.CreateEntity(); CursorEntity.Set <Rect>(); CursorEntity.Set <components.Visibility>(); updateSystems = new systems.RecordingSequentialSystem <float>(this); updateSystems.Add( new systems.ui.Cursor(this), new systems.ui.ScrDeck(this), new systems.ui.ScrGotCard(this), new systems.ui.ButtonTiles(this), new systems.ui.Slider(this), new systems.ui.AnimatedLabel(this), new systems.ui.Label(this), new systems.ui.Tooltip(this), new systems.ui.CorrectRenderOrder(this), new systems.ui.Fade(this), new systems.Reaper(this), new systems.ParentReaper(this)); renderSystems = new SequentialSystem <CommandList>( new systems.ui.Batcher(this)); }