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.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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(MessageOfButcher obj)
  41. {
  42. switch (obj.ButcherType) // 参数未设定
  43. {
  44. case ButcherType._1:
  45. coolTime = 10000;
  46. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:ButcherType1";
  47. break;
  48. case ButcherType._2:
  49. coolTime = 20000;
  50. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:ButcherType2";
  51. break;
  52. case ButcherType._3:
  53. coolTime = 30000;
  54. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:ButcherType3";
  55. break;
  56. case ButcherType._4:
  57. coolTime = 40000;
  58. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:ButcherType4";
  59. break;
  60. case ButcherType.NullButcherType:
  61. coolTime = 10000;
  62. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\nSkill:NullButcherType";
  63. break;
  64. }
  65. initialized = true;
  66. }
  67. private void SetDynamicValue(MessageOfButcher 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. switch (obj.Prop)
  81. {
  82. case PropType.Ptype1:
  83. prop.Text = "🔧";
  84. break;
  85. case PropType.Ptype2:
  86. prop.Text = "🛡";
  87. break;
  88. case PropType.Ptype3:
  89. prop.Text = "♥";
  90. break;
  91. case PropType.Ptype4:
  92. prop.Text = "⛸";
  93. break;
  94. default:
  95. prop.Text = " ";
  96. break;
  97. }
  98. }
  99. public void SetValue(MessageOfButcher obj)
  100. {
  101. if (!initialized)
  102. SetStaticValue(obj);
  103. SetDynamicValue(obj);
  104. }
  105. private int coolTime;
  106. private bool initialized;
  107. }
  108. }