Exemplo n.º 1
0
        public override void OnButtonClick(int buttonID)
        {
            if (buttonID == 0) // dump
            {
                Dictionary <string, string> dict = ReflectionHolder.GetGameObjectProperties(_obj);

                if (dict != null)
                {
                    using (LogFile writer = new LogFile(CUOEnviroment.ExecutablePath, "dump_gameobject.txt"))
                    {
                        writer.Write("###################################################");
                        writer.Write($"CUO version: {CUOEnviroment.Version}");
                        writer.Write($"OBJECT TYPE: {_obj.GetType()}");

                        foreach (KeyValuePair <string, string> item in dict.OrderBy(s => s.Key))
                        {
                            writer.Write($"{item.Key} = {item.Value}");
                        }

                        writer.Write("###################################################");
                        writer.Write("");
                    }
                }
            }
        }
Exemplo n.º 2
0
        public InfoGump(GameObject obj) : base(0, 0)
        {
            X                = 200;
            Y                = 200;
            CanMove          = true;
            AcceptMouseInput = false;
            Add(new GameBorder(0, 0, WIDTH, HEIGHT, 4));

            Add(new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                IsTransparent = true,
                Alpha         = 0.5f,
            });

            Add(new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                IsTransparent = true,
                Alpha         = 0.5f,
            });
            Add(new Label("Object Information", true, 1153, font: 3)
            {
                X = 20, Y = 20
            });
            Add(new Line(20, 50, WIDTH - 50, 1, 0xFFFFFFFF));
            _scrollArea = new ScrollArea(20, 60, WIDTH - 40, 510, true)
            {
                AcceptMouseInput = true
            };
            Add(_scrollArea);

            Dictionary <string, string> dict = ReflectionHolder.GetGameObjectProperties(obj);

            if (dict != null)
            {
                foreach (KeyValuePair <string, string> item in dict.OrderBy(s => s.Key))
                {
                    ScrollAreaItem areaItem = new ScrollAreaItem();

                    Label label = new Label(item.Key + ":", true, 33, font: 1, style: FontStyle.BlackBorder)
                    {
                        X = 2
                    };
                    areaItem.Add(label);

                    int height = label.Height;

                    label = new Label(item.Value, true, 1153, font: 1, style: FontStyle.BlackBorder, maxwidth: WIDTH - 65 - 200)
                    {
                        X = 200
                    };

                    if (label.Height > 0)
                    {
                        height = label.Height;
                    }

                    areaItem.Add(label);
                    areaItem.Add(new Line(0, height + 2, WIDTH - 65, 1, Color.Gray.PackedValue));

                    _scrollArea.Add(areaItem);
                }
            }
        }
Exemplo n.º 3
0
        public InspectorGump(GameObject obj) : base(0, 0)
        {
            X                      = 200;
            Y                      = 100;
            _obj                   = obj;
            CanMove                = true;
            AcceptMouseInput       = false;
            CanCloseWithRightClick = true;
            Add(new BorderControl(0, 0, WIDTH, HEIGHT, 4));

            Add
            (
                new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                Alpha = 0.5f
            }
            );

            Add
            (
                new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                Alpha = 0.5f
            }
            );

            Add(new Label(ResGumps.ObjectInformation, true, 1153, font: 3)
            {
                X = 20, Y = 10
            });
            Add(new Line(20, 30, WIDTH - 50, 1, 0xFFFFFFFF));

            Add
            (
                new NiceButton(WIDTH - 115, 5, 100, 25, ButtonAction.Activate, ResGumps.Dump)
            {
                ButtonParameter = 0
            }
            );

            ScrollArea scrollArea = new ScrollArea(20, 35, WIDTH - 40, HEIGHT - 45, true)
            {
                AcceptMouseInput = true
            };

            Add(scrollArea);

            DataBox databox = new DataBox(0, 0, 1, 1);

            databox.WantUpdateSize = true;
            scrollArea.Add(databox);

            Dictionary <string, string> dict = ReflectionHolder.GetGameObjectProperties(obj);

            if (dict != null)
            {
                int startX = 5;
                int startY = 5;

                foreach (KeyValuePair <string, string> item in dict.OrderBy(s => s.Key))
                {
                    Label label = new Label(item.Key + ":", true, 33, font: 1, style: FontStyle.BlackBorder)
                    {
                        X = startX,
                        Y = startY
                    };

                    databox.Add(label);

                    int height = label.Height;

                    label = new Label
                                (item.Value, true, 1153, font: 1, style: FontStyle.BlackBorder, maxwidth: WIDTH - 65 - 200)
                    {
                        X = startX + 200,
                        Y = startY,
                        AcceptMouseInput = true
                    };

                    label.MouseUp += OnLabelClick;

                    if (label.Height > 0)
                    {
                        height = label.Height;
                    }

                    databox.Add(label);
                    databox.Add(new Line(startX, startY + height + 2, WIDTH - 65, 1, Color.Gray.PackedValue));

                    startY += height + 4;
                }
            }

            databox.ReArrangeChildren();
        }
Exemplo n.º 4
0
        public InspectorGump(GameObject obj) : base(0, 0)
        {
            X                      = 200;
            Y                      = 100;
            _obj                   = obj;
            CanMove                = true;
            AcceptMouseInput       = false;
            CanCloseWithRightClick = true;
            Add(new BorderControl(0, 0, WIDTH, HEIGHT, 4));

            Add(new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                Alpha = 0.5f
            });

            Add(new GumpPicTiled(4, 4, WIDTH - 8, HEIGHT - 8, 0x0A40)
            {
                Alpha = 0.5f
            });
            Add(new Label("Object Information", true, 1153, font: 3)
            {
                X = 20, Y = 10
            });
            Add(new Line(20, 30, WIDTH - 50, 1, 0xFFFFFFFF));
            Add(new NiceButton(WIDTH - 115, 5, 100, 25, ButtonAction.Activate, "Dump")
            {
                ButtonParameter = 0
            });

            _scrollArea = new ScrollArea(20, 35, WIDTH - 40, HEIGHT - 45, true)
            {
                AcceptMouseInput = true
            };
            Add(_scrollArea);

            Dictionary <string, string> dict = ReflectionHolder.GetGameObjectProperties(obj);

            if (dict != null)
            {
                foreach (KeyValuePair <string, string> item in dict.OrderBy(s => s.Key))
                {
                    ScrollAreaItem areaItem = new ScrollAreaItem();

                    Label label = new Label(item.Key + ":", true, 33, font: 1, style: FontStyle.BlackBorder)
                    {
                        X = 2
                    };
                    areaItem.Add(label);

                    int height = label.Height;

                    label = new Label(item.Value, true, 1153, font: 1, style: FontStyle.BlackBorder, maxwidth: WIDTH - 65 - 200)
                    {
                        X = 200,
                        AcceptMouseInput = true
                    };
                    label.MouseUp += OnLabelClick;

                    if (label.Height > 0)
                    {
                        height = label.Height;
                    }

                    areaItem.Add(label);
                    areaItem.Add(new Line(0, height + 2, WIDTH - 65, 1, Color.Gray.PackedValue));

                    _scrollArea.Add(areaItem);
                }
            }
        }