MyIconButton.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. using System;
  2. using System.CodeDom.Compiler;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Runtime.CompilerServices;
  6. using System.Threading;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Input;
  10. using System.Windows.Markup;
  11. using System.Windows.Media;
  12. using System.Windows.Shapes;
  13. using Microsoft.VisualBasic;
  14. using Microsoft.VisualBasic.CompilerServices;
  15. namespace PCL
  16. {
  17. // Token: 0x020001CD RID: 461
  18. [DesignerGenerated]
  19. public class MyIconButton : Border, IComponentConnector
  20. {
  21. // Token: 0x0600157A RID: 5498 RVA: 0x0008F0B0 File Offset: 0x0008D2B0
  22. public MyIconButton()
  23. {
  24. base.MouseLeftButtonUp += this.Button_MouseUp;
  25. base.MouseLeftButtonDown += this.Button_MouseDown;
  26. base.MouseLeftButtonUp += delegate(object sender, MouseButtonEventArgs e)
  27. {
  28. this.Button_MouseUp();
  29. };
  30. base.MouseLeave += delegate(object sender, MouseEventArgs e)
  31. {
  32. this.Button_MouseLeave();
  33. };
  34. base.MouseEnter += delegate(object sender, MouseEventArgs e)
  35. {
  36. this.RefreshAnim();
  37. };
  38. base.MouseLeave += delegate(object sender, MouseEventArgs e)
  39. {
  40. this.RefreshAnim();
  41. };
  42. base.Loaded += delegate(object sender, RoutedEventArgs e)
  43. {
  44. this.RefreshAnim();
  45. };
  46. this.authenticationComposer = ModBase.GetUuid();
  47. this.algoComposer = 1.0;
  48. this.Theme = MyIconButton.Themes.Color;
  49. this.m_MappingComposer = new SolidColorBrush(Color.FromRgb(128, 128, 128));
  50. this._DatabaseComposer = false;
  51. this.InitializeComponent();
  52. }
  53. // Token: 0x14000017 RID: 23
  54. // (add) Token: 0x0600157B RID: 5499 RVA: 0x0008F190 File Offset: 0x0008D390
  55. // (remove) Token: 0x0600157C RID: 5500 RVA: 0x0008F1C8 File Offset: 0x0008D3C8
  56. public event MyIconButton.ClickEventHandler Click
  57. {
  58. [CompilerGenerated]
  59. add
  60. {
  61. MyIconButton.ClickEventHandler clickEventHandler = this._MerchantComposer;
  62. MyIconButton.ClickEventHandler clickEventHandler2;
  63. do
  64. {
  65. clickEventHandler2 = clickEventHandler;
  66. MyIconButton.ClickEventHandler value2 = (MyIconButton.ClickEventHandler)Delegate.Combine(clickEventHandler2, value);
  67. clickEventHandler = Interlocked.CompareExchange<MyIconButton.ClickEventHandler>(ref this._MerchantComposer, value2, clickEventHandler2);
  68. }
  69. while (clickEventHandler != clickEventHandler2);
  70. }
  71. [CompilerGenerated]
  72. remove
  73. {
  74. MyIconButton.ClickEventHandler clickEventHandler = this._MerchantComposer;
  75. MyIconButton.ClickEventHandler clickEventHandler2;
  76. do
  77. {
  78. clickEventHandler2 = clickEventHandler;
  79. MyIconButton.ClickEventHandler value2 = (MyIconButton.ClickEventHandler)Delegate.Remove(clickEventHandler2, value);
  80. clickEventHandler = Interlocked.CompareExchange<MyIconButton.ClickEventHandler>(ref this._MerchantComposer, value2, clickEventHandler2);
  81. }
  82. while (clickEventHandler != clickEventHandler2);
  83. }
  84. }
  85. // Token: 0x170003A9 RID: 937
  86. // (get) Token: 0x0600157D RID: 5501 RVA: 0x0000C1DE File Offset: 0x0000A3DE
  87. // (set) Token: 0x0600157E RID: 5502 RVA: 0x0000C1F0 File Offset: 0x0000A3F0
  88. public string Logo
  89. {
  90. get
  91. {
  92. return this.Path.Data.ToString();
  93. }
  94. set
  95. {
  96. this.Path.Data = (Geometry)new GeometryConverter().ConvertFromString(value);
  97. }
  98. }
  99. // Token: 0x170003AA RID: 938
  100. // (get) Token: 0x0600157F RID: 5503 RVA: 0x0000C20D File Offset: 0x0000A40D
  101. // (set) Token: 0x06001580 RID: 5504 RVA: 0x0000C215 File Offset: 0x0000A415
  102. public double LogoScale
  103. {
  104. get
  105. {
  106. return this.algoComposer;
  107. }
  108. set
  109. {
  110. this.algoComposer = value;
  111. if (!Information.IsNothing(this.Path))
  112. {
  113. this.Path.RenderTransform = new ScaleTransform
  114. {
  115. ScaleX = this.LogoScale,
  116. ScaleY = this.LogoScale
  117. };
  118. }
  119. }
  120. }
  121. // Token: 0x170003AB RID: 939
  122. // (get) Token: 0x06001581 RID: 5505 RVA: 0x0000C253 File Offset: 0x0000A453
  123. // (set) Token: 0x06001582 RID: 5506 RVA: 0x0000C25B File Offset: 0x0000A45B
  124. public MyIconButton.Themes Theme { get; set; }
  125. // Token: 0x170003AC RID: 940
  126. // (get) Token: 0x06001583 RID: 5507 RVA: 0x0000C264 File Offset: 0x0000A464
  127. // (set) Token: 0x06001584 RID: 5508 RVA: 0x0000C26C File Offset: 0x0000A46C
  128. public SolidColorBrush Foreground
  129. {
  130. get
  131. {
  132. return this.m_MappingComposer;
  133. }
  134. set
  135. {
  136. this.m_MappingComposer = value;
  137. checked
  138. {
  139. ModAnimation.AssetParser(ModAnimation.CalcParser() + 1);
  140. this.RefreshAnim();
  141. ModAnimation.AssetParser(ModAnimation.CalcParser() - 1);
  142. }
  143. }
  144. }
  145. // Token: 0x06001585 RID: 5509 RVA: 0x0008F200 File Offset: 0x0008D400
  146. private void Button_MouseUp(object sender, MouseButtonEventArgs e)
  147. {
  148. if (this._DatabaseComposer)
  149. {
  150. ModBase.Log("[Control] 按下图标按钮" + (string.IsNullOrEmpty(base.Name) ? "" : (":" + base.Name)), ModBase.LogLevel.Normal, "出现错误");
  151. MyIconButton.ClickEventHandler merchantComposer = this._MerchantComposer;
  152. if (merchantComposer != null)
  153. {
  154. merchantComposer(RuntimeHelpers.GetObjectValue(sender), e);
  155. }
  156. e.Handled = true;
  157. this.Button_MouseUp();
  158. ModEvent.TryStartEvent(this.EventType, this.EventData);
  159. }
  160. }
  161. // Token: 0x170003AD RID: 941
  162. // (get) Token: 0x06001586 RID: 5510 RVA: 0x0000C293 File Offset: 0x0000A493
  163. // (set) Token: 0x06001587 RID: 5511 RVA: 0x0000C2A5 File Offset: 0x0000A4A5
  164. public string EventType
  165. {
  166. get
  167. {
  168. return Conversions.ToString(base.GetValue(MyIconButton.tokenizerComposer));
  169. }
  170. set
  171. {
  172. base.SetValue(MyIconButton.tokenizerComposer, value);
  173. }
  174. }
  175. // Token: 0x170003AE RID: 942
  176. // (get) Token: 0x06001588 RID: 5512 RVA: 0x0000C2B3 File Offset: 0x0000A4B3
  177. // (set) Token: 0x06001589 RID: 5513 RVA: 0x0000C2C5 File Offset: 0x0000A4C5
  178. public string EventData
  179. {
  180. get
  181. {
  182. return Conversions.ToString(base.GetValue(MyIconButton.m_FilterComposer));
  183. }
  184. set
  185. {
  186. base.SetValue(MyIconButton.m_FilterComposer, value);
  187. }
  188. }
  189. // Token: 0x0600158A RID: 5514 RVA: 0x0008F284 File Offset: 0x0008D484
  190. private void Button_MouseDown(object sender, MouseButtonEventArgs e)
  191. {
  192. this._DatabaseComposer = true;
  193. base.Focus();
  194. ModAnimation.AniStart(ModAnimation.AaScaleTransform(this.PanBack, 0.8 - ((ScaleTransform)this.PanBack.RenderTransform).ScaleX, 400, 0, new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Strong), false), "MyIconButton Scale " + Conversions.ToString(this.authenticationComposer), false);
  195. }
  196. // Token: 0x0600158B RID: 5515 RVA: 0x0008F2F4 File Offset: 0x0008D4F4
  197. private void Button_MouseUp()
  198. {
  199. if (this._DatabaseComposer)
  200. {
  201. this._DatabaseComposer = false;
  202. ModAnimation.AniStart(new ModAnimation.AniData[]
  203. {
  204. ModAnimation.AaScaleTransform(this.PanBack, 1.05 - ((ScaleTransform)this.PanBack.RenderTransform).ScaleX, 250, 0, new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak), false),
  205. ModAnimation.AaScaleTransform(this.PanBack, -0.05, 250, 0, new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Strong), false)
  206. }, "MyIconButton Scale " + Conversions.ToString(this.authenticationComposer), false);
  207. }
  208. this.RefreshAnim();
  209. }
  210. // Token: 0x0600158C RID: 5516 RVA: 0x0008F3A0 File Offset: 0x0008D5A0
  211. private void Button_MouseLeave()
  212. {
  213. this._DatabaseComposer = false;
  214. ModAnimation.AniStart(new ModAnimation.AniData[]
  215. {
  216. ModAnimation.AaScaleTransform(this.PanBack, 1.0 - ((ScaleTransform)this.PanBack.RenderTransform).ScaleX, 250, 0, new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Middle), false)
  217. }, "MyIconButton Scale " + Conversions.ToString(this.authenticationComposer), false);
  218. this.RefreshAnim();
  219. }
  220. // Token: 0x0600158D RID: 5517 RVA: 0x0008F41C File Offset: 0x0008D61C
  221. public void RefreshAnim()
  222. {
  223. try
  224. {
  225. if (base.IsLoaded && ModAnimation.CalcParser() == 0)
  226. {
  227. if (this.PanBack.Background == null)
  228. {
  229. this.PanBack.Background = new ModBase.MyColor(0.0, 255.0, 255.0, 255.0);
  230. }
  231. if (this.Path.Fill == null)
  232. {
  233. switch (this.Theme)
  234. {
  235. case MyIconButton.Themes.Black:
  236. this.Path.Fill = new ModBase.MyColor(160.0, 0.0, 0.0, 0.0);
  237. break;
  238. case MyIconButton.Themes.Red:
  239. this.Path.Fill = new ModBase.MyColor(160.0, 255.0, 76.0, 76.0);
  240. break;
  241. case MyIconButton.Themes.Custom:
  242. this.Path.Fill = new ModBase.MyColor(160.0, this.Foreground);
  243. break;
  244. }
  245. }
  246. if (base.IsMouseOver)
  247. {
  248. List<ModAnimation.AniData> list = new List<ModAnimation.AniData>();
  249. switch (this.Theme)
  250. {
  251. case MyIconButton.Themes.Color:
  252. list.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, "ColorBrush2", 120, 0, null, false));
  253. break;
  254. case MyIconButton.Themes.White:
  255. list.Add(ModAnimation.AaColor(this.PanBack, Border.BackgroundProperty, new ModBase.MyColor(50.0, 255.0, 255.0, 255.0) - this.PanBack.Background, 120, 0, null, false));
  256. break;
  257. case MyIconButton.Themes.Black:
  258. list.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, new ModBase.MyColor(230.0, 0.0, 0.0, 0.0) - this.Path.Fill, 120, 0, null, false));
  259. break;
  260. case MyIconButton.Themes.Red:
  261. list.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, new ModBase.MyColor(255.0, 76.0, 76.0) - this.Path.Fill, 120, 0, null, false));
  262. break;
  263. case MyIconButton.Themes.Custom:
  264. list.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, new ModBase.MyColor(255.0, this.Foreground) - this.Path.Fill, 120, 0, null, false));
  265. break;
  266. }
  267. ModAnimation.AniStart(list, "MyIconButton Color " + Conversions.ToString(this.authenticationComposer), false);
  268. }
  269. else
  270. {
  271. List<ModAnimation.AniData> list2 = new List<ModAnimation.AniData>();
  272. switch (this.Theme)
  273. {
  274. case MyIconButton.Themes.Color:
  275. list2.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, "ColorBrush4", 150, 0, null, false));
  276. this.PanBack.Background = new ModBase.MyColor(0.0, 255.0, 255.0, 255.0);
  277. break;
  278. case MyIconButton.Themes.White:
  279. list2.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, "ColorBrush8", 150, 0, null, false));
  280. list2.Add(ModAnimation.AaColor(this.PanBack, Border.BackgroundProperty, new ModBase.MyColor(0.0, 255.0, 255.0, 255.0) - this.PanBack.Background, 150, 0, null, false));
  281. break;
  282. case MyIconButton.Themes.Black:
  283. list2.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, new ModBase.MyColor(160.0, 0.0, 0.0, 0.0) - this.Path.Fill, 150, 0, null, false));
  284. this.PanBack.Background = new ModBase.MyColor(0.0, 255.0, 255.0, 255.0);
  285. break;
  286. case MyIconButton.Themes.Red:
  287. list2.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, new ModBase.MyColor(160.0, 255.0, 76.0, 76.0) - this.Path.Fill, 150, 0, null, false));
  288. this.PanBack.Background = new ModBase.MyColor(0.0, 255.0, 255.0, 255.0);
  289. break;
  290. case MyIconButton.Themes.Custom:
  291. list2.Add(ModAnimation.AaColor(this.Path, Shape.FillProperty, new ModBase.MyColor(160.0, this.Foreground) - this.Path.Fill, 150, 0, null, false));
  292. this.PanBack.Background = new ModBase.MyColor(0.0, 255.0, 255.0, 255.0);
  293. break;
  294. }
  295. ModAnimation.AniStart(list2, "MyIconButton Color " + Conversions.ToString(this.authenticationComposer), false);
  296. }
  297. }
  298. else
  299. {
  300. ModAnimation.AniStop("MyIconButton Color " + Conversions.ToString(this.authenticationComposer));
  301. switch (this.Theme)
  302. {
  303. case MyIconButton.Themes.Color:
  304. this.Path.SetResourceReference(Shape.FillProperty, "ColorBrush5");
  305. break;
  306. case MyIconButton.Themes.White:
  307. this.Path.SetResourceReference(Shape.FillProperty, "ColorBrush8");
  308. break;
  309. case MyIconButton.Themes.Black:
  310. this.Path.Fill = new ModBase.MyColor(160.0, 0.0, 0.0, 0.0);
  311. break;
  312. case MyIconButton.Themes.Red:
  313. this.Path.Fill = new ModBase.MyColor(160.0, 255.0, 76.0, 76.0);
  314. break;
  315. case MyIconButton.Themes.Custom:
  316. this.Path.Fill = new ModBase.MyColor(160.0, this.Foreground);
  317. break;
  318. }
  319. this.PanBack.Background = new ModBase.MyColor(0.0, 255.0, 255.0, 255.0);
  320. }
  321. }
  322. catch (Exception ex)
  323. {
  324. ModBase.Log(ex, "刷新图标按钮动画状态出错", ModBase.LogLevel.Debug, "出现错误");
  325. }
  326. }
  327. // Token: 0x170003AF RID: 943
  328. // (get) Token: 0x0600158E RID: 5518 RVA: 0x0000C2D3 File Offset: 0x0000A4D3
  329. // (set) Token: 0x0600158F RID: 5519 RVA: 0x0000C2DB File Offset: 0x0000A4DB
  330. internal virtual Border PanBack { get; set; }
  331. // Token: 0x170003B0 RID: 944
  332. // (get) Token: 0x06001590 RID: 5520 RVA: 0x0000C2E4 File Offset: 0x0000A4E4
  333. // (set) Token: 0x06001591 RID: 5521 RVA: 0x0000C2EC File Offset: 0x0000A4EC
  334. internal virtual Path Path { get; set; }
  335. // Token: 0x06001592 RID: 5522 RVA: 0x0008FBA8 File Offset: 0x0008DDA8
  336. [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  337. public void InitializeComponent()
  338. {
  339. if (!this.customerComposer)
  340. {
  341. this.customerComposer = true;
  342. Uri resourceLocator = new Uri("/Plain Craft Launcher 2;component/controls/myiconbutton.xaml", UriKind.Relative);
  343. Application.LoadComponent(this, resourceLocator);
  344. }
  345. }
  346. // Token: 0x06001593 RID: 5523 RVA: 0x0000C2F5 File Offset: 0x0000A4F5
  347. [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  348. [EditorBrowsable(EditorBrowsableState.Never)]
  349. public void System_Windows_Markup_IComponentConnector_Connect(int connectionId, object target)
  350. {
  351. if (connectionId == 1)
  352. {
  353. this.PanBack = (Border)target;
  354. return;
  355. }
  356. if (connectionId == 2)
  357. {
  358. this.Path = (Path)target;
  359. return;
  360. }
  361. this.customerComposer = true;
  362. }
  363. // Token: 0x04000AF3 RID: 2803
  364. [CompilerGenerated]
  365. private MyIconButton.ClickEventHandler _MerchantComposer;
  366. // Token: 0x04000AF4 RID: 2804
  367. public int authenticationComposer;
  368. // Token: 0x04000AF5 RID: 2805
  369. private double algoComposer;
  370. // Token: 0x04000AF6 RID: 2806
  371. [CompilerGenerated]
  372. private MyIconButton.Themes m_ComparatorComposer;
  373. // Token: 0x04000AF7 RID: 2807
  374. private SolidColorBrush m_MappingComposer;
  375. // Token: 0x04000AF8 RID: 2808
  376. public static readonly DependencyProperty tokenizerComposer = DependencyProperty.Register("EventType", typeof(string), typeof(MyIconButton), new PropertyMetadata(null));
  377. // Token: 0x04000AF9 RID: 2809
  378. public static readonly DependencyProperty m_FilterComposer = DependencyProperty.Register("EventData", typeof(string), typeof(MyIconButton), new PropertyMetadata(null));
  379. // Token: 0x04000AFA RID: 2810
  380. private bool _DatabaseComposer;
  381. // Token: 0x04000AFB RID: 2811
  382. [AccessedThroughProperty("PanBack")]
  383. [CompilerGenerated]
  384. private Border _PredicateComposer;
  385. // Token: 0x04000AFC RID: 2812
  386. [AccessedThroughProperty("Path")]
  387. [CompilerGenerated]
  388. private Path poolComposer;
  389. // Token: 0x04000AFD RID: 2813
  390. private bool customerComposer;
  391. // Token: 0x020001CE RID: 462
  392. // (Invoke) Token: 0x0600159C RID: 5532
  393. public delegate void ClickEventHandler(object sender, EventArgs e);
  394. // Token: 0x020001CF RID: 463
  395. public enum Themes
  396. {
  397. // Token: 0x04000AFF RID: 2815
  398. Color,
  399. // Token: 0x04000B00 RID: 2816
  400. White,
  401. // Token: 0x04000B01 RID: 2817
  402. Black,
  403. // Token: 0x04000B02 RID: 2818
  404. Red,
  405. // Token: 0x04000B03 RID: 2819
  406. Custom
  407. }
  408. }
  409. }