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 4.1 kB

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