Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sealed class StatusDialog : MirImageControl
- {
- public static Regex R = new Regex(@"<(.*?/\@.*?)>");
- public static Regex C = new Regex(@"{(.*?/.*?)}");
- public MirButton CloseButton, ElementButton, AttributeButton, StatusButton, StateButton, SkillButton;
- public MirImageControl StatusPage, StatePage, AttributePage, ElementPage, SkillPage;
- public MirLabel[] TextLabel;
- public List<MirLabel> TextButtons;
- public MirButton NextButton, BackButton;
- public MirLabel NameLabel;
- public MirStatList StatList;
- public MirAttributeList AttributeList;
- public MirElementList ElementList;
- public MagicButton[] Magics;
- public int StartIndex;
- public StatusDialog()
- {
- Index = 722;
- Library = Libraries.UI;
- Movable = true;
- TextLabel = new MirLabel[12];
- TextButtons = new List<MirLabel>();
- Sort = true;
- BeforeDraw += (o, e) => RefreshMagic();
- for (int i = 0; i < TextLabel.Length; i++)
- {
- TextLabel[i] = new MirLabel
- {
- DrawFormat = TextFormatFlags.WordBreak,
- Visible = true,
- Parent = this,
- Size = new Size(420, 18),
- Location = new Point(15, 45 + i * 18),
- };
- }
- #region Buttons
- CloseButton = new MirButton
- {
- HoverIndex = 361,
- Index = 360,
- Location = new Point(400, 3),
- Library = Libraries.Prguse2,
- Parent = this,
- PressedIndex = 362,
- Sound = SoundList.ButtonA,
- };
- CloseButton.Click += (o, e) => Hide();
- ElementButton = new MirButton
- {
- HoverIndex = 31,
- Index = 30,
- Location = new Point(6, 43),
- Library = Libraries.UI,
- Parent = this,
- PressedIndex = 32,
- Sound = SoundList.ButtonA,
- };
- ElementButton.Click += (o, e) => ShowElementPage();
- AttributeButton = new MirButton
- {
- HoverIndex = 31,
- Index = 30,
- Location = new Point(75, 43),
- Library = Libraries.UI,
- Parent = this,
- PressedIndex = 32,
- Sound = SoundList.ButtonA,
- };
- AttributeButton.Click += (o, e) => ShowAttributePage();
- StatusButton = new MirButton
- {
- HoverIndex = 31,
- Index = 30,
- Location = new Point(144, 43),
- Library = Libraries.UI,
- Parent = this,
- PressedIndex = 32,
- Sound = SoundList.ButtonA,
- };
- StatusButton.Click += (o, e) => ShowStatusPage();
- SkillButton = new MirButton
- {
- HoverIndex = 31,
- Index = 30,
- Location = new Point(213, 43),
- Library = Libraries.UI,
- Parent = this,
- PressedIndex = 32,
- Sound = SoundList.ButtonA,
- };
- SkillButton.Click += (o, e) =>
- {
- ShowSkillPage();
- RefreshMagic();
- };
- Magics = new MagicButton[6];
- for (int i = 0; i < Magics.Length; i++)
- Magics[i] = new MagicButton { Parent = SkillPage, Visible = false, Location = new Point(8, 40 + i * 33) };
- NextButton = new MirButton
- {
- Index = 396,
- Location = new Point(140, 150),
- Library = Libraries.Prguse,
- Parent = SkillPage,
- PressedIndex = 397,
- Sound = SoundList.ButtonA,
- };
- NextButton.Click += (o, e) =>
- {
- if (StartIndex + 6 >= MapObject.User.Magics.Count) return;
- StartIndex += 6;
- RefreshMagic();
- };
- BackButton = new MirButton
- {
- Index = 398,
- Location = new Point(90, 150),
- Library = Libraries.Prguse,
- Parent = SkillPage,
- PressedIndex = 399,
- Sound = SoundList.ButtonA,
- };
- BackButton.Click += (o, e) =>
- {
- if (StartIndex - 6 < 0) return;
- StartIndex -= 6;
- RefreshMagic();
- };
- #endregion
- #region Pages
- StatusPage = new MirImageControl
- {
- Index = 728,
- Parent = this,
- Library = Libraries.UI,
- Location = new Point(0, 70),
- Visible = true,
- };
- StatusPage.BeforeDraw += (o, e) =>
- {
- StatList.UpdateStats();
- };
- AttributePage = new MirImageControl
- {
- Index = 728,
- Parent = this,
- Library = Libraries.UI,
- Location = new Point(0, 70),
- Visible = false,
- };
- AttributePage.BeforeDraw += (o, e) =>
- {
- AttributeList.UpdateAttributes();
- };
- ElementPage = new MirImageControl
- {
- Index = 728,
- Parent = this,
- Library = Libraries.UI,
- Location = new Point(0, 70),
- Visible = false,
- };
- ElementPage.BeforeDraw += (o, e) =>
- {
- ElementList.ElementStats();
- };
- StatePage = new MirImageControl
- {
- Index = 728,
- Parent = this,
- Library = Libraries.UI,
- Location = new Point(0, 70),
- Visible = false,
- };
- SkillPage = new MirImageControl
- {
- Index = 508,
- Parent = this,
- Library = Libraries.Title,
- Location = new Point(0, 70),
- Visible = false
- };
- StatList = new MirStatList(StatusPage);
- AttributeList = new MirAttributeList(AttributePage);
- ElementList = new MirElementList(ElementPage);
- }
- #endregion
- #region Page Shows
- private void ShowStatusPage()
- {
- StatusPage.Visible = true;
- StatePage.Visible = false;
- AttributePage.Visible = false;
- ElementPage.Visible = false;
- SkillPage.Visible = false;
- StatusButton.Index = 33;
- StatusButton.HoverIndex = 33;
- ElementButton.Index = 30;
- ElementButton.HoverIndex = 31;
- AttributeButton.Index = 30;
- AttributeButton.HoverIndex = 31;
- SkillButton.Index = 30;
- SkillButton.HoverIndex = 31;
- StatList.UpdateStats();
- AttributeList.UpdateAttributes();
- ElementList.ElementStats();
- }
- private void ShowAttributePage()
- {
- StatusPage.Visible = false;
- StatePage.Visible = false;
- AttributePage.Visible = true;
- ElementPage.Visible = false;
- SkillPage.Visible = false;
- StatusButton.Index = 30;
- StatusButton.HoverIndex = 31;
- ElementButton.Index = 30;
- ElementButton.HoverIndex = 31;
- AttributeButton.Index = 33;
- AttributeButton.HoverIndex = 33;
- SkillButton.Index = 30;
- SkillButton.HoverIndex = 31;
- StatList.UpdateStats();
- AttributeList.UpdateAttributes();
- ElementList.ElementStats();
- }
- private void ShowElementPage()
- {
- StatusPage.Visible = false;
- StatePage.Visible = false;
- AttributePage.Visible = false;
- ElementPage.Visible = true;
- SkillPage.Visible = false;
- StatusButton.Index = 30;
- StatusButton.HoverIndex = 31;
- ElementButton.Index = 33;
- ElementButton.HoverIndex = 33;
- AttributeButton.Index = 30;
- AttributeButton.HoverIndex = 31;
- SkillButton.Index = 30;
- SkillButton.HoverIndex = 31;
- StatList.UpdateStats();
- AttributeList.UpdateAttributes();
- ElementList.ElementStats();
- }
- private void ShowStatePage()
- {
- StatusPage.Visible = false;
- StatePage.Visible = true;
- AttributePage.Visible = false;
- ElementPage.Visible = false;
- SkillPage.Visible = false;
- StatusButton.Index = 30;
- StatusButton.HoverIndex = 31;
- ElementButton.Index = 30;
- ElementButton.HoverIndex = 31;
- AttributeButton.Index = 30;
- AttributeButton.HoverIndex = 31;
- SkillButton.Index = 30;
- SkillButton.HoverIndex = 31;
- }
- private void ShowSkillPage()
- {
- StatusPage.Visible = false;
- StatePage.Visible = false;
- AttributePage.Visible = false;
- ElementPage.Visible = false;
- SkillPage.Visible = true;
- StatusButton.Index = 30;
- StatusButton.HoverIndex = 31;
- ElementButton.Index = 30;
- ElementButton.HoverIndex = 31;
- AttributeButton.Index = 30;
- AttributeButton.HoverIndex = 31;
- SkillButton.Index = 33;
- SkillButton.HoverIndex = 33;
- StatList.UpdateStats();
- AttributeList.UpdateAttributes();
- ElementList.ElementStats();
- StartIndex = 0;
- }
- #endregion
- public void Hide()
- {
- if (!Visible) return;
- Visible = false;
- }
- public void Show()
- {
- if (Visible) return;
- Visible = true;
- }
- private void RefreshMagic()
- {
- for (int i = 0; i < Magics.Length; i++)
- {
- if (i + StartIndex >= MapObject.User.Magics.Count)
- {
- Magics[i].Visible = false;
- continue;
- }
- Magics[i].Visible = true;
- Magics[i].Update(MapObject.User.Magics[i + StartIndex]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement