Пример #1
0
 public ModelLoader(ITagContainer diContainer)
 {
     this.diContainer      = diContainer;
     scene                 = diContainer.GetTag <Scene>();
     ecsWorld              = diContainer.GetTag <DefaultEcs.World>();
     sceneLoadSubscription = ecsWorld.Subscribe <messages.SceneLoaded>(HandleSceneLoaded);
 }
        public void Setup()
        {
            _defaultWorld                      = new DefaultWorld(EntityCount);
            _defaultEntitySet                  = _defaultWorld.GetEntities().With <DefaultComponent>().AsSet();
            _defaultRunner                     = new DefaultParallelRunner(Environment.ProcessorCount);
            _defaultSystem                     = new DefaultEcsSystem(_defaultWorld);
            _defaultMultiSystem                = new DefaultEcsSystem(_defaultWorld, _defaultRunner);
            _defaultEntityComponentSystem      = new DefaultEcsEntityComponentSystem(_defaultWorld);
            _defaultMultiEntityComponentSystem = new DefaultEcsEntityComponentSystem(_defaultWorld, _defaultRunner);
            _defaultComponentSystem            = new DefaultEcsComponentSystem(_defaultWorld);
            _defaultComponentMultiSystem       = new DefaultEcsComponentSystem(_defaultWorld, _defaultRunner);

            _entitasWorld       = new Context <EntitasEntity>(1, () => new EntitasEntity());
            _entitasSystem      = new EntitasSystem(_entitasWorld);
            _entitasMultiSystem = new EntitasSystem(_entitasWorld, Environment.ProcessorCount);

            for (int i = 0; i < EntityCount; ++i)
            {
                DefaultEntity defaultEntity = _defaultWorld.CreateEntity();
                defaultEntity.Set <DefaultComponent>();

                EntitasEntity entitasEntity = _entitasWorld.CreateEntity();
                entitasEntity.AddComponent(0, new EntitasComponent());
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        public UIPreloader(ITagContainer diContainer)
        {
            world    = diContainer.GetTag <DefaultEcs.World>();
            mappedDb = diContainer.GetTag <zzio.db.MappedDB>();

            Btn000 = Preload(out var tsBtn000, "btn000", isFont: false);
            Btn001 = Preload(out var tsBtn001, "btn001", isFont: false);
            Btn002 = Preload(out var tsBtn002, "btn002", isFont: false);
            Sld000 = Preload(out var tsSld000, "sld000", isFont: false);
            Tit000 = Preload(out var tsTit000, "tit000", isFont: false);
            Cur000 = Preload(out var tsCur000, "cur000", isFont: false);
            Dnd000 = Preload(out var tsDnd000, "dnd000", isFont: false);
            Wiz000 = Preload(out var tsWiz000, "wiz000", isFont: false);
            Itm000 = Preload(out var tsItm000, "itm000", isFont: false);
            Spl000 = Preload(out var tsSpl000, "spl000", isFont: false);
            Lne000 = Preload(out var tsLne000, "lne000", isFont: false);
            Fnt000 = Preload(out var tsFnt000, "fnt000", isFont: true, lineHeight: 14f, charSpacing: 1f);
            Fnt001 = Preload(out var tsFnt001, "fnt001", isFont: true, charSpacing: 1f);
            Fnt002 = Preload(out var tsFnt002, "fnt002", isFont: true, lineHeight: 17f, charSpacing: 1f, lineOffset: 2f);
            Fnt003 = Preload(out var tsFnt003, "fnt003", isFont: true, lineHeight: 14f, charSpacing: 1f);
            Fnt004 = Preload(out var tsFnt004, "fnt004", isFont: true, lineHeight: 14f, charSpacing: 1f);
            Fsp000 = Preload(out var tsFsp000, "fsp000", isFont: true);
            Inf000 = Preload(out var tsInf000, "inf000", isFont: false);
            Log000 = Preload(out var tsLog000, "log000", isFont: false);
            Cls000 = Preload(out var tsCls000, "cls000", isFont: false);
            Cls001 = Preload(out var tsCls001, "cls001", isFont: false);
            Map000 = Preload(out var tsMap000, "map000", isFont: false);

            tsFnt000.Alternatives.Add(tsFnt001);
            tsFnt000.Alternatives.Add(tsFnt002);
            tsFnt000.Alternatives.Add(tsFsp000);
            tsFnt000.Alternatives.Add(tsItm000);
            tsFnt000.Alternatives.Add(tsCls000);
            tsFnt000.Alternatives.Add(tsFnt003);
            tsFnt000.Alternatives.Add(tsLog000);
            tsFnt000.Alternatives.Add(tsCls001);
            tsFnt000.Alternatives.Add(tsFnt004);

            tsFnt001.Alternatives.Add(tsFnt002);
            tsFnt001.Alternatives.Add(tsInf000);
            tsFnt001.Alternatives.Add(tsFnt000);

            tsFnt002.Alternatives.Add(tsFnt001);
            tsFnt002.Alternatives.Add(tsInf000);
            tsFnt002.Alternatives.Add(tsFsp000);
            tsFnt002.Alternatives.Add(tsItm000);
            tsFnt002.Alternatives.Add(tsCls000);
            tsFnt002.Alternatives.Add(tsCls001);

            tsFnt003.Alternatives.Add(tsFnt001);
            tsFnt003.Alternatives.Add(tsFnt002);
            tsFnt003.Alternatives.Add(tsFsp000);
            tsFnt003.Alternatives.Add(tsItm000);
            tsFnt003.Alternatives.Add(tsFnt000);
            tsFnt003.Alternatives.Add(tsFnt000);
            tsFnt003.Alternatives.Add(tsLog000);
            tsFnt003.Alternatives.Add(tsCls001);
            tsFnt003.Alternatives.Add(tsFnt004);
        }
        public void Setup()
        {
            _defaultWorld                      = new DefaultWorld(EntityCount);
            _defaultEntitySet                  = _defaultWorld.GetEntities().With <DefaultComponent>().AsSet();
            _defaultRunner                     = new DefaultParallelRunner(Environment.ProcessorCount);
            _defaultSystem                     = new DefaultEcsSystem(_defaultWorld);
            _defaultMultiSystem                = new DefaultEcsSystem(_defaultWorld, _defaultRunner);
            _defaultEntityComponentSystem      = new DefaultEcsEntityComponentSystem(_defaultWorld);
            _defaultMultiEntityComponentSystem = new DefaultEcsEntityComponentSystem(_defaultWorld, _defaultRunner);
            _defaultComponentSystem            = new DefaultEcsComponentSystem(_defaultWorld);
            _defaultComponentMultiSystem       = new DefaultEcsComponentSystem(_defaultWorld, _defaultRunner);
            _defaultGeneratorSystem            = new DefaultEcsGeneratorSystem(_defaultWorld);
            _defaultGeneratorMultiSystem       = new DefaultEcsGeneratorSystem(_defaultWorld, _defaultRunner);

            _entitasWorld       = new Context <EntitasEntity>(1, () => new EntitasEntity());
            _entitasSystem      = new EntitasSystem(_entitasWorld);
            _entitasMultiSystem = new EntitasSystem(_entitasWorld, Environment.ProcessorCount);

            _monoWorld = new WorldBuilder().AddSystem(new MonoSystem()).Build();
            _time      = new GameTime();

            _leoWorld   = new LeoWorld();
            _leoSystem  = new LeoSystem();
            _leoSystems = new LeoSystems(_leoWorld).Add(_leoSystem);
            _leoSystems.ProcessInjects().Init();

            SimpleEntitiesSubmissionScheduler sveltoScheduler = new SimpleEntitiesSubmissionScheduler();

            _sveltoWorld  = new EnginesRoot(sveltoScheduler);
            _sveltoSystem = new SveltoSystem();
            _sveltoWorld.AddEngine(_sveltoSystem);
            IEntityFactory sveltoFactory = _sveltoWorld.GenerateEntityFactory();

            for (int i = 0; i < EntityCount; ++i)
            {
                DefaultEntity defaultEntity = _defaultWorld.CreateEntity();
                defaultEntity.Set <DefaultComponent>();

                EntitasEntity entitasEntity = _entitasWorld.CreateEntity();
                entitasEntity.AddComponent(0, new EntitasComponent());

                MonoEntity monoEntity = _monoWorld.CreateEntity();
                monoEntity.Attach(new MonoComponent());

                LeoEntity leoEntity = _leoWorld.NewEntity();
                leoEntity.Get <LeoComponent>();

                sveltoFactory.BuildEntity <SveltoEntity>((uint)i, _sveltoGroup);
            }

            sveltoScheduler.SubmitEntities();
        }
Пример #6
0
 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);
 }
Пример #7
0
 public Savegame(ITagContainer diContainer)
 {
     world    = diContainer.GetTag <DefaultEcs.World>();
     scene    = diContainer.GetTag <Scene>();
     savegame = diContainer.GetTag <zzio.Savegame>();
     disableAttackTriggerDisposable = world.Subscribe <GSModDisableAttackTrigger>(HandleDisableAttackTrigger);
     removeItemDisposable           = world.Subscribe <GSModRemoveItem>(HandleRemoveItem);
     changeNpcStateDisposable       = world.Subscribe <GSModChangeNPCState>(HandleChangeNpcState);
     disableTriggerDisposable       = world.Subscribe <GSModDisableTrigger>(HandleDisableTrigger);
     removeModelDisposable          = world.Subscribe <GSModRemoveModel>(HandleRemoveModel);
     setTriggerDisposable           = world.Subscribe <GSModSetTrigger>(HandleSetTrigger);
     setNpcModifierDisposable       = world.Subscribe <GSModSetNPCModifier>(HandleSetNpcModifier);
     gsmodForSceneDisposable        = world.Subscribe <messages.GSModForScene>(HandleGSModForScene);
 }
Пример #8
0
        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));
        }
Пример #9
0
 public DefaultEcsSystem(DefaultWorld world)
     : this(world, null)
 {
 }
Пример #10
0
 public DefaultEcsComponentSystem(DefaultWorld world, IParallelRunner runner)
     : base(world.GetEntities().With <DefaultSpeed>().With <DefaultPosition>().AsSet(), runner)
 {
     _world = world;
 }
 public DefaultEcsComponentSystem(DefaultWorld world, IParallelRunner runner)
     : base(world, runner)
 {
 }
 public DefaultEcsComponentSystem(DefaultWorld world)
     : this(world, null)
 {
 }
 public DefaultEcsComponentSystem(DefaultWorld world, SystemRunner <int> runner)
     : base(world, runner)
 {
 }
 public DefaultEcsSystem(DefaultWorld world, IParallelRunner runner)
     : base(world.GetEntities().With <DefaultComponent>().AsSet(), runner)
 {
 }
Пример #15
0
 public DefaultEcsSystem(DefaultWorld world, SystemRunner <float> runner)
     : base(world.GetEntities().With <DefaultSpeed>().With <DefaultPosition>().Build(), runner)
 {
 }
Пример #16
0
 public DefaultEcsBatchedChangeSystem(DefaultWorld world)
     : this(world, null)
 {
 }
 public DefaultEcsSystem(DefaultWorld world, SystemRunner <int> runner)
     : base(world.GetEntities().With <DefaultComponent>().Build(), runner)
 {
 }
Пример #18
0
 public PhysicsBodyGenerator(World physicsWorld, DefaultEcs.World world) : base(world, typeof(TSource), typeof(Transform), typeof(PhysicsBody))
 {
     _physicsWorld = physicsWorld;
 }
Пример #19
0
 public Animal(ITagContainer diContainer)
 {
     scene    = diContainer.GetTag <Scene>();
     ecsWorld = diContainer.GetTag <DefaultEcs.World>();
     sceneLoadSubscription = ecsWorld.Subscribe <messages.SceneLoaded>(HandleSceneLoaded);
 }
Пример #20
0
 public DefaultEcsBatchedChangeSystem(DefaultWorld world, IParallelRunner runner)
     : base(world.GetEntities().With <DefaultSpeed>().With <DefaultPosition>().AsSet(), runner)
 {
 }
Пример #21
0
 public RecordingSequentialSystem(ITagContainer diContainer)
 {
     this.diContainer = diContainer;
     world            = diContainer.GetTag <DefaultEcs.World>();
     diContainer.AddTag(recorder);
 }