Exemplo n.º 1
0
        public static void Initialize()
        {

            Window.KeepWindowsInScreen = false;

            #region Assign engine references

            camera = GameForm.camera;

            #endregion


            fileButtonWindow = new FileButtonWindow(GuiManager.Cursor);

            ToolsWindow = new ToolsWindow();
            mVisibleToggleWindows.Add(ToolsWindow);
            
            ListWindow = new ListWindow(ToolsWindow);
            mVisibleToggleWindows.Add(ListWindow);

            //#region Create AttributesWindow
            //mAttributesWindow = new AttributesWindow(messages);
            //mAttributesWindow.SetPositionTL(84.5f, 25.8f);
            //mAttributesWindow.Visible = false;
            //GuiManager.AddWindow(mAttributesWindow);
            //#endregion

            spriteGridPropertiesWindow = new SpriteGridCreationPropertiesWindow(GuiManager.Cursor);
            srSaveOptions = new SpriteRigSaveOptions(messages, GuiManager.Cursor);

            #region TextureCoordinateSelectionWindow

            mTextureCoordinateSelectionWindow = new TextureCoordinatesSelectionWindow();
            GuiManager.AddWindow(mTextureCoordinateSelectionWindow);
            // set AddToListButtonShown to true before setting the visibility to false so that it updates correclty
            mTextureCoordinateSelectionWindow.AddToListButtonShown = true;
            mTextureCoordinateSelectionWindow.Visible = false;
            mTextureCoordinateSelectionWindow.HasCloseButton = true;
            mTextureCoordinateSelectionWindow.AddToListClickEventAdd(messages.AddDisplayRegion);
            mVisibleToggleWindows.Add(mTextureCoordinateSelectionWindow);

            #endregion

            #region MenuStrip

            mMenuStrip = new SpriteEditor.Gui.MenuStrip();
            mMenuStrip.SavedSuccess += new EventHandler(mMenuStrip_SavedSuccess);
            
            #endregion

            GameData.EditorLogic.NodeNetworkEditorManager.AddNodeNetworkMenus(MenuStrip);


            CreateInfoBar();

            CreatePropertyGrids();

            CreateListDisplayWindows();

            List<string> windowsToExclude = new List<string>();
            windowsToExclude.Add(mMenuStrip.Name);

            LayoutManager.LoadWindowLayout(windowsToExclude);

            Window.KeepWindowsInScreen = true;

        }
        private void saveButtonClick(Window callingWindow)
        {
            // If a user thinks he's funny and selects AllNotJoint for BodySprites
            // and AllNotBodySprites for Joints, let the user know he has to
            // specify some criteria.
            if (this.bodySpriteSelectionMethod.Text == "All Not Joint" &&
                this.jointSpriteSelectionMethod.Text == "All Not Body")
            {
                GuiManager.ShowMessageBox(
                    "Cannot select All Not Body for Joint Selection when " +
                    "All Not Joint is selected for Body Sprite Selection.  " +
                    "Change one of the criteria and try to save again.", "Selection Error");
                return;
            }



            double     error           = 0;
            SpriteList possibleSprites = new SpriteList();

            if (this.sceneOrGroup.Text == "Entire Scene")
            {
                possibleSprites = GameData.Scene.Sprites;
            }
            else if (GameData.EditorLogic.CurrentSprites.Count != 0)
            {
                ((Sprite)GameData.EditorLogic.CurrentSprites[0].TopParent).GetAllDescendantsOneWay(possibleSprites);
            }

            #region Get rid of the Axes from the possibleSprites

            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xAxis))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.xAxis);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yAxis))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.yAxis);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.zAxis))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.zAxis);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xRot))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.xRot);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yRot))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.yRot);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xScale))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.xScale);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yScale))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.yScale);
            }
            if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.origin))
            {
                possibleSprites.Remove(GameData.EditorLogic.EditAxes.origin);
            }
            #endregion

            if (this.bodySpriteSelectionMethod.Text == "Name Includes")
            {
                this.bodySprites = possibleSprites.FindSpritesWithNameContaining(this.bodyNameToInclude.Text);
            }
            else if (this.bodySpriteSelectionMethod.Text == "By Texture")
            {
                this.bodySprites = possibleSprites.FindSpritesWithTexture(
                    FlatRedBallServices.Load <Texture2D>(this.bodyAvailableTextures.Text, GameData.SceneContentManager));
            }
            else if (this.bodySpriteSelectionMethod.Text == "All")
            {
                this.bodySprites = possibleSprites;
            }

            if (this.jointSpriteSelectionMethod.Text == "Name Includes")
            {
                this.joints = possibleSprites.FindSpritesWithNameContaining(this.jointNameToInclude.Text);
            }
            else if (this.jointSpriteSelectionMethod.Text == "By Texture")
            {
                this.joints = possibleSprites.FindSpritesWithTexture(
                    FlatRedBallServices.Load <Texture2D>(this.jointAvailableTextures.Text, GameData.SceneContentManager));
            }
            else if (this.jointSpriteSelectionMethod.Text == "All")
            {
                this.joints = possibleSprites;
            }

            try
            {
                if (bodySpriteSelectionMethod == null)
                {
                    System.Windows.Forms.MessageBox.Show("a");
                }

                if (this.bodySpriteSelectionMethod.Text == "All Not Joint")
                {
                    this.bodySprites = new SpriteList();

                    if (possibleSprites == null)
                    {
                        System.Windows.Forms.MessageBox.Show("b");
                    }


                    foreach (Sprite s in possibleSprites)
                    {
                        if (this == null)
                        {
                            System.Windows.Forms.MessageBox.Show("c");
                        }
                        if (this.joints == null)
                        {
                            System.Windows.Forms.MessageBox.Show("d");
                        }
                        if (this.bodySprites == null)
                        {
                            System.Windows.Forms.MessageBox.Show("e");
                        }



                        if (!this.joints.Contains(s))
                        {
                            this.bodySprites.Add(s);
                        }
                    }
                }
            }
            catch { error = 3.3; }
            if (this.jointSpriteSelectionMethod.Text == "All Not Body")
            {
                this.joints = new SpriteList();
                foreach (Sprite s in possibleSprites)
                {
                    if (!this.bodySprites.Contains(s))
                    {
                        this.joints.Add(s);
                    }
                }
            }

            if (this.rootSpriteComboBox.Text != "<No Root>")
            {
                this.root = possibleSprites.FindByName(this.rootSpriteComboBox.Text);
            }
            else
            {
                this.root = null;
            }



            FileButtonWindow.spriteRigOptionsOK(this);
            this.Visible = false;
        }
Exemplo n.º 3
0
        public static void Initialize()
        {
            Window.KeepWindowsInScreen = false;

            #region Assign engine references

            camera = GameForm.camera;

            #endregion


            fileButtonWindow = new FileButtonWindow(GuiManager.Cursor);

            ToolsWindow = new ToolsWindow();
            mVisibleToggleWindows.Add(ToolsWindow);

            ListWindow = new ListWindow(ToolsWindow);
            mVisibleToggleWindows.Add(ListWindow);

            //#region Create AttributesWindow
            //mAttributesWindow = new AttributesWindow(messages);
            //mAttributesWindow.SetPositionTL(84.5f, 25.8f);
            //mAttributesWindow.Visible = false;
            //GuiManager.AddWindow(mAttributesWindow);
            //#endregion

            spriteGridPropertiesWindow = new SpriteGridCreationPropertiesWindow(GuiManager.Cursor);
            srSaveOptions = new SpriteRigSaveOptions(messages, GuiManager.Cursor);

            #region TextureCoordinateSelectionWindow

            mTextureCoordinateSelectionWindow = new TextureCoordinatesSelectionWindow();
            GuiManager.AddWindow(mTextureCoordinateSelectionWindow);
            // set AddToListButtonShown to true before setting the visibility to false so that it updates correclty
            mTextureCoordinateSelectionWindow.AddToListButtonShown = true;
            mTextureCoordinateSelectionWindow.Visible        = false;
            mTextureCoordinateSelectionWindow.HasCloseButton = true;
            mTextureCoordinateSelectionWindow.AddToListClickEventAdd(messages.AddDisplayRegion);
            mVisibleToggleWindows.Add(mTextureCoordinateSelectionWindow);

            #endregion

            #region MenuStrip

            mMenuStrip = new SpriteEditor.Gui.MenuStrip();
            mMenuStrip.SavedSuccess += new EventHandler(mMenuStrip_SavedSuccess);

            #endregion

            GameData.EditorLogic.NodeNetworkEditorManager.AddNodeNetworkMenus(MenuStrip);


            CreateInfoBar();

            CreatePropertyGrids();

            CreateListDisplayWindows();

            List <string> windowsToExclude = new List <string>();
            windowsToExclude.Add(mMenuStrip.Name);

            LayoutManager.LoadWindowLayout(windowsToExclude);

            Window.KeepWindowsInScreen = true;
        }