Пример #1
0
 public New(MultiBoard board, HaCreator.ThirdParty.TabPages.PageCollection Tabs, EventHandler[] rightClickHandler)
 {
     InitializeComponent();
     this.multiBoard = board;
     this.Tabs = Tabs;
     this.rightClickHandler = rightClickHandler;
 }
Пример #2
0
 public BackupManager(MultiBoard multiBoard, InputHandler input, HaCreatorStateManager hcsm, System.Windows.Controls.TabControl tabs)
 {
     this.input      = input;
     this.multiBoard = multiBoard;
     this.hcsm       = hcsm;
     this.tabs       = tabs;
 }
Пример #3
0
        public UserObjectsManager(MultiBoard multiBoard)
        {
            this.multiBoard = multiBoard;

            if (Program.InfoManager == null)
            {
                // Prevents VS designer from crashing when rendering this control; there is no way that Program.InfoManager will be null
                // in the real execution of this code.
                return;
            }

            // Make sure that all our structures exist
            if (!Program.InfoManager.ObjectSets.ContainsKey(oS))
            {
                Program.InfoManager.ObjectSets[oS] = new WzImage(oS);
                Program.InfoManager.ObjectSets[oS].Changed = true;
            }
            WzImage osimg = Program.InfoManager.ObjectSets[oS];
            if (osimg[l0] == null)
            {
                osimg[l0] = new WzSubProperty();
            }
            WzImageProperty l0prop = osimg[l0];
            if (l0prop[l1] == null)
            {
                l0prop[l1] = new WzSubProperty();
            }
            l1prop = l0prop[l1];
        }
Пример #4
0
 public BoardItemContextMenu(MultiBoard multiboard, Board board, BoardItem target)
 {
     this.multiboard = multiboard;
     this.board      = board;
     this.target     = target;
     this.cms        = null;
 }
Пример #5
0
 public void TryConnectFoothold()
 {
     Xna.Point pos = new Xna.Point(X, Y);
     foreach (FootholdAnchor anchor in Board.BoardItems.FHAnchors)
     {
         if (MultiBoard.IsPointInsideRectangle(pos, anchor.Left, anchor.Top, anchor.Right, anchor.Bottom))
         {
             if (connectedLines.Count > 0)
             {
                 if (connectedLines[0].FirstDot != anchor && !FootholdLine.Exists(anchor.X, anchor.Y, connectedLines[0].FirstDot.X, connectedLines[0].FirstDot.Y, Board))
                 {
                     Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> {
                         UndoRedoManager.LineAdded(connectedLines[0], connectedLines[0].FirstDot, anchor)
                     });
                     connectedLines[0].ConnectSecondDot(anchor);
                     FootholdLine fh = new FootholdLine(Board, anchor);
                     Board.BoardItems.FootholdLines.Add(fh);
                 }
             }
             else
             {
                 Board.BoardItems.FootholdLines.Add(new FootholdLine(Board, anchor));
             }
         }
     }
 }
Пример #6
0
 public BackupManager(MultiBoard multiBoard, InputHandler input, HaCreatorStateManager hcsm, HaCreator.ThirdParty.TabPages.PageCollection tabs)
 {
     this.input = input;
     this.multiBoard = multiBoard;
     this.hcsm = hcsm;
     this.tabs = tabs;
 }
Пример #7
0
 public Save(MultiBoard multiBoard)
 {
     InitializeComponent();
     styleManager.ManagerStyle = UserSettings.applicationStyle;
     this.multiBoard = multiBoard;
     label1.Text = "This will save Map.wz to:\r\n'" + Program.WzManager.getWzPath() + "\\EdittedWZ' (Please make sure that the directory exists)";
 }
        public UserObjectsManager(MultiBoard multiBoard)
        {
            this.multiBoard = multiBoard;

            if (Program.InfoManager == null)
            {
                // Prevents VS designer from crashing when rendering this control; there is no way that Program.InfoManager will be null
                // in the real execution of this code.
                return;
            }

            // Make sure that all our structures exist
            if (!Program.InfoManager.ObjectSets.ContainsKey(oS))
            {
                Program.InfoManager.ObjectSets[oS]         = new WzImage(oS);
                Program.InfoManager.ObjectSets[oS].Changed = true;
            }
            WzImage osimg = Program.InfoManager.ObjectSets[oS];

            if (osimg[Program.APP_NAME] == null)
            {
                osimg[Program.APP_NAME] = new WzSubProperty();
            }
            WzImageProperty l0prop = osimg[Program.APP_NAME];

            if (l0prop[l1] == null)
            {
                l0prop[l1] = new WzSubProperty();
            }
            l1prop = l0prop[l1];
        }
Пример #9
0
 public BoardItemContextMenu(MultiBoard multiboard, Board board, BoardItem target)
 {
     this.multiboard = multiboard;
     this.board = board;
     this.target = target;
     this.cms = null;
 }
Пример #10
0
 public BackupManager(MultiBoard multiBoard, InputHandler input, HaCreatorStateManager hcsm, HaCreator.ThirdParty.TabPages.PageCollection tabs)
 {
     this.input      = input;
     this.multiBoard = multiBoard;
     this.hcsm       = hcsm;
     this.tabs       = tabs;
 }
Пример #11
0
 public Load(MultiBoard board, TabPages.PageCollection Tabs, EventHandler rightClickHandler)
 {
     InitializeComponent();
     DialogResult = DialogResult.Cancel;
     styleManager.ManagerStyle = UserSettings.applicationStyle;
     this.multiBoard = board;
     this.Tabs = Tabs;
     this.rightClickHandler = rightClickHandler;
 }
Пример #12
0
 public Load(MultiBoard board, HaCreator.ThirdParty.TabPages.PageCollection Tabs, EventHandler[] rightClickHandler)
 {
     InitializeComponent();
     DialogResult = DialogResult.Cancel;
     this.multiBoard = board;
     this.Tabs = Tabs;
     this.rightClickHandler = rightClickHandler;
     this.searchBox.TextChanged += this.mapBrowser.searchBox_TextChanged;
 }
Пример #13
0
 public Board(Point mapSize, Point centerPoint, MultiBoard parent/*, ItemTypes ApplicationSettings.visibleTypes*/)
 {
     this.mapSize = mapSize;
     this.centerPoint = centerPoint;
     this.parent = parent;
     undoRedoMan = new UndoRedoManager(this);
     parent.Boards.Add(this);
     mouse = new Mouse(this);
 }
Пример #14
0
 public Board(Point mapSize, Point centerPoint, MultiBoard parent /*, ItemTypes ApplicationSettings.visibleTypes*/)
 {
     this.mapSize     = mapSize;
     this.centerPoint = centerPoint;
     this.parent      = parent;
     undoRedoMan      = new UndoRedoManager(this);
     parent.Boards.Add(this);
     mouse = new Mouse(this);
 }
Пример #15
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);
        }
Пример #16
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);
        }
Пример #17
0
 public InputHandler(MultiBoard parentBoard)
 {
     this.parentBoard = parentBoard;
     parentBoard.LeftMouseDown += new MultiBoard.LeftMouseDownDelegate(parentBoard_LeftMouseDown);
     parentBoard.LeftMouseUp += new MultiBoard.LeftMouseUpDelegate(parentBoard_LeftMouseUp);
     parentBoard.RightMouseClick += new MultiBoard.RightMouseClickDelegate(parentBoard_RightMouseClick);
     parentBoard.MouseDoubleClick += new MultiBoard.MouseDoubleClickDelegate(parentBoard_MouseDoubleClick);
     parentBoard.ShortcutKeyPressed += new MultiBoard.ShortcutKeyPressedDelegate(parentBoard_ShortcutKeyPressed);
     parentBoard.MouseMoved += new MultiBoard.MouseMovedDelegate(parentBoard_MouseMoved);
 }
Пример #18
0
 public InputHandler(MultiBoard parentBoard)
 {
     this.parentBoard                = parentBoard;
     parentBoard.LeftMouseDown      += new MultiBoard.LeftMouseDownDelegate(parentBoard_LeftMouseDown);
     parentBoard.LeftMouseUp        += new MultiBoard.LeftMouseUpDelegate(parentBoard_LeftMouseUp);
     parentBoard.RightMouseClick    += new MultiBoard.RightMouseClickDelegate(parentBoard_RightMouseClick);
     parentBoard.MouseDoubleClick   += new MultiBoard.MouseDoubleClickDelegate(parentBoard_MouseDoubleClick);
     parentBoard.ShortcutKeyPressed += new MultiBoard.ShortcutKeyPressedDelegate(parentBoard_ShortcutKeyPressed);
     parentBoard.MouseMoved         += new MultiBoard.MouseMovedDelegate(parentBoard_MouseMoved);
 }
Пример #19
0
 private void PrepareDevice()
 {
     pParams.BackBufferWidth    = Math.Max(DxContainer.Width, 1);
     pParams.BackBufferHeight   = Math.Max(DxContainer.Height, 1);
     pParams.BackBufferFormat   = SurfaceFormat.Color;
     pParams.DepthStencilFormat = DepthFormat.Depth24;
     pParams.DeviceWindowHandle = dxHandle;
     pParams.IsFullScreen       = false;
     //pParams.PresentationInterval = PresentInterval.Immediate;
     DxDevice   = MultiBoard.CreateGraphicsDevice(pParams);
     fontEngine = new FontEngine(UserSettings.FontName, UserSettings.FontStyle, UserSettings.FontSize, DxDevice);
     sprite     = new SpriteBatch(DxDevice);
 }
Пример #20
0
        public Board(Point mapSize, Point centerPoint, MultiBoard parent, ContextMenuStrip menu, ItemTypes visibleTypes, ItemTypes editedTypes)
        {
            this.uid = Interlocked.Increment(ref uidCounter);
            this.MapSize = mapSize;
            this.centerPoint = centerPoint;
            this.parent = parent;
            this.visibleTypes = visibleTypes;
            this.editedTypes = editedTypes;
            this.menu = menu;

            boardItems = new BoardItemsManager(this);
            undoRedoMan = new UndoRedoManager(this);
            mouse = new Mouse(this);
            serMan = new SerializationManager(this);
        }
Пример #21
0
        public Board(Point mapSize, Point centerPoint, MultiBoard parent, System.Windows.Controls.ContextMenu menu, ItemTypes visibleTypes, ItemTypes editedTypes)
        {
            this.uid          = Interlocked.Increment(ref uidCounter);
            this.MapSize      = mapSize;
            this.centerPoint  = centerPoint;
            this.parent       = parent;
            this.visibleTypes = visibleTypes;
            this.editedTypes  = editedTypes;
            this.menu         = menu;

            boardItems  = new BoardItemsManager(this);
            undoRedoMan = new UndoRedoManager(this);
            mouse       = new Mouse(this);
            serMan      = new SerializationManager(this);
        }
Пример #22
0
        public InfoEditor(Board board, MapInfo info, MultiBoard multiBoard)
        {
            InitializeComponent();

            this.board = board;
            this.multiBoard = multiBoard;

            timeLimitEnable.Tag = timeLimit;
            lvLimitEnable.Tag = lvLimit;
            lvForceMoveUse.Tag = lvForceMove;
            firstUserEnable.Tag = firstUserEnter;
            userEnterEnable.Tag = userEnter;
            fieldTypeEnable.Tag = fieldType;
            moveLimitEnable.Tag = moveLimit;
            mapNameEnable.Tag = mapName;
            mapDescEnable.Tag = mapDesc;
            streetNameEnable.Tag = streetNameBox;
            effectEnable.Tag = effectBox;
            dropExpireEnable.Tag = dropExpire;
            dropRateEnable.Tag = dropRate;
            recoveryEnable.Tag = recovery;
            reactorShuffle.Tag = new Control[] { reactorNameShuffle, reactorNameBox };
            reactorNameShuffle.Tag = reactorNameBox;
            fsEnable.Tag = fsBox;
            massEnable.Tag = new Control[] { createMobInterval, fixedMobCapacity };
            hpDecEnable.Tag = new Control[] { decHP, protectItem, decIntervalEnable, decInterval, protectEnable };
            protectEnable.Tag = new Control[] { protectItem };
            decIntervalEnable.Tag = decInterval;
            helpEnable.Tag = helpBox;
            timedMobEnable.Tag = new Control[] { timedMobEnd, timedMobStart };
            summonMobEnable.Tag = new Control[] { timedMobId, timedMobEnable, timedMobMessage };
            autoLieDetectorEnable.Tag = new Control[] { autoLieEnd, autoLieInterval, autoLieProp, autoLieStart };
            allowedItemsEnable.Tag = new Control[] { allowedItems, allowedItemsAdd, allowedItemsRemove };

            this.info = info;
            this.fieldType.SelectedIndex = 0;

            xBox.Value = board.MapSize.X;
            yBox.Value = board.MapSize.Y;

            List<string> sortedBGMs = new List<string>();
            foreach (KeyValuePair<string, WzSoundProperty> bgm in Program.InfoManager.BGMs)
                sortedBGMs.Add(bgm.Key);
            sortedBGMs.Sort();
            foreach (string bgm in sortedBGMs)
                bgmBox.Items.Add(bgm);
            bgmBox.SelectedItem = info.bgm;

            List<string> sortedMarks = new List<string>();
            foreach (KeyValuePair<string, Bitmap> mark in Program.InfoManager.MapMarks)
                sortedMarks.Add(mark.Key);
            sortedMarks.Sort();
            foreach (string mark in sortedMarks)
                markBox.Items.Add(mark);
            markBox.SelectedIndex = 0;

            switch (info.mapType)
            {
                case MapType.CashShopPreview:
                    IDLabel.Text = "CashShopPreview";
                    break;
                case MapType.MapLogin:
                    IDLabel.Text = "MapLogin";
                    break;
                case MapType.RegularMap:
                    if (info.id == -1) IDLabel.Text = "";
                    else IDLabel.Text = info.id.ToString();
                    break;
            }
            nameBox.Text = info.strMapName;
            streetBox.Text = info.strStreetName;
            categoryBox.Text = info.strCategoryName;
            markBox.SelectedItem = info.mapMark;
            if (info.returnMap == info.id) cannotReturnCBX.Checked = true;
            else returnBox.Text = info.returnMap.ToString();
            if (info.forcedReturn == 999999999) returnHereCBX.Checked = true;
            else forcedRet.Text = info.forcedReturn.ToString();
            mobRate.Value = (decimal)info.mobRate;
            //LoadOptionalInt(info.link, linkBox);
            LoadOptionalInt(info.timeLimit, timeLimit, timeLimitEnable);
            LoadOptionalInt(info.lvLimit, lvLimit, lvLimitEnable);
            LoadOptionalInt(info.lvForceMove, lvForceMove, lvForceMoveUse);
            LoadOptionalString(info.onFirstUserEnter, firstUserEnter, firstUserEnable);
            LoadOptionalString(info.onUserEnter, userEnter, userEnterEnable);
            LoadOptionalString(info.mapName, mapName, mapNameEnable);
            LoadOptionalString(info.mapDesc, mapDesc, mapDescEnable);
            LoadOptionalString(info.streetName, streetNameBox, streetNameEnable);
            LoadOptionalString(info.effect, effectBox, effectEnable);
            LoadOptionalInt(info.moveLimit, moveLimit, moveLimitEnable);
            LoadOptionalInt(info.dropExpire, dropExpire, dropExpireEnable);
            LoadOptionalFloat(info.dropRate, dropRate, dropRateEnable);
            LoadOptionalFloat(info.recovery, recovery, recoveryEnable);
            reactorShuffle.Checked = info.reactorShuffle;
            LoadOptionalString(info.reactorShuffleName, reactorNameBox, reactorNameShuffle);
            LoadOptionalFloat(info.fs, fsBox, fsEnable);
            LoadOptionalInt(info.createMobInterval, createMobInterval, massEnable);
            LoadOptionalInt(info.fixedMobCapacity, fixedMobCapacity, massEnable);
            LoadOptionalInt(info.decHP, decHP, hpDecEnable);
            LoadOptionalInt(info.decInterval, decInterval, decIntervalEnable);
            LoadOptionalInt(info.protectItem, protectItem, protectEnable);
            helpEnable.Checked = info.help != null;
            if (info.help != null)
                helpBox.Text = info.help.Replace(@"\n", "\r\n");
            if (info.timeMob != null)
            {
                MapInfo.TimeMob tMob = (MapInfo.TimeMob)info.timeMob;
                summonMobEnable.Checked = true;
                LoadOptionalInt(tMob.startHour, timedMobStart, timedMobEnable);
                LoadOptionalInt(tMob.endHour, timedMobEnd, timedMobEnable);
                timedMobId.Value = tMob.id;
                timedMobMessage.Text = tMob.message.Replace(@"\n", "\r\n");
            }
            if (info.autoLieDetector != null)
            {
                MapInfo.AutoLieDetector ald = (MapInfo.AutoLieDetector)info.autoLieDetector;
                autoLieDetectorEnable.Checked = true;
                autoLieStart.Value = ald.startHour;
                autoLieEnd.Value = ald.endHour;
                autoLieInterval.Value = ald.interval;
                autoLieProp.Value = ald.prop;
            }
            if (info.allowedItem != null)
            {
                allowedItemsEnable.Checked = true;
                foreach (int id in info.allowedItem)
                    allowedItems.Items.Add(id.ToString());
            }
            optionsList.SetChecked(0, info.cloud);
            optionsList.SetChecked(1, info.snow);
            optionsList.SetChecked(2, info.rain);
            optionsList.SetChecked(3, info.swim);
            optionsList.SetChecked(4, info.fly);
            optionsList.SetChecked(5, info.town);
            optionsList.SetChecked(6, info.partyOnly);
            optionsList.SetChecked(7, info.expeditionOnly);
            optionsList.SetChecked(8, info.noMapCmd);
            optionsList.SetChecked(9, info.hideMinimap);
            optionsList.SetChecked(10, info.miniMapOnOff);
            optionsList.SetChecked(11, info.personalShop);
            optionsList.SetChecked(12, info.entrustedShop);
            optionsList.SetChecked(13, info.noRegenMap);
            optionsList.SetChecked(14, info.blockPBossChange);
            optionsList.SetChecked(15, info.everlast);
            optionsList.SetChecked(16, info.damageCheckFree);
            optionsList.SetChecked(17, info.scrollDisable);
            optionsList.SetChecked(18, info.needSkillForFly);
            optionsList.SetChecked(19, info.zakum2Hack);
            optionsList.SetChecked(20, info.allMoveCheck);
            optionsList.SetChecked(21, info.VRLimit);

            for (int i = 0; i < fieldLimitList.Items.Count; i++)
            {
                int value = (int)Math.Pow(2, i);
                fieldLimitList.SetChecked(i, ((int)info.fieldLimit & value) == value);
            }
            if (info.fieldType != null)/* fieldType.SelectedIndex = -1;
            else*/
            {
                fieldType.SelectedIndex = 0;
                if ((int)info.fieldType <= 0x22)
                    fieldType.SelectedIndex = (int)info.fieldType;
                else switch (info.fieldType)
                    {
                        case FieldType.FIELDTYPE_WEDDING:
                            fieldType.SelectedIndex = 0x23;
                            break;
                        case FieldType.FIELDTYPE_WEDDINGPHOTO:
                            fieldType.SelectedIndex = 0x24;
                            break;
                        case FieldType.FIELDTYPE_FISHINGKING:
                            fieldType.SelectedIndex = 0x25;
                            break;
                        case FieldType.FIELDTYPE_SHOWABATH:
                            fieldType.SelectedIndex = 0x26;
                            break;
                        case FieldType.FIELDTYPE_BEGINNERCAMP:
                            fieldType.SelectedIndex = 0x27;
                            break;
                        case FieldType.FIELDTYPE_SNOWMAN:
                            fieldType.SelectedIndex = 0x28;
                            break;
                        case FieldType.FIELDTYPE_SHOWASPA:
                            fieldType.SelectedIndex = 0x29;
                            break;
                        case FieldType.FIELDTYPE_HORNTAILPQ:
                            fieldType.SelectedIndex = 0x2A;
                            break;
                        case FieldType.FIELDTYPE_CRIMSONWOODPQ:
                            fieldType.SelectedIndex = 0x2B;
                            break;
                    }
            }
            foreach (WzImageProperty prop in info.additionalProps)
            {
                TreeNode node = unknownProps.Nodes.Add(prop.Name);
                node.Tag = prop;
                if (prop.WzProperties != null && prop.WzProperties.Count > 0)
                    ExtractPropList(prop.WzProperties, node);
            }
        }
        public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, System.Windows.Controls.TabControl tabs, InputHandler input,
                                     SystemWinCtl.TextBlock textblock_CursorX, SystemWinCtl.TextBlock textblock_CursorY, SystemWinCtl.TextBlock textblock_RCursorX, SystemWinCtl.TextBlock textblock_RCursorY, SystemWinCtl.TextBlock textblock_selectedItem)
        {
            this.multiBoard = multiBoard;
            multiBoard.HaCreatorStateManager = this;

            this.ribbon = ribbon;
            this.tabs   = tabs;
            this.input  = input;

            // Status bar
            this.textblock_CursorX      = textblock_CursorX;
            this.textblock_CursorY      = textblock_CursorY;
            this.textblock_RCursorX     = textblock_RCursorX;
            this.textblock_RCursorY     = textblock_RCursorY;
            this.textblock_selectedItem = textblock_selectedItem;

            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.SelectionChanged += Tabs_SelectionChanged;

            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.Visibility = System.Windows.Visibility.Collapsed;
            ribbon.SetEnabled(false);
        }
Пример #24
0
        public void CreateMapFromImage(WzImage mapImage, string mapName, string streetName, string categoryName, WzSubProperty strMapProp, PageCollection Tabs, MultiBoard multiBoard, EventHandler[] rightClickHandler)
        {
            if (!mapImage.Parsed) mapImage.ParseImage();
            List<string> copyPropNames = VerifyMapPropsKnown(mapImage, false);
            MapInfo info = new MapInfo(mapImage, mapName, streetName, categoryName);
            foreach (string copyPropName in copyPropNames)
            {
                info.additionalNonInfoProps.Add(mapImage[copyPropName]);
            }
            MapType type = GetMapType(mapImage);
            if (type == MapType.RegularMap)
                info.id = int.Parse(WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)));
            info.mapType = type;

            Rectangle VR = new Rectangle();
            Point center = new Point();
            Point size = new Point();
            Point minimapSize = new Point();
            Point minimapCenter = new Point();
            bool hasMinimap = false;
            bool hasVR = false;

            try
            {
                GetMapDimensions(mapImage, out VR, out center, out size, out minimapCenter, out minimapSize, out hasVR, out hasMinimap);
            }
            catch (NoVRException)
            {
                MessageBox.Show("Error - map does not contain size information and HaCreator was unable to generate it. An error has been logged.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ErrorLogger.Log(ErrorLevel.IncorrectStructure, "no size @map " + info.id.ToString());
                return;
            }

            lock (multiBoard)
            {
                CreateMap(mapName, WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)), CreateStandardMapMenu(rightClickHandler), size, center, 8, Tabs, multiBoard);
                Board mapBoard = multiBoard.SelectedBoard;
                mapBoard.Loading = true; // prevents TS Change callbacks
                mapBoard.MapInfo = info;
                if (hasMinimap)
                {
                    mapBoard.MiniMap = ((WzCanvasProperty)mapImage["miniMap"]["canvas"]).PngProperty.GetPNG(false);
                    System.Drawing.Point mmPos = new System.Drawing.Point(-minimapCenter.X, -minimapCenter.Y);
                    mapBoard.MinimapPosition = mmPos;
                    mapBoard.MinimapRectangle = new MinimapRectangle(mapBoard, new Rectangle(mmPos.X, mmPos.Y, minimapSize.X, minimapSize.Y));
                }
                if (hasVR)
                {
                    mapBoard.VRRectangle = new VRRectangle(mapBoard, VR);
                }
                LoadLayers(mapImage, mapBoard);
                LoadLife(mapImage, mapBoard);
                LoadFootholds(mapImage, mapBoard);
                GenerateDefaultZms(mapBoard);
                LoadRopes(mapImage, mapBoard);
                LoadChairs(mapImage, mapBoard);
                LoadPortals(mapImage, mapBoard);
                LoadReactors(mapImage, mapBoard);
                LoadToolTips(mapImage, mapBoard);
                LoadBackgrounds(mapImage, mapBoard);
                LoadMisc(mapImage, mapBoard);

                mapBoard.BoardItems.Sort();
                mapBoard.Loading = false;
            }
            if (ErrorLogger.ErrorsPresent())
            {
                ErrorLogger.SaveToFile("errors.txt");
                if (UserSettings.ShowErrorsMessage)
                {
                    MessageBox.Show("Errors were encountered during the loading process. These errors were saved to \"errors.txt\". Please send this file to the author, either via mail (" + ApplicationSettings.AuthorEmail + ") or from the site you got this software from.\n\n(In the case that this program was not updated in so long that this message is now thrown on every map load, you may cancel this message from the settings)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                ErrorLogger.ClearErrors();
            }
        }
Пример #25
0
 public void CreateMapFromHam(MultiBoard multiBoard, HaCreator.ThirdParty.TabPages.PageCollection Tabs, string data, EventHandler[] rightClickHandler)
 {
     CreateMap("", "", CreateStandardMapMenu(rightClickHandler), new XNA.Point(), new XNA.Point(), 8, Tabs, multiBoard);
     multiBoard.SelectedBoard.Loading = true; // Prevent TS Change callbacks while were loading
     lock (multiBoard)
     {
         multiBoard.SelectedBoard.SerializationManager.DeserializeBoard(data);
         multiBoard.AdjustScrollBars();
     }
     multiBoard.SelectedBoard.Loading = false;
 }
Пример #26
0
 public void CreateMap(string text, string tooltip, ContextMenuStrip menu, Point size, Point center, int layers, HaCreator.ThirdParty.TabPages.PageCollection Tabs, MultiBoard multiBoard)
 {
     lock (multiBoard)
     {
         Board newBoard = multiBoard.CreateBoard(size, center, layers, menu);
         GenerateDefaultZms(newBoard);
         HaCreator.ThirdParty.TabPages.TabPage page = new HaCreator.ThirdParty.TabPages.TabPage(text, multiBoard, tooltip, menu);
         newBoard.TabPage = page;
         page.Tag = newBoard;
         Tabs.Add(page);
         Tabs.CurrentPage = page;
         multiBoard.SelectedBoard = newBoard;
         menu.Tag = newBoard;
         foreach (ToolStripItem item in menu.Items)
             item.Tag = newBoard;
     }
 }
Пример #27
0
 public static void CreateMap(string text, string tooltip, ContextMenuStrip menu, Point size, Point center, int layers, TabPages.PageCollection Tabs, MultiBoard multiBoard)
 {
     Board newBoard = multiBoard.CreateBoard(size, center, layers);
     TabPages.TabPage page = new TabPages.TabPage(text, multiBoard, tooltip, menu);
     page.Tag = newBoard;
     Tabs.Add(page);
     Tabs.CurrentPage = page;
     multiBoard.SelectedBoard = newBoard;
     menu.Tag = newBoard;
     foreach (ToolStripItem item in menu.Items)
         item.Tag = newBoard;
 }
Пример #28
0
 public static void CreateMapFromImage(WzImage mapImage, string mapName, string streetName, PageCollection Tabs, MultiBoard multiBoard, EventHandler rightClickHandler)
 {
     if (!mapImage.Parsed) mapImage.ParseImage();
     VerifyMapPropsKnown(mapImage);
     MapInfo info = new MapInfo(mapImage, mapName, streetName);
     MapType type = GetMapType(mapImage);
     if (type == MapType.RegularMap)
         info.id = int.Parse(WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)));
     info.mapType = type;
     Point center = new Point();
     Point size = new Point();
     if (mapImage["miniMap"] == null)
     {
         if (info.VR == null)
         {
             if (!GetMapVR(mapImage, ref info.VR))
             {
                 new GUI.ErrorBox("Error - map does not contain size information and HaCreator was unable to generate it. An error has been logged.");
                 //MessageBox.Show("Error - map does not contain size information and HaCreator was unable to generate it. An error has been logged.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 ErrorLogger.Log(ErrorLevel.IncorrectStructure, "no size @map " + info.id.ToString());
                 return;
             }
         }
         size = new Point(info.VR.Value.Width + 10, info.VR.Value.Height + 10); //leave 5 pixels on each side
         center = new Point(5 - info.VR.Value.Left, 5 - info.VR.Value.Top);
     }
     else
     {
         IWzImageProperty miniMap = mapImage["miniMap"];
         size = new Point(InfoTool.GetInt(miniMap["width"]), InfoTool.GetInt(miniMap["height"]));
         center = new Point(InfoTool.GetInt(miniMap["centerX"]), InfoTool.GetInt(miniMap["centerY"]));
     }
     CreateMap(mapName, WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)), CreateStandardMapMenu(rightClickHandler), size, center, 8, Tabs, multiBoard);
     Board mapBoard = multiBoard.SelectedBoard;
     mapBoard.MapInfo = info;
     if (mapImage["miniMap"] != null)
         mapBoard.MiniMap = ((WzCanvasProperty)mapImage["miniMap"]["canvas"]).PngProperty.GetPNG(false);
     LoadLayers(mapImage, mapBoard);
     LoadLife(mapImage, mapBoard);
     LoadFootholds(mapImage, mapBoard);
     LoadRopes(mapImage, mapBoard);
     LoadChairs(mapImage, mapBoard);
     LoadPortals(mapImage, mapBoard);
     LoadReactors(mapImage, mapBoard);
     LoadToolTips(mapImage, mapBoard);
     LoadBackgrounds(mapImage, mapBoard);
     mapBoard.BoardItems.Sort();
 }
Пример #29
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
            foreach (IMapleList list in boardItems.AllItemLists)
            {
                RenderList(list, 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 = miniMap.ToTexture2D(parent.GraphicsDevice);
                }

                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);
            }
        }
Пример #30
0
        private void parentBoard_MouseMoved(Board selectedBoard, Point oldPos, Point newPos, Point currPhysicalPos)
        {
            if (selectedBoard.Mouse.MinimapBrowseOngoing && selectedBoard.Mouse.State == MouseState.Selection)
            {
                HandleMinimapBrowse(selectedBoard, currPhysicalPos);
            }
            else if (selectedBoard.Mouse.MultiSelectOngoing && (Math.Abs(selectedBoard.Mouse.X - selectedBoard.Mouse.MultiSelectStart.X) > 1 || Math.Abs(selectedBoard.Mouse.Y - selectedBoard.Mouse.MultiSelectStart.Y) > 1))
            {
                Rectangle        oldRect  = CreateRectangle(oldPos, selectedBoard.Mouse.MultiSelectStart);
                Rectangle        newRect  = CreateRectangle(newPos, selectedBoard.Mouse.MultiSelectStart);
                List <BoardItem> toRemove = new List <BoardItem>();
                foreach (BoardItem item in selectedBoard.BoardItems)
                {
                    /*bool itemUnderNewRect = MultiBoard.IsItemUnderRectangle(item, newRect);
                     * bool newPosUnderRectangle = MultiBoard.IsItemUnderRectangle(item, newRect);
                     * if (itemUnderNewRect && (ApplicationSettings.editedTypes & item.Type) == item.Type && (selectedBoard.SelectedLayerIndex == -1 || item.CheckIfLayerSelected(selectedBoard.SelectedLayerIndex)))
                     * {
                     *  //if (item.IsRectrangleTransparent(Math.Max(item.Left, newRect.Left) - item.Left, Math.Max(item.Top, newRect.Top) - item.Top, Math.Min(item.Right, newRect.Right) - item.Left, Math.Min(item.Bottom, newRect.Bottom) - item.Top))
                     *      item.Selected = true;
                     * }
                     * else if (item.Selected && !itemUnderNewRect && (MultiBoard.IsItemUnderRectangle(item, oldRect) || !MultiBoard.IsPointInsideRectangle(newPos, item.Left, item.Top, item.Right, item.Bottom) || item.IsPixelTransparent(newRect.Left - item.Left, newRect.Top - item.Top)))
                     *  toRemove.Add(item);*/
                    if (MultiBoard.IsItemUnderRectangle(item, newRect) && (ApplicationSettings.editedTypes & item.Type) == item.Type && (selectedBoard.SelectedLayerIndex == -1 || item.CheckIfLayerSelected(selectedBoard.SelectedLayerIndex)))
                    {
                        item.Selected = true;
                    }
                    else if (item.Selected && MultiBoard.IsItemUnderRectangle(item, oldRect))
                    {
                        toRemove.Add(item);
                    }
                }
                foreach (BoardItem item in toRemove)
                {
                    item.Selected = false;
                }
                toRemove.Clear();
            }
            else if (selectedBoard.Mouse.BoundItems.Count > 0)
            {
                //snapping
                if (UserSettings.useSnapping && selectedBoard.Mouse.BoundItems.Count != 0 && !IsKeyPushedDown(Keys.Menu))
                {
                    MouseState state = selectedBoard.Mouse.State;
                    if (state == MouseState.Selection || state == MouseState.StaticObjectAdding || state == MouseState.RandomTiles || state == MouseState.Ropes || state == MouseState.Footholds)
                    {
                        object[] keys = new object[selectedBoard.Mouse.BoundItems.Count];
                        selectedBoard.Mouse.BoundItems.Keys.CopyTo(keys, 0);
                        foreach (object item in keys)
                        {
                            if (item is ISnappable)
                            {
                                ((ISnappable)item).DoSnap();
                            }
                        }
                    }
                }
            }
            else if (selectedBoard.Mouse.State == MouseState.Footholds)
            {
                selectedBoard.Mouse.DoSnap();
            }

            if ((selectedBoard.Mouse.BoundItems.Count > 0 || selectedBoard.Mouse.MultiSelectOngoing) && selectedBoard.Mouse.State == MouseState.Selection)
            {
                //auto scrolling
                if (currPhysicalPos.X - UserSettings.ScrollDistance < 0 && oldPos.X > newPos.X) //move to left
                {
                    selectedBoard.hScroll = (int)Math.Max(0, selectedBoard.hScroll - Math.Pow(UserSettings.ScrollBase, (UserSettings.ScrollDistance - currPhysicalPos.X) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor);
                }
                else if (currPhysicalPos.X + UserSettings.ScrollDistance > selectedBoard.ParentControl.Width && oldPos.X < newPos.X) //move to right
                {
                    selectedBoard.hScroll = (int)Math.Min(selectedBoard.hScroll + Math.Pow(UserSettings.ScrollBase, (currPhysicalPos.X - selectedBoard.ParentControl.Width + UserSettings.ScrollDistance) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor, selectedBoard.ParentControl.maxHScroll);
                }
                if (currPhysicalPos.Y - UserSettings.ScrollDistance < 0 && oldPos.Y > newPos.Y) //move to top
                {
                    selectedBoard.vScroll = (int)Math.Max(0, selectedBoard.vScroll - Math.Pow(UserSettings.ScrollBase, (UserSettings.ScrollDistance - currPhysicalPos.Y) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor);
                }
                else if (currPhysicalPos.Y + UserSettings.ScrollDistance > selectedBoard.ParentControl.Height && oldPos.Y < newPos.Y) //move to bottom
                {
                    selectedBoard.vScroll = (int)Math.Min(selectedBoard.vScroll + Math.Pow(UserSettings.ScrollBase, (currPhysicalPos.Y - selectedBoard.ParentControl.Height + UserSettings.ScrollDistance) * UserSettings.ScrollExponentFactor) * UserSettings.ScrollFactor, selectedBoard.ParentControl.maxVScroll);
                }
            }
        }
Пример #31
0
        public void RenderBoard(SpriteBatch sprite)
        {
            if (mapInfo == null)
            {
                return;
            }
            int xShift = centerPoint.X - hScroll;
            int yShift = centerPoint.Y - vScroll;

            for (int i = 0; i < boardItems.AllItemLists.Length; i++)
            {
                RenderList(boardItems.AllItemLists[i], sprite, xShift, yShift);
            }

            /*RenderBackgroundList(sprite, xShift, yShift, false);
             * RenderList(boardItems.TileObjs, sprite, xShift, yShift);
             * RenderList(boardItems.Mobs, sprite, xShift, yShift);
             * RenderList(boardItems.NPCs, sprite, xShift, yShift);
             * //RenderList(boardItems.Lives, sprite, xShift, yShift);
             * RenderList(boardItems.Reactors, sprite, xShift, yShift);
             * RenderList(boardItems.Portals, sprite, xShift, yShift);
             * RenderBackgroundList(sprite, xShift, yShift, true);*/
            /*if ((ApplicationSettings.visibleTypes & ItemTypes.Footholds) == ItemTypes.Footholds)
             *  foreach (FootholdLine fh in footholdLines) fh.Draw(sprite, fh.GetColor(ApplicationSettings.editedTypes, selectedLayerIndex), xShift, yShift);
             * if ((ApplicationSettings.visibleTypes & ItemTypes.Ropes) == ItemTypes.Ropes)
             *  foreach (RopeLine rope in ropeLines) rope.Draw(sprite, rope.GetColor(ApplicationSettings.editedTypes, selectedLayerIndex), xShift, yShift);*/
            /*RenderList(boardItems.FHAnchors, sprite, xShift, yShift);
             * RenderList(boardItems.RopeAnchors, sprite, xShift, yShift);
             * RenderList(boardItems.Chairs, sprite, xShift, yShift);
             * RenderList(boardItems.CharacterToolTips, sprite, xShift, yShift);
             * RenderList(boardItems.ToolTips, sprite, xShift, yShift);
             * RenderList(boardItems.ToolTipDots, sprite, xShift, yShift);*/
            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);
            }
            if (UserSettings.showVR && mapInfo.VR != null)
            {
                parent.DrawRectangle(sprite, new Rectangle(
                                         MultiBoard.VirtualToPhysical(mapInfo.VR.Value.X, centerPoint.X, hScroll, 0),
                                         MultiBoard.VirtualToPhysical(mapInfo.VR.Value.Y, centerPoint.Y, vScroll, 0),
                                         mapInfo.VR.Value.Width, mapInfo.VR.Value.Height), UserSettings.VRColor);
            }
            if (miniMap != null && UserSettings.useMiniMap)//here comes the cool part ^_^
            {
                parent.FillRectangle(sprite, new Rectangle(0, 0, miniMap.Width, miniMap.Height), Color.Gray);
                if (miniMapTexture == null)
                {
                    miniMapTexture = BoardItem.TextureFromBitmap(parent.Device, miniMap);
                }
                sprite.Draw(miniMapTexture, new Rectangle(0, 0, miniMap.Width, miniMap.Height), null, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0.99999f);
                int x = hScroll / 16;
                int y = vScroll / 16;
                parent.DrawRectangle(sprite, new Rectangle(x, y, parent.Width / _mag, parent.Height / _mag), Color.Blue);
                //parent.DrawRectangle(sprite, new Rectangle(0, 0, miniMap.Width, miniMap.Height), Color.Black);
                parent.DrawLine(sprite, new Vector2(miniMap.Width + 1, 0), new Vector2(miniMap.Width + 1, miniMap.Height), Color.Black);
                parent.DrawLine(sprite, new Vector2(0, miniMap.Height), new Vector2(miniMap.Width + 1, miniMap.Height), Color.Black);
            }
        }
Пример #32
0
        private void debugButton_Click(object sender, EventArgs e)
        {
            // This function iterates over all maps in the game and verifies that we recognize all their props
            // It is meant to use by the developer(s) to speed up the process of adjusting this program for different MapleStory versions
            string wzPath = pathBox.Text;
            short version = -1;
            WzMapleVersion fileVersion = WzTool.DetectMapleVersion(Path.Combine(wzPath, "Item.wz"), out version);
            InitializeWzFiles(wzPath, fileVersion);

            MultiBoard mb = new MultiBoard();
            Board b = new Board(new Microsoft.Xna.Framework.Point(), new Microsoft.Xna.Framework.Point(), mb, null, MapleLib.WzLib.WzStructure.Data.ItemTypes.None, MapleLib.WzLib.WzStructure.Data.ItemTypes.None);

            foreach (string mapid in Program.InfoManager.Maps.Keys)
            {
                MapLoader loader = new MapLoader();
                string mapcat = "Map" + mapid.Substring(0, 1);
                WzImage mapImage = (WzImage)Program.WzManager["map"]["Map"][mapcat][mapid + ".img"];
                if (mapImage == null)
                {
                    continue;
                }
                mapImage.ParseImage();
                if (mapImage["info"]["link"] != null)
                {
                    mapImage.UnparseImage();
                    continue;
                }
                loader.VerifyMapPropsKnown(mapImage, true);
                MapInfo info = new MapInfo(mapImage, null, null, null);
                loader.LoadMisc(mapImage, b);
                if (ErrorLogger.ErrorsPresent())
                {
                    ErrorLogger.SaveToFile("debug_errors.txt");
                    ErrorLogger.ClearErrors();
                }
                mapImage.UnparseImage(); // To preserve memory, since this is a very memory intensive test
            }
            MessageBox.Show("Done");
        }