public RulesetLayout FindByOption(string title, string option, ref int index) { if (title == null || m_Title == title) { index = GetOptionIndex(option); if (index >= 0) { return(this); } title = null; } for (int i = 0; i < m_Children.Length; ++i) { RulesetLayout layout = m_Children[i].FindByOption(title, option, ref index); if (layout != null) { return(layout); } } return(null); }
public bool GetOption(string title, string option) { int index = 0; RulesetLayout layout = m_Layout.FindByOption(title, option, ref index); if (layout == null) { return(true); } return(m_Options[layout.Offset + index]); }
public void SetOption(string title, string option, bool value) { int index = 0; RulesetLayout layout = m_Layout.FindByOption(title, option, ref index); if (layout == null) { return; } m_Options[layout.Offset + index] = value; m_Changed = true; }
public void SetOptionRange(string title, bool value) { RulesetLayout layout = m_Layout.FindByTitle(title); if (layout == null) { return; } for (int i = 0; i < layout.TotalLength; ++i) { m_Options[i + layout.Offset] = value; } m_Changed = true; }
public RulesetLayout FindByTitle(string title) { if (m_Title == title) { return(this); } for (int i = 0; i < m_Children.Length; ++i) { RulesetLayout layout = m_Children[i].FindByTitle(title); if (layout != null) { return(layout); } } return(null); }
public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly) : base(readOnly ? 310 : 50, 50) { m_From = from; m_Ruleset = ruleset; m_Page = page; m_DuelContext = duelContext; m_ReadOnly = readOnly; Dragable = !readOnly; from.CloseGump(typeof(RulesetGump)); from.CloseGump(typeof(DuelContextGump)); from.CloseGump(typeof(ParticipantGump)); RulesetLayout depthCounter = page; int depth = 0; while (depthCounter != null) { ++depth; depthCounter = depthCounter.Parent; } int count = page.Children.Length + page.Options.Length; AddPage(0); int height = 35 + 10 + 2 + (count * 22) + 2 + 30; AddBackground(0, 0, 260, height, 9250); AddBackground(10, 10, 240, height - 20, 0xDAC); AddHtml(35, 25, 190, 20, Center(page.Title), false, false); int x = 35; int y = 47; for (int i = 0; i < page.Children.Length; ++i) { AddGoldenButton(x, y, 1 + i); AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false); y += 22; } for (int i = 0; i < page.Options.Length; ++i) { bool enabled = ruleset.Options[page.Offset + i]; if (readOnly) { AddImage(x, y, enabled ? 0xD3 : 0xD2); } else { AddCheck(x, y, 0xD2, 0xD3, enabled, i); } AddHtml(x + 25, y, 250, 22, page.Options[i], false, false); y += 22; } }
public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext) : this(from, ruleset, page, duelContext, false) { }
public Ruleset(RulesetLayout layout) { m_Layout = layout; m_Options = new BitArray(layout.TotalLength); }