public PlayerTriggers(ITagContainer diContainer) { world = diContainer.GetTag <DefaultEcs.World>(); playerControls = diContainer.GetTag <PlayerControls>(); zzContainer = diContainer.GetTag <IZanzarahContainer>(); zzContainer.OnMouseDown += HandleMouseDown; var game = diContainer.GetTag <Game>(); cameraLocation = diContainer.GetTag <rendering.Camera>().Location; playerLocationLazy = new Lazy <Location>(() => game.PlayerEntity.Get <Location>()); npcMarker = world.CreateEntity(); npcMarker.Set(new Location()); npcMarker.Set(new components.behaviour.Rotate(Vector3.UnitY, 90f)); npcMarker.Set(ManagedResource <ClumpBuffers> .Create( new resources.ClumpInfo(resources.ClumpType.Model, "marker.dff"))); ModelLoader.LoadMaterialsFor(npcMarker, zzio.scn.FOModelRenderType.Solid, zzio.IColor.Green, new zzio.SurfaceProperties(1f, 1f, 1f)); var materials = npcMarker.Get <List <materials.BaseModelInstancedMaterial> >(); foreach (var material in materials) { material.Uniforms.Ref.vertexColorFactor = 1f; } }
public PlayerControls(ITagContainer diContainer) : base(diContainer.GetTag <DefaultEcs.World>()) { diContainer.AddTag(this); World.SetMaxCapacity <components.PlayerControls>(1); lockMessageSubscription = World.Subscribe <messages.LockPlayerControl>(HandleLockPlayerControl); ui = diContainer.GetTag <UI>(); zzContainer = diContainer.GetTag <IZanzarahContainer>(); zzContainer.OnKeyDown += HandleKeyDown; zzContainer.OnKeyUp += HandleKeyUp; }
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)); }
public Zanzarah(ITagContainer diContainer, IZanzarahContainer zanzarahContainer) { tagContainer = new TagContainer().FallbackTo(diContainer); tagContainer.AddTag(this); tagContainer.AddTag <IAssetLoader <Texture> >(new TextureAssetLoader(tagContainer)); tagContainer.AddTag(zanzarahContainer); tagContainer.AddTag(LoadDatabase()); tagContainer.AddTag(UI = new UI(this)); this.zanzarahContainer = zanzarahContainer; var savegame = new zzio.Savegame(); using (var fileStream = new System.IO.FileStream(@"C:\dev\zanzarah\Save\_0004.dat", System.IO.FileMode.Open, System.IO.FileAccess.Read)) using (var reader = new System.IO.BinaryReader(fileStream)) savegame = zzio.Savegame.ReadNew(reader); savegame.sceneId = 2411; CurrentGame = new Game(this, savegame); tagContainer.AddTag(CurrentGame); }
public Cursor(ITagContainer diContainer) : base(diContainer.GetTag <DefaultEcs.World>(), CreateEntityContainer, useBuffer: false) { zzContainer = diContainer.GetTag <IZanzarahContainer>(); recorder = diContainer.GetTag <EntityCommandRecorder>(); ui = diContainer.GetTag <UI>(); }
public Slider(ITagContainer diContainer) : base(diContainer.GetTag <DefaultEcs.World>(), CreateEntityContainer, useBuffer: false) { zzContainer = diContainer.GetTag <IZanzarahContainer>(); ui = diContainer.GetTag <UI>(); addedSubscription = World.SubscribeComponentAdded <components.ui.Slider>(HandleAdded); }
public DialogWaitForSayString(ITagContainer diContainer) : base(diContainer.GetTag <DefaultEcs.World>(), CreateEntityContainer, useBuffer: false) { zzContainer = diContainer.GetTag <IZanzarahContainer>(); zzContainer.OnMouseDown += HandleMouseDown; resetUIDisposable = World.Subscribe <messages.DialogResetUI>(HandleResetUI); }