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.

StatusBarOfCircumstance.xaml.cs 3.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Shapes;
  14. using Protobuf;
  15. namespace Client
  16. {
  17. /// <summary>
  18. /// StatusBarOfCircumstance.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class StatusBarOfCircumstance : UserControl
  21. {
  22. public StatusBarOfCircumstance(Grid parent, int Row, int Column)
  23. {
  24. InitializeComponent();
  25. parent.Children.Add(this);
  26. Grid.SetColumn(this, Column);
  27. Grid.SetColumnSpan(this, 2);
  28. Grid.SetRow(this, Row);
  29. Grid.SetRowSpan(this, 2);
  30. }
  31. public void SetFontSize(double fontsize)
  32. {
  33. status.FontSize = 13 * fontsize / 12;
  34. time.FontSize = 14 * fontsize / 12;
  35. name.FontSize = 14 * fontsize / 12;
  36. scoresOfStudents.FontSize = scoresOfTrickers.FontSize = fontsize;
  37. }
  38. public void SetValue(MessageOfAll obj, bool gateOpened, bool hiddenGateRefreshed, bool hiddenGateOpened, long playerId)
  39. {
  40. int min, sec;
  41. sec = obj.GameTime / 1000;
  42. min = sec / 60;
  43. sec = sec % 60;
  44. time.Text = "Time⏳: " + Convert.ToString(min) + ": ";
  45. if (sec / 10 == 0)
  46. {
  47. time.Text += "0";
  48. time.Text += Convert.ToString(sec);
  49. }
  50. else
  51. {
  52. time.Text += Convert.ToString(sec);
  53. }
  54. if (playerId == 4)
  55. {
  56. name.Text = "🚀 Tricker's";
  57. }
  58. else
  59. {
  60. name.Text = "🚀 Student" + Convert.ToString(playerId) + "'s";
  61. }
  62. if (obj.SubjectFinished < Preparation.Utility.GameData.numOfGeneratorRequiredForRepair)
  63. {
  64. status.Text = "📱: " + Convert.ToString(obj.SubjectFinished) + "\n🚪: ";
  65. }
  66. else
  67. {
  68. status.Text = "📱: Gate can be opened" + "\n🚪: ";
  69. }
  70. if (gateOpened)
  71. {
  72. status.Text += "Open\n🆘: ";
  73. }
  74. else
  75. {
  76. status.Text += "Close\n🆘: ";
  77. }
  78. //if (obj.SubjectFinished >= Preparation.Utility.GameData.numOfGeneratorRequiredForEmergencyExit)
  79. //{
  80. // hiddenGateRefreshed = true;
  81. //}
  82. //if (Preparation.Utility.GameData.numOfStudent == 1 + obj.StudentQuited + obj.StudentGraduated)
  83. //{
  84. // hiddenGateOpened = true;
  85. //}
  86. if (hiddenGateRefreshed)
  87. {
  88. if (hiddenGateOpened)
  89. {
  90. status.Text += "Open\n🏃: ";
  91. }
  92. else
  93. {
  94. status.Text += "Refreshed\n🏃: ";
  95. }
  96. }
  97. else
  98. {
  99. status.Text += "Unrefreshed\n🏃: ";
  100. }
  101. status.Text += Convert.ToString(obj.StudentGraduated) + "\n⚰️: ";
  102. status.Text += Convert.ToString(obj.StudentQuited);
  103. scoresOfStudents.Text = "Scores of Students: " + Convert.ToString(obj.StudentScore);
  104. scoresOfTrickers.Text = "Scores of Tricker: " + Convert.ToString(obj.TrickerScore);
  105. }
  106. }
  107. }