/// <summary> /// Initializes a new instance of the ActionButton class. /// </summary> /// <param name="width">Width of the panel</param> /// <param name="height">Height of the panel</param> /// <param name="dragInfo">Info for dragged item</param> public ActionButton(int width, int height, ItemDragInfo dragInfo) { this.dragInfo = dragInfo; this.dragLocation.X = -1; this.dragLocation.Y = -1; Width = width; Height = height; this.CreateDoors(); this.CreateBrushes(); this.InitializeAnimationParams(); this.InitializeTimer(); BackColor = ((SolidBrush)this.normalBackground).Color; // set up event handlers this.Paint += new PaintEventHandler(this.PaintCallback); this.MouseMove += new MouseEventHandler(this.MouseMoveCallback); this.MouseLeave += new EventHandler(this.MouseLeaveCallback); this.MouseEnter += new EventHandler(this.MouseEnterCallback); this.MouseDown += new MouseEventHandler(this.MouseDownCallback); // Da_FileServer: Some small paint optimizations. this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); }
private void InitForm() { this.Enabled = false; this.ShowInTaskbar = false; this.Opacity = 0; this.Hide(); this.InitializeComponent(); this.SetupFormSize(); // Changed to a global for versions in tqdebug AssemblyName aname = Assembly.GetExecutingAssembly().GetName(); this.currentVersion = aname.Version.ToString(); this.Text = string.Format(CultureInfo.CurrentCulture, "{0} {1}", aname.Name, this.currentVersion); // Setup localized strings. this.characterLabel.Text = Resources.MainFormLabel1; this.vaultLabel.Text = Resources.MainFormLabel2; this.configureButton.Text = Resources.MainFormBtnConfigure; this.exitButton.Text = Resources.GlobalExit; this.panelSelectButton.Text = Resources.MainFormBtnPanelSelect; this.Icon = Resources.TQVIcon; this.searchButton.Text = Resources.MainFormSearchButtonText; this.lastDragPoint.X = -1; this.DragInfo = new ItemDragInfo(this.UIService); this.CreatePanels(); }
/// <summary> /// Marks an item as modified. Used for splitting stacks and removing charms and relics. /// </summary> /// <param name="newItem">New item to be created after the split.</param> public void MarkModified(Item newItem) { if (this.IsModifiedItem) { // The item is already modified. If it has been modified again, then we should tell the sackPanel to redraw it again this.original.sackPanel.CancelDrag(this.original); this.item = newItem; } else { // Tell the sackPanel the drag was cancelled so that it will redraw its now modified item this.sackPanel.CancelDrag(this); // Tell the sack that it has been modified this.sack.IsModified = true; // Now store our info inside original this.original = (ItemDragInfo)this.MemberwiseClone(); // Now set us up to the new item this.item = newItem; this.sack = null; // it does not belong to a sack this.sackPanel = null; // nor a sack panel // reposition the mouse at the center of the new item if it is a different size than the old item if (newItem.Width != this.original.item.Width || newItem.Height != this.original.item.Height) { this.mouseOffset.X = newItem.ItemBitmap.Width / 2; this.mouseOffset.Y = newItem.ItemBitmap.Height / 2; } } }
/// <summary> /// Marks the item as placed removing it from the original container. /// </summary> /// <param name="slot">slot if an equipment placement.</param> public void MarkPlaced(int slot) { // Remove the item from the old sack if (this.IsModifiedItem) { // modified items do not have a source sack. // so no one needs to be notified of the placement. } else { if (this.sack.SackType == SackType.Equipment && slot != -1) { // Remove the item out of the equipment slot this.sack.RemoveAtItem(slot); // Put a dummy item in it's place Item newItem = this.item.MakeEmptyItem(); newItem.PositionX = SackCollection.GetEquipmentLocationOffset(slot).X; newItem.PositionY = SackCollection.GetEquipmentLocationOffset(slot).Y; this.sack.InsertItem(slot, newItem); } else { this.sack.RemoveItem(this.item); } } // finally clear things out this.item = null; this.sack = null; this.sackPanel = null; this.original = null; this.autoMove = AutoMoveLocation.NotSet; this.isBeingCancelled = false; }
/// <summary> /// Sets a drag. Initializes the ItemDragInfo /// </summary> /// <param name="sackPanel">sack panel which contains the item</param> /// <param name="sack">sack which contains the item</param> /// <param name="item">the item being dragged</param> /// <param name="mouseOffset">offset of the mouse pointer to the top left corner of the item bitmap</param> public void Set(SackPanel sackPanel, SackCollection sack, Item item, Point mouseOffset) { this.item = item; this.sack = sack; this.sackPanel = sackPanel; this.mouseOffset = mouseOffset; this.original = null; this.autoMove = AutoMoveLocation.NotSet; this.isBeingCancelled = false; }
private void InitForm() { this.Enabled = false; this.ShowInTaskbar = false; this.Opacity = 0; this.Hide(); this.InitializeComponent(); this.SetupFormSize(); // Changed to a global for versions in tqdebug AssemblyName aname = Assembly.GetExecutingAssembly().GetName(); this.currentVersion = aname.Version.ToString(); this.Text = string.Format(CultureInfo.CurrentCulture, "{0} {1}", aname.Name, this.currentVersion); // Setup localized strings. this.characterLabel.Text = Resources.MainFormLabel1; this.vaultLabel.Text = Resources.MainFormLabel2; this.configureButton.Text = Resources.MainFormBtnConfigure; this.exitButton.Text = Resources.GlobalExit; this.showVaulButton.Text = Resources.MainFormBtnPanelSelect; this.Icon = Resources.TQVIcon; this.searchButton.Text = Resources.MainFormSearchButtonText; this.lastDragPoint.X = -1; this.DragInfo = new ItemDragInfo(this.UIService); #if DEBUG this.DebugLayoutBorderVisible = false; // Set here what you want during debug #endif if (!this.DebugLayoutBorderVisible) { this.flowLayoutPanelRightComboBox.BorderStyle = BorderStyle.None; this.flowLayoutPanelVaultSelector.BorderStyle = BorderStyle.None; this.flowLayoutPanelRightPanels.BorderStyle = BorderStyle.None; this.tableLayoutPanelMain.CellBorderStyle = TableLayoutPanelCellBorderStyle.None; } this.CreatePanels(); }
/// <summary> /// Initializes a new instance of the PlayerPanel class. /// </summary> /// <param name="dragInfo">Instance of the ItemDragInfo</param> /// <param name="numberOfBags">Number of bags in this panel</param> /// <param name="panel1Size">Main panel size</param> /// <param name="panel2Size">Secondary panel size for players who have the additional game sacks</param> /// <param name="tooltip">Tooltip instance</param> public PlayerPanel(ItemDragInfo dragInfo, int numberOfBags, Size panel1Size, Size panel2Size, TTLib tooltip) : base(dragInfo, numberOfBags, panel2Size, tooltip, 2, AutoMoveLocation.Player) { this.Text = Resources.PlayerPanelNoPlayer; this.NoPlayerString = Resources.PlayerPanelNoPlayer; this.Size = new Size( ((panel1Size.Width + panel2Size.Width) * Database.DB.ItemUnitSize) + Convert.ToInt32(24.0F * Database.DB.Scale), (Math.Max(panel1Size.Height, panel2Size.Height) * Database.DB.ItemUnitSize) + Convert.ToInt32(58.0F * Database.DB.Scale)); this.TabStop = false; this.Font = new Font(this.Font.Name, this.Font.SizeInPoints * Database.DB.Scale, this.Font.Style); int borderPad = Convert.ToInt32(2.0F * Database.DB.Scale); this.BagPanelOffset = 1; // bag panel starts with bag #1 this.mainSackPanel = new SackPanel(panel1Size.Width, panel1Size.Height, this.DragInfo, AutoMoveLocation.Player); this.mainSackPanel.SetLocation(new Point(borderPad, this.Size.Height - this.mainSackPanel.Size.Height - borderPad)); this.mainSackPanel.OnNewItemHighlighted += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback); this.mainSackPanel.OnAutoMoveItem += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback); this.mainSackPanel.OnActivateSearch += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback); this.mainSackPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback); this.mainSackPanel.OnItemSelected += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback); this.mainSackPanel.OnResizeForm += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback); this.Controls.Add(this.mainSackPanel); this.mainSackPanel.MaxSacks = 1; this.mainSackPanel.SackType = SackType.Player; this.mainSackPanel.IsMainPlayerPanel = true; this.BagSackPanel.SetLocation(new Point(this.mainSackPanel.Right + borderPad, this.Size.Height - this.BagSackPanel.Size.Height - borderPad)); this.BagSackPanel.IsPlayerBagPanel = true; // Recalculate the button sizing and placement since we moved the BagSackPanel. if (this.BagButtons != null && this.BagButtons.Count > 0) { float buttonWidth = (float)Resources.inventorybagup01.Width; float buttonHeight = (float)Resources.inventorybagup01.Height; float pad = 2.0F; float slotWidth = buttonWidth + (2.0F * pad); // we need to scale down the bag size depending on the # we have // but keep room for the autosort button so the buttons only use half of the panel size. float scale = this.GetBagButtonScale(slotWidth, (this.BagButtons.Count * 2)); float bagSlotWidth = scale * slotWidth; int index = 0; foreach (BagButtonBase button in this.BagButtons) { button.Size = new Size((int)Math.Round(scale * buttonWidth), (int)Math.Round(scale * buttonHeight)); float offset = (bagSlotWidth * index) + ((bagSlotWidth - button.Width) / 2.0F); button.Location = new Point(this.BagSackPanel.Location.X + (int)Math.Round(offset), this.BagSackPanel.Location.Y - button.Height); index++; } } // Move the autosort buttons to their place since the panels got moved. AutoSortButtons[0].Location = new Point(this.mainSackPanel.Location.X, this.mainSackPanel.Location.Y - AutoSortButtons[0].Height); AutoSortButtons[1].Location = new Point( this.BagSackPanel.Location.X + this.BagSackPanel.Width - AutoSortButtons[1].Width, this.BagSackPanel.Location.Y - AutoSortButtons[1].Height); this.BagSackPanel.SackType = SackType.Sack; }
public MainForm() { Log = Logger.Get(this); Log.Info("TQVaultAE Initialization !"); this.Enabled = false; this.ShowInTaskbar = false; this.Opacity = 0; this.Hide(); this.InitializeComponent(); this.SetupFormSize(); #region Apply custom font & scaling this.exitButton.Font = FontHelper.GetFontAlbertusMTLight(12F, UIService.UI.Scale); ScaleControl(this.exitButton); this.characterComboBox.Font = FontHelper.GetFontAlbertusMTLight(13F, UIService.UI.Scale); ScaleControl(this.characterComboBox); ScaleControl(this.characterLabel); ScaleControl(this.itemTextPanel); ScaleControl(this.itemText); this.vaultListComboBox.Font = FontHelper.GetFontAlbertusMTLight(13F, UIService.UI.Scale); ScaleControl(this.vaultListComboBox); this.vaultLabel.Font = FontHelper.GetFontAlbertusMTLight(11F, UIService.UI.Scale); ScaleControl(this.vaultLabel); this.configureButton.Font = FontHelper.GetFontAlbertusMTLight(12F, UIService.UI.Scale); ScaleControl(this.configureButton); this.customMapText.Font = FontHelper.GetFontAlbertusMT(11.25F, UIService.UI.Scale); ScaleControl(this.customMapText); this.panelSelectButton.Font = FontHelper.GetFontAlbertusMTLight(12F, UIService.UI.Scale); ScaleControl(this.panelSelectButton); this.secondaryVaultListComboBox.Font = FontHelper.GetFontAlbertusMTLight(11F, UIService.UI.Scale); ScaleControl(this.secondaryVaultListComboBox); this.aboutButton.Font = FontHelper.GetFontMicrosoftSansSerif(8.25F, UIService.UI.Scale); ScaleControl(this.aboutButton); this.titleLabel.Font = FontHelper.GetFontAlbertusMTLight(24F, UIService.UI.Scale); ScaleControl(this.titleLabel); this.searchButton.Font = FontHelper.GetFontAlbertusMTLight(12F, UIService.UI.Scale); ScaleControl(this.searchButton); #endregion try { this.tooltip = new TTLib(); } catch (Exception ex) { Log.Error("Get TTLib fail !", ex); MessageBox.Show(Log.FormatException(ex)); // Handle failure to create to tooltip here // VXPlib not registered checkVXPlibrary(); this.tooltip = new TTLib(); } // Changed to a global for versions in tqdebug AssemblyName aname = Assembly.GetExecutingAssembly().GetName(); this.currentVersion = aname.Version.ToString(); this.Text = string.Format(CultureInfo.CurrentCulture, "{0} {1}", aname.Name, this.currentVersion); if (TQDebug.DebugEnabled) { // Write this version into the debug file. Log.DebugFormat(CultureInfo.InvariantCulture, "Current TQVault Version: {0}", this.currentVersion); Log.Debug(string.Empty); Log.Debug("Debug Levels"); Log.DebugFormat(CultureInfo.InvariantCulture, "ARCFileDebugLevel: {0}", TQDebug.ArcFileDebugLevel); Log.DebugFormat(CultureInfo.InvariantCulture, "DatabaseDebugLevel: {0}", TQDebug.DatabaseDebugLevel); Log.DebugFormat(CultureInfo.InvariantCulture, "ItemAttributesDebugLevel: {0}", TQDebug.ItemAttributesDebugLevel); Log.DebugFormat(CultureInfo.InvariantCulture, "ItemDebugLevel: {0}", TQDebug.ItemDebugLevel); Log.Debug(string.Empty); } // Setup localized strings. this.characterLabel.Text = Resources.MainFormLabel1; this.vaultLabel.Text = Resources.MainFormLabel2; this.configureButton.Text = Resources.MainFormBtnConfigure; this.exitButton.Text = Resources.GlobalExit; this.panelSelectButton.Text = Resources.MainFormBtnPanelSelect; this.Icon = Resources.TQVIcon; this.searchButton.Text = Resources.MainFormSearchButtonText; // Set up Item strings Item.ItemWith = Resources.ItemWith; Item.ItemRelicBonus = Resources.ItemRelicBonus; Item.ItemRelicCompleted = Resources.ItemRelicCompleted; Item.ItemQuest = Resources.ItemQuest; Item.ItemSeed = Resources.ItemSeed; Item.ItemIT = Resources.ItemIT; Item.ItemRagnarok = Resources.ItemRagnarok; Item.ItemAtlantis = Resources.ItemAtlantis; Item.ShowSkillLevel = Config.Settings.Default.ShowSkillLevel; if (Config.Settings.Default.NoToolTipDelay) { this.tooltip.SetNoDelay(); } this.lastDragPoint.X = -1; this.dragInfo = new ItemDragInfo(); this.CreatePanels(); // Process the mouse scroll wheel to cycle through the vaults. this.MouseWheel += new MouseEventHandler(this.MainFormMouseWheel); this.splashScreen = new SplashScreenForm(); this.splashScreen.MaximumValue = 1; this.splashScreen.FormClosed += new FormClosedEventHandler(this.SplashScreenClosed); if (Config.Settings.Default.LoadAllFiles) { this.splashScreen.MaximumValue += LoadAllFilesTotal(); } this.splashScreen.Show(); this.splashScreen.Update(); }
/// <summary> /// Initializes a new instance of the VaultPanel class. /// </summary> /// <param name="dragInfo">Instance of the ItemDragInfo</param> /// <param name="numberOfBags">Number of bags in this panel</param> /// <param name="panelSize">Main panel size</param> /// <param name="tooltip">Tooltip instance</param> /// <param name="numberOfAutosortButtons">The number of AutoSort buttons associated with this panel.,</param> /// <param name="autoMoveLocation">The automovelocation for this panel.</param> public VaultPanel(ItemDragInfo dragInfo, int numberOfBags, Size panelSize, TTLib tooltip, int numberOfAutosortButtons, AutoMoveLocation autoMoveLocation) { this.DragInfo = dragInfo; this.Tooltip = tooltip; this.AutoMoveLocation = autoMoveLocation; this.Text = Resources.PlayerPanelNoVault; this.NoPlayerString = Resources.PlayerPanelNoVault; this.BackColor = Color.Transparent; this.DrawAsGroupBox = false; // Setup the offset to make room for the autosort button int autosortOffset = 0; if (numberOfAutosortButtons > 0) { autosortOffset = Convert.ToInt32(27.0F * Database.DB.Scale); } this.Size = new Size( (panelSize.Width * Database.DB.ItemUnitSize) + Convert.ToInt32(10.0F * Database.DB.Scale) + autosortOffset + BorderPad, (panelSize.Height * Database.DB.ItemUnitSize) + Convert.ToInt32(56.0F * Database.DB.Scale) + BorderPad); this.TabStop = false; this.Font = new Font(this.Font.Name, this.Font.SizeInPoints * Database.DB.Scale, this.Font.Style); this.BagPanelOffset = 0; // bag panel starts with bag #0 this.BagSackPanel = new SackPanel(panelSize.Width, panelSize.Height, this.DragInfo, autoMoveLocation); this.BagSackPanel.SetLocation(new Point(autosortOffset + BorderPad, this.Size.Height - (this.BagSackPanel.Size.Height + BorderPad))); this.BagSackPanel.OnNewItemHighlighted += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback); this.BagSackPanel.OnAutoMoveItem += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback); this.BagSackPanel.OnActivateSearch += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback); this.BagSackPanel.OnItemSelected += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback); this.BagSackPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback); this.BagSackPanel.OnResizeForm += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback); this.Controls.Add(this.BagSackPanel); this.BagSackPanel.IsPlayerBagPanel = false; this.BagSackPanel.MaxSacks = numberOfBags; // Create the buttons this.bagButtons = new Collection <BagButtonBase>(); this.CreateBagButtons(numberOfBags); // Assume it's the trash panel if we are not autosorting it. if (numberOfAutosortButtons == 0) { this.BagSackPanel.SackType = SackType.Trash; } else { this.autoSortButtons = new Collection <AutoSortButton>(); for (int i = 0; i < numberOfAutosortButtons; ++i) { this.autoSortButtons.Insert(i, this.CreateAutoSortButton(i)); this.Controls.Add(this.autoSortButtons[i]); } this.BagSackPanel.SackType = SackType.Vault; } this.contextMenu = new ContextMenuStrip(); this.contextMenu.BackColor = Color.FromArgb(46, 41, 31); this.contextMenu.DropShadowEnabled = true; this.contextMenu.Font = new Font("Albertus MT", 9.0F * Database.DB.Scale); this.contextMenu.ForeColor = Color.FromArgb(200, 200, 200); this.contextMenu.Opacity = 0.80; this.contextMenu.ShowImageMargin = false; this.contextMenu.ItemClicked += new ToolStripItemClickedEventHandler(this.ContextMenuItemClicked); this.contextMenu.Renderer = new CustomProfessionalRenderer(); this.PropertyChanged += new PropertyChangedEventHandler(this.PropertyChangedCallback); this.Paint += new PaintEventHandler(this.PaintCallback); // to avoid flickering use double buffer and to force control to use OnPaint this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); }
/// <summary> /// Initializes a new instance of the StashPanel class. Hard coded to 3 stash buttons and no autosort buttons. /// </summary> /// <param name="dragInfo">ItemDragInfo instance</param> /// <param name="panelSize">Size of the panel in cells</param> /// <param name="tooltip">ToolTip instance</param> public StashPanel(ItemDragInfo dragInfo, Size panelSize, TTLib tooltip) : base(dragInfo, 3, panelSize, tooltip, 0, AutoMoveLocation.Stash) { this.equipmentPanel = new EquipmentPanel(10, 14, dragInfo, AutoMoveLocation.Stash); this.Controls.Add(this.equipmentPanel); this.equipmentPanel.OnNewItemHighlighted += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback); this.equipmentPanel.OnAutoMoveItem += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback); this.equipmentPanel.OnActivateSearch += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback); this.equipmentPanel.OnItemSelected += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback); this.equipmentPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback); this.equipmentPanel.OnResizeForm += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback); this.Text = Resources.StashPanelText; this.NoPlayerString = Resources.StashPanelText; this.Size = new Size( (panelSize.Width * Database.DB.ItemUnitSize) + Convert.ToInt32(10.0F * Database.DB.Scale) + BorderPad, (panelSize.Height * Database.DB.ItemUnitSize) + Convert.ToInt32(60.0F * Database.DB.Scale) + BorderPad); this.Paint += new PaintEventHandler(this.PaintCallback); this.BagSackPanel.SetLocation(new Point(BorderPad, this.Size.Height - (this.BagSackPanel.Size.Height + BorderPad))); this.BagSackPanel.MaxSacks = 1; this.BagSackPanel.Anchor = AnchorStyles.None; this.EquipmentBackground = Resources.Equipment_bg_new; this.StashBackground = Resources.caravan_bg; // Set up the inital font size if (Database.DB.Scale != 1.0F) { this.Font = new Font(this.Font.Name, this.Font.SizeInPoints * Database.DB.Scale, this.Font.Style); } this.background = Resources.Equipment_bg_new; // Now that the buttons are set we can move the panel this.BagSackPanel.SetLocation(new Point( BorderPad, this.BagButtons[0].Location.Y + this.BagButtons[0].Size.Height + Database.DB.HalfUnitSize)); int offsetX = (panelSize.Width - this.equipmentPanel.SackSize.Width) * Database.DB.HalfUnitSize; if (offsetX < 0) { offsetX = 0; } int offsetY = (panelSize.Height - this.equipmentPanel.SackSize.Height) * Database.DB.HalfUnitSize; if (offsetY < 0) { offsetY = 0; } this.equipmentPanel.SetLocation(new Point( BorderPad + offsetX, this.BagButtons[0].Location.Y + this.BagButtons[0].Size.Height + offsetY)); this.maxPanelSize = panelSize; // Create the background for redrawing now that everything is set. this.equipmentPanel.CursorBackgroundImage = this.CreateCursorBackground(this.equipmentPanel); this.BagSackPanel.Visible = false; this.BagSackPanel.Enabled = false; }