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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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) + "\n职业:TrickerType1";
  47. break;
  48. case TrickerType._2:
  49. coolTime = 20000;
  50. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\n职业:TrickerType2";
  51. break;
  52. case TrickerType._3:
  53. coolTime = 30000;
  54. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\n职业:TrickerType3";
  55. break;
  56. case TrickerType._4:
  57. coolTime = 40000;
  58. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\n职业:TrickerType4";
  59. break;
  60. case TrickerType.NullTrickerType:
  61. coolTime = 10000;
  62. serial.Text = "👥" + Convert.ToString(1) + "👻" + Convert.ToString(obj.PlayerId) + "\n职业:NullTrickerType";
  63. break;
  64. }
  65. initialized = true;
  66. }
  67. private void SetDynamicValue(MessageOfTricker obj)
  68. {
  69. if (obj.PlayerState==PlayerState.Stunned)
  70. {
  71. skillprogress.Value = 0;
  72. skillprogress.Background = Brushes.Gray;
  73. }
  74. else
  75. skillprogress.Background = Brushes.White;
  76. // star.Text = "⭐:";不知道要放什么
  77. status.Text = "🏹:" + Convert.ToString(1) + "\n🏃:" + Convert.ToString(obj.Speed) + "\n🤺:" + Convert.ToString(2) + "\n🗡:" + Convert.ToString(obj.Damage);
  78. scores.Text = "Scores:" + Convert.ToString(0);
  79. foreach(var icon in obj.Prop)
  80. {
  81. switch (icon)
  82. {
  83. case PropType.Ptype1:
  84. prop.Text = "🔧";
  85. break;
  86. case PropType.Ptype2:
  87. prop.Text = "🛡";
  88. break;
  89. case PropType.Ptype3:
  90. prop.Text = "♥";
  91. break;
  92. case PropType.Ptype4:
  93. prop.Text = "⛸";
  94. break;
  95. default:
  96. prop.Text = " ";
  97. break;
  98. }
  99. }
  100. }
  101. public void SetValue(MessageOfTricker obj)
  102. {
  103. if (!initialized)
  104. SetStaticValue(obj);
  105. SetDynamicValue(obj);
  106. }
  107. private int coolTime;
  108. private bool initialized;
  109. }
  110. }