Example #1
0
        public TradeDialog()
        {
            Index    = 389;
            Library  = Libraries.Prguse;
            Movable  = true;
            Size     = new Size(204, 152);
            Location = new Point((Settings.ScreenWidth / 2) - Size.Width - 10, Settings.ScreenHeight - 350);
            Sort     = true;

            #region Buttons
            ConfirmButton = new MirButton
            {
                Index        = 520,
                HoverIndex   = 521,
                Location     = new Point(135, 120),
                Size         = new Size(48, 25),
                Library      = Libraries.Title,
                Parent       = this,
                PressedIndex = 522,
                Sound        = SoundList.ButtonA,
            };
            ConfirmButton.Click += (o, e) =>
            {
                ChangeLockState(!GameScene.User.TradeLocked);
                Network.Enqueue(new C.TradeConfirm {
                    Locked = GameScene.User.TradeLocked
                });
            };

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 23, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) =>
            {
                Hide();
                GameScene.Scene.GuestTradeDialog.Hide();
                TradeCancel();
            };

            #endregion

            #region Host labels
            NameLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(20, 10),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            GoldLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(35, 123),
                Parent     = this,
                Size       = new Size(90, 15),
                Sound      = SoundList.Gold,
            };
            GoldLabel.Click += (o, e) =>
            {
                if (GameScene.SelectedCell == null && GameScene.Gold > 0)
                {
                    MirAmountBox amountBox = new MirAmountBox("Trade Amount:", 116, GameScene.Gold);

                    amountBox.OKButton.Click += (c, a) =>
                    {
                        if (amountBox.Amount > 0)
                        {
                            GameScene.User.TradeGoldAmount += amountBox.Amount;
                            Network.Enqueue(new C.TradeGold {
                                Amount = amountBox.Amount
                            });

                            RefreshInterface();
                        }
                    };

                    amountBox.Show();
                    GameScene.PickedUpGold = false;
                }
            };
            #endregion

            #region Grids
            Grid = new MirItemCell[5 * 2];

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    Grid[2 * x + y] = new MirItemCell
                    {
                        ItemSlot = 2 * x + y,
                        GridType = MirGridType.Trade,
                        Parent   = this,
                        Location = new Point(x * 36 + 10 + x, y * 32 + 39 + y),
                    };
                }
            }
            #endregion
        }
Example #2
0
        public MailComposeParcelDialog()
        {
            Index    = 674;
            Library  = Libraries.Title;
            Size     = new Size(236, 384);
            Movable  = true;
            Sort     = true;
            Location = new Point(GameScene.Scene.InventoryDialog.Size.Width + 10, 0);

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 27, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) =>
            {
                ResetLockedCells();
                Hide();
            };

            RecipientNameLabel = new MirLabel
            {
                Text       = "",
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                ForeColour = Color.White,
                Location   = new Point(70, 35),
                Size       = new Size(150, 15),
                NotControl = true,
            };

            MessageTextBox = new MirTextBox
            {
                ForeColour = Color.White,
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(15, 98),
                Size       = new Size(202, 165),
            };

            MessageTextBox.MultiLine();

            StampButton = new MirButton
            {
                Index        = 203,
                HoverIndex   = 203,
                PressedIndex = 203,
                Location     = new Point(73, 56),
                Size         = new Size(20, 20),
                Library      = Libraries.Prguse2,
                Parent       = this,
                Sound        = SoundList.ButtonA,
            };
            StampButton.Click += (o, e) =>
            {
                StampParcel();
            };

            ItemCover = new MirImageControl
            {
                Index    = 676,
                Location = new Point(63, 310),
                Size     = new Size(144, 33),
                Library  = Libraries.Title,
                Parent   = this
            };

            for (int i = 0; i < Cells.Length; i++)
            {
                Cells[i] = new MirItemCell
                {
                    BorderColour = Color.Lime,
                    Size         = new Size(35, 31),
                    GridType     = MirGridType.Mail,
                    Library      = Libraries.Items,
                    Parent       = this,
                    Location     = new Point(27 + (i * 36), 311),
                    ItemSlot     = i
                };
            }

            ParcelCostLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(63, 269),
                Parent     = this,
                Size       = new Size(143, 15),
            };

            GoldSendLabel = new MirLabel
            {
                DrawFormat = TextFormatFlags.VerticalCenter,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(63, 290),
                Parent     = this,
                Size       = new Size(143, 15),
                Sound      = SoundList.Gold,
            };
            GoldSendLabel.Click += (o, e) =>
            {
                if (GameScene.SelectedCell == null && GameScene.Gold > 0)
                {
                    MirAmountBox amountBox = new MirAmountBox("Send Amount:", 116, GameScene.Gold);

                    amountBox.OKButton.Click += (c, a) =>
                    {
                        if (amountBox.Amount > 0)
                        {
                            GiftGoldAmount += amountBox.Amount;
                            GameScene.Gold -= amountBox.Amount;
                        }

                        GoldSendLabel.Text = GiftGoldAmount.ToString("###,###,##0");

                        CalculatePostage();
                    };

                    amountBox.Show();
                    GameScene.PickedUpGold = false;
                }
            };

            SendButton = new MirButton
            {
                Index        = 607,
                HoverIndex   = 608,
                PressedIndex = 609,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(30, 350)
            };
            SendButton.Click += (o, e) =>
            {
                Network.Enqueue(new C.SendMail {
                    Name = RecipientNameLabel.Text, Message = MessageTextBox.Text, Gold = GiftGoldAmount, ItemsIdx = ItemsIdx, Stamped = Stamped
                });
            };

            CancelButton = new MirButton
            {
                Index        = 193,
                HoverIndex   = 194,
                PressedIndex = 195,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(135, 350)
            };
            CancelButton.Click += (o, e) =>
            {
                ResetLockedCells();
                Hide();
            };
        }
Example #3
0
        public ItemRentDialog()
        {
            Index    = 238;
            Library  = Libraries.Prguse;
            Movable  = true;
            Size     = new Size(204, 109);
            Location = new Point(Settings.ScreenWidth - Size.Width - Size.Width / 2, Size.Height + Size.Height / 2);
            Sort     = true;

            var closeButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(180, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };

            closeButton.Click += (sender, args) =>
            {
                CancelItemRental();
            };

            _lockButton = new MirButton
            {
                Index        = 250,
                HoverIndex   = 251,
                Location     = new Point(22, 76),
                Size         = new Size(28, 25),
                Library      = Libraries.Prguse,
                Parent       = this,
                PressedIndex = 252,
                Sound        = SoundList.ButtonA,
            };
            _lockButton.Click += (o, e) =>
            {
                if (GameScene.User.RentalGoldAmount < 1)
                {
                    return;
                }

                Network.Enqueue(new C.ItemRentalLockFee());
            };

            _rentalPriceButton = new MirButton
            {
                Index    = 28,
                Location = new Point(18, 46),
                Size     = new Size(32, 17),
                Library  = Libraries.Prguse,
                Parent   = this,
                Sound    = SoundList.Gold,
            };
            _rentalPriceButton.Click += (o, e) =>
            {
                if (GameScene.SelectedCell != null || GameScene.Gold <= 0)
                {
                    return;
                }

                var amountBox = new MirAmountBox("Rental fee:", 116, GameScene.Gold);

                amountBox.OKButton.Click += (c, a) =>
                {
                    if (amountBox.Amount <= 0)
                    {
                        return;
                    }

                    GameScene.User.RentalGoldAmount += amountBox.Amount;
                    Network.Enqueue(new C.ItemRentalFee {
                        Amount = GameScene.User.RentalGoldAmount
                    });

                    RefreshInterface();
                };

                amountBox.Show();
                GameScene.PickedUpGold = false;
            };

            _nameLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(30, 8),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
                NotControl = true,
            };

            _rentalPriceLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(60, 42),
                Size       = new Size(150, 14),
                DrawFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter,
            };
            _rentalPriceLabel.Click += (o, e) =>
            {
                var clickEventArgs = e as MouseEventArgs;

                if (clickEventArgs == null)
                {
                    return;
                }

                switch (clickEventArgs.Button)
                {
                case MouseButtons.Left:
                    if (GameScene.SelectedCell != null || GameScene.Gold <= 0)
                    {
                        return;
                    }

                    var amountBox = new MirAmountBox("Rental fee:", 116, GameScene.Gold);

                    amountBox.OKButton.Click += (c, a) =>
                    {
                        if (amountBox.Amount <= 0)
                        {
                            return;
                        }

                        GameScene.User.RentalGoldAmount += amountBox.Amount;
                        Network.Enqueue(new C.ItemRentalFee {
                            Amount = GameScene.User.RentalGoldAmount
                        });

                        RefreshInterface();
                    };

                    amountBox.Show();
                    GameScene.PickedUpGold = false;

                    break;
                }
            };
        }
Example #4
0
        public HeroInventoryDialog()
        {
            Index   = 1422;
            Library = Libraries.Prguse;
            Movable = true;
            Sort    = true;
            Visible = false;

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(299, 2),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            Grid = new MirItemCell[8 * 5];

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    int idx = 8 * y + x;
                    Grid[idx] = new MirItemCell
                    {
                        ItemSlot = 2 + idx,
                        GridType = MirGridType.HeroInventory,
                        Library  = Libraries.Items,
                        Parent   = this,
                        Location = new Point(x * 36 + 14 + x, y % 5 * 32 + 23 + y % 5),
                    };

                    if (idx >= 40)
                    {
                        Grid[idx].Visible = false;
                    }
                }
            }

            for (int i = 0; i < LockBar.Length; i++)
            {
                LockBar[i] = new MirImageControl
                {
                    Index      = 1423,
                    Library    = Libraries.Prguse,
                    Location   = new Point(14, 56 + i * 33),
                    Parent     = this,
                    DrawImage  = true,
                    NotControl = true,
                    Visible    = false,
                };
            }

            HPLockBar = new MirImageControl
            {
                Index      = 1428,
                Library    = Libraries.Prguse,
                Location   = new Point(57, 196),
                Parent     = this,
                DrawImage  = true,
                NotControl = true,
                Visible    = false,
            };

            MPLockBar = new MirImageControl
            {
                Index      = 1429,
                Library    = Libraries.Prguse,
                Location   = new Point(162, 196),
                Parent     = this,
                DrawImage  = true,
                NotControl = true,
                Visible    = false,
            };

            HPButton = new MirButton
            {
                Index        = 560,
                HoverIndex   = 561,
                PressedIndex = 562,
                Library      = Libraries.Title,
                Location     = new Point(58, Size.Height - 60),
                Parent       = this,
                Size         = new Size(60, 25),
                Sound        = SoundList.ButtonA,
                Visible      = false,
            };
            HPButton.Click += (o1, e) =>
            {
                MirAmountBox amountBox = new MirAmountBox("Enter a value", 116, 99);
                amountBox.OKButton.Click += (o, a) => Network.Enqueue(new C.SetAutoPotValue {
                    Stat = Stat.HP, Value = amountBox.Amount
                });
                amountBox.Show();
            };

            MPButton = new MirButton
            {
                Index        = 563,
                HoverIndex   = 564,
                PressedIndex = 565,
                Library      = Libraries.Title,
                Location     = new Point(206, Size.Height - 60),
                Parent       = this,
                Size         = new Size(60, 25),
                Sound        = SoundList.ButtonA,
                Visible      = false,
            };
            MPButton.Click += (o1, e) =>
            {
                MirAmountBox amountBox = new MirAmountBox("Enter a value", 116, 99);
                amountBox.OKButton.Click += (o, a) => Network.Enqueue(new C.SetAutoPotValue {
                    Stat = Stat.MP, Value = amountBox.Amount
                });
                amountBox.Show();
            };

            AutoHPPercentLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(HPButton.Location.X, HPButton.Location.Y + 27),
                AutoSize   = false,
                Size       = new Size(60, 25),
                DrawFormat = TextFormatFlags.HorizontalCenter,
                Visible    = false
            };

            AutoMPPercentLabel = new MirLabel
            {
                Parent     = this,
                Location   = new Point(MPButton.Location.X, MPButton.Location.Y + 27),
                AutoSize   = false,
                Size       = new Size(60, 25),
                DrawFormat = TextFormatFlags.HorizontalCenter,
                Visible    = false
            };

            HPItem = new MirItemCell
            {
                ItemSlot = 0,
                GridType = MirGridType.HeroHPItem,
                Library  = Libraries.Items,
                Parent   = this,
                Location = new Point(HPButton.Location.X + 64, HPButton.Location.Y + 5),
                Visible  = false
            };

            MPItem = new MirItemCell
            {
                ItemSlot = 0,
                GridType = MirGridType.HeroMPItem,
                Library  = Libraries.Items,
                Parent   = this,
                Location = new Point(MPButton.Location.X - 40, MPButton.Location.Y + 5),
                Visible  = false
            };

            RefreshInterface();
        }