Exemple #1
0
            public ShopItem
            (
                uint serial,
                ushort graphic,
                ushort hue,
                int count,
                uint price,
                string name
            )
            {
                LocalSerial = serial;
                Graphic     = graphic;
                Hue         = hue;
                Price       = price;
                Name        = name;

                Add
                (
                    new ResizePicLine(0x39)
                {
                    X     = 10,
                    Width = 190
                }
                );

                int offY = 15;

                string itemName = StringHelper.CapitalizeAllWords(Name);

                TextureControl control;

                if (SerialHelper.IsMobile(LocalSerial))
                {
                    ushort             hue2      = Hue;
                    AnimationDirection direction = GetMobileAnimationDirection(Graphic, ref hue2, 1);

                    Add
                    (
                        control = new TextureControl
                    {
                        Texture          = direction != null ? direction.FrameCount != 0 ? direction.Frames[0] : null : null,
                        X                = 5,
                        Y                = 5 + offY,
                        AcceptMouseInput = false,
                        Hue              = Hue == 0 ? hue2 : Hue,
                        IsPartial        = TileDataLoader.Instance.StaticData[Graphic].IsPartialHue
                    }
                    );

                    if (control.Texture != null)
                    {
                        control.Width  = control.Texture.Width;
                        control.Height = control.Texture.Height;
                    }
                    else
                    {
                        control.Width  = 35;
                        control.Height = 35;
                    }

                    if (control.Width > 35)
                    {
                        control.Width = 35;
                    }

                    if (control.Height > 35)
                    {
                        control.Height = 35;
                    }
                }
                else if (SerialHelper.IsItem(LocalSerial))
                {
                    ArtTexture texture = ArtLoader.Instance.GetTexture(Graphic);

                    Add
                    (
                        control = new TextureControl
                    {
                        Texture          = texture,
                        X                = 10 - texture?.ImageRectangle.X ?? 0,
                        Y                = 5 + offY + texture?.ImageRectangle.Y ?? 0,
                        Width            = texture?.ImageRectangle.Width ?? 0,
                        Height           = texture?.ImageRectangle.Height ?? 0,
                        AcceptMouseInput = false,
                        ScaleTexture     = false,
                        Hue              = Hue,
                        IsPartial        = TileDataLoader.Instance.StaticData[Graphic].IsPartialHue
                    }
                    );
                }
                else
                {
                    return;
                }

                string subname = string.Format(ResGumps.Item0Price1, itemName, Price);

                Add
                (
                    _name = new Label(subname, true, 0x219, 110, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_LEFT, true)
                {
                    X = 55,
                    Y = offY
                }
                );

                int height = Math.Max(_name.Height, control.Height) + 10;

                Add
                (
                    _amountLabel = new Label
                                       (count.ToString(), true, 0x0219, 35, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_RIGHT)
                {
                    X = 168,
                    Y = offY + (height >> 2)
                }
                );

                Width  = 220;
                Height = Math.Max(50, height);

                WantUpdateSize = false;

                if (World.ClientFeatures.TooltipsEnabled)
                {
                    SetTooltip(LocalSerial);
                }

                Amount = count;
            }
            public GridLootItem(Serial serial)
            {
                _serial = serial;

                Item item = World.Items.Get(serial);

                if (item == null)
                {
                    Dispose();

                    return;
                }

                const int SIZE = 70;

                CanMove = false;

                HSliderBar amount = new HSliderBar(0, 0, SIZE, 1, item.Amount, item.Amount, HSliderBarStyle.MetalWidgetRecessedBar, true, color: 0xFFFF, drawUp: true);

                Add(amount);

                amount.IsVisible = amount.IsEnabled = amount.MaxValue > 1;


                AlphaBlendControl background = new AlphaBlendControl();

                background.Y      = 15;
                background.Width  = SIZE;
                background.Height = SIZE;
                Add(background);


                _texture              = new TextureControl();
                _texture.IsPartial    = item.ItemData.IsPartialHue;
                _texture.ScaleTexture = true;
                _texture.Hue          = item.Hue;
                _texture.Texture      = FileManager.Art.GetTexture(item.DisplayedGraphic);
                _texture.Y            = 15;
                _texture.Width        = SIZE;
                _texture.Height       = SIZE;
                _texture.CanMove      = false;

                if (World.ClientFlags.TooltipsEnabled)
                {
                    _texture.SetTooltip(item);
                }

                Add(_texture);


                _texture.MouseUp += (sender, e) =>
                {
                    if (e.Button == MouseButton.Left)
                    {
                        NetClient.Socket.Send(new PPickUpRequest(item, (ushort)amount.Value));
                        GameActions.DropItem(_serial, Position.INVALID, World.Player.Equipment[(int)Layer.Backpack]);
                    }
                };

                Width  = background.Width;
                Height = background.Height + 15;

                WantUpdateSize = false;
            }
Exemple #3
0
            public GridLootItem(uint serial)
            {
                LocalSerial = serial;

                Item item = World.Items.Get(serial);

                if (item == null)
                {
                    Dispose();

                    return;
                }

                const int SIZE = 50;

                CanMove = false;

                HSliderBar amount = new HSliderBar(0, 0, SIZE, 1, item.Amount, item.Amount, HSliderBarStyle.MetalWidgetRecessedBar, true, color: 0xFFFF, drawUp: true);

                Add(amount);

                amount.IsVisible = amount.IsEnabled = amount.MaxValue > 1;


                AlphaBlendControl background = new AlphaBlendControl();

                background.Y      = 15;
                background.Width  = SIZE;
                background.Height = SIZE;
                Add(background);


                _texture              = new TextureControl();
                _texture.IsPartial    = item.ItemData.IsPartialHue;
                _texture.ScaleTexture = true;
                _texture.Hue          = item.Hue;
                _texture.Texture      = ArtLoader.Instance.GetTexture(item.DisplayedGraphic);
                _texture.Y            = 15;
                _texture.Width        = SIZE;
                _texture.Height       = SIZE;
                _texture.CanMove      = false;

                if (World.ClientFeatures.TooltipsEnabled)
                {
                    _texture.SetTooltip(item);
                }

                Add(_texture);


                _texture.MouseUp += (sender, e) =>
                {
                    if (e.Button == MouseButtonType.Left)
                    {
                        GameActions.GrabItem(item, (ushort)amount.Value);
                    }
                };

                Width  = background.Width;
                Height = background.Height + 15;

                WantUpdateSize = false;
            }
Exemple #4
0
            public ShopItem(Item item)
            {
                Item = item;
                string itemName = StringHelper.CapitalizeAllWords(item.Name);

                TextureControl control;

                if (item.Serial.IsMobile)
                {
                    byte group = 0;

                    switch (FileManager.Animations.GetGroupIndex(item.Graphic))
                    {
                    case ANIMATION_GROUPS.AG_LOW:
                        group = (byte)LOW_ANIMATION_GROUP.LAG_STAND;

                        break;

                    case ANIMATION_GROUPS.AG_HIGHT:
                        group = (byte)HIGHT_ANIMATION_GROUP.HAG_STAND;

                        break;

                    case ANIMATION_GROUPS.AG_PEOPLE:
                        group = (byte)PEOPLE_ANIMATION_GROUP.PAG_STAND;

                        break;
                    }

                    ushort graphic = item.Graphic;
                    ushort hue2    = item.Hue;

                    ref AnimationDirection direction = ref FileManager.Animations.GetBodyAnimationGroup(ref graphic, ref group, ref hue2, true).Direction[1];
                    FileManager.Animations.AnimID    = item.Graphic;
                    FileManager.Animations.AnimGroup = group;
                    FileManager.Animations.Direction = 1;

                    if (direction.FrameCount == 0)
                    {
                        FileManager.Animations.LoadDirectionGroup(ref direction);
                    }

                    Add(control = new TextureControl
                    {
                        Texture          = direction.Frames[0], //FileManager.Animations.GetTexture(direction.FramesHashes[0]),
                        X                = 5,
                        Y                = 5,
                        AcceptMouseInput = false,
                        Hue              = item.Hue == 0 ? (Hue)hue2 : item.Hue,
                        IsPartial        = item.ItemData.IsPartialHue
                    });

                    control.Width  = control.Texture.Width;
                    control.Height = control.Texture.Height;

                    if (control.Width > 35)
                    {
                        control.Width = 35;
                    }

                    if (control.Height > 35)
                    {
                        control.Height = 35;
                    }
                }
Exemple #5
0
        public OptionsGump() : base(0, 0)
        {
            Add(new AlphaBlendControl(0.05f)
            {
                X      = 1,
                Y      = 1,
                Width  = WIDTH - 2,
                Height = HEIGHT - 2
            });

            Stream stream = typeof(Engine).Assembly.GetManifestResourceStream("ClassicUO.cuologo.png");

            Texture2D.TextureDataFromStreamEXT(stream, out int w, out int h, out byte[] pixels, 350, 365);

            TextureControl tc = new TextureControl()
            {
                X             = 150 + (WIDTH - 150 - 350) / 2,
                Y             = (HEIGHT - 365) / 2,
                Width         = w,
                Height        = h,
                Alpha         = 0.95f,
                IsTransparent = true,
                ScaleTexture  = false
            };

            tc.Texture = new SpriteTexture(w, h);
            tc.Texture.SetData(pixels);
            Add(tc);

            Add(new NiceButton(10, 10, 140, 25, ButtonAction.SwitchPage, "Generals")
            {
                IsSelected = true, ButtonParameter = 1
            });
            Add(new NiceButton(10, 10 + 30 * 1, 140, 25, ButtonAction.SwitchPage, "Sounds")
            {
                ButtonParameter = 2
            });
            Add(new NiceButton(10, 10 + 30 * 2, 140, 25, ButtonAction.SwitchPage, "Video")
            {
                ButtonParameter = 3
            });
            Add(new NiceButton(10, 10 + 30 * 3, 140, 25, ButtonAction.SwitchPage, "Macro")
            {
                ButtonParameter = 4
            });
            Add(new NiceButton(10, 10 + 30 * 4, 140, 25, ButtonAction.SwitchPage, "Tooltip")
            {
                ButtonParameter = 5
            });
            Add(new NiceButton(10, 10 + 30 * 5, 140, 25, ButtonAction.SwitchPage, "Fonts")
            {
                ButtonParameter = 6
            });
            Add(new NiceButton(10, 10 + 30 * 6, 140, 25, ButtonAction.SwitchPage, "Speech")
            {
                ButtonParameter = 7
            });
            Add(new NiceButton(10, 10 + 30 * 7, 140, 25, ButtonAction.SwitchPage, "Combat")
            {
                ButtonParameter = 8
            });

            Add(new Line(160, 5, 1, HEIGHT - 10, Color.Gray.PackedValue));

            int offsetX = 60;
            int offsetY = 60;

            Add(new Line(160, 405 + 35 + 1, WIDTH - 160, 1, Color.Gray.PackedValue));

            Add(new Button((int)Buttons.Cancel, 0x00F3, 0x00F1, 0x00F2)
            {
                X = 154 + offsetX, Y = 405 + offsetY, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Apply, 0x00EF, 0x00F0, 0x00EE)
            {
                X = 248 + offsetX, Y = 405 + offsetY, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Default, 0x00F6, 0x00F4, 0x00F5)
            {
                X = 346 + offsetX, Y = 405 + offsetY, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Ok, 0x00F9, 0x00F8, 0x00F7)
            {
                X = 443 + offsetX, Y = 405 + offsetY, ButtonAction = ButtonAction.Activate
            });

            AcceptMouseInput = true;
            CanMove          = true;

            BuildGeneral();
            BuildSounds();
            BuildVideo();
            BuildCommands();
            BuildFonts();
            BuildSpeech();
            BuildCombat();
            BuildTooltip();

            ChangePage(1);
        }