Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,373 @@
/***************************************************************************
* Gump.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using Server.Network;
namespace Server.Gumps
{
public class Gump
{
private static uint m_NextSerial = 1;
private static byte[] m_BeginLayout = StringToBuffer("{ ");
private static byte[] m_EndLayout = StringToBuffer(" }");
private static byte[] m_NoMove = StringToBuffer("{ nomove }");
private static byte[] m_NoClose = StringToBuffer("{ noclose }");
private static byte[] m_NoDispose = StringToBuffer("{ nodispose }");
private static byte[] m_NoResize = StringToBuffer("{ noresize }");
private bool m_Closable = true;
private bool m_Disposable = true;
private bool m_Draggable = true;
private bool m_Resizable = true;
private uint m_Serial;
private List<string> m_Strings;
internal int m_TextEntries, m_Switches;
private int m_X, m_Y;
public Gump(int x, int y)
{
do
{
m_Serial = m_NextSerial++;
} while (m_Serial == 0); // standard client apparently doesn't send a gump response packet if serial == 0
m_X = x;
m_Y = y;
TypeID = GetTypeID(GetType());
Entries = new List<GumpEntry>();
m_Strings = new List<string>();
}
public int TypeID{ get; }
public List<GumpEntry> Entries{ get; }
public uint Serial
{
get => m_Serial;
set
{
if (m_Serial != value)
{
m_Serial = value;
Invalidate();
}
}
}
public int X
{
get => m_X;
set
{
if (m_X != value)
{
m_X = value;
Invalidate();
}
}
}
public int Y
{
get => m_Y;
set
{
if (m_Y != value)
{
m_Y = value;
Invalidate();
}
}
}
public bool Disposable
{
get => m_Disposable;
set
{
if (m_Disposable != value)
{
m_Disposable = value;
Invalidate();
}
}
}
public bool Resizable
{
get => m_Resizable;
set
{
if (m_Resizable != value)
{
m_Resizable = value;
Invalidate();
}
}
}
public bool Draggable
{
get => m_Draggable;
set
{
if (m_Draggable != value)
{
m_Draggable = value;
Invalidate();
}
}
}
public bool Closable
{
get => m_Closable;
set
{
if (m_Closable != value)
{
m_Closable = value;
Invalidate();
}
}
}
public static int GetTypeID(Type type)
{
return type?.FullName?.GetHashCode() ?? -1;
}
public void Invalidate()
{
//if ( m_Strings.Count > 0 )
// m_Strings.Clear();
}
public void AddPage(int page)
{
Add(new GumpPage(page));
}
public void AddAlphaRegion(int x, int y, int width, int height)
{
Add(new GumpAlphaRegion(x, y, width, height));
}
public void AddBackground(int x, int y, int width, int height, int gumpID)
{
Add(new GumpBackground(x, y, width, height, gumpID));
}
public void AddButton(int x, int y, int normalID, int pressedID, int buttonID,
GumpButtonType type = GumpButtonType.Reply, int param = 0)
{
Add(new GumpButton(x, y, normalID, pressedID, buttonID, type, param));
}
public void AddCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
Add(new GumpCheck(x, y, inactiveID, activeID, initialState, switchID));
}
public void AddGroup(int group)
{
Add(new GumpGroup(group));
}
public void AddTooltip(int number)
{
Add(new GumpTooltip(number));
}
public void AddHtml(int x, int y, int width, int height, string text, bool background = false, bool scrollbar = false)
{
Add(new GumpHtml(x, y, width, height, text, background, scrollbar));
}
public void AddHtmlLocalized(int x, int y, int width, int height, int number, bool background = false, bool scrollbar = false)
{
Add(new GumpHtmlLocalized(x, y, width, height, number, background, scrollbar));
}
public void AddHtmlLocalized(int x, int y, int width, int height, int number, int color, bool background = false,
bool scrollbar = false)
{
Add(new GumpHtmlLocalized(x, y, width, height, number, color, background, scrollbar));
}
public void AddHtmlLocalized(int x, int y, int width, int height, int number, string args, int color,
bool background = false, bool scrollbar = false)
{
Add(new GumpHtmlLocalized(x, y, width, height, number, args, color, background, scrollbar));
}
public void AddImage(int x, int y, int gumpID, int hue = 0)
{
Add(new GumpImage(x, y, gumpID, hue));
}
public void AddImageTiled(int x, int y, int width, int height, int gumpID)
{
Add(new GumpImageTiled(x, y, width, height, gumpID));
}
public void AddImageTiledButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type,
int param, int itemID, int hue, int width, int height, int localizedTooltip = -1)
{
Add(new GumpImageTileButton(x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height,
localizedTooltip));
}
public void AddItem(int x, int y, int itemID, int hue = 0)
{
Add(new GumpItem(x, y, itemID, hue));
}
public void AddLabel(int x, int y, int hue, string text)
{
Add(new GumpLabel(x, y, hue, text));
}
public void AddLabelCropped(int x, int y, int width, int height, int hue, string text)
{
Add(new GumpLabelCropped(x, y, width, height, hue, text));
}
public void AddRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
Add(new GumpRadio(x, y, inactiveID, activeID, initialState, switchID));
}
public void AddTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText, int size = 0)
{
Add(new GumpTextEntryLimited(x, y, width, height, hue, entryID, initialText, size));
}
public void AddItemProperty(uint serial)
{
Add(new GumpItemProperty(serial));
}
public void Add(GumpEntry g)
{
if (g.Parent != this)
{
g.Parent = this;
}
else if (!Entries.Contains(g))
{
Invalidate();
Entries.Add(g);
}
}
public void Remove(GumpEntry g)
{
if (g == null || !Entries.Contains(g))
return;
Invalidate();
Entries.Remove(g);
g.Parent = null;
}
public int Intern(string value)
{
int indexOf = m_Strings.IndexOf(value);
if (indexOf >= 0) return indexOf;
Invalidate();
m_Strings.Add(value);
return m_Strings.Count - 1;
}
public void SendTo(NetState state)
{
state.AddGump(this);
state.Send(Compile(state));
}
public static byte[] StringToBuffer(string str)
{
return Encoding.ASCII.GetBytes(str);
}
private Packet Compile(NetState ns = null)
{
IGumpWriter disp;
if (ns?.Unpack == true)
disp = new DisplayGumpPacked(this);
else
disp = new DisplayGumpFast(this);
if (!m_Draggable)
disp.AppendLayout(m_NoMove);
if (!m_Closable)
disp.AppendLayout(m_NoClose);
if (!m_Disposable)
disp.AppendLayout(m_NoDispose);
if (!m_Resizable)
disp.AppendLayout(m_NoResize);
int count = Entries.Count;
for (int i = 0; i < count; ++i)
{
GumpEntry e = Entries[i];
disp.AppendLayout(m_BeginLayout);
e.AppendTo(ns, disp);
disp.AppendLayout(m_EndLayout);
}
disp.WriteStrings(m_Strings);
disp.Flush();
m_TextEntries = disp.TextEntries;
m_Switches = disp.Switches;
return (Packet)disp;
}
public virtual void OnResponse(NetState sender, RelayInfo info)
{
}
public virtual void OnServerClose(NetState owner)
{
}
}
}

View file

@ -0,0 +1,77 @@
/***************************************************************************
* GumpAlphaRegion.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpAlphaRegion : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("checkertrans");
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpAlphaRegion(int x, int y, int width, int height)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public override string Compile(NetState ns)
{
return $"{{ checkertrans {m_X} {m_Y} {m_Width} {m_Height} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
}
}
}

View file

@ -0,0 +1,86 @@
/***************************************************************************
* GumpBackground.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpBackground : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("resizepic");
private int m_GumpID;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpBackground(int x, int y, int width, int height, int gumpID)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_GumpID = gumpID;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int GumpID
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public override string Compile(NetState ns)
{
return $"{{ resizepic {m_X} {m_Y} {m_GumpID} {m_Width} {m_Height} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_GumpID);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
}
}
}

View file

@ -0,0 +1,121 @@
/***************************************************************************
* GumpButton.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public enum GumpButtonType
{
Page = 0,
Reply = 1
}
public class GumpButton : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("button");
private int m_ButtonID;
private int m_ID1, m_ID2;
private int m_Param;
private GumpButtonType m_Type;
private int m_X, m_Y;
public GumpButton(int x, int y, int normalID, int pressedID, int buttonID,
GumpButtonType type = GumpButtonType.Reply, int param = 0)
{
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int NormalID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int PressedID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int ButtonID
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public GumpButtonType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
Gump parent = Parent;
parent?.Invalidate();
}
}
}
public int Param
{
get => m_Param;
set => Delta(ref m_Param, value);
}
public override string Compile(NetState ns)
{
return $"{{ button {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout((int)m_Type);
disp.AppendLayout(m_Param);
disp.AppendLayout(m_ButtonID);
}
}
}

View file

@ -0,0 +1,97 @@
/***************************************************************************
* GumpCheck.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpCheck : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("checkbox");
private int m_ID1, m_ID2;
private bool m_InitialState;
private int m_SwitchID;
private int m_X, m_Y;
public GumpCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
m_X = x;
m_Y = y;
m_ID1 = inactiveID;
m_ID2 = activeID;
m_InitialState = initialState;
m_SwitchID = switchID;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int InactiveID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int ActiveID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public bool InitialState
{
get => m_InitialState;
set => Delta(ref m_InitialState, value);
}
public int SwitchID
{
get => m_SwitchID;
set => Delta(ref m_SwitchID, value);
}
public override string Compile(NetState ns)
{
return $"{{ checkbox {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout(m_InitialState);
disp.AppendLayout(m_SwitchID);
disp.Switches++;
}
}
}

View file

@ -0,0 +1,78 @@
/***************************************************************************
* GumpEntry.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public abstract class GumpEntry
{
private Gump m_Parent;
public Gump Parent
{
get => m_Parent;
set
{
if (m_Parent != value)
{
m_Parent?.Remove(this);
m_Parent = value;
m_Parent?.Add(this);
}
}
}
protected void Delta(ref uint var, uint val)
{
if (var != val)
var = val;
}
protected void Delta(ref int var, int val)
{
if (var != val)
var = val;
}
protected void Delta(ref bool var, bool val)
{
if (var != val)
var = val;
}
protected void Delta(ref string var, string val)
{
if (var != val)
var = val;
}
protected void Delta(ref object[] var, object[] val)
{
if (var != val)
var = val;
}
public abstract string Compile(NetState ns);
public abstract void AppendTo(NetState ns, IGumpWriter disp);
}
}

View file

@ -0,0 +1,52 @@
/***************************************************************************
* GumpGroup.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpGroup : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("group");
private int m_Group;
public GumpGroup(int group)
{
m_Group = group;
}
public int Group
{
get => m_Group;
set => Delta(ref m_Group, value);
}
public override string Compile(NetState ns)
{
return $"{{ group {m_Group} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Group);
}
}
}

View file

@ -0,0 +1,104 @@
/***************************************************************************
* GumpHtml.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpHtml : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("htmlgump");
private bool m_Background, m_Scrollbar;
private string m_Text;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Text = text;
m_Background = background;
m_Scrollbar = scrollbar;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public string Text
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public bool Background
{
get => m_Background;
set => Delta(ref m_Background, value);
}
public bool Scrollbar
{
get => m_Scrollbar;
set => Delta(ref m_Scrollbar, value);
}
public override string Compile(NetState ns)
{
return
$"{{ htmlgump {m_X} {m_Y} {m_Width} {m_Height} {Parent.Intern(m_Text)} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(Parent.Intern(m_Text));
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
}
}
}

View file

@ -0,0 +1,233 @@
/***************************************************************************
* GumpHtmlLocalized.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public enum GumpHtmlLocalizedType
{
Plain,
Color,
Args
}
public class GumpHtmlLocalized : GumpEntry
{
private static byte[] m_LayoutNamePlain = Gump.StringToBuffer("xmfhtmlgump");
private static byte[] m_LayoutNameColor = Gump.StringToBuffer("xmfhtmlgumpcolor");
private static byte[] m_LayoutNameArgs = Gump.StringToBuffer("xmfhtmltok");
private string m_Args;
private bool m_Background, m_Scrollbar;
private int m_Color;
private int m_Number;
private GumpHtmlLocalizedType m_Type;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpHtmlLocalized(int x, int y, int width, int height, int number,
bool background = false, bool scrollbar = false)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Background = background;
m_Scrollbar = scrollbar;
m_Type = GumpHtmlLocalizedType.Plain;
}
public GumpHtmlLocalized(int x, int y, int width, int height, int number, int color,
bool background = false, bool scrollbar = false)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Color = color;
m_Background = background;
m_Scrollbar = scrollbar;
m_Type = GumpHtmlLocalizedType.Color;
}
public GumpHtmlLocalized(int x, int y, int width, int height, int number, string args, int color,
bool background = false, bool scrollbar = false)
{
// Are multiple arguments unsupported? And what about non ASCII arguments?
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Args = args;
m_Color = color;
m_Background = background;
m_Scrollbar = scrollbar;
m_Type = GumpHtmlLocalizedType.Args;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Number
{
get => m_Number;
set => Delta(ref m_Number, value);
}
public string Args
{
get => m_Args;
set => Delta(ref m_Args, value);
}
public int Color
{
get => m_Color;
set => Delta(ref m_Color, value);
}
public bool Background
{
get => m_Background;
set => Delta(ref m_Background, value);
}
public bool Scrollbar
{
get => m_Scrollbar;
set => Delta(ref m_Scrollbar, value);
}
public GumpHtmlLocalizedType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
Parent?.Invalidate();
}
}
}
public override string Compile(NetState ns)
{
switch (m_Type)
{
case GumpHtmlLocalizedType.Plain:
return
$"{{ xmfhtmlgump {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}";
case GumpHtmlLocalizedType.Color:
return
$"{{ xmfhtmlgumpcolor {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} }}";
default: // GumpHtmlLocalizedType.Args
return
$"{{ xmfhtmltok {m_X} {m_Y} {m_Width} {m_Height} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} {m_Number} @{m_Args}@ }}";
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
switch (m_Type)
{
case GumpHtmlLocalizedType.Plain:
{
disp.AppendLayout(m_LayoutNamePlain);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Number);
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
break;
}
case GumpHtmlLocalizedType.Color:
{
disp.AppendLayout(m_LayoutNameColor);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Number);
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
disp.AppendLayout(m_Color);
break;
}
case GumpHtmlLocalizedType.Args:
{
disp.AppendLayout(m_LayoutNameArgs);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
disp.AppendLayout(m_Color);
disp.AppendLayout(m_Number);
disp.AppendLayout(m_Args);
break;
}
}
}
}
}

View file

@ -0,0 +1,85 @@
/***************************************************************************
* GumpImage.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpImage : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("gumppic");
private static byte[] m_HueEquals = Gump.StringToBuffer(" hue=");
private int m_GumpID;
private int m_Hue;
private int m_X, m_Y;
public GumpImage(int x, int y, int gumpID, int hue = 0)
{
m_X = x;
m_Y = y;
m_GumpID = gumpID;
m_Hue = hue;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int GumpID
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile(NetState ns)
{
return m_Hue == 0 ? $"{{ gumppic {m_X} {m_Y} {m_GumpID} }}" :
$"{{ gumppic {m_X} {m_Y} {m_GumpID} hue={m_Hue} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_GumpID);
if (m_Hue != 0)
{
disp.AppendLayout(m_HueEquals);
disp.AppendLayoutNS(m_Hue);
}
}
}
}

View file

@ -0,0 +1,172 @@
/***************************************************************************
* GumpImageTileButton.cs
* -------------------
* begin : April 26, 2005
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpImageTileButton : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("buttontileart");
private static byte[] m_LayoutTooltip = Gump.StringToBuffer(" }{ tooltip");
private int m_ButtonID;
private int m_Height;
private int m_Hue;
private int m_ID1, m_ID2;
private int m_ItemID;
private int m_Param;
private GumpButtonType m_Type;
private int m_Width;
//Note, on OSI, The tooltip supports ONLY clilocs as far as I can figure out, and the tooltip ONLY works after the buttonTileArt (as far as I can tell from testing)
private int m_X, m_Y;
public GumpImageTileButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param,
int itemID, int hue, int width, int height, int localizedTooltip = -1)
{
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
m_ItemID = itemID;
m_Hue = hue;
m_Width = width;
m_Height = height;
LocalizedTooltip = localizedTooltip;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int NormalID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int PressedID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int ButtonID
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public GumpButtonType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
Gump parent = Parent;
parent?.Invalidate();
}
}
}
public int Param
{
get => m_Param;
set => Delta(ref m_Param, value);
}
public int ItemID
{
get => m_ItemID;
set => Delta(ref m_ItemID, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int LocalizedTooltip{ get; set; }
public override string Compile(NetState ns)
{
if (LocalizedTooltip > 0)
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {LocalizedTooltip} }}";
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout((int)m_Type);
disp.AppendLayout(m_Param);
disp.AppendLayout(m_ButtonID);
disp.AppendLayout(m_ItemID);
disp.AppendLayout(m_Hue);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
if (LocalizedTooltip > 0)
{
disp.AppendLayout(m_LayoutTooltip);
disp.AppendLayout(LocalizedTooltip);
}
}
}
}

View file

@ -0,0 +1,86 @@
/***************************************************************************
* GumpImageTiled.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpImageTiled : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("gumppictiled");
private int m_GumpID;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpImageTiled(int x, int y, int width, int height, int gumpID)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_GumpID = gumpID;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int GumpID
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public override string Compile(NetState ns)
{
return $"{{ gumppictiled {m_X} {m_Y} {m_Width} {m_Height} {m_GumpID} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_GumpID);
}
}
}

View file

@ -0,0 +1,82 @@
/***************************************************************************
* GumpItem.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpItem : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("tilepic");
private static byte[] m_LayoutNameHue = Gump.StringToBuffer("tilepichue");
private int m_Hue;
private int m_ItemID;
private int m_X, m_Y;
public GumpItem(int x, int y, int itemID, int hue = 0)
{
m_X = x;
m_Y = y;
m_ItemID = itemID;
m_Hue = hue;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int ItemID
{
get => m_ItemID;
set => Delta(ref m_ItemID, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile(NetState ns)
{
return m_Hue == 0 ? $"{{ tilepic {m_X} {m_Y} {m_ItemID} }}" :
$"{{ tilepichue {m_X} {m_Y} {m_ItemID} {m_Hue} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_Hue == 0 ? m_LayoutName : m_LayoutNameHue);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ItemID);
if (m_Hue != 0)
disp.AppendLayout(m_Hue);
}
}
}

View file

@ -0,0 +1,52 @@
/***************************************************************************
* GumpItemProperty.cs
* -------------------
* begin : May 26, 2013
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpItemProperty : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("itemproperty");
private uint m_Serial;
public GumpItemProperty(uint serial)
{
m_Serial = serial;
}
public uint Serial
{
get => m_Serial;
set => Delta(ref m_Serial, value);
}
public override string Compile(NetState ns)
{
return $"{{ itemproperty {m_Serial} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Serial);
}
}
}

View file

@ -0,0 +1,78 @@
/***************************************************************************
* GumpLabel.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpLabel : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("text");
private int m_Hue;
private string m_Text;
private int m_X, m_Y;
public GumpLabel(int x, int y, int hue, string text)
{
m_X = x;
m_Y = y;
m_Hue = hue;
m_Text = text;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string Text
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public override string Compile(NetState ns)
{
return $"{{ text {m_X} {m_Y} {m_Hue} {Parent.Intern(m_Text)} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Hue);
disp.AppendLayout(Parent.Intern(m_Text));
}
}
}

View file

@ -0,0 +1,95 @@
/***************************************************************************
* GumpLabelCropped.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpLabelCropped : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("croppedtext");
private int m_Hue;
private string m_Text;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpLabelCropped(int x, int y, int width, int height, int hue, string text)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_Text = text;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string Text
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public override string Compile(NetState ns)
{
return $"{{ croppedtext {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {Parent.Intern(m_Text)} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue);
disp.AppendLayout(Parent.Intern(m_Text));
}
}
}

View file

@ -0,0 +1,52 @@
/***************************************************************************
* GumpPage.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpPage : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("page");
private int m_Page;
public GumpPage(int page)
{
m_Page = page;
}
public int Page
{
get => m_Page;
set => Delta(ref m_Page, value);
}
public override string Compile(NetState ns)
{
return $"{{ page {m_Page} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Page);
}
}
}

View file

@ -0,0 +1,97 @@
/***************************************************************************
* GumpRadio.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpRadio : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("radio");
private int m_ID1, m_ID2;
private bool m_InitialState;
private int m_SwitchID;
private int m_X, m_Y;
public GumpRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
m_X = x;
m_Y = y;
m_ID1 = inactiveID;
m_ID2 = activeID;
m_InitialState = initialState;
m_SwitchID = switchID;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int InactiveID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int ActiveID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public bool InitialState
{
get => m_InitialState;
set => Delta(ref m_InitialState, value);
}
public int SwitchID
{
get => m_SwitchID;
set => Delta(ref m_SwitchID, value);
}
public override string Compile(NetState ns)
{
return $"{{ radio {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout(m_InitialState);
disp.AppendLayout(m_SwitchID);
disp.Switches++;
}
}
}

View file

@ -0,0 +1,107 @@
/***************************************************************************
* GumpTextEntry.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpTextEntry : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("textentry");
private int m_EntryID;
private int m_Hue;
private string m_InitialText;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int EntryID
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public string InitialText
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public override string Compile(NetState ns)
{
return
$"{{ textentry {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue);
disp.AppendLayout(m_EntryID);
disp.AppendLayout(Parent.Intern(m_InitialText));
disp.TextEntries++;
}
}
}

View file

@ -0,0 +1,116 @@
/***************************************************************************
* GumpTextEntryLimited.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpTextEntryLimited : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("textentrylimited");
private int m_EntryID;
private int m_Hue;
private string m_InitialText;
private int m_Size;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpTextEntryLimited(int x, int y, int width, int height, int hue, int entryID, string initialText, int size = 0)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
m_Size = size;
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int EntryID
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public string InitialText
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public int Size
{
get => m_Size;
set => Delta(ref m_Size, value);
}
public override string Compile(NetState ns)
{
return
$"{{ textentrylimited {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} {m_Size} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue);
disp.AppendLayout(m_EntryID);
disp.AppendLayout(Parent.Intern(m_InitialText));
disp.AppendLayout(m_Size);
disp.TextEntries++;
}
}
}

View file

@ -0,0 +1,52 @@
/***************************************************************************
* GumpTooltip.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpTooltip : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("tooltip");
private int m_Number;
public GumpTooltip(int number)
{
m_Number = number;
}
public int Number
{
get => m_Number;
set => Delta(ref m_Number, value);
}
public override string Compile(NetState ns)
{
return $"{{ tooltip {m_Number} }}";
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Number);
}
}
}

View file

@ -0,0 +1,69 @@
/***************************************************************************
* RelayInfo.cs
* -------------------
* begin : May 1, 2002
* copyright : (C) The RunUO Software Team
* email : info@runuo.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
namespace Server.Gumps
{
public class TextRelay
{
public TextRelay(int entryID, string text)
{
EntryID = entryID;
Text = text;
}
public int EntryID{ get; }
public string Text{ get; }
}
public class RelayInfo
{
public RelayInfo(int buttonID, int[] switches, TextRelay[] textEntries)
{
ButtonID = buttonID;
Switches = switches;
TextEntries = textEntries;
}
public int ButtonID{ get; }
public int[] Switches{ get; }
public TextRelay[] TextEntries{ get; }
public bool IsSwitched(int switchID)
{
for (int i = 0; i < Switches.Length; ++i)
if (Switches[i] == switchID)
return true;
return false;
}
public TextRelay GetTextEntry(int entryID)
{
for (int i = 0; i < TextEntries.Length; ++i)
if (TextEntries[i].EntryID == entryID)
return TextEntries[i];
return null;
}
}
}