Beispiel #1
0
        public SpritePropertyGrid(Cursor cursor)
            : base(cursor)
        {
            MakeVisibleOnSpriteSet = true;

            InitialExcludeIncludeMembers();

            #region Category Cleanup

            RemoveCategory("Uncategorized");

            SelectCategory("Basic");

            #endregion

            #region UI Replacement

            #region Replace the CurrentChainName UI element

            mCurrentChainNameComboBox        = new ComboBox(this.mCursor);
            mCurrentChainNameComboBox.ScaleX = 5;
            ReplaceMemberUIElement("CurrentChainName", mCurrentChainNameComboBox);

            #endregion

            mAnimationChainFileTextBox                     = new FileTextBox(this.mCursor);
            mAnimationChainFileTextBox.ScaleX              = 8;
            mAnimationChainFileTextBox.TextBox.CursorOver += ShowAnimationPopup;
            this.AddWindow(mAnimationChainFileTextBox, "Animation");
            mAnimationChainFileTextBox.SetFileType("achx");
            this.SetLabelForWindow(mAnimationChainFileTextBox, "Animation File");

            mAnimationChainFileTextBox.FileSelect += SetAnimationChainOnSprite;

            #endregion

            this.MinimumScaleY = 10;

            SetMemberDisplayName("CursorSelectable", "Active");
        }
        public SpriteFramePropertyGrid(Cursor cursor)
            : base(cursor)
        {
            ExcludeAllMembers();

            #region Include Basic Members

            IncludeMember("X", "Basic");
            IncludeMember("Y", "Basic");
            IncludeMember("Z", "Basic");

            IncludeMember("RotationX", "Basic");
            IncludeMember("RotationY", "Basic");
            IncludeMember("RotationZ", "Basic");

            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 Scale Members

            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");

            Button setPixelPerfectScale = new Button(mCursor);
            setPixelPerfectScale.ScaleX = 5;
            setPixelPerfectScale.ScaleY = 2;

            setPixelPerfectScale.Text = "Set Pixel\nPerfect";

            setPixelPerfectScale.Click += SetPixelPerfectClick;

            AddWindow(setPixelPerfectScale, "Scale");

            #endregion

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

            #region Animation members

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

            #endregion

            #region Include Color Members

            IncludeMember("ColorOperation", "Color");

#if !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

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

            #endregion

            #region Include Blend Members

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

            #endregion

            #region Include Border Members

            IncludeMember("TextureBorderWidth", "Border");
            IncludeMember("SpriteBorderWidth", "Border");
            IncludeMember("Borders", "Border");
            IncludeMember("PixelSize", "Border");

            #endregion

            #region Customize "Borders"

            SetMemberChangeEvent("Borders", OnBordersChanged);

            #endregion

            #region Customize TextureBorderWidth

            UpDown upDown = GetUIElementForMember("TextureBorderWidth") as UpDown;
            upDown.MinValue = 0;
            upDown.MaxValue = .5f;

            mTextureBorderWidthInPixels               = new UpDown(mCursor);
            mTextureBorderWidthInPixels.ScaleX        = 6;
            mTextureBorderWidthInPixels.ValueChanged += ChangeTextureBorderWidthInPixels;
            mTextureBorderWidthInPixels.RoundTo       = 1;
            AddWindow(mTextureBorderWidthInPixels, "Border");


            #endregion


            #region Replace the CurrentChainName UI element

            mCurrentChainNameComboBox        = new ComboBox(this.mCursor);
            mCurrentChainNameComboBox.ScaleX = 5;
            ReplaceMemberUIElement("CurrentChainName", mCurrentChainNameComboBox);

            #endregion

            mAnimationChainFileTextBox                     = new FileTextBox(this.mCursor);
            mAnimationChainFileTextBox.ScaleX              = 8;
            mAnimationChainFileTextBox.TextBox.CursorOver += ShowAnimationPopup;
            this.AddWindow(mAnimationChainFileTextBox, "Animation");
            mAnimationChainFileTextBox.SetFileType("achx");
            this.SetLabelForWindow(mAnimationChainFileTextBox, "Animation File");

            mAnimationChainFileTextBox.FileSelect += SetAnimationChainOnSprite;


            AfterUpdateDisplayedProperties += new GuiMessage(UpdateTextureBorderWidthUI);

            RemoveCategory("Uncategorized");

            SelectCategory("Basic");
        }
        public PositionedModelPropertyGrid(Cursor cursor)
            : base(cursor)
        {
            ExcludeAllMembers();

            #region Include Basic Members

            IncludeMember("X", "Basic");
            IncludeMember("Y", "Basic");
            IncludeMember("Z", "Basic");



            IncludeMember("RotationX", "Basic");
            IncludeMember("RotationY", "Basic");
            IncludeMember("RotationZ", "Basic");

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

            IncludeMember("Name", "Basic");

            IncludeMember("IsAutomaticallyUpdated", "Basic");

            IncludeMember("Visible", "Basic");

            #endregion

            #region Include "Scale" members

            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");
            IncludeMember("ScaleZ", "Scale");

#if !FRB_MDX
            IncludeMember("FlipX", "Scale");
            IncludeMember("FlipY", "Scale");
            IncludeMember("FlipZ", "Scale");
#endif

            #endregion

            #region Include "Rendering" members

            IncludeMember("FaceCullMode", "Rendering");

            #endregion

            #region Include Relative Members

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

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

            #endregion

            #region Include Animation Members

#if FRB_XNA
            //IncludeMember("HasAnimation", "Animation");
            //IncludeMember("Animate", "Animation");
            //IncludeMember("CurrentAnimation", "Animation");

            //mCurrentAnimationComboBox = new ComboBox(GuiManager.Cursor);
            //mCurrentAnimationComboBox.ScaleX = 6;
            //ReplaceMemberUIElement("CurrentAnimation", mCurrentAnimationComboBox);

            mHierarchyFileTextBox        = new FileTextBox(GuiManager.Cursor);
            mHierarchyFileTextBox.ScaleY = 1.5f;
            mHierarchyFileTextBox.ScaleX = 15;
            List <string> fileTypes = new List <string>();
            fileTypes.Add("wbi");
            fileTypes.Add("whe");
            mHierarchyFileTextBox.SetFileType(fileTypes);
            this.AddWindow(mHierarchyFileTextBox, "Animation");
            mHierarchyFileTextBox.FileSelect += new GuiMessage(LoadSkeleton);



            mAnimationListDisplayWindow        = new ListDisplayWindow(cursor);
            mAnimationListDisplayWindow.ScaleX = 15;
            mAnimationListDisplayWindow.ScaleY = 15;
            mAnimationListDisplayWindow.ListBox.StrongSelect += new GuiMessage(StrongSelectAnimation);
            mAnimationListDisplayWindow.ListBox.Highlight    += new GuiMessage(ShowAnimationPropertyGrid);
            this.AddWindow(mAnimationListDisplayWindow, "Animation");



            mAddAnimationButton        = new Button(GuiManager.Cursor);
            mAddAnimationButton.Text   = "Add Animation";
            mAddAnimationButton.ScaleX = 8.5f;
            mAddAnimationButton.ScaleY = 1.5f;
            this.AddWindow(mAddAnimationButton, "Animation");
            mAddAnimationButton.Click += new GuiMessage(AddAnimationClick);

            mRemoveAllAnimationDataButton        = new Button(cursor);
            mRemoveAllAnimationDataButton.Text   = "Remove All Anim Data";
            mRemoveAllAnimationDataButton.ScaleX = 8.5f;
            mRemoveAllAnimationDataButton.ScaleY = 1.5f;
            this.AddWindow(mRemoveAllAnimationDataButton, "Animation");
            mRemoveAllAnimationDataButton.Click += new GuiMessage(RemoveAllAnimationButtonClick);


            mAnimationListDisplayWindow.EnableRemovingFromList();
#endif
            #endregion



            #region Remove Uncategorized and set default category
            RemoveCategory("Uncategorized");

            SelectCategory("Basic");
            #endregion

#if FRB_XNA
            PropertyGrid.SetPropertyGridTypeAssociation(typeof(Animation3DInstance), typeof(Animation3DInstancePropertyGrid));
#endif

            ShowIColorableProperties();

            this.X = this.ScaleX;
            this.Y = this.ScaleY + Window.MoveBarHeight + 3;
        }