Наследование: GumpEntry
Пример #1
0
		public virtual void HandleRadio(GumpRadio entry, bool state)
		{
			if (RadioHandler != null)
			{
				RadioHandler(entry, state);
			}
			else if (Radios[entry] != null)
			{
				Radios[entry](entry, state);
			}
		}
Пример #2
0
		protected void AddRadio(GumpRadio entry, Action<GumpRadio, bool> handler)
		{
			if (entry == null)
			{
				return;
			}

			if (!Radios.ContainsKey(entry))
			{
				Radios.Add(entry, handler);
			}
			else
			{
				Radios[entry] = handler;
			}

			Add(entry);
		}
Пример #3
0
		public virtual bool CanDisplay(GumpRadio entry)
		{
			return entry != null;
		}
Пример #4
0
		public virtual void Write(string name, GumpRadio e)
		{
			CreateElement(e);
			SetAttribute("name", name);
			SetAttribute("x", e.X);
			SetAttribute("y", e.Y);
			SetAttribute("switchid", e.SwitchID);
			SetAttribute("onid", e.ActiveID);
			SetAttribute("offid", e.InactiveID);
			SetAttribute("state", e.InitialState);
			Append();
		}
Пример #5
0
        protected Packet Compile(NetState ns, bool convertToViewer = false)
        {
            IGumpWriter disp;

            if (ns != null && ns.Unpack)
            {
                disp = new DisplayGumpPacked(this);
            }
            else
            {
                disp = new DisplayGumpFast(this);
            }

            if (!this._Dragable)
            {
                disp.AppendLayout(_NoMove);
            }

            if (!this._Closable)
            {
                disp.AppendLayout(_NoClose);
            }

            if (!this._Disposable)
            {
                disp.AppendLayout(_NoDispose);
            }

            if (!this._Resizable)
            {
                disp.AppendLayout(_NoResize);
            }

            int count = this._Entries.Count;

            for (int i = 0; i < count; ++i)
            {
                GumpEntry e = this._Entries[i];

                disp.AppendLayout(_BeginLayout);

                if (!convertToViewer)
                {
                    e.AppendTo(disp);
                }
                else
                {
                    GumpButton button = e as GumpButton;

                    if (button != null)
                    {
                        new GumpImage(button.X, button.Y, button.NormalID).AppendTo(disp);
                    }
                    else
                    {
                        GumpImageTileButton tileButton = e as GumpImageTileButton;

                        if (tileButton != null)
                        {
                            new GumpImageTiled(tileButton.X, tileButton.Y, tileButton.Width, tileButton.Height,
                                               tileButton.NormalID).AppendTo(disp);
                        }
                        else
                        {
                            GumpRadio radio = e as GumpRadio;

                            if (radio != null)
                            {
                                new GumpImage(radio.X, radio.Y, radio.InitialState ? radio.ActiveID : radio.InactiveID)
                                .AppendTo(disp);
                            }
                            else
                            {
                                GumpCheck check = e as GumpCheck;

                                if (check != null)
                                {
                                    new GumpImage(check.X, check.Y,
                                                  check.InitialState ? check.ActiveID : check.InactiveID).AppendTo(disp);
                                }
                                // Process text fields
                            }
                        }
                    }
                }

                disp.AppendLayout(_EndLayout);
            }

            disp.WriteStrings(this._Strings);

            disp.Flush();

            this._TextEntries = disp.TextEntries;
            this._Switches    = disp.Switches;

            return(disp as Packet);
        }