コード例 #1
0
        private void InitializeInstructionGrid(Window callingWindow)
        {
            if (!initialized)
            {
                InstructionBlueprintListPropertyGrid grid = ((InstructionBlueprintListPropertyGrid)GetUIElementForMember("Instructions"));
                grid.ListDisplayWindow.EnableRemovingFromList();
                grid.ListDisplayWindow.EnableAddingToList(typeof(InstructionBlueprint));


                grid.ListDisplayWindow.ShowPropertyGridOnStrongSelect = true;
                initialized = true;
            }
        }
コード例 #2
0
        public EmissionSettingsPropertyGrid(Cursor cursor) : base(cursor)
        {
            #region Set "this" properties

            this.AfterUpdateDisplayedProperties += PropertiesUpdated;

            #endregion

            #region Include/Categorize members


            IncludeMember("VelocityRangeType", "Velocity");
            IncludeMember("RadialVelocity", "Velocity");
            IncludeMember("RadialVelocityRange", "Velocity");
            IncludeMember("XVelocity", "Velocity");
            IncludeMember("YVelocity", "Velocity");
            IncludeMember("ZVelocity", "Velocity");
            IncludeMember("XVelocityRange", "Velocity");
            IncludeMember("YVelocityRange", "Velocity");
            IncludeMember("ZVelocityRange", "Velocity");
            IncludeMember("WedgeAngle", "Velocity");
            IncludeMember("WedgeSpread", "Velocity");

            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");
            IncludeMember("ScaleXRange", "Scale");
            IncludeMember("ScaleYRange", "Scale");
            IncludeMember("ScaleXVelocity", "Scale");
            IncludeMember("ScaleYVelocity", "Scale");
            IncludeMember("ScaleXVelocityRange", "Scale");
            IncludeMember("ScaleYVelocityRange", "Scale");
            IncludeMember("MatchScaleXToY", "Scale");

            IncludeMember("XAcceleration", "Acceleration");
            IncludeMember("YAcceleration", "Acceleration");
            IncludeMember("ZAcceleration", "Acceleration");
            IncludeMember("XAccelerationRange", "Acceleration");
            IncludeMember("YAccelerationRange", "Acceleration");
            IncludeMember("ZAccelerationRange", "Acceleration");
            IncludeMember("Drag", "Acceleration");

            IncludeMember("Alpha", "Color/Fade");
            IncludeMember("Red", "Color/Fade");
            IncludeMember("Green", "Color/Fade");
            IncludeMember("Blue", "Color/Fade");

            ((UpDown)GetUIElementForMember("Alpha")).MinValue = 0;
            ((UpDown)GetUIElementForMember("Alpha")).MaxValue = 255;
            ((UpDown)GetUIElementForMember("Red")).MinValue   = 0;
            ((UpDown)GetUIElementForMember("Green")).MinValue = 0;
            ((UpDown)GetUIElementForMember("Blue")).MinValue  = 0;


            IncludeMember("AlphaRate", "Color/Fade");
            IncludeMember("RedRate", "Color/Fade");
            IncludeMember("GreenRate", "Color/Fade");
            IncludeMember("BlueRate", "Color/Fade");
            IncludeMember("BlendOperation", "Color/Fade");
            IncludeMember("ColorOperation", "Color/Fade");

            IncludeMember("Instructions", "Instructions");

            #endregion

            #region Set the event changed for the VelocityRangeType property

            //mVelocityWindows.Add(GetUIElementForMember("VelocityRangeType"));
            mVelocityProperties.Add("RadialVelocity");
            mVelocityProperties.Add("RadialVelocityRange");
            mVelocityProperties.Add("XVelocity");
            mVelocityProperties.Add("YVelocity");
            mVelocityProperties.Add("ZVelocity");
            mVelocityProperties.Add("XVelocityRange");
            mVelocityProperties.Add("YVelocityRange");
            mVelocityProperties.Add("ZVelocityRange");
            mVelocityProperties.Add("WedgeAngle");
            mVelocityProperties.Add("WedgeSpread");

            List <string> properties = new List <string>();
            properties.Add("XVelocity");
            properties.Add("YVelocity");
            properties.Add("ZVelocity");
            properties.Add("XVelocityRange");
            properties.Add("YVelocityRange");
            properties.Add("ZVelocityRange");
            mVelocityPropertiesByRangeType.Add(RangeType.Component, properties);

            properties = new List <string>();
            properties.Add("WedgeAngle");
            properties.Add("WedgeSpread");
            properties.Add("RadialVelocity");
            properties.Add("RadialVelocityRange");
            mVelocityPropertiesByRangeType.Add(RangeType.Cone, properties);

            properties = new List <string>();
            properties.Add("RadialVelocity");
            properties.Add("RadialVelocityRange");
            mVelocityPropertiesByRangeType.Add(RangeType.Radial, properties);

            properties = new List <string>();
            properties.Add("RadialVelocity");
            properties.Add("RadialVelocityRange");
            mVelocityPropertiesByRangeType.Add(RangeType.Spherical, properties);

            properties = new List <string>();
            properties.Add("WedgeAngle");
            properties.Add("WedgeSpread");
            properties.Add("RadialVelocity");
            properties.Add("RadialVelocityRange");
            mVelocityPropertiesByRangeType.Add(RangeType.Wedge, properties);

            SetMemberChangeEvent("VelocityRangeType", ChangeVelocityRangeType);

            #endregion

            #region Create the "Instructions" UI element

            SetMemberDisplayName("Instructions", "");

            mInstructionPropertyGrid            = new InstructionBlueprintListPropertyGrid(GuiManager.Cursor);
            mInstructionPropertyGrid.HasMoveBar = false;
            AfterUpdateDisplayedProperties     += new GuiMessage(InitializeInstructionGrid);

            ReplaceMemberUIElement("Instructions", mInstructionPropertyGrid);

            mInstructionPropertyGrid.ListDisplayWindow.AfterAddItem += new GuiMessage(AddInstructionBlueprint);
            mInstructionPropertyGrid.ListDisplayWindow.ScaleX        = 18;
            mInstructionPropertyGrid.ScaleX = 23;

            #endregion

            #region If not in FRB XNA, remove elements not supported in FRB XNA

#if !FRB_XNA
            // Only do this for non FRB_XNA
            ComboBox colorOperationComboBox = GetUIElementForMember("ColorOperation") as ComboBox;


            for (int i = colorOperationComboBox.Count - 1; i > -1; i--)
            {
                TextureOperation textureOperation =
                    ((TextureOperation)colorOperationComboBox[i].ReferenceObject);

                if (!FlatRedBall.Graphics.GraphicalEnumerations.IsTextureOperationSupportedInFrbXna(
                        textureOperation))
                {
                    colorOperationComboBox.RemoveAt(i);
                }
            }
#endif
            #endregion

            ExcludeMember("AnimationChain");
            ExcludeMember("Animate");
        }