Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.90 KB | None | 0 0
  1. public sealed class StatusDialog : MirImageControl
  2. {
  3. public static Regex R = new Regex(@"<(.*?/\@.*?)>");
  4. public static Regex C = new Regex(@"{(.*?/.*?)}");
  5.  
  6. public MirButton CloseButton, ElementButton, AttributeButton, StatusButton, StateButton, SkillButton;
  7. public MirImageControl StatusPage, StatePage, AttributePage, ElementPage, SkillPage;
  8. public MirLabel[] TextLabel;
  9. public List<MirLabel> TextButtons;
  10. public MirButton NextButton, BackButton;
  11.  
  12. public MirLabel NameLabel;
  13.  
  14. public MirStatList StatList;
  15. public MirAttributeList AttributeList;
  16. public MirElementList ElementList;
  17.  
  18. public MagicButton[] Magics;
  19.  
  20. public int StartIndex;
  21.  
  22. public StatusDialog()
  23. {
  24. Index = 722;
  25. Library = Libraries.UI;
  26. Movable = true;
  27.  
  28. TextLabel = new MirLabel[12];
  29. TextButtons = new List<MirLabel>();
  30.  
  31. Sort = true;
  32.  
  33. BeforeDraw += (o, e) => RefreshMagic();
  34.  
  35. for (int i = 0; i < TextLabel.Length; i++)
  36. {
  37. TextLabel[i] = new MirLabel
  38. {
  39. DrawFormat = TextFormatFlags.WordBreak,
  40. Visible = true,
  41. Parent = this,
  42. Size = new Size(420, 18),
  43. Location = new Point(15, 45 + i * 18),
  44. };
  45. }
  46.  
  47. #region Buttons
  48. CloseButton = new MirButton
  49. {
  50. HoverIndex = 361,
  51. Index = 360,
  52. Location = new Point(400, 3),
  53. Library = Libraries.Prguse2,
  54. Parent = this,
  55. PressedIndex = 362,
  56. Sound = SoundList.ButtonA,
  57. };
  58. CloseButton.Click += (o, e) => Hide();
  59.  
  60. ElementButton = new MirButton
  61. {
  62. HoverIndex = 31,
  63. Index = 30,
  64. Location = new Point(6, 43),
  65. Library = Libraries.UI,
  66. Parent = this,
  67. PressedIndex = 32,
  68. Sound = SoundList.ButtonA,
  69. };
  70. ElementButton.Click += (o, e) => ShowElementPage();
  71.  
  72. AttributeButton = new MirButton
  73. {
  74. HoverIndex = 31,
  75. Index = 30,
  76. Location = new Point(75, 43),
  77. Library = Libraries.UI,
  78. Parent = this,
  79. PressedIndex = 32,
  80. Sound = SoundList.ButtonA,
  81. };
  82. AttributeButton.Click += (o, e) => ShowAttributePage();
  83.  
  84. StatusButton = new MirButton
  85. {
  86. HoverIndex = 31,
  87. Index = 30,
  88. Location = new Point(144, 43),
  89. Library = Libraries.UI,
  90. Parent = this,
  91. PressedIndex = 32,
  92. Sound = SoundList.ButtonA,
  93. };
  94. StatusButton.Click += (o, e) => ShowStatusPage();
  95.  
  96. SkillButton = new MirButton
  97. {
  98. HoverIndex = 31,
  99. Index = 30,
  100. Location = new Point(213, 43),
  101. Library = Libraries.UI,
  102. Parent = this,
  103. PressedIndex = 32,
  104. Sound = SoundList.ButtonA,
  105. };
  106. SkillButton.Click += (o, e) =>
  107. {
  108. ShowSkillPage();
  109. RefreshMagic();
  110. };
  111.  
  112. Magics = new MagicButton[6];
  113.  
  114. for (int i = 0; i < Magics.Length; i++)
  115. Magics[i] = new MagicButton { Parent = SkillPage, Visible = false, Location = new Point(8, 40 + i * 33) };
  116.  
  117. NextButton = new MirButton
  118. {
  119. Index = 396,
  120. Location = new Point(140, 150),
  121. Library = Libraries.Prguse,
  122. Parent = SkillPage,
  123. PressedIndex = 397,
  124. Sound = SoundList.ButtonA,
  125. };
  126. NextButton.Click += (o, e) =>
  127. {
  128. if (StartIndex + 6 >= MapObject.User.Magics.Count) return;
  129.  
  130. StartIndex += 6;
  131. RefreshMagic();
  132. };
  133.  
  134. BackButton = new MirButton
  135. {
  136. Index = 398,
  137. Location = new Point(90, 150),
  138. Library = Libraries.Prguse,
  139. Parent = SkillPage,
  140. PressedIndex = 399,
  141. Sound = SoundList.ButtonA,
  142. };
  143. BackButton.Click += (o, e) =>
  144. {
  145. if (StartIndex - 6 < 0) return;
  146.  
  147. StartIndex -= 6;
  148. RefreshMagic();
  149. };
  150.  
  151.  
  152.  
  153. #endregion
  154.  
  155. #region Pages
  156.  
  157. StatusPage = new MirImageControl
  158. {
  159. Index = 728,
  160. Parent = this,
  161. Library = Libraries.UI,
  162. Location = new Point(0, 70),
  163. Visible = true,
  164. };
  165. StatusPage.BeforeDraw += (o, e) =>
  166. {
  167. StatList.UpdateStats();
  168. };
  169. AttributePage = new MirImageControl
  170. {
  171. Index = 728,
  172. Parent = this,
  173. Library = Libraries.UI,
  174. Location = new Point(0, 70),
  175. Visible = false,
  176. };
  177. AttributePage.BeforeDraw += (o, e) =>
  178. {
  179. AttributeList.UpdateAttributes();
  180. };
  181.  
  182. ElementPage = new MirImageControl
  183. {
  184. Index = 728,
  185. Parent = this,
  186. Library = Libraries.UI,
  187. Location = new Point(0, 70),
  188. Visible = false,
  189. };
  190. ElementPage.BeforeDraw += (o, e) =>
  191. {
  192. ElementList.ElementStats();
  193. };
  194.  
  195. StatePage = new MirImageControl
  196. {
  197. Index = 728,
  198. Parent = this,
  199. Library = Libraries.UI,
  200. Location = new Point(0, 70),
  201. Visible = false,
  202. };
  203.  
  204.  
  205. SkillPage = new MirImageControl
  206. {
  207. Index = 508,
  208. Parent = this,
  209. Library = Libraries.Title,
  210. Location = new Point(0, 70),
  211. Visible = false
  212. };
  213.  
  214.  
  215. StatList = new MirStatList(StatusPage);
  216. AttributeList = new MirAttributeList(AttributePage);
  217. ElementList = new MirElementList(ElementPage);
  218. }
  219.  
  220.  
  221. #endregion
  222.  
  223. #region Page Shows
  224. private void ShowStatusPage()
  225. {
  226. StatusPage.Visible = true;
  227. StatePage.Visible = false;
  228. AttributePage.Visible = false;
  229. ElementPage.Visible = false;
  230. SkillPage.Visible = false;
  231. StatusButton.Index = 33;
  232. StatusButton.HoverIndex = 33;
  233. ElementButton.Index = 30;
  234. ElementButton.HoverIndex = 31;
  235. AttributeButton.Index = 30;
  236. AttributeButton.HoverIndex = 31;
  237. SkillButton.Index = 30;
  238. SkillButton.HoverIndex = 31;
  239. StatList.UpdateStats();
  240. AttributeList.UpdateAttributes();
  241. ElementList.ElementStats();
  242. }
  243.  
  244. private void ShowAttributePage()
  245. {
  246. StatusPage.Visible = false;
  247. StatePage.Visible = false;
  248. AttributePage.Visible = true;
  249. ElementPage.Visible = false;
  250. SkillPage.Visible = false;
  251. StatusButton.Index = 30;
  252. StatusButton.HoverIndex = 31;
  253. ElementButton.Index = 30;
  254. ElementButton.HoverIndex = 31;
  255. AttributeButton.Index = 33;
  256. AttributeButton.HoverIndex = 33;
  257. SkillButton.Index = 30;
  258. SkillButton.HoverIndex = 31;
  259. StatList.UpdateStats();
  260. AttributeList.UpdateAttributes();
  261. ElementList.ElementStats();
  262. }
  263.  
  264. private void ShowElementPage()
  265. {
  266. StatusPage.Visible = false;
  267. StatePage.Visible = false;
  268. AttributePage.Visible = false;
  269. ElementPage.Visible = true;
  270. SkillPage.Visible = false;
  271. StatusButton.Index = 30;
  272. StatusButton.HoverIndex = 31;
  273. ElementButton.Index = 33;
  274. ElementButton.HoverIndex = 33;
  275. AttributeButton.Index = 30;
  276. AttributeButton.HoverIndex = 31;
  277. SkillButton.Index = 30;
  278. SkillButton.HoverIndex = 31;
  279. StatList.UpdateStats();
  280. AttributeList.UpdateAttributes();
  281. ElementList.ElementStats();
  282. }
  283.  
  284. private void ShowStatePage()
  285. {
  286. StatusPage.Visible = false;
  287. StatePage.Visible = true;
  288. AttributePage.Visible = false;
  289. ElementPage.Visible = false;
  290. SkillPage.Visible = false;
  291. StatusButton.Index = 30;
  292. StatusButton.HoverIndex = 31;
  293. ElementButton.Index = 30;
  294. ElementButton.HoverIndex = 31;
  295. AttributeButton.Index = 30;
  296. AttributeButton.HoverIndex = 31;
  297. SkillButton.Index = 30;
  298. SkillButton.HoverIndex = 31;
  299. }
  300.  
  301. private void ShowSkillPage()
  302. {
  303. StatusPage.Visible = false;
  304. StatePage.Visible = false;
  305. AttributePage.Visible = false;
  306. ElementPage.Visible = false;
  307. SkillPage.Visible = true;
  308. StatusButton.Index = 30;
  309. StatusButton.HoverIndex = 31;
  310. ElementButton.Index = 30;
  311. ElementButton.HoverIndex = 31;
  312. AttributeButton.Index = 30;
  313. AttributeButton.HoverIndex = 31;
  314. SkillButton.Index = 33;
  315. SkillButton.HoverIndex = 33;
  316. StatList.UpdateStats();
  317. AttributeList.UpdateAttributes();
  318. ElementList.ElementStats();
  319. StartIndex = 0;
  320. }
  321.  
  322. #endregion
  323.  
  324.  
  325.  
  326. public void Hide()
  327. {
  328. if (!Visible) return;
  329. Visible = false;
  330. }
  331.  
  332. public void Show()
  333. {
  334. if (Visible) return;
  335. Visible = true;
  336. }
  337.  
  338. private void RefreshMagic()
  339. {
  340.  
  341. for (int i = 0; i < Magics.Length; i++)
  342. {
  343. if (i + StartIndex >= MapObject.User.Magics.Count)
  344. {
  345. Magics[i].Visible = false;
  346. continue;
  347. }
  348.  
  349. Magics[i].Visible = true;
  350. Magics[i].Update(MapObject.User.Magics[i + StartIndex]);
  351. }
  352. }
  353.  
  354.  
  355. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement