Game.PostEffectsWindow.OnAttach C# (CSharp) Méthode

OnAttach() protected méthode

protected OnAttach ( ) : void
Résultat void
        protected override void OnAttach()
        {
            base.OnAttach();

            instance = this;

            viewport = RendererWorld.Instance.DefaultViewport;

            window = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\PostEffectsWindow.gui" );
            Controls.Add( window );

            for( int n = 0; n < scrollBarFloatParameters.Length; n++ )
            {
                scrollBarFloatParameters[ n ] = (EScrollBar)window.Controls[
                    "FloatParameter" + n.ToString() ];
                scrollBarFloatParameters[ n ].ValueChange += floatParameter_ValueChange;
            }
            for( int n = 0; n < checkBoxBoolParameters.Length; n++ )
            {
                checkBoxBoolParameters[ n ] = (ECheckBox)window.Controls[ "BoolParameter" + n.ToString() ];
                checkBoxBoolParameters[ n ].CheckedChange += boolParameter_CheckedChange;
            }

            listBox = (EListBox)window.Controls[ "List" ];
            listBox.Items.Add( "HDR" );
            listBox.Items.Add( "LDRBloom" );
            listBox.Items.Add( "Glass" );
            listBox.Items.Add( "OldTV" );
            listBox.Items.Add( "HeatVision" );
            listBox.Items.Add( "MotionBlur" );
            listBox.Items.Add( "RadialBlur" );
            listBox.Items.Add( "Blur" );
            listBox.Items.Add( "Grayscale" );
            listBox.Items.Add( "Invert" );
            listBox.Items.Add( "Tiling" );

            listBox.SelectedIndexChange += listBox_SelectedIndexChange;

            checkBoxEnabled = (ECheckBox)window.Controls[ "Enabled" ];
            checkBoxEnabled.Click += checkBoxEnabled_Click;

            for( int n = 0; n < listBox.Items.Count; n++ )
            {
                EButton itemButton = listBox.ItemButtons[ n ];
                ECheckBox checkBox = (ECheckBox)itemButton.Controls[ "CheckBox" ];

                string name = GetListCompositorItemName( (string)listBox.Items[ n ] );

                CompositorInstance compositorInstance = viewport.GetCompositorInstance( name );
                if( compositorInstance != null && compositorInstance.Enabled )
                    checkBox.Checked = true;

                if( itemButton.Text == "HDR" )
                    checkBox.Enable = false;

                checkBox.Click += listBoxCheckBox_Click;
            }

            listBox.SelectedIndex = 0;

            ( (EButton)window.Controls[ "Close" ] ).Click += delegate( EButton sender )
            {
                SetShouldDetach();
            };

            //ApplyToTheScreenGUI
            {
                ECheckBox checkBox = (ECheckBox)window.Controls[ "ApplyToTheScreenGUI" ];
                checkBox.Checked = EngineApp.Instance.ScreenGuiRenderer.ApplyPostEffectsToScreenRenderer;
                checkBox.Click += delegate( ECheckBox sender )
                {
                    EngineApp.Instance.ScreenGuiRenderer.ApplyPostEffectsToScreenRenderer = sender.Checked;
                };
            }
        }