public override void OnClientAreaChanged(Rectangle oValue, Rectangle nValue) { base.OnClientAreaChanged(oValue, nValue); if (Links == null) { return; } Grid?.Dispose(); Grid = new DXItemGrid { Parent = this, Location = ClientArea.Location, GridSize = new Size(Math.Max(1, (ClientArea.Size.Width) / (DXItemCell.CellWidth - 1)), Math.Max(1, ClientArea.Size.Height / (DXItemCell.CellHeight - 1))), GridType = GridType.Belt, AllowLink = false, }; for (int i = 0; i < Grid.Grid.Length; i++) { new DXLabel { Parent = Grid.Grid[i], Text = ((i + 1) % 10).ToString(), Font = new Font(Config.FontName, CEnvir.FontSize(8F), FontStyle.Italic), IsControl = false, Location = new Point(-2, -1) }; } UpdateLinks(); }
private void TextBox_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar) { case (char)Keys.Enter: e.Handled = true; if (!string.IsNullOrEmpty(TextBox.TextBox.Text)) { CEnvir.Enqueue(new C.Chat { Text = TextBox.TextBox.Text, }); if (TextBox.TextBox.Text[0] == '/') { string[] parts = TextBox.TextBox.Text.Split(' '); if (parts.Length > 0) { LastPM = parts[0]; } } } DXTextBox.ActiveTextBox = null; TextBox.TextBox.Text = string.Empty; break; case (char)Keys.Escape: e.Handled = true; DXTextBox.ActiveTextBox = null; TextBox.TextBox.Text = string.Empty; break; } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); foreach (KeyValuePair <LibraryFile, string> pair in Libraries.LibraryList) { if (!File.Exists(@".\" + pair.Value)) { continue; } CEnvir.LibraryList[pair.Key] = new MirLibrary(@".\" + pair.Value); } ConfigReader.Load(); CEnvir.LoadDatabase(); CEnvir.Target = new TargetForm(); DXManager.Create(); DXSoundManager.Create(); DXControl.ActiveScene = new LoginScene(Config.IntroSceneSize); MessagePump.Run(CEnvir.Target, CEnvir.GameLoop); ConfigReader.Save(); CEnvir.Session?.Save(true); CEnvir.Unload(); DXManager.Unload(); DXSoundManager.Unload(); }
public DXDropFilterWindow() { TitleLabel.Text = "Drop Filter"; CloseButton.Visible = true; SetClientSize(new Size(130, 65)); int i = 8; int gap = 16; Point CheckBoxRightPoint = new Point(100, 0); CommonCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Common:" }, Visible = true }; CommonCheckBox.Location = new Point(CheckBoxRightPoint.X - CommonCheckBox.Size.Width, ClientArea.Y + i); CommonCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.DropFilterToggle { Grade = Rarity.Common }); }; i += gap; SuperiorCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Superior:" }, Visible = true }; SuperiorCheckBox.Location = new Point(CheckBoxRightPoint.X - SuperiorCheckBox.Size.Width, ClientArea.Y + i); SuperiorCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.DropFilterToggle { Grade = Rarity.Superior }); }; i += gap; EliteCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Elite:" }, Visible = true }; EliteCheckBox.Location = new Point(CheckBoxRightPoint.X - EliteCheckBox.Size.Width, ClientArea.Y + i); EliteCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.DropFilterToggle { Grade = Rarity.Elite }); }; i += gap; }
protected override void OnMouseDoubleClick(MouseEventArgs e) { try { DXControl.ActiveScene?.OnMouseClick(e); } catch (Exception ex) { CEnvir.SaveException(ex); } }
protected override void OnMouseWheel(MouseEventArgs e) { try { DXControl.ActiveScene?.OnMouseWheel(e); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
protected override void OnKeyPress(KeyPressEventArgs e) { try { DXControl.ActiveScene?.OnKeyPress(e); e.Handled = true; } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
public override void OnIsVisibleChanged(bool oValue, bool nValue) { base.OnIsVisibleChanged(oValue, nValue); UserGrid.ClearLinks(); if (!IsTrading || GameScene.Game.Observer) { return; } CEnvir.Enqueue(new C.TradeClose()); }
private Size LoadMapType7(byte[] Bytes) { try { int offset = 21; int Width = BitConverter.ToInt16(Bytes, offset); offset += 4; int Height = BitConverter.ToInt16(Bytes, offset); return(new Size(Width, Height)); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } return(Size.Empty); }
protected override void OnMouseUp(MouseEventArgs e) { if (GameScene.Game != null) { GameScene.Game.MapControl.MapButtons &= ~e.Button; } try { DXControl.ActiveScene?.OnMouseUp(e); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
private Size LoadMapType5(byte[] Bytes) { try { int offset = 20; short Attribute = (short)(BitConverter.ToInt16(Bytes, offset)); int Width = (int)(BitConverter.ToInt16(Bytes, offset += 2)); int Height = (int)(BitConverter.ToInt16(Bytes, offset += 2)); return(new Size(Width, Height)); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } return(Size.Empty); }
protected override void OnMouseDown(MouseEventArgs e) { if (GameScene.Game != null && e.Button == MouseButtons.Right && (GameScene.Game.SelectedCell != null || GameScene.Game.GoldPickedUp)) { GameScene.Game.SelectedCell = null; GameScene.Game.GoldPickedUp = false; return; } try { DXControl.ActiveScene?.OnMouseDown(e); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
private void Image_MouseClick(object sender, MouseEventArgs e) { //if (SelectedInfo != GameScene.Game.MapControl.MapInfo) return; //if (MapObject.User.Buffs.All(z => z.Type != BuffType.Developer)) //if (!SelectedInfo.AllowRT || !SelectedInfo.AllowTT || !GameScene.Game.MapControl.MapInfo.AllowRT || !GameScene.Game.MapControl.MapInfo.AllowTT) return; if ((e.Button & MouseButtons.Right) == MouseButtons.Right) { //TODO Teleport Ring int x = (int)((e.Location.X - Image.DisplayArea.X) / ScaleX); int y = (int)((e.Location.Y - Image.DisplayArea.Y) / ScaleY); CEnvir.Enqueue(new C.TeleportRing { Location = new Point(x, y), Index = SelectedInfo.Index }); } }
private Size LoadMapType100(byte[] Bytes) { try { int offset = 4; if ((Bytes[0] != 1) || (Bytes[1] != 0)) { return(Size.Empty); //only support version 1 atm } int Width = BitConverter.ToInt16(Bytes, offset); offset += 2; int Height = BitConverter.ToInt16(Bytes, offset); return(new Size(Width, Height)); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } return(Size.Empty); }
public ExitDialog() { TitleLabel.Text = @"Exit Game"; SetClientSize(new Size(200, 50 + DefaultHeight + DefaultHeight)); ToSelectButton = new DXButton { Location = new Point(ClientArea.X + 35, ClientArea.Y + 20), Size = new Size(130, DefaultHeight), Parent = this, Label = { Text = "Character Select" }, }; ToSelectButton.MouseClick += (o, e) => { if (CEnvir.Now < MapObject.User.CombatTime.AddSeconds(10) && !GameScene.Game.Observer) { GameScene.Game.ReceiveChat("Unable to logout whilst in combat.", MessageType.System); return; } CEnvir.Enqueue(new C.Logout()); }; ExitButton = new DXButton { Location = new Point(ClientArea.X + 35, ClientArea.Y + 30 + DefaultHeight), Size = new Size(130, DefaultHeight), Parent = this, Label = { Text = "Exit Game" }, }; ExitButton.MouseClick += (o, e) => { if (CEnvir.Now < MapObject.User.CombatTime.AddSeconds(10) && !GameScene.Game.Observer) { GameScene.Game.ReceiveChat("Unable to exit game whilst in combat.", MessageType.System); return; } CEnvir.Target.Close(); }; }
public static void CreateScreenShot() { Bitmap image = CEnvir.Target.GetImage(); using (Graphics graphics = Graphics.FromImage(image)) { string text = $"Date: {CEnvir.Now.ToShortDateString()}{Environment.NewLine}"; text += $"Time: {CEnvir.Now.TimeOfDay:hh\\:mm\\:ss}{Environment.NewLine}"; if (GameScene.Game != null) { text += $"Player: {MapObject.User.Name}{Environment.NewLine}"; } using (Font font = new Font(Config.FontName, CEnvir.FontSize(8F))) { graphics.DrawString(text, font, Brushes.Black, 3, 33); graphics.DrawString(text, font, Brushes.Black, 4, 32); graphics.DrawString(text, font, Brushes.Black, 5, 33); graphics.DrawString(text, font, Brushes.Black, 4, 34); graphics.DrawString(text, font, Brushes.White, 4, 33); } } string path = Path.Combine(Application.StartupPath, @"Screenshots\"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } int count = Directory.GetFiles(path, "*.png").Length; string fileName = $"Image {count}.png"; image.Save(Path.Combine(path, fileName), ImageFormat.Png); image.Dispose(); if (GameScene.Game != null) { GameScene.Game.ReceiveChat("Screenshot Saved " + fileName, MessageType.System); } }
private void UserGoldLabel_MouseClick(object sender, MouseEventArgs e) { if (GameScene.Game.Observer) { return; } DXItemAmountWindow window = new DXItemAmountWindow("交易金币", new ClientUserItem(Globals.GoldInfo, GameScene.Game.User.Gold)); window.ConfirmButton.MouseClick += (o1, e1) => { if (window.Amount <= 0) { return; } CEnvir.Enqueue(new C.TradeAddGold { Gold = window.Amount }); }; }
protected override void OnKeyUp(KeyEventArgs e) { CEnvir.Shift = e.Shift; CEnvir.Alt = e.Alt; CEnvir.Ctrl = e.Control; if (e.KeyCode == Keys.Pause) { CreateScreenShot(); } try { DXControl.ActiveScene?.OnKeyUp(e); e.Handled = true; } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
public static DXMessageBox Show(string message, string caption, DialogAction action = DialogAction.None) { DXMessageBox box = new DXMessageBox(message, caption); switch (action) { case DialogAction.None: break; case DialogAction.Close: box.OKButton.MouseClick += (o, e) => CEnvir.Target.Close(); box.CloseButton.MouseClick += (o, e) => CEnvir.Target.Close(); break; case DialogAction.ReturnToLogin: box.OKButton.MouseClick += (o, e) => CEnvir.ReturnToLogin(); box.CloseButton.MouseClick += (o, e) => CEnvir.ReturnToLogin(); break; } return(box); }
protected override void OnMouseMove(MouseEventArgs e) { //TODO Move to other locations instead? if (Config.ClipMouse && Focused) { Cursor.Clip = RectangleToScreen(ClientRectangle); } else { Cursor.Clip = Rectangle.Empty; } CEnvir.MouseLocation = e.Location; try { DXControl.ActiveScene?.OnMouseMove(e); } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); CEnvir.Shift = e.Shift; CEnvir.Alt = e.Alt; CEnvir.Ctrl = e.Control; try { if (e.Alt && e.KeyCode == Keys.Enter) { DXManager.ToggleFullScreen(); return; } DXControl.ActiveScene?.OnKeyDown(e); e.Handled = true; } catch (Exception ex) { CEnvir.SaveError(ex.ToString()); } }
public MainPanel() { LibraryFile = LibraryFile.GameInter; Index = 50; ExperienceBar = new DXImageControl { Parent = this, LibraryFile = LibraryFile.GameInter, Index = 51, }; ExperienceBar.Location = new Point((Size.Width - ExperienceBar.Size.Width) / 2 + 1, 2 + 1); ExperienceBar.BeforeDraw += (o, e) => { if (ExperienceBar.Library == null) { return; } if (MapObject.User.Level >= Globals.ExperienceList.Count) { return; } decimal MaxExperience = Globals.ExperienceList[MapObject.User.Level]; if (MaxExperience == 0) { return; } //Get percent. MirImage image = ExperienceBar.Library.CreateImage(56, ImageType.Image); if (image == null) { return; } int x = (ExperienceBar.Size.Width - image.Width) / 2; int y = (ExperienceBar.Size.Height - image.Height) / 2; float percent = (float)Math.Min(1, Math.Max(0, MapObject.User.Experience / MaxExperience)); if (percent == 0) { return; } PresentTexture(image.Image, this, new Rectangle(ExperienceBar.DisplayArea.X + x, ExperienceBar.DisplayArea.Y + y - 1, (int)(image.Width * percent), image.Height), Color.White, ExperienceBar); }; DXControl HealthBar = new DXControl { Parent = this, Location = new Point(35, 22), Size = ExperienceBar.Library.GetSize(52), }; HealthBar.BeforeDraw += (o, e) => { if (ExperienceBar.Library == null) { return; } if (MapObject.User.Stats[Stat.Health] == 0) { return; } float percent = Math.Min(1, Math.Max(0, MapObject.User.CurrentHP / (float)MapObject.User.Stats[Stat.Health])); if (percent == 0) { return; } MirImage image = ExperienceBar.Library.CreateImage(52, ImageType.Image); if (image == null) { return; } PresentTexture(image.Image, this, new Rectangle(HealthBar.DisplayArea.X, HealthBar.DisplayArea.Y, (int)(image.Width * percent), image.Height), Color.White, HealthBar); }; DXControl ManaBar = new DXControl { Parent = this, Location = new Point(35, 36), Size = ExperienceBar.Library.GetSize(52), }; ManaBar.BeforeDraw += (o, e) => { if (ExperienceBar.Library == null) { return; } if (MapObject.User.Stats[Stat.Mana] == 0) { return; } float percent = Math.Min(1, Math.Max(0, MapObject.User.CurrentMP / (float)MapObject.User.Stats[Stat.Mana])); if (percent == 0) { return; } MirImage image = ExperienceBar.Library.CreateImage(54, ImageType.Image); if (image == null) { return; } PresentTexture(image.Image, this, new Rectangle(ManaBar.DisplayArea.X, ManaBar.DisplayArea.Y, (int)(image.Width * percent), image.Height), Color.White, ManaBar); }; DXImageControl OtherBar = new DXImageControl { Parent = this, Location = new Point(35, 50), LibraryFile = LibraryFile.GameInter, Index = 58, Visible = false, }; DXButton CharacterButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 82, Parent = this, Location = new Point(650, 23), Hint = "角色 [Q]" }; CharacterButton.MouseClick += (o, e) => { GameScene.Game.CharacterBox.Visible = !GameScene.Game.CharacterBox.Visible; }; DXButton InventoryButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 87, Parent = this, Location = new Point(689, 23), Hint = "背包 [W]\n" + "宠物背包 [U]" }; InventoryButton.MouseClick += (o, e) => GameScene.Game.InventoryBox.Visible = !GameScene.Game.InventoryBox.Visible; DXButton SpellButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 92, Parent = this, Location = new Point(728, 23), Hint = "技能 [E]" }; SpellButton.MouseClick += (o, e) => GameScene.Game.MagicBox.Visible = !GameScene.Game.MagicBox.Visible; DXButton QuestButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 112, Parent = this, Location = new Point(767, 23), Hint = "任务 [J]" }; QuestButton.MouseClick += (o, e) => GameScene.Game.QuestBox.Visible = !GameScene.Game.QuestBox.Visible; DXButton MailButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 97, Parent = this, Location = new Point(806, 23), Hint = "邮件 [,]" }; MailButton.MouseClick += (o, e) => GameScene.Game.MailBox.Visible = !GameScene.Game.MailBox.Visible; NewMailIcon = new DXImageControl { LibraryFile = LibraryFile.GameInter, Index = 240, Parent = MailButton, IsControl = false, Location = new Point(2, 2), Visible = false, }; AvailableQuestIcon = new DXImageControl { LibraryFile = LibraryFile.GameInter, Index = 240, Parent = QuestButton, IsControl = false, Location = new Point(2, 2), Visible = false, }; AvailableQuestIcon.VisibleChanged += (o, e) => { if (AvailableQuestIcon.Visible) { CompletedQuestIcon.Location = new Point(2, QuestButton.Size.Height - CompletedQuestIcon.Size.Height); } else { CompletedQuestIcon.Location = new Point(2, 2); } }; CompletedQuestIcon = new DXImageControl { LibraryFile = LibraryFile.GameInter, Index = 241, Parent = QuestButton, IsControl = false, Location = new Point(2, 2), Visible = false, }; DXButton BeltButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 107, Parent = this, Location = new Point(845, 23), Hint = "快捷栏 [Z]" }; BeltButton.MouseClick += (o, e) => GameScene.Game.BeltBox.Visible = !GameScene.Game.BeltBox.Visible; DXButton GroupButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 102, Parent = this, Location = new Point(884, 23), Hint = "组队 [P]" }; GroupButton.MouseClick += (o, e) => GameScene.Game.GroupBox.Visible = !GameScene.Game.GroupBox.Visible; DXButton ConfigButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 117, Parent = this, Location = new Point(923, 23), Hint = "设置 [O]" }; ConfigButton.MouseClick += (o, e) => GameScene.Game.ConfigBox.Visible = !GameScene.Game.ConfigBox.Visible; DXButton CashShopButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 122, Parent = this, Location = new Point(972, 16), Hint = "元宝商铺 [Y]" }; CashShopButton.MouseClick += (o, e) => { if (GameScene.Game.MarketPlaceBox.StoreTab.IsVisible) { GameScene.Game.MarketPlaceBox.Visible = false; } else { GameScene.Game.MarketPlaceBox.Visible = true; GameScene.Game.MarketPlaceBox.StoreTab.TabButton.InvokeMouseClick(); } }; DXLabel label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "职业", Hint = "职业", }; label.Location = new Point(300 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "等级", Hint = "等级", }; label.Location = new Point(300 - label.Size.Width, 40); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "防御", }; label.Location = new Point(385 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "魔防", }; label.Location = new Point(470 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "攻击", }; label.Location = new Point(385 - label.Size.Width, 40); DXLabel MCLabelLabel = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "魔法", }; MCLabelLabel.Location = new Point(470 - MCLabelLabel.Size.Width, 40); DXLabel SCLabelLabel = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "道术", }; SCLabelLabel.Location = new Point(470 - SCLabelLabel.Size.Width, 40); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "准确", Hint = "准确", }; label.Location = new Point(567 - label.Size.Width, 20); label = new DXLabel { Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(9F), FontStyle.Bold), Text = "敏捷", Hint = "敏捷", }; label.Location = new Point(567 - label.Size.Width, 40); ClassLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(300, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; LevelLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(300, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; ACLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(385, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; MRLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(470, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; DCLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(385, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; MCLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(470, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; MCLabel.VisibleChanged += (o, e) => MCLabelLabel.Visible = MCLabel.Visible; SCLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(470, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; SCLabel.VisibleChanged += (o, e) => SCLabelLabel.Visible = SCLabel.Visible; AccuracyLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(567, 20), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; AgilityLabel = new DXLabel { AutoSize = false, Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F)), Location = new Point(567, 40), Size = new Size(60, 16), DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; HealthLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; HealthLabel.SizeChanged += (o, e) => { HealthLabel.Location = new Point(HealthBar.Location.X + (HealthBar.Size.Width - HealthLabel.Size.Width) / 2, HealthBar.Location.Y + (HealthBar.Size.Height - HealthLabel.Size.Height) / 2); }; ManaLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; ManaLabel.SizeChanged += (o, e) => { ManaLabel.Location = new Point(ManaBar.Location.X + (ManaBar.Size.Width - ManaLabel.Size.Width) / 2, ManaBar.Location.Y + (ManaBar.Size.Height - ManaLabel.Size.Height) / 2); }; ExperienceLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; ExperienceLabel.SizeChanged += (o, e) => { ExperienceLabel.Location = new Point(ExperienceBar.Location.X + (ExperienceBar.Size.Width - ExperienceLabel.Size.Width) / 2, ExperienceBar.Location.Y + (ExperienceBar.Size.Height - ExperienceLabel.Size.Height) / 2); }; AttackModeLabel = new DXLabel { Parent = this, ForeColour = Color.Cyan, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; AttackModeLabel.SizeChanged += (o, e) => { AttackModeLabel.Location = new Point(OtherBar.Location.X, OtherBar.Location.Y + (OtherBar.Size.Height - AttackModeLabel.Size.Height) / 2 - 2); }; PetModeLabel = new DXLabel { Parent = this, ForeColour = Color.Cyan, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; PetModeLabel.SizeChanged += (o, e) => { PetModeLabel.Location = new Point(OtherBar.Location.X + OtherBar.Size.Width - PetModeLabel.Size.Width, OtherBar.Location.Y + (OtherBar.Size.Height - PetModeLabel.Size.Height) / 2 - 2); }; }
public BlockDialog() { TitleLabel.Text = "Block List"; HasFooter = false; SetClientSize(new Size(200, 200)); ListBox = new DXListBox { Parent = this, Location = ClientArea.Location, Size = new Size(ClientArea.Width, ClientArea.Height - 25) }; DXButton addButton = new DXButton { Label = { Text = "Add" }, Parent = this, Location = new Point(ClientArea.X, ClientArea.Bottom - 20), Size = new Size(80, SmallButtonHeight), ButtonType = ButtonType.SmallButton, }; addButton.MouseClick += (o, e) => { DXInputWindow window = new DXInputWindow("Please enter the name of the person you wish to Block.", "Block Player") { ConfirmButton = { Enabled = false }, Modal = true }; window.ValueTextBox.TextBox.TextChanged += (o1, e1) => { window.ConfirmButton.Enabled = Globals.CharacterReg.IsMatch(window.ValueTextBox.TextBox.Text); }; window.ConfirmButton.MouseClick += (o1, e1) => { CEnvir.Enqueue(new C.BlockAdd { Name = window.Value }); }; }; DXButton removeButton = new DXButton { Label = { Text = "Remove" }, Parent = this, Location = new Point(ClientArea.Right - 80, ClientArea.Bottom - 20), Size = new Size(80, SmallButtonHeight), ButtonType = ButtonType.SmallButton, Enabled = false, }; removeButton.MouseClick += (o, e) => { if (ListBox.SelectedItem == null) { return; } DXMessageBox box = new DXMessageBox($"Are you sure you want to Un-Block {ListBox.SelectedItem.Label.Text}?", "Un-Block Player", DXMessageBoxButtons.YesNo); box.YesButton.MouseClick += (o1, e1) => { CEnvir.Enqueue(new C.BlockRemove { Index = (int)ListBox.SelectedItem.Item }); }; }; ListBox.selectedItemChanged += (o, e) => { removeButton.Enabled = ListBox.SelectedItem != null; }; RefreshList(); }
private void SaveSettings(object o, MouseEventArgs e) { if (Config.FullScreen != FullScreenCheckBox.Checked) { DXManager.ToggleFullScreen(); } if (GameSizeComboBox.SelectedItem is Size && Config.GameSize != (Size)GameSizeComboBox.SelectedItem) { Config.GameSize = (Size)GameSizeComboBox.SelectedItem; if (ActiveScene is GameScene) { ActiveScene.Size = Config.GameSize; DXManager.SetResolution(ActiveScene.Size); } } if (LanguageComboBox.SelectedItem is string && Config.Language != (string)LanguageComboBox.SelectedItem) { Config.Language = (string)LanguageComboBox.SelectedItem; if (CEnvir.Connection != null && CEnvir.Connection.ServerConnected) { CEnvir.Enqueue(new C.SelectLanguage { Language = Config.Language }); } } if (Config.VSync != VSyncCheckBox.Checked) { Config.VSync = VSyncCheckBox.Checked; DXManager.ResetDevice(); } Config.LimitFPS = LimitFPSCheckBox.Checked; Config.ClipMouse = ClipMouseCheckBox.Checked; Config.DebugLabel = DebugLabelCheckBox.Checked; DebugLabel.IsVisible = Config.DebugLabel; PingLabel.IsVisible = Config.DebugLabel; if (Config.SoundInBackground != BackgroundSoundBox.Checked) { Config.SoundInBackground = BackgroundSoundBox.Checked; DXSoundManager.UpdateFlags(); } bool volumeChanged = false; if (Config.SystemVolume != SystemVolumeBox.Value) { Config.SystemVolume = (int)SystemVolumeBox.Value; volumeChanged = true; } if (Config.MusicVolume != MusicVolumeBox.Value) { Config.MusicVolume = (int)MusicVolumeBox.Value; volumeChanged = true; } if (Config.PlayerVolume != PlayerVolumeBox.Value) { Config.PlayerVolume = (int)PlayerVolumeBox.Value; volumeChanged = true; } if (Config.MonsterVolume != MonsterVolumeBox.Value) { Config.MonsterVolume = (int)MonsterVolumeBox.Value; volumeChanged = true; } if (Config.MagicVolume != SpellVolumeBox.Value) { Config.MagicVolume = (int)SpellVolumeBox.Value; volumeChanged = true; } Config.ShowItemNames = ItemNameCheckBox.Checked; Config.ShowMonsterNames = MonsterNameCheckBox.Checked; Config.ShowPlayerNames = PlayerNameCheckBox.Checked; Config.ShowUserHealth = UserHealthCheckBox.Checked; Config.ShowMonsterHealth = MonsterHealthCheckBox.Checked; Config.ShowDamageNumbers = DamageNumbersCheckBox.Checked; Config.EscapeCloseAll = EscapeCloseAllCheckBox.Checked; Config.ShiftOpenChat = ShiftOpenChatCheckBox.Checked; Config.RightClickDeTarget = RightClickDeTargetCheckBox.Checked; Config.MonsterBoxVisible = MonsterBoxVisibleCheckBox.Checked; Config.LogChat = LogChatCheckBox.Checked; Config.DrawEffects = DrawEffectsCheckBox.Checked; if (volumeChanged) { DXSoundManager.AdjustVolume(); } Config.UseNetworkConfig = UseNetworkConfigCheckBox.Checked; Config.IPAddress = IPAddressTextBox.TextBox.Text; Config.Port = (int)PortBox.Value; bool coloursChanged = false; if (Config.LocalTextColour != LocalColourBox.BackColour) { Config.LocalTextColour = LocalColourBox.BackColour; coloursChanged = true; } if (Config.GMWhisperInTextColour != GMWhisperInColourBox.BackColour) { Config.GMWhisperInTextColour = GMWhisperInColourBox.BackColour; coloursChanged = true; } if (Config.WhisperInTextColour != WhisperInColourBox.BackColour) { Config.WhisperInTextColour = WhisperInColourBox.BackColour; coloursChanged = true; } if (Config.WhisperOutTextColour != WhisperOutColourBox.BackColour) { Config.WhisperOutTextColour = WhisperOutColourBox.BackColour; coloursChanged = true; } if (Config.GroupTextColour != GroupColourBox.BackColour) { Config.GroupTextColour = GroupColourBox.BackColour; coloursChanged = true; } if (Config.GuildTextColour != GuildColourBox.BackColour) { Config.GuildTextColour = GuildColourBox.BackColour; coloursChanged = true; } if (Config.ShoutTextColour != ShoutColourBox.BackColour) { Config.ShoutTextColour = ShoutColourBox.BackColour; coloursChanged = true; } if (Config.GlobalTextColour != GlobalColourBox.BackColour) { Config.GlobalTextColour = GlobalColourBox.BackColour; coloursChanged = true; } if (Config.ObserverTextColour != ObserverColourBox.BackColour) { Config.ObserverTextColour = ObserverColourBox.BackColour; coloursChanged = true; } if (Config.HintTextColour != HintColourBox.BackColour) { Config.HintTextColour = HintColourBox.BackColour; coloursChanged = true; } if (Config.SystemTextColour != SystemColourBox.BackColour) { Config.SystemTextColour = SystemColourBox.BackColour; coloursChanged = true; } if (Config.GainsTextColour != GainsColourBox.BackColour) { Config.GainsTextColour = GainsColourBox.BackColour; coloursChanged = true; } if (Config.AnnouncementTextColour != AnnouncementColourBox.BackColour) { Config.AnnouncementTextColour = AnnouncementColourBox.BackColour; coloursChanged = true; } if (coloursChanged && GameScene.Game != null) { foreach (ChatTab tab in ChatTab.Tabs) { tab.UpdateColours(); } } }
public CompanionOptionsDialog() { TitleLabel.Text = "Companion Options"; SetClientSize(new Size(182, 341)); Movable = false; TypeFilterLabel = new DXLabel { Parent = this, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Item Type Filter:", }; TypeFilterLabel.Location = new Point(ClientArea.Left + 3, ClientArea.Y + 1); CheckBoxRightPoint = new Point(TypeFilterLabel.Size.Width, 0); int i = 22; int gap = 16; GoldCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Gold:" }, Visible = true }; GoldCheckBox.Location = new Point(CheckBoxRightPoint.X - GoldCheckBox.Size.Width, ClientArea.Y + i); GoldCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Gold }); }; i += gap; WeaponCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Weapon:" }, Visible = true }; WeaponCheckBox.Location = new Point(CheckBoxRightPoint.X - WeaponCheckBox.Size.Width, ClientArea.Y + i); WeaponCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Weapon }); }; i += gap; ArmourCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Armour:" }, Visible = true }; ArmourCheckBox.Location = new Point(CheckBoxRightPoint.X - ArmourCheckBox.Size.Width, ClientArea.Y + i); ArmourCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Armour }); }; i += gap; HelmetCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Helmet:" }, Visible = true }; HelmetCheckBox.Location = new Point(CheckBoxRightPoint.X - HelmetCheckBox.Size.Width, ClientArea.Y + i); HelmetCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Helmet }); }; i += gap; ShieldCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Shield:" }, Visible = true }; ShieldCheckBox.Location = new Point(CheckBoxRightPoint.X - ShieldCheckBox.Size.Width, ClientArea.Y + i); ShieldCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Shield }); }; i += gap; NecklaceCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Necklace:" }, Visible = true }; NecklaceCheckBox.Location = new Point(CheckBoxRightPoint.X - NecklaceCheckBox.Size.Width, ClientArea.Y + i); NecklaceCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Necklace }); }; i += gap; BraceletCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Bracelet:" }, Visible = true }; BraceletCheckBox.Location = new Point(CheckBoxRightPoint.X - BraceletCheckBox.Size.Width, ClientArea.Y + i); BraceletCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Bracelet }); }; i += gap; RingCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Ring:" }, Visible = true }; RingCheckBox.Location = new Point(CheckBoxRightPoint.X - RingCheckBox.Size.Width, ClientArea.Y + i); RingCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Ring }); }; i += gap; ShoesCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Shoes:" }, Visible = true }; ShoesCheckBox.Location = new Point(CheckBoxRightPoint.X - ShoesCheckBox.Size.Width, ClientArea.Y + i); ShoesCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Shoes }); }; i += gap; EmblemsCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Emblems:" }, Visible = true }; EmblemsCheckBox.Location = new Point(CheckBoxRightPoint.X - EmblemsCheckBox.Size.Width, ClientArea.Y + i); EmblemsCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Emblem }); }; i += gap; WingsCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Wings:" }, Visible = true }; WingsCheckBox.Location = new Point(CheckBoxRightPoint.X - WingsCheckBox.Size.Width, ClientArea.Y + i); WingsCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Wings }); }; i += gap; BookLabel = new DXLabel { Parent = this, ForeColour = Color.White, IsControl = false, Text = "Book:", }; BookLabel.Location = new Point(CheckBoxRightPoint.X - BookLabel.Size.Width - 16, ClientArea.Y + i); BookWarriorCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "" }, Hint = "Warrior", Visible = true }; BookWarriorCheckBox.Location = new Point(CheckBoxRightPoint.X - 16, ClientArea.Y + i); BookWarriorCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Book, Class = RequiredClass.Warrior }); }; BookWizardCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "" }, Hint = "Wizard", Visible = true }; BookWizardCheckBox.Location = new Point(CheckBoxRightPoint.X + BookWarriorCheckBox.Size.Width - 16, ClientArea.Y + i); BookWizardCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Book, Class = RequiredClass.Wizard }); }; BookTaoistCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "" }, Hint = "Taoist", Visible = true }; BookTaoistCheckBox.Location = new Point(CheckBoxRightPoint.X + BookWarriorCheckBox.Size.Width + BookWizardCheckBox.Size.Width - 16, ClientArea.Y + i); BookTaoistCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Book, Class = RequiredClass.Taoist }); }; BookAssassinCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "" }, Hint = "Assassin", Visible = true }; BookAssassinCheckBox.Location = new Point(CheckBoxRightPoint.X + BookWarriorCheckBox.Size.Width + BookWizardCheckBox.Size.Width + BookTaoistCheckBox.Size.Width - 16, ClientArea.Y + i); BookAssassinCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Book, Class = RequiredClass.Assassin }); }; i += gap; PotionCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Potion:" }, Visible = true }; PotionCheckBox.Location = new Point(CheckBoxRightPoint.X - PotionCheckBox.Size.Width, ClientArea.Y + i); PotionCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Consumable }); }; i += gap; OreCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Ore:" }, Visible = true }; OreCheckBox.Location = new Point(CheckBoxRightPoint.X - OreCheckBox.Size.Width, ClientArea.Y + i); OreCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupToggle { Type = ItemType.Ore }); }; i += gap; i += gap; GradeFilterLabel = new DXLabel { Parent = this, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Item Grade Filter:", }; GradeFilterLabel.Location = new Point(ClientArea.Left + 3, ClientArea.Y + i); CheckBoxRightPoint = new Point(GradeFilterLabel.Size.Width, 0); i += 22; CommonCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Common:" }, Visible = true }; CommonCheckBox.Location = new Point(CheckBoxRightPoint.X - CommonCheckBox.Size.Width, ClientArea.Y + i); CommonCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupGradeToggle { Grade = Rarity.Common }); }; i += gap; SuperiorCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Superior:" }, Visible = true }; SuperiorCheckBox.Location = new Point(CheckBoxRightPoint.X - SuperiorCheckBox.Size.Width, ClientArea.Y + i); SuperiorCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupGradeToggle { Grade = Rarity.Superior }); }; i += gap; EliteCheckBox = new DXCheckBox { Parent = this, ForeColour = Color.White, Label = { Text = "Elite:" }, Visible = true }; EliteCheckBox.Location = new Point(CheckBoxRightPoint.X - EliteCheckBox.Size.Width, ClientArea.Y + i); EliteCheckBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.CompanionPickupGradeToggle { Grade = Rarity.Elite }); }; i += gap; }
public InventoryDialog() { LibraryFile = LibraryFile.Interface; Index = 130; Movable = true; CloseButton = new DXButton { Parent = this, Index = 15, LibraryFile = LibraryFile.Interface, }; CloseButton.Location = new Point(DisplayArea.Width - CloseButton.Size.Width - 5, 5); CloseButton.MouseClick += (o, e) => Visible = false; TitleLabel = new DXLabel { Text = "Inventory", Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), Outline = true, OutlineColour = Color.Black, IsControl = false, }; TitleLabel.Location = new Point((DisplayArea.Width - TitleLabel.Size.Width) / 2, 8); Grid = new DXItemGrid { GridSize = new Size(6, 8), Parent = this, ItemGrid = GameScene.Game.Inventory, GridType = GridType.Inventory, Location = new Point(20, 39), GridPadding = 1, BackColour = Color.Empty, Border = false }; CEnvir.LibraryList.TryGetValue(LibraryFile.GameInter, out MirLibrary library); DXControl WeightBar = new DXControl { Parent = this, Location = new Point(53, 355), Size = library.GetSize(360), }; WeightBar.BeforeDraw += (o, e) => { if (library == null) { return; } if (MapObject.User.Stats[Stat.BagWeight] == 0) { return; } float percent = Math.Min(1, Math.Max(0, MapObject.User.BagWeight / (float)MapObject.User.Stats[Stat.BagWeight])); if (percent == 0) { return; } MirImage image = library.CreateImage(360, ImageType.Image); if (image == null) { return; } PresentTexture(image.Image, this, new Rectangle(WeightBar.DisplayArea.X, WeightBar.DisplayArea.Y, (int)(image.Width * percent), image.Height), Color.White, WeightBar); }; WeightLabel = new DXLabel { Parent = this, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; WeightLabel.SizeChanged += (o, e) => { WeightLabel.Location = new Point(WeightBar.Location.X + (WeightBar.Size.Width - WeightLabel.Size.Width) / 2, WeightBar.Location.Y - 1 + (WeightBar.Size.Height - WeightLabel.Size.Height) / 2); }; GoldTitle = new DXLabel { AutoSize = false, ForeColour = Color.Goldenrod, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Left, Parent = this, Location = new Point(55, 381), Font = new Font(Config.FontName, CEnvir.FontSize(8F), FontStyle.Bold), Text = "Gold", Size = new Size(97, 20) }; GoldLabel = new DXLabel { AutoSize = false, ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Right, Parent = this, Location = new Point(80, 381), Text = "0", Size = new Size(97, 20), Sound = SoundIndex.GoldPickUp }; GoldLabel.MouseClick += GoldLabel_MouseClick; GameGoldTitle = new DXLabel { AutoSize = false, ForeColour = Color.DarkOrange, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Left, Parent = this, Location = new Point(55, 400), Font = new Font(Config.FontName, CEnvir.FontSize(8F), FontStyle.Bold), Text = "GG", Size = new Size(97, 20) }; GameGoldLabel = new DXLabel { AutoSize = false, ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.Right, Parent = this, Location = new Point(80, 400), Text = "0", Size = new Size(97, 20) }; SortButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 364, Parent = this, Location = new Point(180, 384), Hint = "Sort", Enabled = false }; TrashButton = new DXButton { LibraryFile = LibraryFile.GameInter, Index = 358, Parent = this, Location = new Point(218, 384), Hint = "Trash", Enabled = false }; CurrencyLabel = new DXLabel { Parent = this, Location = new Point(8, 380), Hint = "Wallet [Ctrl + C]", Size = new Size(45, 40), Sound = SoundIndex.GoldPickUp }; CurrencyLabel.MouseClick += CurrencyLabel_MouseClick; }
public TradeDialog() { TitleLabel.Text = "交易窗口"; Location = new Point(40, 40); UserGrid = new DXItemGrid { GridSize = new Size(5, 3), Parent = this, Location = new Point(ClientArea.X + 5, ClientArea.Y + 25), GridType = GridType.TradeUser, Linked = true, }; foreach (DXItemCell cell in UserGrid.Grid) { cell.LinkChanged += (o, e) => { cell.ReadOnly = cell.Item != null; if (cell.Item == null || GameScene.Game.Observer) { return; } CEnvir.Enqueue(new C.TradeAddItem { Cell = new CellLinkInfo { Slot = cell.Link.Slot, Count = cell.LinkedCount, GridType = cell.Link.GridType } }); }; } PlayerGrid = new DXItemGrid { GridSize = new Size(5, 3), Parent = this, Location = new Point(UserGrid.Location.X + UserGrid.Size.Width + 20, ClientArea.Y + 25), ItemGrid = PlayerItems = new ClientUserItem[15], GridType = GridType.TradePlayer, ReadOnly = true, }; UserLabel = new DXLabel { Text = "用户", Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), Outline = true, OutlineColour = Color.Black, IsControl = false, }; UserLabel.SizeChanged += (o, e) => UserLabel.Location = new Point(UserGrid.Location.X + (UserGrid.Size.Width - UserLabel.Size.Width) / 2, ClientArea.Y); UserLabel.Location = new Point(UserGrid.Location.X + (UserGrid.Size.Width - UserLabel.Size.Width) / 2, ClientArea.Y); PlayerLabel = new DXLabel { Text = "玩家", Parent = this, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), Outline = true, OutlineColour = Color.Black, IsControl = false, }; PlayerLabel.SizeChanged += (o, e) => PlayerLabel.Location = new Point(PlayerGrid.Location.X + (PlayerGrid.Size.Width - PlayerLabel.Size.Width) / 2, ClientArea.Y); PlayerLabel.Location = new Point(PlayerGrid.Location.X + (PlayerGrid.Size.Width - PlayerLabel.Size.Width) / 2, ClientArea.Y); UserGoldLabel = new DXLabel { AutoSize = false, Border = true, BorderColour = Color.FromArgb(99, 83, 50), ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter, Parent = this, Location = new Point(UserGrid.Location.X + 60, UserGrid.Location.Y + UserGrid.Size.Height + 5), Text = "0", Size = new Size(UserGrid.Size.Width - 61, 20), Sound = SoundIndex.GoldPickUp }; UserGoldLabel.MouseClick += UserGoldLabel_MouseClick; new DXLabel { AutoSize = false, Border = true, BorderColour = Color.FromArgb(99, 83, 50), ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter, Parent = this, Location = new Point(UserGrid.Location.X + 1, UserGrid.Location.Y + UserGrid.Size.Height + 5), Text = "金币", Size = new Size(58, 20), IsControl = false, }; PlayerGoldLabel = new DXLabel { AutoSize = false, Border = true, BorderColour = Color.FromArgb(99, 83, 50), ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter, Parent = this, Location = new Point(PlayerGrid.Location.X + 60, UserGrid.Location.Y + UserGrid.Size.Height + 5), Text = "0", Size = new Size(UserGrid.Size.Width - 61, 20), Sound = SoundIndex.GoldPickUp }; new DXLabel { AutoSize = false, Border = true, BorderColour = Color.FromArgb(99, 83, 50), ForeColour = Color.White, DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter, Parent = this, Location = new Point(PlayerGrid.Location.X + 1, UserGrid.Location.Y + UserGrid.Size.Height + 5), Text = "金币", Size = new Size(58, 20), IsControl = false, }; ConfirmButton = new DXButton { Parent = this, Location = new Point(UserGrid.Location.X + UserGrid.Size.Width - 80, UserGoldLabel.Location.Y + 25), Label = { Text = "确认" }, ButtonType = ButtonType.SmallButton, Size = new Size(80, SmallButtonHeight), }; ConfirmButton.MouseClick += (o, e) => { if (GameScene.Game.Observer) { return; } ConfirmButton.Enabled = false; CEnvir.Enqueue(new C.TradeConfirm()); }; SetClientSize(new Size(PlayerGrid.Size.Width * 2 + 30, PlayerGrid.Size.Height + UserLabel.Size.Height + 15 + UserGoldLabel.Size.Height + ConfirmButton.Size.Height)); }
public void AttemptAction(ObjectAction action) { if (CEnvir.Now < NextActionTime || ActionQueue.Count > 0) { return; } if (CEnvir.Now < ServerTime) { return; //Next Server response Time. } switch (action.Action) { case MirAction.Moving: if (CEnvir.Now < MoveTime) { return; } break; case MirAction.Attack: action.Extra[2] = Functions.GetElement(Stats); if (GameScene.Game.Equipment[(int)EquipmentSlot.Amulet]?.Info.ItemType == ItemType.DarkStone) { foreach (KeyValuePair <Stat, int> stats in GameScene.Game.Equipment[(int)EquipmentSlot.Amulet].Info.Stats.Values) { switch (stats.Key) { case Stat.FireAffinity: action.Extra[2] = Element.Fire; break; case Stat.IceAffinity: action.Extra[2] = Element.Ice; break; case Stat.LightningAffinity: action.Extra[2] = Element.Lightning; break; case Stat.WindAffinity: action.Extra[2] = Element.Wind; break; case Stat.HolyAffinity: action.Extra[2] = Element.Holy; break; case Stat.DarkAffinity: action.Extra[2] = Element.Dark; break; case Stat.PhantomAffinity: action.Extra[2] = Element.Phantom; break; } } } MagicType attackMagic = MagicType.None; if (AttackMagic != MagicType.None) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != AttackMagic) { continue; } if (CEnvir.Now < pair.Value.NextCast) { break; } if (AttackMagic == MagicType.Karma) { if (Stats[Stat.Health] * pair.Value.Cost / 100 > CurrentHP || Buffs.All(x => x.Type != BuffType.Cloak)) { break; } } else if (pair.Value.Cost > CurrentMP) { break; } attackMagic = AttackMagic; break; } } if (CanPowerAttack && TargetObject != null) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.Slaying) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanThrusting && GameScene.Game.MapControl.CanEnergyBlast(action.Direction)) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.Thrusting) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanHalfMoon && (TargetObject != null || (GameScene.Game.MapControl.CanHalfMoon(action.Direction) && (GameScene.Game.MapControl.HasTarget(Functions.Move(CurrentLocation, action.Direction)) || attackMagic != MagicType.Thrusting)))) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.HalfMoon) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanDestructiveBlow && (TargetObject != null || (GameScene.Game.MapControl.CanDestructiveBlow(action.Direction) && (GameScene.Game.MapControl.HasTarget(Functions.Move(CurrentLocation, action.Direction)) || attackMagic != MagicType.Thrusting)))) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.DestructiveSurge) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (attackMagic == MagicType.None && CanFlameSplash && (TargetObject != null || GameScene.Game.MapControl.CanDestructiveBlow(action.Direction))) { foreach (KeyValuePair <MagicInfo, ClientUserMagic> pair in Magics) { if (pair.Key.Magic != MagicType.FlameSplash) { continue; } if (pair.Value.Cost > CurrentMP) { break; } attackMagic = pair.Key.Magic; break; } } if (CanBladeStorm) { attackMagic = MagicType.BladeStorm; } else if (CanDragonRise) { attackMagic = MagicType.DragonRise; } else if (CanFlamingSword) { attackMagic = MagicType.FlamingSword; } action.Extra[1] = attackMagic; break; case MirAction.Mount: return; } SetAction(action); int attackDelay; switch (action.Action) { case MirAction.Standing: NextActionTime = CEnvir.Now + Globals.TurnTime; CEnvir.Enqueue(new C.Turn { Direction = action.Direction }); if ((GameScene.Game.MapControl.MapButtons & MouseButtons.Right) != MouseButtons.Right) { GameScene.Game.CanRun = false; } break; case MirAction.Harvest: NextActionTime = CEnvir.Now + Globals.HarvestTime; CEnvir.Enqueue(new C.Harvest { Direction = action.Direction }); GameScene.Game.CanRun = false; break; case MirAction.Moving: MoveTime = CEnvir.Now + Globals.MoveTime; CEnvir.Enqueue(new C.Move { Direction = action.Direction, Distance = MoveDistance }); GameScene.Game.CanRun = true; break; case MirAction.Attack: attackDelay = Globals.AttackDelay - Stats[Stat.AttackSpeed] * Globals.ASpeedRate; attackDelay = Math.Max(800, attackDelay); AttackTime = CEnvir.Now + TimeSpan.FromMilliseconds(attackDelay); if (BagWeight > Stats[Stat.BagWeight]) { AttackTime += TimeSpan.FromMilliseconds(attackDelay); } CEnvir.Enqueue(new C.Attack { Direction = action.Direction, Action = action.Action, AttackMagic = MagicType }); GameScene.Game.CanRun = false; break; case MirAction.Spell: NextMagicTime = CEnvir.Now + Globals.MagicDelay; if (BagWeight > Stats[Stat.BagWeight]) { NextMagicTime += Globals.MagicDelay; } CEnvir.Enqueue(new C.Magic { Direction = action.Direction, Action = action.Action, Type = MagicType, Target = AttackTargets?.Count > 0 ? AttackTargets[0].ObjectID : 0, Location = MagicLocations?.Count > 0 ? MagicLocations[0] : Point.Empty }); GameScene.Game.CanRun = false; break; case MirAction.Mining: attackDelay = Globals.AttackDelay - Stats[Stat.AttackSpeed] * Globals.ASpeedRate; attackDelay = Math.Max(800, attackDelay); AttackTime = CEnvir.Now + TimeSpan.FromMilliseconds(attackDelay); if (BagWeight > Stats[Stat.BagWeight]) { AttackTime += TimeSpan.FromMilliseconds(attackDelay); } CEnvir.Enqueue(new C.Mining { Direction = action.Direction }); GameScene.Game.CanRun = false; break; default: GameScene.Game.CanRun = false; break; } ServerTime = CEnvir.Now.AddSeconds(5); }
public CompanionDialog() { TitleLabel.Text = "宠物"; SetClientSize(new Size(355, 590)); // feature 拾取过滤 物品显示过滤 HasTitle = true; CompanionTabControl = new DXTabControl { Parent = this, Location = ClientArea.Location, Size = ClientArea.Size, }; CompanionBagTab = new DXTab { Parent = CompanionTabControl, Border = true, TabButton = { Label = { Text = "宠物背包" } }, }; PickUpFilterTab = new DXTab { Parent = CompanionTabControl, Border = true, TabButton = { Label = { Text = "拾取过滤" } }, }; ItemNameFilterTab = new DXTab { Parent = CompanionTabControl, Border = true, TabButton = { Label = { Text = "显示过滤" } }, }; CompanionTabControl.SelectedTab = CompanionBagTab; DXControl filterPanel = new DXControl { Parent = PickUpFilterTab, Size = new Size(PickUpFilterTab.Size.Width, 26), Location = new Point(0, 0), Border = true, BorderColour = Color.FromArgb(198, 166, 99) }; DXLabel PickUpFilterItemNameLabel = new DXLabel { Parent = filterPanel, Location = new Point(5, 5), Text = "名字:", }; PickUpFilterItemNameBox = new DXTextBox { Parent = filterPanel, Size = new Size(90, 20), Location = new Point(PickUpFilterItemNameLabel.Location.X + PickUpFilterItemNameLabel.Size.Width + 5, PickUpFilterItemNameLabel.Location.Y), }; PickUpFilterItemNameBox.TextBox.KeyPress += TextBox_KeyPress; PickUpFilterItemTypelabel = new DXLabel { Parent = filterPanel, Location = new Point(PickUpFilterItemNameBox.Location.X + PickUpFilterItemNameBox.Size.Width + 10, 5), Text = "物品:", }; PickUpFilterItemTypeBox = new DXComboBox { Parent = filterPanel, Location = new Point(PickUpFilterItemTypelabel.Location.X + PickUpFilterItemTypelabel.Size.Width + 5, PickUpFilterItemTypelabel.Location.Y), Size = new Size(72, DXComboBox.DefaultNormalHeight), DropDownHeight = 198 }; new DXListBoxItem { Parent = PickUpFilterItemTypeBox.ListBox, Label = { Text = "所有" }, Item = null }; Type itemType = typeof(ItemType); for (ItemType i = ItemType.Nothing; i <= ItemType.ItemPart; i++) { MemberInfo[] infos = itemType.GetMember(i.ToString()); DescriptionAttribute description = infos[0].GetCustomAttribute <DescriptionAttribute>(); new DXListBoxItem { Parent = PickUpFilterItemTypeBox.ListBox, Label = { Text = description?.Description ?? i.ToString() }, Item = i }; } PickUpFilterItemTypeBox.ListBox.SelectItem(null); PickUpFilterSearchButton = new DXButton { Size = new Size(80, SmallButtonHeight), Location = new Point(PickUpFilterItemTypeBox.Location.X + PickUpFilterItemTypeBox.Size.Width + 15, PickUpFilterItemTypelabel.Location.Y - 1), Parent = filterPanel, ButtonType = ButtonType.SmallButton, Label = { Text = "搜索" } }; PickUpFilterSearchButton.MouseClick += (o, e) => Search(); PickUpFilterRow = new PickUpFilterRow[9]; PickupFilterSearchScrollBar = new DXVScrollBar { Parent = PickUpFilterTab, Location = new Point(PickUpFilterTab.Size.Width - 14, filterPanel.Size.Height + 5), Size = new Size(14, PickUpFilterTab.Size.Height - 5 - filterPanel.Size.Height), VisibleSize = PickUpFilterRow.Length, Change = 3, }; PickupFilterSearchScrollBar.ValueChanged += SearchScrollBar_ValueChanged; for (int i = 0; i < PickUpFilterRow.Length; i++) { int index = i; PickUpFilterRow[index] = new PickUpFilterRow { Parent = PickUpFilterTab, Location = new Point(0, filterPanel.Size.Height + 5 + i * 58), }; // SearchRows[index].MouseClick += (o, e) => { SelectedRow = SearchRows[index]; }; PickUpFilterRow[index].MouseWheel += PickupFilterSearchScrollBar.DoMouseWheel; } // feature end //CompanionDisplayPoint = new Point(ClientArea.X + 60, ClientArea.Y + 50); CompanionDisplayPoint = new Point(60, 120); InventoryGrid = new DXItemGrid { GridSize = new Size(10, 10), Parent = CompanionBagTab, GridType = GridType.CompanionInventory, Location = new Point(0, 200), }; EquipmentGrid = new DXItemCell[Globals.CompanionEquipmentSize]; DXItemCell cell; EquipmentGrid[(int)CompanionSlot.Bag] = cell = new DXItemCell { Location = new Point(196, 5), Parent = CompanionBagTab, FixedBorder = true, Border = true, Slot = (int)CompanionSlot.Bag, GridType = GridType.CompanionEquipment, }; cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 99); EquipmentGrid[(int)CompanionSlot.Head] = cell = new DXItemCell { Location = new Point(236, 5), Parent = CompanionBagTab, FixedBorder = true, Border = true, Slot = (int)CompanionSlot.Head, GridType = GridType.CompanionEquipment, }; cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 100); EquipmentGrid[(int)CompanionSlot.Back] = cell = new DXItemCell { Location = new Point(276, 5), Parent = CompanionBagTab, FixedBorder = true, Border = true, Slot = (int)CompanionSlot.Back, GridType = GridType.CompanionEquipment, }; cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 101); EquipmentGrid[(int)CompanionSlot.Food] = cell = new DXItemCell { Location = new Point(316, 5), Parent = CompanionBagTab, FixedBorder = true, Border = true, Slot = (int)CompanionSlot.Food, GridType = GridType.CompanionEquipment, }; cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 102); DXCheckBox PickUpCheckBox = new DXCheckBox { Parent = CompanionBagTab, Label = { Text = "拾取物品:" }, Visible = false }; //PickUpCheckBox.Location = new Point(ClientArea.Right - PickUpCheckBox.Size.Width +3, ClientArea.Y + 45); PickUpCheckBox.Location = new Point(60, 90); /* * new DXLabel * { * AutoSize = false, * Parent = this, * Outline = true, * Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), * ForeColour = Color.FromArgb(198, 166, 99), * OutlineColour = Color.Black, * IsControl = false, * Text = "Abilities", * Location = new Point(ClientArea.X + 196, CompanionDisplayPoint.Y - 20), * Size = new Size(156, 20), * DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter, * }; */ DXLabel label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 3", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y - 70); Level3Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y - 67), Text = "不可用" }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 5", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y - 50); Level5Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y - 47), Text = "不可用" }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 7", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y - 30); Level7Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y - 27), Text = "不可用" }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 10", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y - 10); Level10Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y - 7), Text = "不可用" }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 11", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y + 10); Level11Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y + 13), Text = "不可用" }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 13", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y + 30); Level13Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y + 33), Text = "不可用" }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Level 15", }; label.Location = new Point(235 - label.Size.Width, CompanionDisplayPoint.Y + 50); Level15Label = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(235, CompanionDisplayPoint.Y + 53), Text = "不可用" }; NameLabel = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(CompanionDisplayPoint.X + 25, CompanionDisplayPoint.Y - 27) }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "名字", }; label.Location = new Point(CompanionDisplayPoint.X + 30 - label.Size.Width, CompanionDisplayPoint.Y - 30); LevelLabel = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(CompanionDisplayPoint.X + 25, CompanionDisplayPoint.Y - 7) }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "等级", }; label.Location = new Point(CompanionDisplayPoint.X + 30 - label.Size.Width, CompanionDisplayPoint.Y - 10); ExperienceLabel = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(CompanionDisplayPoint.X + 25, CompanionDisplayPoint.Y + 13) }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "经验", }; label.Location = new Point(CompanionDisplayPoint.X + 30 - label.Size.Width, CompanionDisplayPoint.Y + 10); HungerLabel = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(CompanionDisplayPoint.X + 25, CompanionDisplayPoint.Y + 33) }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "饥饿度", }; label.Location = new Point(CompanionDisplayPoint.X + 30 - label.Size.Width, CompanionDisplayPoint.Y + 30); WeightLabel = new DXLabel { Parent = CompanionBagTab, ForeColour = Color.White, Outline = true, OutlineColour = Color.Black, IsControl = false, Location = new Point(CompanionDisplayPoint.X + 25, CompanionDisplayPoint.Y + 53) }; label = new DXLabel { Parent = CompanionBagTab, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "重量", }; label.Location = new Point(CompanionDisplayPoint.X + 30 - label.Size.Width, CompanionDisplayPoint.Y + 50); }
public CompanionFilterDialog() { CloseButton.Visible = false; TitleLabel.Text = "Filter Companion Pick"; SetClientSize(new Size(350, 341)); DXLabel label = new DXLabel { Parent = this, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Class", }; label.Location = new Point(20, 40); DrawClassFilter(); label = new DXLabel { Parent = this, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Rarity Type", }; label.Location = new Point(20, 100); DrawRarityFilter(); label = new DXLabel { Parent = this, Outline = true, Font = new Font(Config.FontName, CEnvir.FontSize(10F), FontStyle.Bold), ForeColour = Color.FromArgb(198, 166, 99), OutlineColour = Color.Black, IsControl = false, Text = "Item Type", }; label.Location = new Point(20, 160); DrawItemTypeFilter(); DXButton filterButton = new DXButton { Parent = this, Label = { Text = "Save settings", }, ButtonType = ButtonType.SmallButton, Size = new Size(80, SmallButtonHeight) }; filterButton.Location = new Point(Size.Width / 2 - filterButton.Size.Width / 2, Size.Height - 30); filterButton.MouseClick += (o, e) => { List <MirClass> fClass = GetCheckedItemsClass(); List <Rarity> fRarity = GetCheckedItemsRarity(); List <ItemType> fType = GetCheckedItemsType(); GameScene.Game.User.FiltersClass = String.Join(",", fClass); GameScene.Game.User.FiltersRarity = String.Join(",", fRarity); GameScene.Game.User.FiltersItemType = String.Join(",", fType); CEnvir.Enqueue(new C.SendCompanionFilters { FilterClass = GetCheckedItemsClass(), FilterRarity = GetCheckedItemsRarity(), FilterItemType = GetCheckedItemsType() }); }; }