Exemplo n.º 1
0
 public void Setup()
 {
     parentContainer = new TagContainer();
     parentContainer.AddTag <Tag1>(new SubTag1Of1());
     parentContainer.AddTag(new Tag2());
     container = parentContainer.ExtendedWith(new Tag3(), new SubTag2Of1() as Tag1);
 }
Exemplo n.º 2
0
 public void CanAddAndRemoveNewTag()
 {
     Assert.IsFalse(container.HasTag <Tag1>());
     Assert.IsFalse(container.RemoveTag <Tag1>());
     container.AddTag(new Tag1());
     Assert.IsTrue(container.HasTag <Tag1>());
     Assert.IsTrue(container.RemoveTag <Tag1>());
     Assert.IsFalse(container.HasTag <Tag1>());
     Assert.IsFalse(container.RemoveTag <Tag1>());
 }
Exemplo n.º 3
0
 public void Setup()
 {
     fallback = new TagContainer();
     fallback.AddTag <Tag1>(new SubTag1Of1());
     fallback.AddTag(new Tag2());
     main = new TagContainer();
     main.AddTag(new Tag3());
     main.AddTag(new SubTag2Of1() as Tag1);
     container = main.FallbackTo(fallback);
 }
Exemplo n.º 4
0
        public ActorEditor(ITagContainer diContainer)
        {
            this.diContainer     = diContainer;
            device               = diContainer.GetTag <GraphicsDevice>();
            resourcePool         = diContainer.GetTag <IResourcePool>();
            Window               = diContainer.GetTag <WindowContainer>().NewWindow("Actor Editor");
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100.0f, 600.0f);
            Window.AddTag(this);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            fbArea           = Window.GetTag <FramebufferArea>();
            fbArea.OnResize += HandleResize;
            fbArea.OnRender += HandleRender;
            diContainer.GetTag <OpenDocumentSet>().AddEditor(this);

            openFileModal                    = new OpenFileModal(diContainer);
            openFileModal.Filter             = "*.aed";
            openFileModal.IsFilterChangeable = false;
            openFileModal.OnOpenedResource  += Load;

            locationBuffer = new LocationBuffer(device);
            AddDisposable(locationBuffer);
            localDiContainer = diContainer.ExtendedWith(locationBuffer);
            camera           = new Camera(localDiContainer);
            AddDisposable(camera);
            controls = new OrbitControlsTag(Window, camera.Location, localDiContainer);
            AddDisposable(controls);
            localDiContainer.AddTag(camera);

            gridRenderer = new DebugGridRenderer(diContainer);
            gridRenderer.Material.LinkTransformsTo(camera);
            gridRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(gridRenderer);
            localDiContainer.AddTag <IStandardTransformMaterial>(gridRenderer.Material);

            editor.AddInfoSection("Info", HandleInfoContent);
            editor.AddInfoSection("Animation Playback", HandlePlaybackContent);
            editor.AddInfoSection("Body animations", () => HandlePartContent(false, () => body?.AnimationsContent() ?? false), false);
            editor.AddInfoSection("Wings animations", () => HandlePartContent(true, () => wings?.AnimationsContent() ?? false), false);
            editor.AddInfoSection("Body skeleton", () => HandlePartContent(false, () => body?.skeletonRenderer.Content() ?? false), false);
            editor.AddInfoSection("Wings skeleton", () => HandlePartContent(true, () => wings?.skeletonRenderer.Content() ?? false), false);
            editor.AddInfoSection("Head IK", HandleHeadIKContent, false);
        }
Exemplo n.º 5
0
 public void ModifiesMain()
 {
     container.AddTag(new Tag4());
     Assert.True(main.HasTag <Tag4>());
     Assert.True(container.RemoveTag <Tag4>());
     Assert.False(main.HasTag <Tag4>());
 }
Exemplo n.º 6
0
            public DatasetComponent(ITagContainer diContainer)
            {
                diContainer.AddTag(this);
                this.diContainer = diContainer;

                editor              = diContainer.GetTag <SceneEditor>();
                editor.OnLoadScene += HandleLoadScene;
                editor.editor.AddInfoSection("Info", HandleContent, false);
            }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 public ModelComponent(ITagContainer diContainer)
 {
     diContainer.AddTag(this);
     this.diContainer = diContainer;
     editor           = diContainer.GetTag <SceneEditor>();
     editor.selectableContainers.Add(this);
     editor.fbArea.OnRender += HandleRender;
     editor.OnLoadScene     += HandleLoadScene;
     diContainer.GetTag <MenuBarWindowTag>().AddCheckbox("View/Models", () => ref isVisible, () => editor.fbArea.IsDirty = true);
     editor.editor.AddInfoSection("Models", HandleInfoSection, false);
 }
Exemplo n.º 9
0
        public static IBuiltPipeline Get(ITagContainer diContainer, Func <IPipelineBuilder, IBuiltPipeline> create)
        {
            if (diContainer.HasTag <PipelineFor <T> >())
            {
                return(diContainer.GetTag <PipelineFor <T> >().Pipeline);
            }
            var holder = new PipelineFor <T>(
                create(diContainer.GetTag <PipelineCollection>().GetPipeline()));

            diContainer.AddTag(holder);
            return(holder.Pipeline);
        }
Exemplo n.º 10
0
            public WorldComponent(ITagContainer diContainer)
            {
                diContainer.AddTag(this);
                this.diContainer = diContainer;
                var fbArea = diContainer.GetTag <FramebufferArea>();

                fbArea.OnRender += HandleRender;
                renderer         = new WorldRenderer(diContainer);
                diContainer.GetTag <MenuBarWindowTag>().AddCheckbox("View/World", () => ref isVisible, () => fbArea.IsDirty = true);
                editor              = diContainer.GetTag <SceneEditor>();
                editor.OnLoadScene += HandleLoadScene;
            }
Exemplo n.º 11
0
            private int detailLevel = 4; // Detail levels from 1, invisible is 0

            public FOModelComponent(ITagContainer diContainer)
            {
                diContainer.AddTag(this);
                this.diContainer = diContainer;
                editor           = diContainer.GetTag <SceneEditor>();
                editor.selectableContainers.Add(this);
                editor.fbArea.OnRender += HandleRender;
                editor.OnLoadScene     += HandleLoadScene;
                diContainer.GetTag <MenuBarWindowTag>().AddRadio("View/FOModels", new[]
                {
                    "Invisible",
                    "Detail Level 0",
                    "Detail Level 1",
                    "Detail Level 2",
                    "Detail Level 3"
                }, () => ref detailLevel, () => editor.fbArea.IsDirty = true);
                editor.editor.AddInfoSection("FOModels", HandleInfoSection, false);
            }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
 public void AddTagDoesNotModifyParent()
 {
     container.AddTag(new Tag4());
     Assert.IsTrue(container.HasTag <Tag4>());
     Assert.IsFalse(parentContainer.HasTag <Tag4>());
 }
Exemplo n.º 14
0
 public ITagContainer AddTag <TTag>(TTag tag) where TTag : class =>
 main.AddTag(tag);
Exemplo n.º 15
0
 public RecordingSequentialSystem(ITagContainer diContainer)
 {
     this.diContainer = diContainer;
     world            = diContainer.GetTag <DefaultEcs.World>();
     diContainer.AddTag(recorder);
 }