You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

StatusBarOfHunter.xaml.cs 4.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Shapes;
  19. using Protobuf;
  20. namespace Client
  21. {
  22. /// <summary>
  23. /// StatusBarOfHunter.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class StatusBarOfHunter : UserControl
  26. {
  27. public StatusBarOfHunter(Grid parent, int Row, int Column)
  28. {
  29. InitializeComponent();
  30. parent.Children.Add(this);
  31. Grid.SetColumn(this, Column);
  32. Grid.SetColumnSpan(this, 2);
  33. Grid.SetRow(this, Row);
  34. initialized = false;
  35. }
  36. public void SetFontSize(double fontsize)
  37. {
  38. serial.FontSize = scores.FontSize = star.FontSize = status.FontSize = prop.FontSize = fontsize;
  39. }
  40. private void SetStaticValue(MessageOfTricker obj)
  41. {
  42. switch (obj.TrickerType) // 参数未设定
  43. {
  44. case TrickerType._1:
  45. coolTime = 10000;
  46. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:TrickerType1";
  47. break;
  48. case TrickerType._2:
  49. coolTime = 20000;
  50. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:TrickerType2";
  51. break;
  52. case TrickerType._3:
  53. coolTime = 30000;
  54. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:TrickerType3";
  55. break;
  56. case TrickerType._4:
  57. coolTime = 40000;
  58. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:TrickerType4";
  59. break;
  60. case TrickerType.NullTrickerType:
  61. coolTime = 10000;
  62. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:NullTrickerType";
  63. break;
  64. }
  65. initialized = true;
  66. }
  67. private void SetDynamicValue(MessageOfTricker obj)
  68. {
  69. skillprogress.Value = 100 - obj.TimeUntilSkillAvailable / coolTime * 100;
  70. if (!obj.Movable) // 认为movable为真时可动
  71. {
  72. skillprogress.Value = 0;
  73. skillprogress.Background = Brushes.Gray;
  74. }
  75. else
  76. skillprogress.Background = Brushes.White;
  77. // star.Text = "⭐:";不知道要放什么
  78. status.Text = "🏹:" + Convert.ToString(1) + "\n🏃:" + Convert.ToString(obj.Speed) + "\n🤺:" + Convert.ToString(2) + "\n🗡:" + Convert.ToString(obj.Damage);
  79. scores.Text = "Scores:" + Convert.ToString(0);
  80. foreach(var icon in obj.Prop)
  81. {
  82. switch (icon)
  83. {
  84. case PropType.Ptype1:
  85. prop.Text = "🔧";
  86. break;
  87. case PropType.Ptype2:
  88. prop.Text = "🛡";
  89. break;
  90. case PropType.Ptype3:
  91. prop.Text = "♥";
  92. break;
  93. case PropType.Ptype4:
  94. prop.Text = "⛸";
  95. break;
  96. default:
  97. prop.Text = " ";
  98. break;
  99. }
  100. }
  101. }
  102. public void SetValue(MessageOfTricker obj)
  103. {
  104. if (!initialized)
  105. SetStaticValue(obj);
  106. SetDynamicValue(obj);
  107. }
  108. private int coolTime;
  109. private bool initialized;
  110. }
  111. }