Пример #1
0
        public ObjectsList(ObjectsPanel panel, PictureBox pb, GameWorld world, int x, int y, int width, int height,
            CheckTextButton showWar, CheckTextButton showCharacters, CheckTextButton showNpc, CheckTextButton showDrop,
            CharacterToolTip characterToolTip, NpcToolTip npcToolTip)
        {
            this.panel = panel;
            this.pb = pb;
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.world = world;
            this.world.L2LiveObjectUpdate += world_L2LiveObjectUpdate;
            this.world.AddCharacter += (s, e) => { world_ObjectsChanged(); };
            //this.world.AddDrop += (s, e) => { world_ObjectsChanged(); };
            this.world.AddNpc += (s, e) => { world_ObjectsChanged(); };
            this.world.DeleteCharacter += (s, e) => { world_ObjectsChanged(); };
            //this.world.DeleteDrop += (s, e) => { world_ObjectsChanged(); };
            this.world.DeleteNpc += (s, e) => { world_ObjectsChanged(); };
            this.hoveredIndex = -1;
            this.showWar = showWar;
            this.showCharacters = showCharacters;
            this.showNpc = showNpc;
            this.showDrop = showDrop;
            this.objList = new List<L2Object>();
            this.characterToolTip = characterToolTip;
            this.npcToolTip = npcToolTip;

            scroll = new VScrollBar();
            scroll.Height = height - 1;
            scroll.Left = pb.Left + x + width - scroll.Width;
            scroll.Top = pb.Top + y + 1;
            scroll.LargeChange = height / itemHeight;
            pb.FindForm().Controls.Add(scroll);
            scroll.BringToFront();
            scroll.ValueChanged += scroll_ValueChanged;

            this.clip = new Rectangle(x + 1, y + 1, width - 2 - scroll.Width, height - 2);

            pb.MouseMove += pb_MouseMove;
            pb.MouseLeave += pb_MouseLeave;
            pb.MouseClick += pb_MouseClick;
            pb.FindForm().MouseWheel += ObjectsList_MouseWheel;

            hpBar = new MiniHPBar(72);
            hpBar5 = new Mini5HPBar(72);
            mpBar5 = new Mini5MPBar(72);
        }
Пример #2
0
        public ObjectsPanel(Control parent, GameWorld world, CharacterToolTip characterToolTip, NpcToolTip npcToolTip)
        {
            this.world = world;
            this.world.AddCharacter += (s, e) => { this.Update(); };
            this.world.DeleteCharacter += (s, e) => { this.Update(); };
            this.world.AddNpc += (s, e) => { this.Update(); };
            this.world.DeleteNpc += (s, e) => { this.Update(); };
            this.world.AddDrop += (s, e) => { this.Update(); };
            this.world.DeleteDrop += (s, e) => { this.Update(); };
            this.world.L2LiveObjectUpdate += (s, e) => { this.Update(); };

            pb = new PictureBox();
            pb.Width = 230;
            pb.Height = 190;
            pb.Top = 348;
            pb.Left = 0;
            pb.Paint += pb_Paint;
            parent.Controls.Add(pb);

            showWar = new CheckTextButton(pb);
            showWar.Text = "war:-";
            showWar.Left = 3;
            showWar.Top = 171;
            showWar.Height = 15;
            showWar.Width = 48;
            showWar.FontBrush = GUI.WarBrush;
            showWar.CheckedChanged += showWar_CheckedChanged;
            showWar.PrepareBrushes();

            showCharacters = new CheckTextButton(pb);
            showCharacters.Text = "chs:-";
            showCharacters.Left = showWar.Left + showWar.Width + 4;
            showCharacters.Top = showWar.Top;
            showCharacters.Height = showWar.Height;
            showCharacters.Width = showWar.Width;
            showCharacters.Checked = true;
            showCharacters.FontBrush = GUI.NeutralBrush;
            showCharacters.CheckedChanged += showNeutral_CheckedChanged;
            showCharacters.PrepareBrushes();

            showNpc = new CheckTextButton(pb);
            showNpc.Text = "npc:-";
            showNpc.Left = showCharacters.Left + showCharacters.Width + 4;
            showNpc.Top = showWar.Top;
            showNpc.Height = showWar.Height;
            showNpc.Width = showWar.Width;
            showNpc.FontBrush = GUI.NpcBrush;
            showNpc.CheckedChanged += showNpc_CheckedChanged;
            showNpc.PrepareBrushes();

            showDrop = new CheckTextButton(pb);
            showDrop.Text = "drop:-";
            showDrop.Left = showNpc.Left + showWar.Width + 4;
            showDrop.Top = showWar.Top;
            showDrop.Height = showWar.Height;
            showDrop.Width = showWar.Width;
            showDrop.FontBrush = GUI.AllyBrush;
            showDrop.CheckedChanged += showAlly_CheckedChanged;
            showDrop.PrepareBrushes();

            form = parent.FindForm();
            form.HandleCreated += form_HandleCreated;
            list = new ObjectsList(this, pb, world, 3, 3, 223, 166,
                showWar, showCharacters, showNpc, showDrop,
                characterToolTip, npcToolTip);
            list.ObjectClick += (s, e) => { if (ObjectClick != null) ObjectClick(this, e); };
        }