예제 #1
0
        private Packet Compile()
        {
            if (m_Packet == null)
            {
                DisplayGumpFast disp = new DisplayGumpFast(this);

                if (!m_Dragable)
                {
                    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 = m_Entries.Count;
                GumpEntry e;

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

                    disp.AppendLayout(m_BeginLayout);
                    e.AppendTo(disp);
                    disp.AppendLayout(m_EndLayout);
                }

                //disp.WriteText( m_Strings );
                List <string> strings = new List <string>();
                for (int i = 0; i < m_Strings.Count; i++)
                {
                    strings.Add(m_Strings[i] as string);
                }
                disp.WriteStrings(strings);

                m_TextEntries = disp.TextEntries;
                m_Switches    = disp.Switches;

                m_Packet = disp;
            }

            return(m_Packet);
        }
예제 #2
0
        public static Packet Compile(this Gump g, NetState ns = null)
        {
            IGumpWriter disp = new DisplayGumpFast(g);

            // IGumpWriter disp = new DisplayGumpPacked(g);

            if (!g.Draggable)
            {
                disp.AppendLayout(Gump.NoMove);
            }

            if (!g.Closable)
            {
                disp.AppendLayout(Gump.NoClose);
            }

            if (!g.Disposable)
            {
                disp.AppendLayout(Gump.NoDispose);
            }

            if (!g.Resizable)
            {
                disp.AppendLayout(Gump.NoResize);
            }

            var count   = g.Entries.Count;
            var strings = new List <string>();

            for (var i = 0; i < count; ++i)
            {
                var e = g.Entries[i];

                disp.AppendLayout(m_BeginLayout);
                e.AppendToByType(disp, strings);
                disp.AppendLayout(m_EndLayout);
            }

            disp.WriteStrings(strings);

            disp.Flush();

            return((Packet)disp);
        }