Ejemplo n.º 1
0
        public void AfterTreeItemSelect()
        {
            AnimationChainSave lastChain = SelectedState.Self.Snapshot.AnimationChainSave;
            AnimationFrameSave lastFrame = SelectedState.Self.Snapshot.AnimationFrameSave;

            SaveWireframeCameraPosition();

            // Refresh the wireframe before the property grid so the property
            // grid can get the texture information.
            WireframeManager.Self.RefreshAll();
            PropertyGridManager.Self.Refresh();
            SelectedState.Self.TakeSnapshot();

            if (lastChain != SelectedState.Self.SelectedChain)
            {
                // handle new chain selected here
                WireframeManager.Self.HandleAnimationChainChanged();
                PreviewManager.Self.ReactToAnimationChainSelected();
                AnimationChainSelected?.Invoke(this, null);
            }
            if (lastFrame != SelectedState.Self.SelectedFrame)
            {
                PreviewManager.Self.ReactToAnimationFrameSelected();
            }
        }
Ejemplo n.º 2
0
        public MainControl()
        {
            mSelf = this;
            InitializeComponent();

            this.animationsListToolBar1.AddAnimationClick += AddAnimationToolStripMenuItem_Click;

            CreateViewModel();

            mScrollBarControlLogic = new ScrollBarControlLogic(PreviewSplitContainer.Panel1);

            ApplicationEvents.Self.WireframePanning       += delegate { mScrollBarControlLogic.UpdateScrollBars(); };
            ApplicationEvents.Self.WireframeTextureChange += ScrollBarHandleTextureChange;
            ApplicationEvents.Self.AfterZoomChange        += delegate
            {
                mScrollBarControlLogic.ZoomPercentage = (float)ApplicationState.Self.WireframeZoomValue;
                mScrollBarControlLogic.UpdateScrollBars();
            };

            this.imageRegionSelectionControl1   = new FlatRedBall.SpecializedXnaControls.ImageRegionSelectionControl();
            imageRegionSelectionControl1.Click += new EventHandler(HandleImageRegionSelectionControlClick);
            this.PreviewSplitContainer.Panel1.Controls.Add(this.imageRegionSelectionControl1);

            //
            // imageRegionSelectionControl1
            //
            // Winforms has issues with controls that contain custom controls
            // and if this control was in custom code, it caused all kinds of
            // issues.  So we'll just instantiate it here as a workaround.
            this.imageRegionSelectionControl1.CurrentTexture         = null;
            this.imageRegionSelectionControl1.DesiredFramesPerSecond = 30F;
            this.imageRegionSelectionControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            //this.imageRegionSelectionControl1.Width = 100;
            //this.imageRegionSelectionControl1.Height = 100;
            this.imageRegionSelectionControl1.Location = new System.Drawing.Point(0, 23);
            this.imageRegionSelectionControl1.Name     = "imageRegionSelectionControl1";
            this.imageRegionSelectionControl1.Size     = new System.Drawing.Size(296, 264);
            this.imageRegionSelectionControl1.TabIndex = 0;
            this.imageRegionSelectionControl1.Text     = "imageRegionSelectionControl1";
            this.imageRegionSelectionControl1.BringToFront();

            this.WireframeTopUiControl.PropertyChanged += HandleEditorControlsPropertyChanged;

            SelectedState.Self.Initialize(this.AnimationTreeView);
            if (this.DesignMode == false)
            {
                HandleRegionXnaInitialize();
                this.imageRegionSelectionControl1.XnaUpdate += new Action(HandleXnaUpdate);
            }
            PropertyGridManager.Self.Initialize(SelectedItemPropertyGrid, this.tileMapInfoWindow1);
            PropertyGridManager.Self.AnimationChainChange += RaiseAnimationChainChanges;
            PropertyGridManager.Self.AnimationFrameChange += HandleAnimationFrameChanges;


            TreeViewManager.Self.Initialize(AnimationTreeView);
            TreeViewManager.Self.AnimationChainsChange  += RaiseAnimationChainChanges;
            TreeViewManager.Self.AnimationChainSelected += (not, used) => AnimationChainSelected?.Invoke(this, null);

            StatusBarManager.Self.Initialize(statusStrip1, CursorStatusLabel);

            WireframeManager.Self.AnimationFrameChange += HandleAnimationFrameChanges;


            PopulateUnitTypeComboBox();

            PreviewManager.Self.Initialize(PreviewGraphicsControl, previewControls1);
        }