コード例 #1
0
        public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, PageCollection tabs, InputHandler input)
        {
            this.multiBoard = multiBoard;
            this.ribbon     = ribbon;
            this.tabs       = tabs;
            this.input      = input;
            this.backupMan  = new BackupManager(multiBoard, input, this, tabs);

            this.ribbon.NewClicked               += ribbon_NewClicked;
            this.ribbon.OpenClicked              += ribbon_OpenClicked;
            this.ribbon.SaveClicked              += ribbon_SaveClicked;
            this.ribbon.RepackClicked            += ribbon_RepackClicked;
            this.ribbon.AboutClicked             += ribbon_AboutClicked;
            this.ribbon.HelpClicked              += ribbon_HelpClicked;
            this.ribbon.SettingsClicked          += ribbon_SettingsClicked;
            this.ribbon.ExitClicked              += ribbon_ExitClicked;
            this.ribbon.ViewToggled              += ribbon_ViewToggled;
            this.ribbon.ShowMinimapToggled       += ribbon_ShowMinimapToggled;
            this.ribbon.ParallaxToggled          += ribbon_ParallaxToggled;
            this.ribbon.LayerViewChanged         += ribbon_LayerViewChanged;
            this.ribbon.MapSimulationClicked     += ribbon_MapSimulationClicked;
            this.ribbon.RegenerateMinimapClicked += ribbon_RegenerateMinimapClicked;
            this.ribbon.SnappingToggled          += ribbon_SnappingToggled;
            this.ribbon.RandomTilesToggled       += ribbon_RandomTilesToggled;
            this.ribbon.InfoModeToggled          += ribbon_InfoModeToggled;
            this.ribbon.HaRepackerClicked        += ribbon_HaRepackerClicked;
            this.ribbon.FinalizeClicked          += ribbon_FinalizeClicked;
            this.ribbon.NewPlatformClicked       += ribbon_NewPlatformClicked;
            this.ribbon.UserObjsClicked          += ribbon_UserObjsClicked;
            this.ribbon.ExportClicked            += ribbon_ExportClicked;
            this.ribbon.RibbonKeyDown            += multiBoard.DxContainer_KeyDown;

            this.tabs.CurrentPageChanged += tabs_CurrentPageChanged;
            this.tabs.PageClosing        += tabs_PageClosing;
            this.tabs.PageRemoved        += tabs_PageRemoved;

            this.multiBoard.OnBringToFrontClicked  += multiBoard_OnBringToFrontClicked;
            this.multiBoard.OnEditBaseClicked      += multiBoard_OnEditBaseClicked;
            this.multiBoard.OnEditInstanceClicked  += multiBoard_OnEditInstanceClicked;
            this.multiBoard.OnLayerTSChanged       += multiBoard_OnLayerTSChanged;
            this.multiBoard.OnSendToBackClicked    += multiBoard_OnSendToBackClicked;
            this.multiBoard.ReturnToSelectionState += multiBoard_ReturnToSelectionState;
            this.multiBoard.SelectedItemChanged    += multiBoard_SelectedItemChanged;
            this.multiBoard.MouseMoved             += multiBoard_MouseMoved;
            this.multiBoard.ImageDropped           += multiBoard_ImageDropped;
            this.multiBoard.ExportRequested        += ribbon_ExportClicked;
            this.multiBoard.LoadRequested          += ribbon_OpenClicked;
            this.multiBoard.CloseTabRequested      += multiBoard_CloseTabRequested;
            this.multiBoard.SwitchTabRequested     += multiBoard_SwitchTabRequested;
            this.multiBoard.BackupCheck            += multiBoard_BackupCheck;
            this.multiBoard.BoardRemoved           += multiBoard_BoardRemoved;
            this.multiBoard.MinimapStateChanged    += multiBoard_MinimapStateChanged;

            multiBoard.Visible = false;
            ribbon.SetEnabled(false);
        }
コード例 #2
0
ファイル: Editor.cs プロジェクト: ilvmoney/hasuite-new
 private void Editor_Load(object sender, EventArgs e)
 {
     if (new Load(multiBoard, Tabs, new EventHandler(mapEditInfo)).ShowDialog() == DialogResult.OK)
     {
         multiBoard.Start();
         InputHandler handler = new InputHandler(multiBoard);
     }
     else
     {
         FormClosing -= Editor_FormClosing;
         Close();
     }
     layersComboBox.SelectedIndex = 0;
 }
コード例 #3
0
        public void RenderBoard(SpriteBatch sprite)
        {
            if (mapInfo == null)
            {
                return;
            }
            int           xShift = centerPoint.X - hScroll;
            int           yShift = centerPoint.Y - vScroll;
            SelectionInfo sel    = GetUserSelectionInfo();

            // Render the object lists
            for (int i = 0; i < boardItems.AllItemLists.Length; i++)
            {
                RenderList(boardItems.AllItemLists[i], sprite, xShift, yShift, sel);
            }

            // Render the user's selection square
            if (mouse.MultiSelectOngoing)
            {
                Rectangle selectionRect = InputHandler.CreateRectangle(
                    new Point(MultiBoard.VirtualToPhysical(mouse.MultiSelectStart.X, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(mouse.MultiSelectStart.Y, centerPoint.Y, vScroll, 0)),
                    new Point(MultiBoard.VirtualToPhysical(mouse.X, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(mouse.Y, centerPoint.Y, vScroll, 0)));
                parent.DrawRectangle(sprite, selectionRect, UserSettings.SelectSquare);
                selectionRect.X++;
                selectionRect.Y++;
                selectionRect.Width--;
                selectionRect.Height--;
                parent.FillRectangle(sprite, selectionRect, UserSettings.SelectSquareFill);
            }

            // Render VR if it exists
            if (VRRectangle != null && (sel.visibleTypes & VRRectangle.Type) != 0)
            {
                VRRectangle.Draw(sprite, xShift, yShift, sel);
            }
            // Render minimap rectangle
            if (MinimapRectangle != null && (sel.visibleTypes & MinimapRectangle.Type) != 0)
            {
                MinimapRectangle.Draw(sprite, xShift, yShift, sel);
            }

            // Render the minimap itself
            if (miniMap != null && UserSettings.useMiniMap)
            {
                // Area for the image itself
                Rectangle minimapImageArea = new Rectangle((miniMapPos.X + centerPoint.X) / _mag, (miniMapPos.Y + centerPoint.Y) / _mag, miniMap.Width, miniMap.Height);

                // Render gray area
                parent.FillRectangle(sprite, minimapArea, Color.Gray);
                // Render minimap
                if (miniMapTexture == null)
                {
                    miniMapTexture = BoardItem.TextureFromBitmap(parent.GraphicsDevice, miniMap);
                }
                sprite.Draw(miniMapTexture, minimapImageArea, null, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0.99999f);
                // Render current location on minimap
                parent.DrawRectangle(sprite, new Rectangle(hScroll / _mag, vScroll / _mag, parent.CurrentDXWindowSize.Width / _mag, (int)parent.CurrentDXWindowSize.Height / _mag), Color.Blue);

                // Render minimap borders
                parent.DrawRectangle(sprite, minimapImageArea, Color.Black);
            }

            // Render center point if InfoMode on
            if (ApplicationSettings.InfoMode)
            {
                parent.FillRectangle(sprite, new Rectangle(MultiBoard.VirtualToPhysical(-5, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(-5, centerPoint.Y, vScroll, 0), 10, 10), Color.DarkRed);
            }
        }