示例#1
0
        public AnimationFramePropertyGrid(Cursor cursor)
            : base(cursor)
        {
            Name = "AnimationFrame Properties";

            ExcludeMember("Empty");

            ExcludeMember("TextureName");

            #region Set member display names

            SetMemberDisplayName("frameTime", "Frame Length (ms):");
            SetMemberDisplayName("texture", "Texture:");
            SetMemberDisplayName("xFlip", "Flip Vertical:");
            SetMemberDisplayName("yFlip", "Flip Horizontal:");

            #endregion



            IncludeMember("Texture", "Texture");

            #region Custom Pixel texture coordinate values

            TextureCoordinatePropertyGridHelper.CreatePixelCoordinateUi(
                this,
                "TopCoordinate",
                "BottomCoordinate",
                "LeftCoordinate",
                "RightCoordinate",
                "Tex Coords",
                out mTopPixel,
                out mLeftPixel,
                out mPixelHeight,
                out mPixelWidth);

            mLeftPixel.ValueChanged   += ChangeLeftPixel;
            mTopPixel.ValueChanged    += ChangeTopPixel;
            mPixelWidth.ValueChanged  += ChangePixelWidth;
            mPixelHeight.ValueChanged += ChangePixelHeight;

            //MoveWindowToTop(textDisplay);

            MoveWindowToTop(mPixelHeight);
            MoveWindowToTop(mPixelWidth);
            MoveWindowToTop(mTopPixel);
            MoveWindowToTop(mLeftPixel);


            #endregion

            mHideShowTextureCoordinates        = new Button(GuiManager.Cursor);
            mHideShowTextureCoordinates.Text   = "Show Texture Coords";
            mHideShowTextureCoordinates.ScaleX = 9.0f;
            mHideShowTextureCoordinates.Click += new GuiMessage(ClickHideShowTextureCoordinates);
            AddWindow(mHideShowTextureCoordinates, "Tex Coords");

            this.AfterUpdateDisplayedProperties += UpdateCustomUI;
        }
示例#2
0
        private void InitialExcludeIncludeMembers()
        {
            ExcludeAllMembers();

            #region Basic Members
            IncludeMember("X", "Basic");
            SetMemberChangeEvent("X", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("Y", "Basic");
            SetMemberChangeEvent("Y", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("Z", "Basic");
            SetMemberChangeEvent("Z", ShowCantEditAbsoluteValuesMessage);

            IncludeMember("Visible", "Basic");
            IncludeMember("CursorSelectable", "Basic");

            IncludeMember("Name", "Basic");

            mOrderingMode = new ComboBox(mCursor);
            mOrderingMode.AddItem("Distance from Camera", OrderingMode.DistanceFromCamera);
            mOrderingMode.AddItem("ZBuffered", OrderingMode.ZBuffered);
            mOrderingMode.ScaleX = 6.5f;
            AddWindow(mOrderingMode, "Basic");
            SetLabelForWindow(mOrderingMode, "OrderingMode");
            mOrderingMode.ItemClick += SetOrderingMode;

            #endregion

            #region Rotation Members

            IncludeMember("RotationX", "Rotation");
            SetMemberChangeEvent("RotationX", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("RotationY", "Rotation");
            SetMemberChangeEvent("RotationY", ShowCantEditAbsoluteValuesMessage);
            IncludeMember("RotationZ", "Rotation");
            SetMemberChangeEvent("RotationZ", ShowCantEditAbsoluteValuesMessage);

            #endregion

            #region Scale Members
            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");

            IncludeMember("PixelSize", "Scale");
            ((UpDown)GetUIElementForMember("PixelSize")).Sensitivity = .01f;
            // Vic says:  Any value for PixelSize above 0 will result in the
            // Sprite having a valid PixelSize.  Values below 0 are ignored.
            // This isn't the best solution, but there's really no reason for
            // a user to ever set a value below -1, so we'll put a cap on that.
            // Eventualy we may want to make this more robust by "hopping" to -1
            // if the user drags the value down below 0, and "hopping" to 0 if the
            // user drags the value up from -1.
            ((UpDown)GetUIElementForMember("PixelSize")).MinValue = -1;

            mSetPixelPerfectScaleButton        = new Button(mCursor);
            mSetPixelPerfectScaleButton.Text   = "Set Pixel\nPerfect Scale";
            mSetPixelPerfectScaleButton.ScaleX = 6;
            mSetPixelPerfectScaleButton.ScaleY = 2f;

            AddWindow(mSetPixelPerfectScaleButton, "Scale");
            mSetPixelPerfectScaleButton.Click += SetPixelPerfectScaleClick;


            #endregion

            #region Animation

            IncludeMember("AnimationChains", "Animation");
            IncludeMember("CurrentChainName", "Animation");
            IncludeMember("Animate", "Animation");
            IncludeMember("AnimationSpeed", "Animation");

            #endregion

            #region Texture Members

            IncludeMember("Texture", "Texture");
            SetMemberChangeEvent("Texture", OnTextureChange);

            IncludeMember("TextureAddressMode", "Texture");

            //mTopTextureCoordinateUpDown = IncludeMember("TopTextureCoordinate", "Texture") as UpDown;
            //mTopTextureCoordinateUpDown.Sensitivity = .01f;

            //mBottomTextureCoordinateUpDown = IncludeMember("BottomTextureCoordinate", "Texture") as UpDown;
            //mBottomTextureCoordinateUpDown.Sensitivity = .01f;

            //mLeftTextureCoordinateUpDown = IncludeMember("LeftTextureCoordinate", "Texture") as UpDown;
            //mLeftTextureCoordinateUpDown.Sensitivity = .01f;

            //mRightTextureCoordinateUpDown = IncludeMember("RightTextureCoordinate", "Texture") as UpDown;
            //mRightTextureCoordinateUpDown.Sensitivity = .01f;
            TextureCoordinatePropertyGridHelper.CreatePixelCoordinateUi(
                this,
                "TopCoordinate",
                "BottomCoordinate",
                "LeftCoordinate",
                "RightCoordinate",
                "Texture",
                out mTopPixel,
                out mLeftPixel,
                out mPixelHeight,
                out mPixelWidth);

            mLeftPixel.ValueChanged   += ChangeLeftPixel;
            mTopPixel.ValueChanged    += ChangeTopPixel;
            mPixelWidth.ValueChanged  += ChangePixelWidth;
            mPixelHeight.ValueChanged += ChangePixelHeight;

            this.AfterUpdateDisplayedProperties += UpdateCustomUI;

            IncludeMember("FlipHorizontal", "Texture");
            IncludeMember("FlipVertical", "Texture");


            mPixelPerfectTextureCoordinates        = new ToggleButton(this.mCursor);
            mPixelPerfectTextureCoordinates.Text   = "Pixel Perfect\nCoordinates";
            mPixelPerfectTextureCoordinates.ScaleX = 5.5f;
            mPixelPerfectTextureCoordinates.ScaleY = 2.1f;

            AddWindow(mPixelPerfectTextureCoordinates, "Texture");

            #endregion

            #region Relative

            IncludeMember("RelativeX", "Relative");
            IncludeMember("RelativeY", "Relative");
            IncludeMember("RelativeZ", "Relative");

            IncludeMember("RelativeRotationX", "Relative");
            IncludeMember("RelativeRotationY", "Relative");
            IncludeMember("RelativeRotationZ", "Relative");

            #endregion

            #region Color

            IncludeMember("ColorOperation", "Color");

#if !FRB_XNA
            ComboBox colorOperationComboBox = GetUIElementForMember("ColorOperation") as ComboBox;

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

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

            IncludeMember("Red", "Color");
            IncludeMember("Green", "Color");
            IncludeMember("Blue", "Color");

            IncludeMember("BlendOperation", "Blend");
            IncludeMember("Alpha", "Blend");

            #endregion
        }