Server.Gumps.Gump.Intern C# (CSharp) Méthode

Intern() public méthode

public Intern ( string value ) : int
value string
Résultat int
        public int Intern( string value )
        {
            int indexOf = m_Strings.IndexOf( value );

            if ( indexOf >= 0 )
            {
                return indexOf;
            }
            else
            {
                Invalidate();
                m_Strings.Add( value );
                return m_Strings.Count - 1;
            }
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Honestly...I don't know why this is here.
        /// </summary>
        /// <param name="page">The gump to reference.</param>
        /// <returns>A string of the specially formatted gump entries.</returns>
        public string Compile(Gump page)
        {
            string ret = "";

            switch (m_Style)
            {
            case "details":
                if (m_Background)
                {
                    ret += String.Format("{{ gumppictiled {0} {1} {2} {3} {4} }}", m_X, m_Y, m_Width, m_Height, m_BackgroundID);
                }
                int colWidth = Width / m_ColCount;
                int i        = 0;
                int xbase    = m_X;
                while (i < columnValues.Count && i < m_ParentList.columns)
                {
                    xbase = m_X + (i * colWidth);
                    object obj = columnValues[i];
                    if (obj is string)
                    {
                        string caption = (string)obj;
                        if (caption.Contains("</"))
                        {
                            ret += String.Format("{{ htmlgump {0} {1} {2} {3} {4} {5} {6} }}", m_X + (i * colWidth), m_Y, colWidth, m_Height, page.Intern(caption), false, false);
                        }
                        else
                        {
                            ret += String.Format("{{ text {0} {1} {2} {3} }}", m_X + (i * colWidth), m_Y, skin.NormalText, page.Intern(caption));
                        }
                    }
                    else if (obj is GumpButton)
                    {
                        GumpButton btn = (GumpButton)obj;
                        ret += String.Format("{{ button {0} {1} {2} {3} {4} {5} {6} }}", xbase, m_Y, btn.NormalID, btn.PressedID, (int)btn.Type, btn.Param, btn.ButtonID);
                    }
                    else if (obj is GumpCheck)
                    {
                        GumpCheck chk = (GumpCheck)obj;
                        ret += String.Format("{{ checkbox {0} {1} {2} {3} {4} {5} }}", xbase, m_Y, chk.ActiveID, chk.InactiveID, chk.InitialState, chk.SwitchID);
                    }
                    ret += String.Format("{{gumppictiled {0} {1} {2} {3} {4} }}", m_X + (i * colWidth), m_Y, skin.EntryDividerWidth, skin.EntryDividerHeight, skin.EntryDividerID);
                    i++;
                }
                break;

            case "icons":
                string caption2 = (string)columnValues[captionID];
                if (caption2.Contains("</"))
                {
                    ret += String.Format("{{ htmlgump {0} {1} {2} {3} {4} {5} {6} }}", m_X, m_Y + skin.EntryCaptionPositionY, skin.EntryCaptionWidth, skin.EntryCaptionHeight, page.Intern(caption2), false, false);
                }
                else
                {
                    ret += String.Format("{{ text {0} {1} {2} {3} }}", m_X, m_Y + skin.EntryCaptionPositionY, skin.NormalText, page.Intern(caption2));
                }
                int id = skin.EntryDefaultIcon;
                ret += String.Format("{{ gumppictiled {0} {1} {2} {3} {4} }}", m_X, m_Y, m_Width, m_Height, m_BackgroundID);
                if (arguments.ContainsKey("icon"))
                {
                    id = (int)arguments["icon"];
                }
                ret += String.Format("{{ gumppictiled {0} {1} {2} {3} {4} }}", ((skin.EntryCaptionWidth - m_X) - skin.EntryIconWidth) / 2, m_Y + skin.EntryIconY, skin.EntryIconWidth, skin.EntryIconHeight, id);
                GumpButton btn2 = null;
                if (arguments.ContainsKey("button"))
                {
                    btn2 = (GumpButton)arguments["button"];
                    ret += String.Format("{{ buttontileart {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} }}", m_X, m_Y, skin.EntryButtonUnderlay, skin.EntryButtonUnderlay, (int)btn2.Type, btn2.Param, btn2.ButtonID, skin.EntryButtonUnderlay, skin.DefaultBackgroundColor, skin.EntryIconWidth, skin.EntryIconHeight);
                }
                break;
            }
            if (m_Tooltip)
            {
                ret += String.Format("{{ tooltip {0} }}", TooltipID);
            }
            return(ret);
        }
All Usage Examples Of Server.Gumps.Gump::Intern