public ControlGroup CreateOptionGroupControl(int ind, Func <int, bool> ResponseFunc) { ControlGroup c = new ControlGroup(new Point(Location.X, Location.Y + Offset + QuestionTextHeight + Offset + ind * (OptionHeight + Offset))); c.Add(new RelativeLabel(new Point(Offset, 0), new Size(OptionHeight, OptionHeight)), "ButtonLabel"); c.Add(new RelativeLabel(new Point(Offset + OptionHeight + Offset, 0), new Size(GroupSize.Width - 3 * Offset - OptionHeight, OptionHeight)), "TextLabel"); c.GetControl("TextLabel").Text = AllOptions[ind]; c.GetControl("ButtonLabel").Click += delegate(object sender, EventArgs e) { ResponseFunc(ind); Dispose(); }; bool KeywordFound = false; string[] Keywords = ButtonImages.Keys.ToArray(); foreach (string kw in Keywords) { if (KeywordFound = AllOptions[ind].Contains(kw)) { c.GetControl("ButtonLabel").BackgroundImage = ButtonImages[kw]; break; } } if (!KeywordFound) { c.GetControl("ButtonLabel").BackgroundImage = ButtonImages["misc"]; } return(c); }
public ControlGroup CreateQuestGroupControl(Quest quest, Player player, int SlotNum, int SpecOffset) { ControlGroup c = new ControlGroup(new Point(Location.X, SlotNum * (Height + Offset) + SideMenu.EndPoint.Y + 2 * Offset + NameLabelHeight + SpecOffset)); c.Add(new RelativeLabel(new Point(Offset, 0), new Size(Height, Height)), "ImageLabel"); c.Add(new RelativeLabel(new Point(Offset + Height + Offset, 0), new Size(Width - 3 * Offset - Height, 50)), "TextLabel"); c.Add(new RelativeLabel(new Point(Offset + Height + Offset, 50), new Size(Width - 3 * Offset - Height, 50)), "RequirementsLabel"); string[] TextBuf = QuestText(quest, player); c.GetControl("TextLabel").Text = TextBuf[0]; c.GetControl("RequirementsLabel").Text = TextBuf[1]; c.GetControl("ImageLabel").BackgroundImage = Character.GetCharacter(quest.CharacterID).CharacterImage; return(c); }
public ControlGroup CreateOptionGroupControl(int ind, Func<int,bool> ResponseFunc) { ControlGroup c = new ControlGroup(new Point(Location.X,Location.Y + Offset + QuestionTextHeight + Offset + ind * (OptionHeight+Offset) )); c.Add(new RelativeLabel(new Point(Offset,0), new Size(OptionHeight,OptionHeight)), "ButtonLabel"); c.Add(new RelativeLabel(new Point(Offset+OptionHeight+Offset,0),new Size(GroupSize.Width-3*Offset-OptionHeight,OptionHeight)),"TextLabel"); c.GetControl("TextLabel").Text = AllOptions[ind]; c.GetControl("ButtonLabel").Click += delegate(object sender, EventArgs e) { ResponseFunc(ind); Dispose(); }; bool KeywordFound = false; string[] Keywords = ButtonImages.Keys.ToArray(); foreach (string kw in Keywords) { if (KeywordFound = AllOptions[ind].Contains(kw)) { c.GetControl("ButtonLabel").BackgroundImage = ButtonImages[kw]; break; } } if (!KeywordFound) c.GetControl("ButtonLabel").BackgroundImage = ButtonImages["misc"]; return c; }
public ControlGroup CreateQuestGroupControl(Quest quest, Player player, int SlotNum, int SpecOffset) { ControlGroup c = new ControlGroup(new Point(Location.X,SlotNum*(Height+Offset)+SideMenu.EndPoint.Y+2*Offset+NameLabelHeight+SpecOffset)); c.Add(new RelativeLabel(new Point(Offset,0), new Size(Height,Height)), "ImageLabel"); c.Add(new RelativeLabel(new Point(Offset+Height+Offset,0),new Size(Width-3*Offset-Height,50)),"TextLabel"); c.Add(new RelativeLabel(new Point(Offset+Height+Offset,50),new Size(Width-3*Offset-Height,50)),"RequirementsLabel"); string[] TextBuf = QuestText(quest,player); c.GetControl("TextLabel").Text = TextBuf[0]; c.GetControl("RequirementsLabel").Text = TextBuf[1]; c.GetControl("ImageLabel").BackgroundImage = Character.GetCharacter(quest.CharacterID).CharacterImage; return c; }