Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        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
                });
            }
        }
Esempio n. 5
0
        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();
            };
        }
Esempio n. 6
0
        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
                });
            };
        }
Esempio n. 7
0
        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();
        }
Esempio n. 8
0
        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();
                }
            }
        }
Esempio n. 9
0
        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;
        }
Esempio n. 10
0
        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()
                });
            };
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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));
        }
Esempio n. 13
0
        public void ReceiveChat(MessageAction action, params object[] args)
        {
            DXLabel label;

            switch (action)
            {
            case MessageAction.Revive:
                label = new DXLabel
                {
                    AutoSize   = false,
                    Text       = "You have died, Click here to revive in town.",
                    Outline    = false,
                    DrawFormat = TextFormatFlags.WordBreak | TextFormatFlags.WordEllipsis,
                    Parent     = TextPanel,
                };
                label.MouseClick += (o, e) =>
                {
                    CEnvir.Enqueue(new C.TownRevive());
                    label.Dispose();
                };
                label.MouseWheel += ScrollBar.DoMouseWheel;
                label.Disposing  += (o, e) =>
                {
                    if (IsDisposed)
                    {
                        return;
                    }

                    History.Remove(label);
                    UpdateScrollBar();
                    ScrollBar.Value = ScrollBar.MaxValue - label.Size.Height;
                };
                label.Tag = MessageType.Announcement;
                break;

            default:
                return;
            }

            UpdateColours(label);

            Size size = DXLabel.GetHeight(label, TextPanel.Size.Width);

            label.Size = new Size(size.Width, size.Height);

            History.Add(label);

            while (History.Count > 250)
            {
                DXLabel oldLabel = History[0];
                History.Remove(oldLabel);
                oldLabel.Dispose();
            }

            AlertIcon.Visible = !IsVisible && Panel.AlertCheckBox.Checked;

            bool update = ScrollBar.Value >= ScrollBar.MaxValue - ScrollBar.VisibleSize;

            UpdateScrollBar();


            if (update)
            {
                ScrollBar.Value = ScrollBar.MaxValue - label.Size.Height;
            }
            else
            {
                UpdateItems();
            }
        }
Esempio n. 14
0
        public MailDialog()
        {
            TitleLabel.Text = "邮件";
            HasFooter       = true;

            SetClientSize(new Size(350, 350));

            //Rows
            Header = new MailRow
            {
                Parent   = this,
                Location = ClientArea.Location,
                IsHeader = true,
            };

            Rows      = new MailRow[15];
            ScrollBar = new DXVScrollBar
            {
                Parent      = this,
                Size        = new Size(14, ClientArea.Height - 2 - 22),
                Location    = new Point(ClientArea.Right - 14, ClientArea.Top + 1 + 22),
                VisibleSize = 15,
                Change      = 3,
            };
            ScrollBar.ValueChanged += ScrollBar_ValueChanged;
            MouseWheel             += ScrollBar.DoMouseWheel;

            DXControl panel = new DXControl
            {
                Parent   = this,
                Location = new Point(ClientArea.Location.X, ClientArea.Location.Y + Header.Size.Height + 2),
                Size     = new Size(ClientArea.Width - 16, ClientArea.Size.Height - 22)
            };

            for (int i = 0; i < 15; i++)
            {
                int index = i;
                Rows[index] = new MailRow
                {
                    Parent   = panel,
                    Location = new Point(0, 22 * i),
                    Visible  = false,
                };
                Rows[index].MouseClick += (o, e) =>
                {
                    GameScene.Game.ReadMailBox.Mail = Rows[index].Mail;

                    if (Rows[index].Mail.Opened)
                    {
                        return;
                    }

                    Rows[index].Mail.Opened = true;
                    Rows[index].RefreshIcon();
                    GameScene.Game.MailBox.UpdateIcon();

                    CEnvir.Enqueue(new C.MailOpened {
                        Index = Rows[index].Mail.Index
                    });
                };
                Rows[index].MouseWheel += ScrollBar.DoMouseWheel;
            }

            CollectAllButton = new DXButton
            {
                Location = new Point(ClientArea.Right - 100, Size.Height - 43),
                Size     = new Size(80, DefaultHeight),
                Parent   = this,
                Label    = { Text = "签收" }
            };
            CollectAllButton.MouseClick += (o, e) =>
            {
                int count = 15;
                foreach (ClientMailInfo mail in MailList)
                {
                    if (count <= 0)
                    {
                        break;
                    }

                    if (mail.Items.Count == 0)
                    {
                        continue;
                    }

                    if (!mail.Opened)
                    {
                        mail.Opened = true;
                        CEnvir.Enqueue(new C.MailOpened {
                            Index = mail.Index
                        });
                        count--;
                        foreach (MailRow row in Rows)
                        {
                            if (row.Mail != mail)
                            {
                                continue;
                            }
                            row.RefreshIcon();
                            break;
                        }
                    }

                    foreach (ClientUserItem item in mail.Items)
                    {
                        CEnvir.Enqueue(new C.MailGetItem {
                            Index = mail.Index, Slot = item.Slot
                        });
                    }
                    count--;
                }

                GameScene.Game.MailBox.UpdateIcon();
            };


            DeleteAll = new DXButton
            {
                Location = new Point(ClientArea.Right - 200, Size.Height - 43),
                Size     = new Size(80, DefaultHeight),
                Parent   = this,
                Label    = { Text = "删除" }
            };
            DeleteAll.MouseClick += (o, e) =>
            {
                int count = 15;
                foreach (ClientMailInfo mail in MailList)
                {
                    if (count <= 0)
                    {
                        break;
                    }
                    if (mail.Items.Count > 0)
                    {
                        continue;
                    }

                    CEnvir.Enqueue(new C.MailDelete {
                        Index = mail.Index
                    });
                    count--;
                }
            };

            NewButton = new DXButton
            {
                Location = new Point(ClientArea.Right - 300, Size.Height - 43),
                Size     = new Size(80, DefaultHeight),
                Parent   = this,
                Label    = { Text = "写邮件" }
            };
            NewButton.MouseClick += (o, e) =>
            {
                GameScene.Game.SendMailBox.Visible = true;
                GameScene.Game.SendMailBox.BringToFront();
            };
        }
Esempio n. 15
0
        public BlockDialog()
        {
            TitleLabel.Text = "黑名单";

            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 = "添加" },
                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("请输入您要屏蔽的玩家角色名.", "屏蔽玩家")
                {
                    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 = "移除" },
                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($"您确认对玩家 {ListBox.SelectedItem.Label.Text} 解除屏蔽?", "解除屏蔽", 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();
        }