示例#1
0
        public string GetValue(int index)
        {
            if (index < 0 || index >= this.m_Entries.Length)
            {
                return((string)null);
            }
            LayoutEntry layoutEntry = this.m_Entries[index];

            switch (layoutEntry.Name)
            {
            case "text":
                return(this.m_Text[layoutEntry[3]]);

            case "croppedtext":
                return(this.m_Text[layoutEntry[5]]);

            case "xmfhtmlgump":
            case "xmfhtmlgumpcolor":
                return("#" + (object)layoutEntry[4]);

            case "htmlgump":
                return(this.m_Text[layoutEntry[4]]);

            default:
                string str = layoutEntry.Name;
                for (int index1 = 0; index1 < layoutEntry.Parameters.Length; ++index1)
                {
                    str = str + " " + (object)layoutEntry.Parameters[index1];
                }
                return(str);
            }
        }
示例#2
0
 public GServerButton(GServerGump owner, LayoutEntry le)
     : base(le[2], le[2], le[3], le[0], le[1])
 {
     this.m_Owner   = owner;
     this.m_Type    = le[4];
     this.m_Param   = le[5];
     this.m_RelayID = le[6];
 }
示例#3
0
        private void ProcessLayout(LayoutEntry[] list, string[] text)
        {
            int  num1 = 0;
            int  num2 = 0;
            bool flag = false;

            for (int index = 0; index < list.Length; ++index)
            {
                LayoutEntry le = list[index];
                switch (le.Name)
                {
                case "nodispose":
                case "noresize":
                    goto case "nodispose";

                case "checkertrans":
                    this.Pages(num1).Add((Gump) new GTransparentRegion(this, le[0], le[1], le[2], le[3]));
                    goto case "nodispose";

                case "page":
                    num1 = le[0];
                    if (num1 == 0)
                    {
                        flag = false;
                        num2 = 0;
                        goto case "nodispose";
                    }
                    else if (!flag || num1 < num2)
                    {
                        num2 = num1;
                        flag = true;
                        goto case "nodispose";
                    }
                    else
                    {
                        goto case "nodispose";
                    }

                case "noclose":
                    this.m_CanClose = false;
                    goto case "nodispose";

                case "nomove":
                    this.m_CanMove = false;
                    goto case "nodispose";

                case "resizepic":
                    this.Pages(num1).Add((Gump) new GServerBackground(this, le[0], le[1], le[3], le[4], le[2] + 4, true));
                    goto case "nodispose";

                case "gumppictiled":
                    this.Pages(num1).Add((Gump) new GServerBackground(this, le[0], le[1], le[2], le[3], le[4], false));
                    goto case "nodispose";

                case "gumppic":
                    string attribute = le.GetAttribute("hue");
                    IHue   hue;
                    if (attribute != null)
                    {
                        try
                        {
                            hue = Hues.Load(Convert.ToInt32(attribute) + 1);
                        }
                        catch
                        {
                            hue = Hues.Default;
                        }
                    }
                    else
                    {
                        hue = Hues.Default;
                    }
                    if (le.GetAttribute("class") == "VirtueGumpItem")
                    {
                        this.Pages(num1).Add((Gump) new GVirtueItem(this, le[0], le[1], le[2], hue));
                        goto case "nodispose";
                    }
                    else
                    {
                        this.Pages(num1).Add((Gump) new GServerImage(this, le[0], le[1], le[2], hue));
                        goto case "nodispose";
                    }

                case "textentry":
                    this.Pages(num1).Add((Gump) new GServerTextBox(text[le[6]], le));
                    goto case "nodispose";

                case "tilepic":
                    this.Pages(num1).Add((Gump) new GItemArt(le[0], le[1], le[2]));
                    goto case "nodispose";

                case "tilepichue":
                    this.Pages(num1).Add((Gump) new GItemArt(le[0], le[1], le[2], Hues.GetItemHue(le[2], le[3] + 1)));
                    goto case "nodispose";

                case "button":
                    this.Pages(num1).Add((Gump) new GServerButton(this, le));
                    goto case "nodispose";

                case "radio":
                    this.Pages(num1).Add((Gump) new GServerRadio(this, le));
                    goto case "nodispose";

                case "checkbox":
                    this.Pages(num1).Add((Gump) new GServerCheckBox(this, le));
                    goto case "nodispose";

                case "text":
                    int num3 = le[2];
                    this.Pages(num1).Add((Gump) new GLabel(text[le[3]], (IFont)Engine.GetUniFont(1), Hues.Load(num3 + 1), le[0] - 1, le[1]));
                    goto case "nodispose";

                case "croppedtext":
                    int    num4   = le[4];
                    string str    = text[le[5]];
                    int    xWidth = le[2];
                    IFont  Font   = (IFont)Engine.GetUniFont(1);
                    if (Font.GetStringWidth(str) > xWidth)
                    {
                        while (str.Length > 0 && Font.GetStringWidth(str + "...") > xWidth)
                        {
                            str = str.Substring(0, str.Length - 1);
                        }
                        str += "...";
                    }
                    GLabel glabel = new GLabel(str, Font, Hues.Load(num4 + 1), le[0] - 1, le[1]);
                    glabel.Scissor(0, 0, xWidth, le[3]);
                    this.Pages(num1).Add((Gump)glabel);
                    goto case "nodispose";

                case "xmfhtmlgump":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, le[5] != 0 || le[6] == 0 ? 0 : 16777215);
                    goto case "nodispose";

                case "xmfhtmlgumpcolor":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, Engine.C16232(le[7]));
                    goto case "nodispose";

                case "htmlgump":
                    this.ProcessHtmlGump(num1, le[0], le[1], le[2], le[3], text[le[4]], le[5] != 0, le[6] != 0, le[5] != 0 || le[6] == 0 ? 0 : 16777215);
                    goto case "nodispose";

                default:
                    Engine.AddTextMessage(le.Name);
                    goto case "nodispose";
                }
            }
            this.Page = num2 == 0 ? 1 : num2;
        }
示例#4
0
 public GServerCheckBox(GServerGump owner, LayoutEntry le)
     : base(le[2], le[3], le[4] != 0, le[0], le[1])
 {
     this.m_Owner   = owner;
     this.m_RelayID = le[5];
 }