Browse Source

fix: 🐛 fix the bug caused by frequent refresh of map

fix the bug caused by frequent refresh of map
tags/0.1.0
Shawqeem 2 years ago
parent
commit
0b77d514c7
3 changed files with 15 additions and 9 deletions
  1. +1
    -1
      CAPI/cpp/API/src/AI.cpp
  2. +13
    -7
      logic/Client/MainWindow.xaml.cs
  3. +1
    -1
      logic/cmd/playback.cmd

+ 1
- 1
CAPI/cpp/API/src/AI.cpp View File

@@ -3,7 +3,7 @@
#include <array> #include <array>
#include "AI.h" #include "AI.h"
#include "constants.h" #include "constants.h"
//注意不要使用conio.h,Windows.h等非标准库
// 注意不要使用conio.h,Windows.h等非标准库


// 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新 // 为假则play()期间确保游戏状态不更新,为真则只保证游戏状态在调用相关方法时不更新
extern const bool asynchronous = false; extern const bool asynchronous = false;


+ 13
- 7
logic/Client/MainWindow.xaml.cs View File

@@ -288,7 +288,7 @@ namespace Client
{ {
for (int j = 0; j < 50; j++) for (int j = 0; j < 50; j++)
{ {
if (mapPatches[i, j] != null)
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].Width = UpperLayerOfMap.ActualWidth / 50;
mapPatches[i, j].Height = UpperLayerOfMap.ActualHeight / 50; mapPatches[i, j].Height = UpperLayerOfMap.ActualHeight / 50;
@@ -299,6 +299,7 @@ namespace Client
} }
} }
} }

private void DrawMap() private void DrawMap()
{ {
for (int i = 0; i < defaultMap.GetLength(0); i++) for (int i = 0; i < defaultMap.GetLength(0); i++)
@@ -560,7 +561,6 @@ namespace Client
} }
} }


//待修改
private bool CanSee(MessageOfStudent msg) private bool CanSee(MessageOfStudent msg)
{ {
if (msg.PlayerState == PlayerState.Quit || msg.PlayerState == PlayerState.Graduated) if (msg.PlayerState == PlayerState.Quit || msg.PlayerState == PlayerState.Graduated)
@@ -1037,7 +1037,6 @@ namespace Client
} }
//} //}
ZoomMap(); ZoomMap();

} }
catch (Exception exc) catch (Exception exc)
{ {
@@ -1051,7 +1050,7 @@ namespace Client
} }
} }


// 键盘控制,未完善
// 键盘控制
private void KeyBoardControl(object sender, KeyEventArgs e) private void KeyBoardControl(object sender, KeyEventArgs e)
{ {
if (!isPlaybackMode && !isSpectatorMode) if (!isPlaybackMode && !isSpectatorMode)
@@ -1262,7 +1261,6 @@ namespace Client
} }
} }


// 之后需要修改,现在只具有修改按钮形状的功能,并不能实现暂停/继续
private void ClickToPauseOrContinue(object sender, RoutedEventArgs e) private void ClickToPauseOrContinue(object sender, RoutedEventArgs e)
{ {
if (!isClientStocked) if (!isClientStocked)
@@ -1284,6 +1282,7 @@ namespace Client
} }
} }
} }

// 未复现 // 未复现
private void ClickToConnect(object sender, RoutedEventArgs e) private void ClickToConnect(object sender, RoutedEventArgs e)
{ {
@@ -1297,24 +1296,28 @@ namespace Client
else else
WindowState = WindowState.Normal; WindowState = WindowState.Normal;
} }

private void ClickToClose(object sender, RoutedEventArgs e) private void ClickToClose(object sender, RoutedEventArgs e)
{ {
Application.Current.Shutdown(); Application.Current.Shutdown();
} }

private void ClickToMinimize(object sender, RoutedEventArgs e) private void ClickToMinimize(object sender, RoutedEventArgs e)
{ {
WindowState = WindowState.Minimized; WindowState = WindowState.Minimized;
} }

private void DragWindow(object sender, RoutedEventArgs e) private void DragWindow(object sender, RoutedEventArgs e)
{ {
DragMove(); DragMove();
} }


// 寻求帮助、访问EESAST(部分功能未复
// 寻求帮助、访问EESAST(部分功能未复
private void ClickForHelp(object sender, RoutedEventArgs e) private void ClickForHelp(object sender, RoutedEventArgs e)
{ {
PleaseWait(); PleaseWait();
} }

private void ClickToVisitEESAST(object sender, RoutedEventArgs e) private void ClickToVisitEESAST(object sender, RoutedEventArgs e)
{ {
try try
@@ -1328,12 +1331,13 @@ namespace Client
} }
} }


// 配置连接(未复)、我的AI(THUAI5未实现)、获取更新、天梯信息(可能需要网站协助)
// 配置连接(未复)、我的AI(THUAI5未实现)、获取更新、天梯信息(可能需要网站协助)
private void ClickToSetConnect(object sender, RoutedEventArgs e) private void ClickToSetConnect(object sender, RoutedEventArgs e)
{ {
// ConnectRegister crg = new(); // ConnectRegister crg = new();
// crg.Show(); // crg.Show();
} }

private void ClickToEnterVS(object sender, RoutedEventArgs e) private void ClickToEnterVS(object sender, RoutedEventArgs e)
{ {
// try // try
@@ -1354,10 +1358,12 @@ namespace Client
// } // }
PleaseWait(); PleaseWait();
} }

private void ClickForUpdate(object sender, RoutedEventArgs e) private void ClickForUpdate(object sender, RoutedEventArgs e)
{ {
PleaseWait(); PleaseWait();
} }

private void ClickToCheckLadder(object sender, RoutedEventArgs e) private void ClickToCheckLadder(object sender, RoutedEventArgs e)
{ {
PleaseWait(); PleaseWait();


+ 1
- 1
logic/cmd/playback.cmd View File

@@ -1,5 +1,5 @@
@echo off @echo off


start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --playbackFile .\test.thuaipb --playbackSpeed 2
start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --playbackFile .\longtest.thuaipb --playbackSpeed 4


ping -n 2 127.0.0.1 > NUL ping -n 2 127.0.0.1 > NUL

Loading…
Cancel
Save