示例#1
0
        public MainControl()
        {
            mSelf = this;
            InitializeComponent();


            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();

            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;

            StatusBarManager.Self.Initialize(statusStrip1, CursorStatusLabel);

            WireframeManager.Self.AnimationFrameChange += HandleAnimationFrameChanges;

            PopulateUnitTypeComboBox();

            PreviewManager.Self.Initialize(PreviewGraphicsControl, previewControls1);
        }
        public TmxEditorControl()
        {
            InitializeComponent();

            CreateXnaControl();

            TilesetController.Self.Initialize(this.XnaControl, TilesetsListBox, this.StatusLabel,
                this.TilesetTilePropertyGrid, this.HasCollisionsCheckBox, NameTextBox, EntitiesComboBox);
            TilesetController.Self.AnyTileMapChange += HandleChangeInternal;

            XnaControl.XnaUpdate += new Action(HandleXnaUpdate);
            XnaControl.XnaDraw += new Action(HandleXnaDraw);

            mScrollBarControlLogic = new ScrollBarControlLogic(this.splitContainer3.Panel1);
            ApplicationEvents.Self.WireframePanning += delegate
            {
                mScrollBarControlLogic.UpdateScrollBars();
            };
            ApplicationEvents.Self.SelectedTilesetChanged += delegate
            {
                int width = 256;
                int height = 256;

                var texture = TilesetController.Self.CurrentTexture;

                if(texture != null)
                {
                    width = texture.Width;
                    height = texture.Height;
                }

                mScrollBarControlLogic.UpdateToImage(width, height);
            };

            LayersController.Self.Initialize(this.LayersListBox, LayerPropertyGrid);
            LayersController.Self.AnyTileMapChange += HandleChangeInternal;
            HandleXnaInitialize();

            EditorObjects.IoC.Container.Set<TmxEditor.Managers.ResizeFixer>(new Managers.ResizeFixer());
        }