Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Text;
- using System.IO;
- using System.Drawing;
- using System.Drawing.Design;
- using System.Drawing.Drawing2D;
- using Server;
- using Server.Gumps;
- using Server.Network;
- using Server.Commands;
- using Server.Mobiles;
- namespace Server.AutoPVP
- {
- public abstract class AutoPVP_UITemplateList<T> : SuperGumpList<T>
- {
- public const int ErrorHue = 0x22, TextHue = 0x55;
- public const string HtmlFontColor = @"<BASEFONT COLOR=#8CEFD6>";
- private string _TitleLeft;
- public string TitleLeft { get { return _TitleLeft; } set { _TitleLeft = value; } }
- private string _TitleRight;
- public string TitleRight { get { return _TitleRight; } set { _TitleRight = value; } }
- private string _Notification;
- public string Notification { get { return _Notification; } set { _Notification = value; } }
- private bool _Minimized;
- public bool Minimized { get { return _Minimized; } set { _Minimized = value; } }
- private T _Selected;
- public T Selected { get { return _Selected; } set { _Selected = value; } }
- public AutoPVP_UITemplateList(Gump parent, PlayerMobile user, SuperGump_Args args)
- : base(new Point(100, 100), parent, user, args)
- {
- AddBackground(0, 0, 600, 50, 9270);
- AddImageTiled(295, 10, 15, 30, 9275);
- AddLabel(20, 15, TextHue, _TitleLeft);
- AddLabel(320, 15, TextHue, _TitleRight);
- if (!_Minimized)
- { AddButton(295, 15, 250, 251, ToggleMinimize); }
- else
- {
- AddButton(295, 15, 252, 253, ToggleMinimize);
- return;
- }
- AddBackground(0, 50, 600, 350, 9270);
- AddImageTiled(10, 90, 300, 5, 9277);
- AddImageTiled(10, 120, 300, 5, 9277);
- AddImageTiled(10, 150, 300, 5, 9277);
- AddImageTiled(10, 180, 300, 5, 9277);
- AddImageTiled(10, 210, 300, 5, 9277);
- AddImageTiled(10, 240, 580, 5, 9277);
- AddImageTiled(10, 270, 580, 5, 9277);
- AddImageTiled(10, 300, 580, 5, 9277);
- AddImageTiled(10, 330, 580, 5, 9277);
- AddImageTiled(10, 360, 580, 5, 9277);
- AddImageTiled(100, 60, 5, 330, 9275);
- AddImageTiled(295, 60, 15, 330, 9275);
- AddImageTiled(360, 240, 5, 150, 9275);
- AddLabel(20, 65, TextHue, AutoPVP_System.GetMessage(User, 539));
- AddLabel(115, 65, TextHue, AutoPVP_System.GetMessage(User, 551));
- ForEach();
- if (Page > 0)
- { AddButton(295, 60, 250, 251, ScrollUp); }
- else
- { AddImage(295, 60, 251); }
- int minSize = 28, maxSize = 280;
- int size = maxSize / PageCount;
- if (size < minSize)
- { size = minSize; }
- if (size > maxSize)
- { size = maxSize; }
- int yPos = 85 + ((maxSize / PageCount) * (Page + 1)) - size;
- AddImageTiled(299, yPos, 5, size, 10742);
- if (Page + 1 < PageCount)
- { AddButton(295, 367, 252, 253, ScrollDown); }
- else
- { AddImage(295, 367, 253); }
- AddBackground(0, 400, 600, 50, 9270);
- AddLabelCropped(20, 415, 560, 20, TextHue, _Notification);
- _Notification = String.Empty;
- }
- private void ToggleMinimize(GumpButton entry)
- {
- _Minimized = !_Minimized;
- Refresh();
- }
- private void ScrollUp(GumpButton entry)
- { PreviousPage(); }
- private void ScrollDown(GumpButton entry)
- { NextPage(); }
- public override SuperGump_Args InvalidateArgs(SuperGump_Args args)
- {
- if (args["title_left"] == null || !(args["title_left"] is string))
- { args["title_left"] = _TitleLeft; }
- else
- { _TitleLeft = args.Get<string>("title_left"); }
- if (args["title_right"] == null || !(args["title_right"] is string))
- { args["title_right"] = _TitleRight; }
- else
- { _TitleRight = args.Get<string>("title_right"); }
- if (args["notification"] == null || !(args["notification"] is string))
- { args["notification"] = _Notification; }
- else
- { _Notification = args.Get<string>("notification"); }
- if (args["minimized"] == null || !(args["minimized"] is bool))
- { args["minimized"] = _Minimized; }
- else
- { _Minimized = args.Get<bool>("minimized"); }
- if (args["selected"] == null || !(args["selected"] is T))
- { args["selected"] = _Selected; }
- else
- { _Selected = args.Get<T>("selected"); }
- return base.InvalidateArgs(args);
- }
- public override SuperGump Refresh(bool openIfClosed)
- {
- Args["title_left"] = _TitleLeft;
- Args["title_right"] = _TitleRight;
- Args["notification"] = _Notification;
- Args["minimized"] = _Minimized;
- Args["selected"] = _Selected;
- return base.Refresh(openIfClosed);
- }
- }
- }
Add Comment
Please, Sign In to add comment