fix: Adds static warning/notice gumps. (#1741)
### Summary * Adds `StaticNoticeGump<T>` and `StaticWarningGump<T>` * Converts NoticeGump/WarningGump to use `DynamicGump` * Changes various uses of notice gump and warning gump to their static counterpart.
This commit is contained in:
parent
65532ea887
commit
bb7bc57e42
19 changed files with 713 additions and 430 deletions
|
|
@ -1767,13 +1767,8 @@ namespace Server.Gumps
|
|||
}
|
||||
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
new AdminNoticeGump(
|
||||
$"You have {(ban ? "banned" : "deleted")} the account{(rads.Count == 1 ? "" : "s")}.",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
() => ResendGump_Callback(from, list, rads, ban ? page : 0)
|
||||
)
|
||||
);
|
||||
|
|
@ -1786,13 +1781,8 @@ namespace Server.Gumps
|
|||
else
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
new AdminNoticeGump(
|
||||
$"You have chosen not to {(ban ? "ban" : "delete")} the account{(rads.Count == 1 ? "" : "s")}.",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
() => ResendGump_Callback(from, list, rads, page)
|
||||
)
|
||||
);
|
||||
|
|
@ -3049,10 +3039,7 @@ namespace Server.Gumps
|
|||
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
sb.ToString(),
|
||||
0xFFC000,
|
||||
420,
|
||||
400,
|
||||
okay => BanShared_Callback(from, okay, a)
|
||||
|
|
@ -3099,10 +3086,7 @@ namespace Server.Gumps
|
|||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
$"You are about to firewall {a.LoginIPs.Length} address{(a.LoginIPs.Length != 1 ? "s" : "")}. Do you wish to continue?",
|
||||
0xFFC000,
|
||||
420,
|
||||
400,
|
||||
okay => FirewallShared_Callback(from, okay, a)
|
||||
|
|
@ -3237,10 +3221,7 @@ namespace Server.Gumps
|
|||
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
$"<center>Account of {a.Username}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equipped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
okay => AccountDelete_Callback(from, okay, a)
|
||||
|
|
@ -3266,10 +3247,7 @@ namespace Server.Gumps
|
|||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
$"You are about to ban {rads.Count} marked account{(rads.Count == 1 ? "" : "s")}. Be cautioned, the only way to reverse this is by hand--manually unbanning each account.<br><br>Do you wish to continue?",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
okay => Marked_Callback(from, okay, true, list, rads, m_ListPage)
|
||||
|
|
@ -3279,13 +3257,8 @@ namespace Server.Gumps
|
|||
else
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
new AdminNoticeGump(
|
||||
"You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
() => ResendGump_Callback(from, list, rads, m_ListPage)
|
||||
)
|
||||
);
|
||||
|
|
@ -3306,14 +3279,7 @@ namespace Server.Gumps
|
|||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
string.Format(
|
||||
"You are about to <em><basefont color=red>permanently delete</basefont></em> {0} marked account{1}. Likewise, all characters on the account{1} will be deleted, including equipped, inventory, and banked items. Any houses tied to the account{1} will be demolished.<br><br>Do you wish to continue?",
|
||||
rads.Count,
|
||||
rads.Count == 1 ? "" : "s"
|
||||
),
|
||||
0xFFC000,
|
||||
$"You are about to <em><basefont color=red>permanently delete</basefont></em> {rads.Count} marked account{(rads.Count == 1 ? "" : "s")}. Likewise, all characters on the account{(rads.Count == 1 ? "" : "s")} will be deleted, including equipped, inventory, and banked items. Any houses tied to the account{(rads.Count == 1 ? "" : "s")} will be demolished.<br><br>Do you wish to continue?",
|
||||
420,
|
||||
280,
|
||||
okay => Marked_Callback(from, okay, false, list, rads, m_ListPage)
|
||||
|
|
@ -3323,13 +3289,8 @@ namespace Server.Gumps
|
|||
else
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
new AdminNoticeGump(
|
||||
"You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
() => ResendGump_Callback(from, list, rads, m_ListPage)
|
||||
)
|
||||
);
|
||||
|
|
@ -3554,10 +3515,7 @@ namespace Server.Gumps
|
|||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
$"You are about to clear the address list for account {a} containing {ips.Length} {(ips.Length == 1 ? "entry" : "entries")}. Do you wish to continue?",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
okay => RemoveLoginIPs_Callback(from, okay, a)
|
||||
|
|
@ -3998,10 +3956,7 @@ namespace Server.Gumps
|
|||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
$"You are about to firewall {m_List[index]}. All connection attempts from a matching IP will be refused. Are you sure?",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
okay => Firewall_Callback(from, okay, a, m_List[index])
|
||||
|
|
@ -4100,10 +4055,7 @@ namespace Server.Gumps
|
|||
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
$"You are about to remove address {ip} from account {a}. Do you wish to continue?",
|
||||
0xFFC000,
|
||||
420,
|
||||
280,
|
||||
okay => RemoveLoginIP_Callback(from, okay, a, ip)
|
||||
|
|
@ -4395,5 +4347,15 @@ namespace Server.Gumps
|
|||
return aLevel < bLevel ? 1 : x.Username.InsensitiveCompare(y.Username);
|
||||
}
|
||||
}
|
||||
|
||||
private class AdminNoticeGump : StaticNoticeGump<AdminNoticeGump>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
public override string Content { get; }
|
||||
|
||||
public AdminNoticeGump(string content, Action callback) : base(callback) => Content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -903,7 +903,7 @@ namespace Server.Gumps
|
|||
* These containers can be used to re-create the vendor in a new location.
|
||||
* Any barkeepers have been converted into deeds.
|
||||
*/
|
||||
from.SendGump(new NoticeGump(1060637, 30720, 1060012, 32512, 420, 280));
|
||||
from.SendGump(new ReplaceHouseNoticeGump());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1107,13 +1107,7 @@ namespace Server.Gumps
|
|||
if (isOwner)
|
||||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
1060736,
|
||||
32512,
|
||||
420,
|
||||
280,
|
||||
new RemoveAllCoOwnersWarningGump(
|
||||
okay => ClearCoOwners_Callback(from, okay, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1153,13 +1147,7 @@ namespace Server.Gumps
|
|||
if (isCoOwner)
|
||||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
1018039,
|
||||
32512,
|
||||
420,
|
||||
280,
|
||||
new RemoveAllFriendsWarningGump(
|
||||
okay => ClearFriends_Callback(from, okay, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1176,15 +1164,7 @@ namespace Server.Gumps
|
|||
case 9: // Clear Ban List
|
||||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
1060753,
|
||||
32512,
|
||||
420,
|
||||
280,
|
||||
okay => ClearBans_Callback(from, okay, m_House)
|
||||
)
|
||||
new LifeAllBansWarningGump(okay => ClearBans_Callback(from, okay, m_House))
|
||||
);
|
||||
|
||||
break;
|
||||
|
|
@ -1198,15 +1178,7 @@ namespace Server.Gumps
|
|||
case 11: // Clear Access List
|
||||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
1061842,
|
||||
32512,
|
||||
420,
|
||||
280,
|
||||
okay => ClearAccess_Callback(from, okay, m_House)
|
||||
)
|
||||
new RevokeAccessWarning(okay => ClearAccess_Callback(from, okay, m_House))
|
||||
);
|
||||
|
||||
break;
|
||||
|
|
@ -1217,15 +1189,8 @@ namespace Server.Gumps
|
|||
{
|
||||
if (m_House.PlayerVendors.Count > 0)
|
||||
{
|
||||
// You have vendors working out of this building. It cannot be declared private until there are no vendors in place.
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
501887,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new CannotConvertPrivateNoticeGump(
|
||||
() => PublicPrivateNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1234,15 +1199,8 @@ namespace Server.Gumps
|
|||
|
||||
if (m_House.VendorRentalContracts.Count > 0)
|
||||
{
|
||||
// You cannot currently take this action because you have vendor contracts locked down in your home. You must remove them first.
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
1062351,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new CannotPerformActionContractsNoticeGump(
|
||||
() => PublicPrivateNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1253,15 +1211,8 @@ namespace Server.Gumps
|
|||
|
||||
m_House.ChangeLocks(from);
|
||||
|
||||
// This house is now private.
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
501888,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new HouseConvertedPrivateNoticeGump(
|
||||
() => PublicPrivateNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1294,13 +1245,7 @@ namespace Server.Gumps
|
|||
if (BaseHouse.NewVendorSystem)
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
501886,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new HouseConvertedPublicNoticeGump(
|
||||
() => PublicPrivateNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1308,13 +1253,7 @@ namespace Server.Gumps
|
|||
else
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
"This house is now public. Friends of the house may now have vendors working out of this building.",
|
||||
0xF8C000,
|
||||
320,
|
||||
180,
|
||||
new HouseConvertedPublicOldSystemNoticeGump(
|
||||
() => PublicPrivateNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1350,37 +1289,19 @@ namespace Server.Gumps
|
|||
{
|
||||
if (m_House.HasRentedVendors)
|
||||
{
|
||||
// You cannot perform this action while you still have vendors rented out in this house.
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
1062395,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new CannotPerformActionVendorsNoticeGump(
|
||||
() => CustomizeNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
else if (m_House.ConvertEntry != null)
|
||||
{
|
||||
var e = m_House.ConvertEntry;
|
||||
|
||||
if (e != null)
|
||||
{
|
||||
from.SendGump(
|
||||
new WarningGump(
|
||||
1060635,
|
||||
30720,
|
||||
1060013,
|
||||
32512,
|
||||
420,
|
||||
280,
|
||||
okay => ConvertHouse_Callback(from, okay, m_House)
|
||||
)
|
||||
);
|
||||
}
|
||||
from.SendGump(
|
||||
new ConvertToCustomHouseWarningGump(
|
||||
okay => ConvertHouse_Callback(from, okay, m_House)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1393,13 +1314,7 @@ namespace Server.Gumps
|
|||
if (m_House.HasRentedVendors)
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
1062395,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new CannotPerformActionVendorsNoticeGump(
|
||||
() => CustomizeNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1407,13 +1322,7 @@ namespace Server.Gumps
|
|||
else if (m_House.HasAddonContainers)
|
||||
{
|
||||
from.SendGump(
|
||||
new NoticeGump(
|
||||
1060637,
|
||||
30720,
|
||||
1074863,
|
||||
32512,
|
||||
320,
|
||||
180,
|
||||
new CannotCustomizeAddonsNoticeGump(
|
||||
() => CustomizeNotice_Callback(from, m_House)
|
||||
)
|
||||
);
|
||||
|
|
@ -1739,5 +1648,202 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveAllCoOwnersWarningGump : StaticWarningGump<RemoveAllCoOwnersWarningGump>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
// You are about to remove ALL co-owners from your house. Are you certain you wish to clear the co-owner list?
|
||||
public override int StaticLocalizedContent => 1060736;
|
||||
|
||||
public RemoveAllCoOwnersWarningGump(Action<bool> callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveAllFriendsWarningGump : StaticWarningGump<RemoveAllFriendsWarningGump>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
/*
|
||||
* If you go ahead with this option, all of the current friendships will be removed from the house,
|
||||
* and any vendors associated with said friends will be made unwelcome. Are you sure you want to do this?
|
||||
*/
|
||||
public override int StaticLocalizedContent => 1018039;
|
||||
|
||||
public RemoveAllFriendsWarningGump(Action<bool> callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class LifeAllBansWarningGump : StaticWarningGump<LifeAllBansWarningGump>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
// You are about to lift all bans for this house. Are you sure you wish to do this?
|
||||
public override int StaticLocalizedContent => 1060753;
|
||||
|
||||
public LifeAllBansWarningGump(Action<bool> callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class RevokeAccessWarning : StaticWarningGump<RevokeAccessWarning>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
/*
|
||||
* This will revoke access from everyone on this list and immediately eject them from the house.
|
||||
* Those players will no longer be able to enter the house.
|
||||
* Are you sure you wish to clear the house access list?
|
||||
*/
|
||||
public override int StaticLocalizedContent => 1061842;
|
||||
|
||||
public RevokeAccessWarning(Action<bool> callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class ConvertToCustomHouseWarningGump : StaticWarningGump<ConvertToCustomHouseWarningGump>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
/*
|
||||
* You are about to turn your house into a customizable house.
|
||||
* You will be refunded or charged the value of this house minus the cost of the equivalent customizable dirt lot.
|
||||
* All of your possessions in the house will be transported to a Moving Crate.
|
||||
* Deed-based house add-ons will be converted back into deeds.
|
||||
* Vendors and barkeeps will also be stored in the Moving Crate.
|
||||
* Your house will be leveled to its foundation, and you will be able to build new walls, windows, doors, and stairs.
|
||||
* Are you sure you wish to continue?
|
||||
*/
|
||||
public override int StaticLocalizedContent => 1060013;
|
||||
|
||||
public ConvertToCustomHouseWarningGump(Action<bool> callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class CannotPerformActionVendorsNoticeGump : StaticNoticeGump<CannotPerformActionVendorsNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
// You cannot perform this action while you still have vendors rented out in this house.
|
||||
public override int StaticLocalizedContent => 1062395;
|
||||
|
||||
public CannotPerformActionVendorsNoticeGump(Action callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class CannotPerformActionContractsNoticeGump : StaticNoticeGump<CannotPerformActionContractsNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
/*
|
||||
* You cannot currently take this action because you have vendor contracts locked down in your home.
|
||||
* You must remove them first.
|
||||
*/
|
||||
public override int StaticLocalizedContent => 1062351;
|
||||
|
||||
public CannotPerformActionContractsNoticeGump(Action callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class CannotCustomizeAddonsNoticeGump : StaticNoticeGump<CannotCustomizeAddonsNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
/*
|
||||
* The house cannot be customized when certain special house add-ons including aquariums, raised garden beds,
|
||||
* and special temporary add-ons are present in the house.
|
||||
* Please re-deed the special add-ons before customizing the house.
|
||||
*/
|
||||
public override int StaticLocalizedContent => 1074863;
|
||||
|
||||
public CannotCustomizeAddonsNoticeGump(Action callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class ReplaceHouseNoticeGump : StaticNoticeGump<ReplaceHouseNoticeGump>
|
||||
{
|
||||
public override int Width => 420;
|
||||
public override int Height => 280;
|
||||
|
||||
/*
|
||||
* You have successfully replaced your original house with a new house.
|
||||
* The value of the replaced house has been deposited into your bank box.
|
||||
* All of the items in your original house have been relocated to a Moving Crate in the new house.
|
||||
* Any deed-based house add-ons have been converted back into deeds.
|
||||
* Vendors and barkeeps in the house, if any, have been stored in the Moving Crate as well.
|
||||
* Use the <B>Get Vendor</B> context-sensitive menu option on your character to retrieve them.
|
||||
* These containers can be used to re-create the vendor in a new location.
|
||||
* Any barkeepers have been converted into deeds.
|
||||
*/
|
||||
public override int StaticLocalizedContent => 1060012;
|
||||
}
|
||||
|
||||
private class HouseConvertedPublicNoticeGump : StaticNoticeGump<HouseConvertedPublicNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
// This house is now public. The owner may now place vendors and vendor rental contracts.
|
||||
public override int StaticLocalizedContent => 501886;
|
||||
|
||||
public HouseConvertedPublicNoticeGump(Action callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class CannotConvertPrivateNoticeGump : StaticNoticeGump<CannotConvertPrivateNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
/*
|
||||
* You have vendors working out of this building.
|
||||
* It cannot be declared private until there are no vendors in place.
|
||||
*/
|
||||
public override int StaticLocalizedContent => 501887;
|
||||
|
||||
public CannotConvertPrivateNoticeGump(Action callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class HouseConvertedPrivateNoticeGump : StaticNoticeGump<HouseConvertedPrivateNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
public override int StaticLocalizedContent => 501888; // This house is now private.
|
||||
|
||||
public HouseConvertedPrivateNoticeGump(Action callback) : base(callback)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class HouseConvertedPublicOldSystemNoticeGump : StaticNoticeGump<HouseConvertedPublicOldSystemNoticeGump>
|
||||
{
|
||||
public override int Width => 320;
|
||||
public override int Height => 180;
|
||||
|
||||
public override string Content { get; }
|
||||
|
||||
public HouseConvertedPublicOldSystemNoticeGump(Action callback) : base(callback) =>
|
||||
Content =
|
||||
"This house is now public. Friends of the house may now have vendors working out of this building.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,37 @@
|
|||
using Server.Network;
|
||||
using System;
|
||||
|
||||
namespace Server.Gumps
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class NoticeGump : WarningGump
|
||||
{
|
||||
public delegate void NoticeGumpCallback();
|
||||
|
||||
public class NoticeGump : Gump
|
||||
public NoticeGump(
|
||||
TextDefinition content, int width, int height,
|
||||
Action callback = null
|
||||
) : this(
|
||||
1060637, // <CENTER>NOTICE</CENTER>
|
||||
0x7800,
|
||||
content,
|
||||
0xFFC000,
|
||||
width,
|
||||
height,
|
||||
callback
|
||||
)
|
||||
{
|
||||
private readonly NoticeGumpCallback m_Callback;
|
||||
}
|
||||
|
||||
public NoticeGump(
|
||||
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
|
||||
NoticeGumpCallback callback = null
|
||||
) : base((640 - width) / 2, (480 - height) / 2)
|
||||
{
|
||||
m_Callback = callback;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, width, height, 5054);
|
||||
|
||||
AddImageTiled(10, 10, width - 20, 20, 2624);
|
||||
AddAlphaRegion(10, 10, width - 20, 20);
|
||||
AddHtmlLocalized(10, 10, width - 20, 20, header, headerColor);
|
||||
|
||||
AddImageTiled(10, 40, width - 20, height - 80, 2624);
|
||||
AddAlphaRegion(10, 40, width - 20, height - 80);
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
if (content.Number > 0)
|
||||
{
|
||||
AddHtmlLocalized(10, 40, width - 20, height - 80, content.Number, contentColor, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(
|
||||
10,
|
||||
40,
|
||||
width - 20,
|
||||
height - 80,
|
||||
$"<BASEFONT COLOR=#{contentColor:X6}>{content.String}</BASEFONT>",
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AddImageTiled(10, height - 30, width - 20, 20, 2624);
|
||||
AddAlphaRegion(10, height - 30, width - 20, 20);
|
||||
AddButton(10, height - 30, 4005, 4007, 1);
|
||||
AddHtmlLocalized(40, height - 30, 120, 20, 1011036, 32767); // OKAY
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
m_Callback?.Invoke();
|
||||
}
|
||||
}
|
||||
public NoticeGump(
|
||||
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
|
||||
Action callback = null
|
||||
) : base(
|
||||
header,
|
||||
headerColor,
|
||||
content,
|
||||
contentColor,
|
||||
width,
|
||||
height,
|
||||
callback != null ? _ => callback() : null,
|
||||
false
|
||||
)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
13
Projects/UOContent/Gumps/StaticNoticeGump.cs
Normal file
13
Projects/UOContent/Gumps/StaticNoticeGump.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Gumps;
|
||||
|
||||
public abstract class StaticNoticeGump<T> : StaticWarningGump<T> where T : StaticNoticeGump<T>
|
||||
{
|
||||
public override int Header => 1060637; // <CENTER>NOTICE</CENTER>
|
||||
public sealed override bool CancelButton => false;
|
||||
|
||||
public StaticNoticeGump(Action callback = null) : base(callback != null ? _ => callback() : null)
|
||||
{
|
||||
}
|
||||
}
|
||||
95
Projects/UOContent/Gumps/StaticWarningGump.cs
Normal file
95
Projects/UOContent/Gumps/StaticWarningGump.cs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps;
|
||||
|
||||
public abstract class StaticWarningGump<T> : StaticGump<T> where T : StaticWarningGump<T>
|
||||
{
|
||||
public virtual int Header => 1060635; // <CENTER>WARNING</CENTER>
|
||||
public virtual int HeaderColor => 0x7800;
|
||||
public virtual int ContentColor => StaticLocalizedContent > 0 ? 0x7F00 : 0xFFC000;
|
||||
public abstract int Width { get; }
|
||||
public abstract int Height { get; }
|
||||
public virtual bool CancelButton => true;
|
||||
|
||||
// If this is overridden, then the content will be localized and cached.
|
||||
public virtual int StaticLocalizedContent => 0;
|
||||
|
||||
public virtual string Content => null;
|
||||
|
||||
private readonly Action<bool> _callback;
|
||||
|
||||
public StaticWarningGump(Action<bool> callback = null) : base(0, 0)
|
||||
{
|
||||
_callback = callback;
|
||||
X = (640 - Width) / 2;
|
||||
Y = (480 - Height) / 2;
|
||||
}
|
||||
|
||||
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||
{
|
||||
var width = Width;
|
||||
var height = Height;
|
||||
var header = Header;
|
||||
var headerColor = HeaderColor;
|
||||
var cancelButton = CancelButton;
|
||||
|
||||
builder.SetNoClose();
|
||||
|
||||
builder.AddPage();
|
||||
|
||||
builder.AddBackground(0, 0, width, height, 5054);
|
||||
|
||||
builder.AddImageTiled(10, 10, width - 20, 20, 2624);
|
||||
builder.AddAlphaRegion(10, 10, width - 20, 20);
|
||||
builder.AddHtmlLocalized(10, 10, width - 20, 20, header, (short)headerColor);
|
||||
|
||||
builder.AddImageTiled(10, 40, width - 20, height - 80, 2624);
|
||||
builder.AddAlphaRegion(10, 40, width - 20, height - 80);
|
||||
|
||||
if (StaticLocalizedContent > 0)
|
||||
{
|
||||
builder.AddHtmlLocalized(
|
||||
10,
|
||||
40,
|
||||
width - 20,
|
||||
height - 80,
|
||||
StaticLocalizedContent,
|
||||
(short)ContentColor,
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AddHtmlPlaceholder(
|
||||
10,
|
||||
40,
|
||||
width - 20,
|
||||
height - 80,
|
||||
"content",
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
builder.AddImageTiled(10, height - 30, width - 20, 20, 2624);
|
||||
builder.AddAlphaRegion(10, height - 30, width - 20, 20);
|
||||
|
||||
builder.AddButton(10, height - 30, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(40, height - 30, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
if (cancelButton)
|
||||
{
|
||||
builder.AddButton(10 + (width - 20) / 2, height - 30, 4005, 4007, 0);
|
||||
builder.AddHtmlLocalized(40 + (width - 20) / 2, height - 30, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
}
|
||||
|
||||
protected sealed override void BuildStrings(ref GumpStringsBuilder builder)
|
||||
{
|
||||
builder.SetStringSlot("content", $"<BASEFONT COLOR=#{ContentColor:X6}>{Content}</BASEFONT>");
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1);
|
||||
}
|
||||
|
|
@ -1,66 +1,97 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
namespace Server.Gumps;
|
||||
|
||||
public class WarningGump : DynamicGump
|
||||
{
|
||||
public delegate void WarningGumpCallback(bool okay);
|
||||
private readonly int _header;
|
||||
private readonly int _headerColor;
|
||||
private readonly int _contentColor;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
private readonly bool _cancelButton;
|
||||
private readonly TextDefinition _content;
|
||||
private readonly Action<bool> _callback;
|
||||
|
||||
public class WarningGump : Gump
|
||||
public WarningGump(
|
||||
TextDefinition content, int width, int height,
|
||||
Action<bool> callback = null, bool cancelButton = true
|
||||
) : this(
|
||||
1060635, // <CENTER>WARNING</CENTER>
|
||||
0x7800,
|
||||
content,
|
||||
0xFFC000,
|
||||
width,
|
||||
height,
|
||||
callback,
|
||||
cancelButton
|
||||
)
|
||||
{
|
||||
private readonly WarningGumpCallback m_Callback;
|
||||
}
|
||||
|
||||
public WarningGump(
|
||||
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
|
||||
WarningGumpCallback callback = null, bool cancelButton = true
|
||||
) : base((640 - width) / 2, (480 - height) / 2)
|
||||
public WarningGump(
|
||||
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
|
||||
Action<bool> callback = null, bool cancelButton = true
|
||||
) : base((640 - width) / 2, (480 - height) / 2)
|
||||
{
|
||||
_header = header;
|
||||
_headerColor = headerColor;
|
||||
_content = content;
|
||||
_contentColor = contentColor;
|
||||
_width = width;
|
||||
_height = height;
|
||||
_cancelButton = cancelButton;
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
protected sealed override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||
{
|
||||
builder.SetNoClose();
|
||||
|
||||
builder.AddPage();
|
||||
|
||||
builder.AddBackground(0, 0, _width, _height, 5054);
|
||||
|
||||
builder.AddImageTiled(10, 10, _width - 20, 20, 2624);
|
||||
builder.AddAlphaRegion(10, 10, _width - 20, 20);
|
||||
builder.AddHtmlLocalized(10, 10, _width - 20, 20, _header, (short)_headerColor);
|
||||
|
||||
builder.AddImageTiled(10, 40, _width - 20, _height - 80, 2624);
|
||||
builder.AddAlphaRegion(10, 40, _width - 20, _height - 80);
|
||||
|
||||
if (_content != null)
|
||||
{
|
||||
m_Callback = callback;
|
||||
|
||||
Closable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, width, height, 5054);
|
||||
|
||||
AddImageTiled(10, 10, width - 20, 20, 2624);
|
||||
AddAlphaRegion(10, 10, width - 20, 20);
|
||||
AddHtmlLocalized(10, 10, width - 20, 20, header, headerColor);
|
||||
|
||||
AddImageTiled(10, 40, width - 20, height - 80, 2624);
|
||||
AddAlphaRegion(10, 40, width - 20, height - 80);
|
||||
|
||||
if (content != null)
|
||||
if (_content.Number > 0)
|
||||
{
|
||||
if (content.Number > 0)
|
||||
{
|
||||
AddHtmlLocalized(10, 40, width - 20, height - 80, content.Number, contentColor, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(
|
||||
10,
|
||||
40,
|
||||
width - 20,
|
||||
height - 80,
|
||||
$"<BASEFONT COLOR=#{contentColor:X6}>{content.String}</BASEFONT>",
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
builder.AddHtmlLocalized(10, 40, _width - 20, _height - 80, _content.Number, (short)_contentColor, false, true);
|
||||
}
|
||||
|
||||
AddImageTiled(10, height - 30, width - 20, 20, 2624);
|
||||
AddAlphaRegion(10, height - 30, width - 20, 20);
|
||||
|
||||
AddButton(10, height - 30, 4005, 4007, 1);
|
||||
AddHtmlLocalized(40, height - 30, 170, 20, 1011036, 32767); // OKAY
|
||||
|
||||
if (cancelButton)
|
||||
else
|
||||
{
|
||||
AddButton(10 + (width - 20) / 2, height - 30, 4005, 4007, 0);
|
||||
AddHtmlLocalized(40 + (width - 20) / 2, height - 30, 170, 20, 1011012, 32767); // CANCEL
|
||||
builder.AddHtml(
|
||||
10,
|
||||
40,
|
||||
_width - 20,
|
||||
_height - 80,
|
||||
$"<BASEFONT COLOR=#{_contentColor:X6}>{_content.String}</BASEFONT>",
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info) => m_Callback?.Invoke(info.ButtonID == 1);
|
||||
builder.AddImageTiled(10, _height - 30, _width - 20, 20, 2624);
|
||||
builder.AddAlphaRegion(10, _height - 30, _width - 20, 20);
|
||||
|
||||
builder.AddButton(10, _height - 30, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(40, _height - 30, 170, 20, 1011036, 0x7FFF); // OKAY
|
||||
|
||||
if (_cancelButton)
|
||||
{
|
||||
builder.AddButton(10 + (_width - 20) / 2, _height - 30, 4005, 4007, 0);
|
||||
builder.AddHtmlLocalized(40 + (_width - 20) / 2, _height - 30, 170, 20, 1011012, 32767); // CANCEL
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue