private void ReplaceButton(string name, ButtonInfo inf) { if (ButtonInfo.ContainsKey(name)) { ButtonInfo.Remove(name); } ButtonInfo.Add(name, inf); }
public BaseSkin(string name) { SkinName = name; ButtonInfo prevbtn = new ButtonInfo(240, 177, 80, 25, ListButtonOverlay, "PREV"); ButtonInfo nextbtn = new ButtonInfo(322, 177, 80, 25, ListButtonOverlay, "NEXT"); ButtonInfo finbtn = new ButtonInfo(158, 177, 80, 25, ListButtonOverlay, "OK"); ButtonInfo.Add("ListPrevButton", prevbtn); ButtonInfo.Add("ListNextButton", nextbtn); ButtonInfo.Add("ListDoneButton", finbtn); }
internal void BaseDeserialize(XmlReader read) { try { read.ReadStartElement(); int count = read.ReadContentAsInt(); read.ReadEndElement(); int i = 0; while (i < count) { string name = read.LocalName; //SkillSettings.DoTell2("Current Name (win): " + name); int x = Int32.Parse(read.GetAttribute(0)); int y = Int32.Parse(read.GetAttribute(1)); int w = Int32.Parse(read.GetAttribute(2)); int h = Int32.Parse(read.GetAttribute(3)); int bg = Int32.Parse(read.GetAttribute(4)); WindowInfo inf = new WindowInfo(x, y, w, h, bg); ReplaceWindow(name, inf); read.Read(); i++; } read.ReadStartElement(); int count2 = read.ReadContentAsInt(); i = 0; read.ReadEndElement(); while (i < count2) { string name = read.LocalName; //SkillSettings.DoTell2("Current Name (btn): " + name); int x = Int32.Parse(read.GetAttribute(0)); int y = Int32.Parse(read.GetAttribute(1)); int w = Int32.Parse(read.GetAttribute(2)); int h = Int32.Parse(read.GetAttribute(3)); int bg = Int32.Parse(read.GetAttribute(4)); string txt = read.GetAttribute(5); int tx = Int32.Parse(read.GetAttribute(6)); int ty = Int32.Parse(read.GetAttribute(7)); int up = Int32.Parse(read.GetAttribute(8)); int dn = Int32.Parse(read.GetAttribute(9)); ButtonInfo inf = new ButtonInfo(x, y, w, h, bg, txt, tx, ty, up, dn); ReplaceButton(name, inf); read.Read(); i++; } } catch (Exception e) { Console.WriteLine("Exception while reading in Button and Window info: " + e); } }
internal void BaseSerialize(XmlWriter write) { try { IEnumerator vals = WindowInfo.GetEnumerator(); IEnumerator btns = ButtonInfo.GetEnumerator(); write.WriteStartElement("WindowCount"); write.WriteValue(WindowInfo.Count); write.WriteEndElement(); while (vals.MoveNext()) { WindowInfo c = (WindowInfo)((KeyValuePair <string, WindowInfo>)vals.Current).Value; write.WriteStartElement((string)((KeyValuePair <string, WindowInfo>)vals.Current).Key); write.WriteAttributeString("X", "" + c.X); write.WriteAttributeString("Y", "" + c.Y); write.WriteAttributeString("W", "" + c.W); write.WriteAttributeString("H", "" + c.H); write.WriteAttributeString("BG", "" + c.bgID); write.WriteEndElement(); } write.WriteStartElement("ButtonCount"); write.WriteValue(ButtonInfo.Count); write.WriteEndElement(); while (btns.MoveNext()) { //SkillSettings.DoTell2("Type of btns.Current: " + btns.Current.GetType()); //SkillSettings.doTell("Type of btns.Current.Value: "+(((DictionaryEntry)btns.Current).Value).GetType()); ButtonInfo b = (ButtonInfo)((KeyValuePair <string, ButtonInfo>)btns.Current).Value; write.WriteStartElement((string)((KeyValuePair <string, ButtonInfo>)btns.Current).Key); write.WriteAttributeString("X", "" + b.X); write.WriteAttributeString("Y", "" + b.Y); write.WriteAttributeString("W", "" + b.W); write.WriteAttributeString("H", "" + b.H); write.WriteAttributeString("BG", "" + b.bgID); write.WriteAttributeString("TXT", b.text); write.WriteAttributeString("TX", "" + b.textX); write.WriteAttributeString("TY", "" + b.textY); write.WriteAttributeString("U", "" + b.up); write.WriteAttributeString("D", "" + b.down); write.WriteEndElement(); } } catch (Exception e) { Console.WriteLine("Exception while writing out Button and Window info: " + e); } }
/// <summary> /// Sets up a new page for the GumpList to add items to. /// </summary> /// <param name="title">The title of the page.</param> /// <param name="first">Determines if actions for the first page should be taken.</param> /// <param name="last">Determines if actions for the last page should be taken.</param> /// <param name="pg">The page number of this page.</param> private void SetupPage(string title, bool first, bool last, int pg) { if (topbar != null) { topbar.X = X; //+sk.ListStartX; topbar.Y = Y; //+sk.ListStartY; topbar.AppendTo(page); } ButtonInfo ListPrevButton = sk.ButtonInfo["ListPrevButton"]; ButtonInfo ListNextButton = sk.ButtonInfo["ListNextButton"]; //ButtonInfo inf2 = sk.ButtonInfo["ListDoneButton"]; page.AddPage(pg); page.AddLabel(sk.ListTitleX, sk.ListTitleY, sk.ListTitleHue, title); DebugWrite("Page: " + pg); if (!first) { DebugWrite("Adding previous button: " + (pg - 1)); if (ListPrevButton.bgID != 0) { this.AddSuperButton(X + ListPrevButton.X, Y + ListPrevButton.Y, ListPrevButton.H, ListPrevButton.W, ListPrevButton.bgID, sk.ListUnderButtonN, sk.ListUnderButtonP, ListPrevButton.text, GumpButtonType.Page, 0, pg - 1); } else { page.AddButton(ListPrevButton.X, ListPrevButton.Y, ListPrevButton.up, ListPrevButton.down, 1, GumpButtonType.Page, pg - 1); } } if (!last) { DebugWrite("Adding next button: " + (pg + 1)); if (ListNextButton.bgID != 0) { this.AddSuperButton(X + ListNextButton.X, Y + ListNextButton.Y, ListNextButton.H, ListNextButton.W, ListNextButton.bgID, sk.ListUnderButtonN, sk.ListUnderButtonP, ListNextButton.text, GumpButtonType.Page, 0, pg + 1); } else { page.AddButton(ListNextButton.X, ListNextButton.Y, ListNextButton.up, ListNextButton.down, 1, GumpButtonType.Page, pg + 1); } } //AddSuperButton(inf2.X, inf2.Y, inf2.H, inf2.W, inf2.bgID, sk.EntryButtonUnderlay, sk.EntryButtonUnderlay, inf2.text, GumpButtonType.Reply, 1, 0); }
private void ReplaceButton(string name, ButtonInfo inf) { if (ButtonInfo.ContainsKey(name)) ButtonInfo.Remove(name); ButtonInfo.Add(name, inf); }
internal void BaseDeserialize(XmlReader read) { try { read.ReadStartElement(); int count = read.ReadContentAsInt(); read.ReadEndElement(); int i = 0; while (i < count) { string name = read.LocalName; //SkillSettings.DoTell2("Current Name (win): " + name); int x = Int32.Parse(read.GetAttribute(0)); int y = Int32.Parse(read.GetAttribute(1)); int w = Int32.Parse(read.GetAttribute(2)); int h = Int32.Parse(read.GetAttribute(3)); int bg = Int32.Parse(read.GetAttribute(4)); WindowInfo inf = new WindowInfo(x, y, w, h, bg); ReplaceWindow(name, inf); read.Read(); i++; } read.ReadStartElement(); int count2 = read.ReadContentAsInt(); i = 0; read.ReadEndElement(); while (i < count2) { string name = read.LocalName; //SkillSettings.DoTell2("Current Name (btn): " + name); int x = Int32.Parse(read.GetAttribute(0)); int y = Int32.Parse(read.GetAttribute(1)); int w = Int32.Parse(read.GetAttribute(2)); int h = Int32.Parse(read.GetAttribute(3)); int bg = Int32.Parse(read.GetAttribute(4)); string txt = read.GetAttribute(5); int tx = Int32.Parse(read.GetAttribute(6) ); int ty = Int32.Parse(read.GetAttribute(7) ); int up = Int32.Parse(read.GetAttribute(8)); int dn = Int32.Parse(read.GetAttribute(9)); ButtonInfo inf = new ButtonInfo( x, y, w, h, bg, txt, tx, ty, up, dn ); ReplaceButton(name, inf); read.Read(); i++; } } catch (Exception e) { Console.WriteLine("Exception while reading in Button and Window info: " + e); } }
public SkillSkin(string name) : base(name) { this.WindowInfo.Add("SkillWindow", new WindowInfo(215, 28, 337, 400, 2520)); this.ButtonInfo.Add("LockButton", new ButtonInfo(0, 0, 0, 0, 2092, 2092)); this.ButtonInfo.Add("UpButton", new ButtonInfo(0, 0, 0, 0, 2435, 2436)); this.ButtonInfo.Add("DownButton", new ButtonInfo(0, 0, 0, 0, 2437, 2438)); this.ButtonInfo.Add("UseButton", new ButtonInfo(0, 0, 0, 0, 2103, 2104)); this.ButtonInfo.Add("NewGroup", new ButtonInfo(36, 188, 80, 25, 0, 0)); this.ButtonInfo.Add("ExpandContractGroup", new ButtonInfo(0, 0, 0, 0, 2087, 2086)); this.EntryButtonUnderlay = 0; this.NormalText = 1736; ButtonInfo prevbtn = new ButtonInfo(285, 390, 0, 0, 2223, 2223); ButtonInfo nextbtn = new ButtonInfo(305, 390, 0, 0, 2224, 2224); ButtonInfo.Remove("ListPrevButton"); ButtonInfo.Add("ListPrevButton", prevbtn); ButtonInfo.Remove("ListNextButton"); ButtonInfo.Add("ListNextButton", nextbtn); }