Beispiel #1
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            ReflectionProbe probe = (ReflectionProbe)InspectedObject;

            drawer.AddDefault(probe);
            drawer.AddConditional("Radius", () => probe.Type == ReflectionProbeType.Sphere);
            drawer.AddConditional("Extents", () => probe.Type == ReflectionProbeType.Box);

            captureButton.OnClick += () => probe.Capture();

            Layout.AddSpace(10);
            Layout.AddElement(captureButton);
        }
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject != null)
            {
                ReflectionProbe probe = (ReflectionProbe)InspectedObject;

                probeTypeField.OnSelectionChanged += x =>
                {
                    probe.Type = (ReflectionProbeType)x;

                    ToggleTypeSpecificFields((ReflectionProbeType)x);
                };

                radiusField.OnChanged   += x => { probe.Radius = x; MarkAsModified(); };
                radiusField.OnConfirmed += ConfirmModify;
                radiusField.OnFocusLost += ConfirmModify;

                extentsField.OnChanged   += x => { probe.Extents = x; MarkAsModified(); };
                extentsField.OnConfirmed += ConfirmModify;
                extentsField.OnFocusLost += ConfirmModify;

                customTextureField.OnChanged += x =>
                {
                    probe.CustomTexture = Resources.Load <Texture>(x.UUID);
                    MarkAsModified();
                    ConfirmModify();
                };

                captureButton.OnClick += () => probe.Capture();

                Layout.AddElement(probeTypeField);
                Layout.AddElement(radiusField);
                Layout.AddElement(extentsField);
                Layout.AddElement(customTextureField);
                Layout.AddSpace(10);
                Layout.AddElement(captureButton);

                ToggleTypeSpecificFields(probe.Type);
            }
        }