|
|
|
@@ -34,8 +34,6 @@ namespace Client |
|
|
|
{ |
|
|
|
public MainWindow() |
|
|
|
{ |
|
|
|
unitHeight = unitWidth = unit = 13; |
|
|
|
bonusflag = true; |
|
|
|
timer = new DispatcherTimer |
|
|
|
{ |
|
|
|
Interval = new TimeSpan(50000) // 每50ms刷新一次 |
|
|
|
@@ -60,6 +58,10 @@ namespace Client |
|
|
|
listOfGate = new List<MessageOfGate>(); |
|
|
|
listOfHiddenGate = new List<MessageOfHiddenGate>(); |
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
|
unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50; |
|
|
|
unitFontsize = unit / 13; |
|
|
|
unitHeight = UpperLayerOfMap.ActualHeight / 50; |
|
|
|
unitWidth = UpperLayerOfMap.ActualWidth / 50; |
|
|
|
ReactToCommandline(); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -194,6 +196,7 @@ namespace Client |
|
|
|
0 => PlayerType.NullPlayerType, |
|
|
|
1 => PlayerType.StudentPlayer, |
|
|
|
2 => PlayerType.TrickerPlayer, |
|
|
|
_ => PlayerType.NullPlayerType |
|
|
|
}; |
|
|
|
playerMsg.PlayerType = playerType; |
|
|
|
if (Convert.ToInt64(comInfo[3]) == 1) |
|
|
|
@@ -268,9 +271,9 @@ namespace Client |
|
|
|
{ |
|
|
|
TextBox icon = new() |
|
|
|
{ |
|
|
|
FontSize = 10, |
|
|
|
Width = 20, |
|
|
|
Height = 20, |
|
|
|
FontSize = 7 * unitFontsize, |
|
|
|
Width = unitWidth, |
|
|
|
Height = unitHeight, |
|
|
|
Text = text, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Left, |
|
|
|
VerticalAlignment = VerticalAlignment.Top, |
|
|
|
@@ -282,37 +285,23 @@ namespace Client |
|
|
|
UpperLayerOfMap.Children.Add(icon); |
|
|
|
} |
|
|
|
|
|
|
|
private void ZoomMap() |
|
|
|
{ |
|
|
|
for (int i = 0; i < 50; i++) |
|
|
|
{ |
|
|
|
for (int j = 0; j < 50; j++) |
|
|
|
{ |
|
|
|
if (mapPatches[i, j] != null && (mapPatches[i, j].Width != UpperLayerOfMap.ActualWidth / 50 || mapPatches[i, j].Height != UpperLayerOfMap.ActualHeight / 50)) |
|
|
|
{ |
|
|
|
mapPatches[i, j].Width = UpperLayerOfMap.ActualWidth / 50; |
|
|
|
mapPatches[i, j].Height = UpperLayerOfMap.ActualHeight / 50; |
|
|
|
mapPatches[i, j].HorizontalAlignment = HorizontalAlignment.Left; |
|
|
|
mapPatches[i, j].VerticalAlignment = VerticalAlignment.Top; |
|
|
|
mapPatches[i, j].Margin = new Thickness(UpperLayerOfMap.ActualWidth / 50 * j, UpperLayerOfMap.ActualHeight / 50 * i, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void ZoomMapAtFirst() |
|
|
|
private void ZoomMap(object sender, SizeChangedEventArgs e) |
|
|
|
{ |
|
|
|
unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50; |
|
|
|
unitFontsize = unit / 13; |
|
|
|
unitHeight = UpperLayerOfMap.ActualHeight / 50; |
|
|
|
unitWidth = UpperLayerOfMap.ActualWidth / 50; |
|
|
|
for (int i = 0; i < 50; i++) |
|
|
|
{ |
|
|
|
for (int j = 0; j < 50; j++) |
|
|
|
{ |
|
|
|
if (mapPatches[i, j] != null) |
|
|
|
{ |
|
|
|
mapPatches[i, j].Width = UpperLayerOfMap.ActualWidth / 50; |
|
|
|
mapPatches[i, j].Height = UpperLayerOfMap.ActualHeight / 50; |
|
|
|
mapPatches[i, j].Width = unitWidth; |
|
|
|
mapPatches[i, j].Height = unitHeight; |
|
|
|
mapPatches[i, j].HorizontalAlignment = HorizontalAlignment.Left; |
|
|
|
mapPatches[i, j].VerticalAlignment = VerticalAlignment.Top; |
|
|
|
mapPatches[i, j].Margin = new Thickness(UpperLayerOfMap.ActualWidth / 50 * j, UpperLayerOfMap.ActualHeight / 50 * i, 0, 0); |
|
|
|
mapPatches[i, j].Margin = new Thickness(unitWidth * j, unitHeight * i, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -330,7 +319,7 @@ namespace Client |
|
|
|
Height = unitHeight, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Left, |
|
|
|
VerticalAlignment = VerticalAlignment.Top, |
|
|
|
Margin = new Thickness(Width * (j), Height * (i), 0, 0) |
|
|
|
Margin = new Thickness(unitWidth * j, unitHeight * i, 0, 0)//unitWidth cannot be replaced by Width |
|
|
|
}; |
|
|
|
switch (defaultMap[i, j]) |
|
|
|
{ |
|
|
|
@@ -697,7 +686,7 @@ namespace Client |
|
|
|
MaxButton.Content = "🗖"; |
|
|
|
foreach (var obj in listOfHuman) |
|
|
|
{ |
|
|
|
if (obj.PlayerId < GameData.numOfStudent && obj.StudentType != StudentType.Robot) |
|
|
|
if (!isDataFixed[obj.PlayerId] && obj.PlayerId < GameData.numOfStudent && obj.StudentType != StudentType.Robot) |
|
|
|
{ |
|
|
|
IStudentType occupation = (IStudentType)OccupationFactory.FindIOccupation(Transformation.ToStudentType(obj.StudentType)); |
|
|
|
totalLife[obj.PlayerId] = occupation.MaxHp; |
|
|
|
@@ -709,60 +698,52 @@ namespace Client |
|
|
|
coolTime[i, obj.PlayerId] = iActiveSkill.SkillCD; |
|
|
|
++i; |
|
|
|
} |
|
|
|
isDataFixed[obj.PlayerId] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (var obj in listOfButcher) |
|
|
|
{ |
|
|
|
IGhostType occupation1 = (IGhostType)OccupationFactory.FindIOccupation(Transformation.ToTrickerType(obj.TrickerType)); |
|
|
|
int j = 0; |
|
|
|
foreach (var skill in occupation1.ListOfIActiveSkill) |
|
|
|
if (!isDataFixed[obj.PlayerId]) |
|
|
|
{ |
|
|
|
var iActiveSkill = SkillFactory.FindIActiveSkill(skill); |
|
|
|
coolTime[j, GameData.numOfStudent] = iActiveSkill.SkillCD; |
|
|
|
++j; |
|
|
|
IGhostType occupation1 = (IGhostType)OccupationFactory.FindIOccupation(Transformation.ToTrickerType(obj.TrickerType)); |
|
|
|
int j = 0; |
|
|
|
foreach (var skill in occupation1.ListOfIActiveSkill) |
|
|
|
{ |
|
|
|
var iActiveSkill = SkillFactory.FindIActiveSkill(skill); |
|
|
|
coolTime[j, GameData.numOfStudent] = iActiveSkill.SkillCD; |
|
|
|
++j; |
|
|
|
} |
|
|
|
isDataFixed[obj.PlayerId] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (StatusBarsOfSurvivor != null) |
|
|
|
{ |
|
|
|
for (int i = 0; i < GameData.numOfStudent; i++) |
|
|
|
{ |
|
|
|
StatusBarsOfSurvivor[i].SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650); |
|
|
|
StatusBarsOfSurvivor[i].NewData(totalLife, totalDeath, coolTime); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StatusBarsOfHunter != null) |
|
|
|
{ |
|
|
|
StatusBarsOfHunter.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650); |
|
|
|
StatusBarsOfHunter.NewData(totalLife, totalDeath, coolTime); |
|
|
|
} |
|
|
|
if (StatusBarsOfCircumstance != null) |
|
|
|
StatusBarsOfCircumstance.SetFontSize(12 * UpperLayerOfMap.ActualHeight / 650); |
|
|
|
// 完成窗口信息更新 |
|
|
|
if (StatusBarsOfSurvivor != null) |
|
|
|
{ |
|
|
|
for (int i = 0; i < GameData.numOfStudent; i++) |
|
|
|
{ |
|
|
|
StatusBarsOfSurvivor[i].SetFontSize(12 * unitFontsize); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StatusBarsOfHunter != null) |
|
|
|
StatusBarsOfHunter.SetFontSize(12 * unitFontsize); |
|
|
|
if (StatusBarsOfCircumstance != null) |
|
|
|
StatusBarsOfCircumstance.SetFontSize(12 * unitFontsize); |
|
|
|
if (!isClientStocked) |
|
|
|
{ |
|
|
|
unit = Math.Sqrt(UpperLayerOfMap.ActualHeight * UpperLayerOfMap.ActualWidth) / 50; |
|
|
|
unitHeight = UpperLayerOfMap.ActualHeight / 50; |
|
|
|
unitWidth = UpperLayerOfMap.ActualWidth / 50; |
|
|
|
try |
|
|
|
{ |
|
|
|
// if (log != null) |
|
|
|
//{ |
|
|
|
// string temp = ""; |
|
|
|
// for (int i = 0; i < dataDict[GameObjType.Character].Count; i++) |
|
|
|
// { |
|
|
|
// temp += Convert.ToString(dataDict[GameObjType.Character][i].MessageOfCharacter.TeamID) + "\n"; |
|
|
|
// } |
|
|
|
// log.Content = temp; |
|
|
|
// } |
|
|
|
UpperLayerOfMap.Children.Clear(); |
|
|
|
// if ((communicator == null || !communicator.Client.IsConnected) && !isPlaybackMode) |
|
|
|
//{ |
|
|
|
// UnderLayerOfMap.Children.Clear(); |
|
|
|
// throw new Exception("Client is unconnected."); |
|
|
|
// } |
|
|
|
// else |
|
|
|
//{ |
|
|
|
|
|
|
|
foreach (var data in listOfAll) |
|
|
|
{ |
|
|
|
StatusBarsOfCircumstance.SetValue(data, gateOpened, isEmergencyDrawed, isEmergencyOpened, playerID, isPlaybackMode); |
|
|
|
@@ -770,7 +751,6 @@ namespace Client |
|
|
|
if (!hasDrawed && mapFlag) |
|
|
|
{ |
|
|
|
DrawMap(); |
|
|
|
ZoomMapAtFirst(); |
|
|
|
} |
|
|
|
foreach (var data in listOfHuman) |
|
|
|
{ |
|
|
|
@@ -791,7 +771,7 @@ namespace Client |
|
|
|
icon.Fill = Brushes.Gray; |
|
|
|
TextBox num = new() |
|
|
|
{ |
|
|
|
FontSize = 7 * UpperLayerOfMap.ActualHeight / 650, |
|
|
|
FontSize = 7 * unitFontsize, |
|
|
|
Width = 2 * radiusTimes * unitWidth, |
|
|
|
Height = 2 * radiusTimes * unitHeight, |
|
|
|
Text = Convert.ToString(data.PlayerId), |
|
|
|
@@ -943,7 +923,7 @@ namespace Client |
|
|
|
int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfFixedGenerator); |
|
|
|
TextBox icon = new() |
|
|
|
{ |
|
|
|
FontSize = 8 * UpperLayerOfMap.ActualHeight / 650, |
|
|
|
FontSize = 8 * unitFontsize, |
|
|
|
Width = unitWidth, |
|
|
|
Height = unitHeight, |
|
|
|
Text = Convert.ToString(deg), |
|
|
|
@@ -965,7 +945,7 @@ namespace Client |
|
|
|
int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedChest); |
|
|
|
TextBox icon = new() |
|
|
|
{ |
|
|
|
FontSize = 8 * UpperLayerOfMap.ActualHeight / 650, |
|
|
|
FontSize = 8 * unitFontsize, |
|
|
|
Width = unitWidth, |
|
|
|
Height = unitHeight, |
|
|
|
Text = Convert.ToString(deg), |
|
|
|
@@ -987,7 +967,7 @@ namespace Client |
|
|
|
int deg = (int)(100.0 * data.Progress / Preparation.Utility.GameData.degreeOfOpenedDoorway); |
|
|
|
TextBox icon = new() |
|
|
|
{ |
|
|
|
FontSize = 8 * UpperLayerOfMap.ActualHeight / 650, |
|
|
|
FontSize = 8 * unitFontsize, |
|
|
|
Width = unitWidth, |
|
|
|
Height = unitHeight, |
|
|
|
Text = Convert.ToString(deg), |
|
|
|
@@ -1009,7 +989,7 @@ namespace Client |
|
|
|
{ |
|
|
|
TextBox icon = new() |
|
|
|
{ |
|
|
|
FontSize = 9 * UpperLayerOfMap.ActualHeight / 650, |
|
|
|
FontSize = 9 * unitFontsize, |
|
|
|
Width = unitWidth, |
|
|
|
Height = unitHeight, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Left, |
|
|
|
@@ -1042,7 +1022,7 @@ namespace Client |
|
|
|
isEmergencyOpened = true; |
|
|
|
TextBox icon = new() |
|
|
|
{ |
|
|
|
FontSize = 9 * UpperLayerOfMap.ActualHeight / 650, |
|
|
|
FontSize = 9 * unitFontsize, |
|
|
|
Width = unitWidth, |
|
|
|
Height = unitHeight, |
|
|
|
Text = Convert.ToString("🔓"), |
|
|
|
@@ -1056,8 +1036,6 @@ namespace Client |
|
|
|
UpperLayerOfMap.Children.Add(icon); |
|
|
|
} |
|
|
|
} |
|
|
|
//} |
|
|
|
ZoomMap(); |
|
|
|
} |
|
|
|
catch (Exception exc) |
|
|
|
{ |
|
|
|
@@ -1440,7 +1418,6 @@ namespace Client |
|
|
|
private MessageOfTricker? butcher = null; |
|
|
|
private bool humanOrButcher;//true for human |
|
|
|
|
|
|
|
private bool bonusflag; |
|
|
|
private bool mapFlag = false; |
|
|
|
private bool hasDrawed = false; |
|
|
|
public int[,] defaultMap = new int[,] { |
|
|
|
@@ -1502,7 +1479,8 @@ namespace Client |
|
|
|
bool isSpectatorMode = false; |
|
|
|
bool isEmergencyOpened = false; |
|
|
|
bool isEmergencyDrawed = false; |
|
|
|
bool isDataFixed = false; |
|
|
|
bool[] isDataFixed = new bool[5] { false, false, false, false, false }; |
|
|
|
double unitFontsize = 10; |
|
|
|
const double radiusTimes = 1.0 * Preparation.Utility.GameData.characterRadius / Preparation.Utility.GameData.numOfPosGridPerCell; |
|
|
|
const double bulletRadiusTimes = 1.0 * GameData.bulletRadius / Preparation.Utility.GameData.numOfPosGridPerCell; |
|
|
|
private int[] totalLife = new int[4] { 100, 100, 100, 100 }, totalDeath = new int[4] { 100, 100, 100, 100 }; |
|
|
|
|