diff --git a/ImaginWorld/DLC/FinalTown/Music/AdvantageIsMine.mp3 b/ImaginWorld/DLC/FinalTown/Music/AdvantageIsMine.mp3 deleted file mode 100644 index 6680134..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/AdvantageIsMine.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/BookTower.mp3 b/ImaginWorld/DLC/FinalTown/Music/BookTower.mp3 deleted file mode 100644 index 69b0bc4..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/BookTower.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/EmptyCityEchoe.mp3 b/ImaginWorld/DLC/FinalTown/Music/EmptyCityEchoe.mp3 deleted file mode 100644 index 14bcf1d..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/EmptyCityEchoe.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/EmptySnowfield.mp3 b/ImaginWorld/DLC/FinalTown/Music/EmptySnowfield.mp3 deleted file mode 100644 index fe7bac6..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/EmptySnowfield.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/Endding1.mp3 b/ImaginWorld/DLC/FinalTown/Music/Endding1.mp3 deleted file mode 100644 index 6b42fa3..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/Endding1.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/FantasyForest.mp3 b/ImaginWorld/DLC/FinalTown/Music/FantasyForest.mp3 deleted file mode 100644 index 41412a5..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/FantasyForest.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/FluorescentMushrooms.mp3 b/ImaginWorld/DLC/FinalTown/Music/FluorescentMushrooms.mp3 deleted file mode 100644 index 2112cd3..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/FluorescentMushrooms.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/FrostWind.mp3 b/ImaginWorld/DLC/FinalTown/Music/FrostWind.mp3 deleted file mode 100644 index 3660a16..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/FrostWind.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/MidnightLight.mp3 b/ImaginWorld/DLC/FinalTown/Music/MidnightLight.mp3 deleted file mode 100644 index 40076e4..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/MidnightLight.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/OceanDrifting.mp3 b/ImaginWorld/DLC/FinalTown/Music/OceanDrifting.mp3 deleted file mode 100644 index 923102f..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/OceanDrifting.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/PowerfulEnemy.mp3 b/ImaginWorld/DLC/FinalTown/Music/PowerfulEnemy.mp3 deleted file mode 100644 index 2d476c4..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/PowerfulEnemy.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/ProsperousTown.mp3 b/ImaginWorld/DLC/FinalTown/Music/ProsperousTown.mp3 deleted file mode 100644 index c116bb9..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/ProsperousTown.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/QuickVictory.mp3 b/ImaginWorld/DLC/FinalTown/Music/QuickVictory.mp3 deleted file mode 100644 index f16ea36..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/QuickVictory.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/SilenceRain.mp3 b/ImaginWorld/DLC/FinalTown/Music/SilenceRain.mp3 deleted file mode 100644 index 41affab..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/SilenceRain.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/StarlitFade.mp3 b/ImaginWorld/DLC/FinalTown/Music/StarlitFade.mp3 deleted file mode 100644 index 8008804..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/StarlitFade.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/TimeIsOfTheEssence.mp3 b/ImaginWorld/DLC/FinalTown/Music/TimeIsOfTheEssence.mp3 deleted file mode 100644 index fde550a..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/TimeIsOfTheEssence.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/TotalWar.mp3 b/ImaginWorld/DLC/FinalTown/Music/TotalWar.mp3 deleted file mode 100644 index 664efc7..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/TotalWar.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/UnderseaRuins.mp3 b/ImaginWorld/DLC/FinalTown/Music/UnderseaRuins.mp3 deleted file mode 100644 index 2852c74..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/UnderseaRuins.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/WanderingMusic.mp3 b/ImaginWorld/DLC/FinalTown/Music/WanderingMusic.mp3 deleted file mode 100644 index 4683717..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/WanderingMusic.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/WarmHome.mp3 b/ImaginWorld/DLC/FinalTown/Music/WarmHome.mp3 deleted file mode 100644 index 2ca87ab..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/WarmHome.mp3 and /dev/null differ diff --git a/ImaginWorld/DLC/FinalTown/Music/WhispersMist.mp3 b/ImaginWorld/DLC/FinalTown/Music/WhispersMist.mp3 deleted file mode 100644 index 2425539..0000000 Binary files a/ImaginWorld/DLC/FinalTown/Music/WhispersMist.mp3 and /dev/null differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\344\270\200\347\261\273\346\230\237\344\275\223.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\344\270\200\347\261\273\346\230\237\344\275\223.mp3" new file mode 100644 index 0000000..31e31a2 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\344\270\200\347\261\273\346\230\237\344\275\223.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\344\270\200\350\247\246\345\215\263\345\217\221.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\344\270\200\350\247\246\345\215\263\345\217\221.mp3" new file mode 100644 index 0000000..b229def Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\344\270\200\350\247\246\345\215\263\345\217\221.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\345\205\250\351\235\242\346\210\230\344\272\211.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\345\205\250\351\235\242\346\210\230\344\272\211.mp3" new file mode 100644 index 0000000..0130eac Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\345\205\250\351\235\242\346\210\230\344\272\211.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\345\207\273\347\240\264\345\274\272\346\225\214.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\345\207\273\347\240\264\345\274\272\346\225\214.mp3" new file mode 100644 index 0000000..fdf8bbe Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\345\207\273\347\240\264\345\274\272\346\225\214.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\345\245\207\345\271\273\346\243\256\346\236\227.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\345\245\207\345\271\273\346\243\256\346\236\227.mp3" new file mode 100644 index 0000000..eb09651 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\345\245\207\345\271\273\346\243\256\346\236\227.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\345\267\247\345\205\213\345\212\233\347\263\226.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\345\267\247\345\205\213\345\212\233\347\263\226.mp3" new file mode 100644 index 0000000..b2f1bbb Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\345\267\247\345\205\213\345\212\233\347\263\226.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\346\265\267\346\264\213\346\274\202\346\265\201.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\346\265\267\346\264\213\346\274\202\346\265\201.mp3" new file mode 100644 index 0000000..17c169b Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\346\265\267\346\264\213\346\274\202\346\265\201.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\346\270\251\346\232\226\347\232\204\345\256\266.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\346\270\251\346\232\226\347\232\204\345\256\266.mp3" new file mode 100644 index 0000000..c88c441 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\346\270\251\346\232\226\347\232\204\345\256\266.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\346\270\251\351\246\250\345\260\217\351\225\207.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\346\270\251\351\246\250\345\260\217\351\225\207.mp3" new file mode 100644 index 0000000..895557a Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\346\270\251\351\246\250\345\260\217\351\225\207.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\347\250\263\346\255\245\346\216\250\350\277\233.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\347\250\263\346\255\245\346\216\250\350\277\233.mp3" new file mode 100644 index 0000000..0f6b0b9 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\347\250\263\346\255\245\346\216\250\350\277\233.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\347\273\235\345\242\203\351\201\255\351\201\207.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\347\273\235\345\242\203\351\201\255\351\201\207.mp3" new file mode 100644 index 0000000..33c473d Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\347\273\235\345\242\203\351\201\255\351\201\207.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\347\276\244\346\230\237\351\227\252\350\200\200.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\347\276\244\346\230\237\351\227\252\350\200\200.mp3" new file mode 100644 index 0000000..cf3068d Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\347\276\244\346\230\237\351\227\252\350\200\200.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\203\234\345\210\270\345\234\250\346\217\241.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\203\234\345\210\270\345\234\250\346\217\241.mp3" new file mode 100644 index 0000000..15c273e Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\203\234\345\210\270\345\234\250\346\217\241.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\215\247\345\205\211\350\230\221\350\217\207.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\215\247\345\205\211\350\230\221\350\217\207.mp3" new file mode 100644 index 0000000..bebcb18 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\215\247\345\205\211\350\230\221\350\217\207.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\220\275\346\227\245\344\275\231\346\231\226.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\220\275\346\227\245\344\275\231\346\231\226.mp3" new file mode 100644 index 0000000..750df58 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\220\275\346\227\245\344\275\231\346\231\226.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\227\217\344\271\246\351\253\230\345\241\224.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\227\217\344\271\246\351\253\230\345\241\224.mp3" new file mode 100644 index 0000000..c0595c6 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\227\217\344\271\246\351\253\230\345\241\224.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\231\232\347\251\272\350\276\271\347\274\230.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\231\232\347\251\272\350\276\271\347\274\230.mp3" new file mode 100644 index 0000000..687a714 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\231\232\347\251\272\350\276\271\347\274\230.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\260\234\351\242\230\347\216\204\346\234\272.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\260\234\351\242\230\347\216\204\346\234\272.mp3" new file mode 100644 index 0000000..92b0c39 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\260\234\351\242\230\347\216\204\346\234\272.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\350\260\242\345\271\225.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\350\260\242\345\271\225.mp3" new file mode 100644 index 0000000..7b93d36 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\350\260\242\345\271\225.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\351\201\227\345\277\230\345\272\237\345\242\237.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\351\201\227\345\277\230\345\272\237\345\242\237.mp3" new file mode 100644 index 0000000..538f459 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\351\201\227\345\277\230\345\272\237\345\242\237.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\351\232\217\351\243\216\351\243\230\350\215\241.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\351\232\217\351\243\216\351\243\230\350\215\241.mp3" new file mode 100644 index 0000000..73eddde Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\351\232\217\351\243\216\351\243\230\350\215\241.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\351\233\250\346\273\264\346\267\205\346\262\245.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\351\233\250\346\273\264\346\267\205\346\262\245.mp3" new file mode 100644 index 0000000..b5dcabe Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\351\233\250\346\273\264\346\267\205\346\262\245.mp3" differ diff --git "a/ImaginWorld/DLC/FinalTown/Music/\351\234\234\345\206\273\345\257\222\351\243\216.mp3" "b/ImaginWorld/DLC/FinalTown/Music/\351\234\234\345\206\273\345\257\222\351\243\216.mp3" new file mode 100644 index 0000000..34a8801 Binary files /dev/null and "b/ImaginWorld/DLC/FinalTown/Music/\351\234\234\345\206\273\345\257\222\351\243\216.mp3" differ diff --git "a/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257.vb" "b/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257.vb" index 96d2263..56ea6a1 100644 --- "a/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257.vb" +++ "b/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257.vb" @@ -12,12 +12,13 @@ Public Class 客户端 Public Shared Property 是否收到响应 As Boolean = False Public Shared Sub 启动客户端(服务器IP As String, 服务器端口 As String) + 是否正在运行 = True + 是否收到响应 = False UDP客户端 = New UdpClient() 服务器地址 = New IPEndPoint(IPAddress.Parse(服务器IP), 服务器端口) 取消令牌源 = New CancellationTokenSource() 监听任务 = Task.Run(AddressOf 监听消息, 取消令牌源.Token) - 是否正在运行 = True - 是否收到响应 = False + UDP客户端.Client.ReceiveTimeout = 10000 End Sub Public Shared Sub 监听消息() @@ -31,6 +32,7 @@ Public Class 客户端 DebugPrint(ex.Message, Color.Tomato) End Try End While + UI同步上下文.Post(Sub() DebugPrint("客户端消息处理线程已停止运行", Color.Tomato), Nothing) End Sub Public Shared Sub 发送消息(message As List(Of String)) diff --git "a/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257\347\232\204\346\266\210\346\201\257\345\223\215\345\272\224.vb" "b/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257\347\232\204\346\266\210\346\201\257\345\223\215\345\272\224.vb" index 483e59e..89cacf7 100644 --- "a/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257\347\232\204\346\266\210\346\201\257\345\223\215\345\272\224.vb" +++ "b/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\345\256\242\346\210\267\347\253\257\347\232\204\346\266\210\346\201\257\345\223\215\345\272\224.vb" @@ -1,6 +1,4 @@  -Imports System.Net - Public Class 客户端的消息响应 Public Shared Property 消息字典 As New Dictionary(Of String, Action(Of List(Of String))) @@ -9,6 +7,8 @@ Public Class 客户端的消息响应 消息字典.Add("iw_sever_message", AddressOf 收到弹出式消息) 消息字典.Add("iw_sever_playerlist", AddressOf 收到多人模式空位列表) 消息字典.Add("iw_sever_powerdown", AddressOf 收到服务器已停止运行) + 消息字典.Add("iw_sever_remove", AddressOf 收到服务器移出此设备) + 消息字典.Add("iw_sever_ban", AddressOf 收到服务器封禁此设备) DebugPrint($"客户端消息响应初始化完成,共计 {消息字典.Count } 个消息处理方法", Color.CornflowerBlue) End Sub @@ -28,22 +28,46 @@ Public Class 客户端的消息响应 End Sub Public Shared Sub 收到弹出式消息(消息 As List(Of String)) - Dim a1 As New 多项单选对话框($"收到弹出式消息", {"OK"}, 消息.Last) - a1.ShowDialog(Form1) + UI同步上下文.Post(Sub() + Dim a1 As New 多项单选对话框($"收到弹出式消息", {"OK"}, 消息.Last) + a1.ShowDialog(Form1) + End Sub, Nothing) End Sub Public Shared Sub 收到多人模式空位列表(消息 As List(Of String)) 客户端.是否收到响应 = True - Dim a1 As New 多项单选对话框($"收到了多人模式玩家空位信息", {"OK"}, "假设这里是那个界面,因为还没做所以先用这个对话框代替",, 500) - a1.ShowDialog(Form1) + UI同步上下文.Post(Sub() + Dim a1 As New 多项单选对话框($"连接成功,现在选择角色", {"OK"}, "因为还没做,所以先用这个对话框顶一下", 300, 500) + a1.ShowDialog(Form1) + 界面控制.切换界面(界面控制.主界面图层.主层, New 界面主层_殖民地) + End Sub, Nothing) End Sub Public Shared Sub 收到服务器已停止运行(消息 As List(Of String)) 客户端.停止客户端() - Dim a1 As New 多项单选对话框($"断开连接", {"OK"}, "服务器已停止运行,自动返回主菜单") - a1.ShowDialog(Form1) - Form1.重新创建句柄() - Form1.Invoke(Sub() 界面控制.切换界面(界面控制.主界面图层.主层, New 界面主层_主菜单)) + UI同步上下文.Post(Sub() + Dim a1 As New 多项单选对话框($"自动断开连接", {"OK"}, "服务器已停止运行") + a1.ShowDialog(Form1) + Form1.释放所有资源回主菜单() + End Sub, Nothing) + End Sub + + Public Shared Sub 收到服务器移出此设备(消息 As List(Of String)) + 客户端.停止客户端() + UI同步上下文.Post(Sub() + Dim a1 As New 多项单选对话框($"主动断开连接", {"OK"}, "你已被服务器移出") + a1.ShowDialog(Form1) + Form1.释放所有资源回主菜单() + End Sub, Nothing) + End Sub + + Public Shared Sub 收到服务器封禁此设备(消息 As List(Of String)) + 客户端.停止客户端() + UI同步上下文.Post(Sub() + Dim a1 As New 多项单选对话框($"强制断开连接", {"OK"}, "你已被服务器封禁") + a1.ShowDialog(Form1) + Form1.释放所有资源回主菜单() + End Sub, Nothing) End Sub End Class diff --git "a/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\346\234\215\345\212\241\345\231\250.vb" "b/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\346\234\215\345\212\241\345\231\250.vb" index 2116348..5f0574c 100644 --- "a/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\346\234\215\345\212\241\345\231\250.vb" +++ "b/ImaginWorld/\345\244\232\344\272\272\346\270\270\346\210\217/\346\234\215\345\212\241\345\231\250.vb" @@ -1,7 +1,10 @@ -Imports System.Net +Imports System.IO +Imports System.Net Imports System.Net.Sockets Imports System.Text Imports System.Threading +Imports System.Text.Json +Imports Microsoft.VisualBasic.FileIO.FileSystem Public Class 服务器 Public Shared Property UDP广播 As UdpClient @@ -22,9 +25,8 @@ Public Class 服务器 Public Shared Property 是否允许新地址加入 As Boolean = False Public Shared Property 自动踢出延迟 As Integer = Integer.MaxValue Public Shared Property 自动开始广播 As Boolean = False - Public Shared Property 是否启用广播 As Boolean = False - Public Shared Property 保留的客户端列表 As New List(Of IPEndPoint) - Public Shared Property 黑名单 As New List(Of IPEndPoint) + Public Shared Property 保留的客户端列表 As New List(Of String) + Public Shared Property 黑名单 As New List(Of String) Public Shared Property 开放单人数据位 As Boolean = False Public Shared Property 已发送字节 As Long = 0 @@ -43,7 +45,7 @@ Public Class 服务器 Public Property 心跳包接收时间 As Date = Nothing Public Property 连续超时次数 As Integer = 0 Public Property 玩家对象名称 As String = "" - Public Property 玩家所在主场景 As String = "在选择玩家界面" + Public Property 玩家所在主场景 As String = "等待角色选择" End Class Enum 玩家权限类型 @@ -54,27 +56,32 @@ Public Class 服务器 Public Shared Sub 启动服务器() Try + 是否正在运行 = True UDP广播 = New UdpClient() - 取消广播任务令牌源 = New CancellationTokenSource() + If 自动开始广播 Then + 取消广播任务令牌源 = New CancellationTokenSource() + 广播任务 = Task.Run(AddressOf 广播服务器游戏信息, 取消广播任务令牌源.Token) + End If 取消令牌源 = New CancellationTokenSource() - 广播任务 = Task.Run(AddressOf 广播服务器游戏信息, 取消广播任务令牌源.Token) UDP服务器 = New UdpClient(服务器端口) + UDP服务器.Client.ReceiveTimeout = 10000 For i As Integer = 1 To 响应线程数量 Dim 响应任务 As Task = Task.Run(AddressOf 监听消息, 取消令牌源.Token) 响应任务列表.Add(响应任务) Next + Dim 黑名单文件 = Path.Combine(Application.StartupPath, "PlayerData", "SeverBan.json") + If FileExists(黑名单文件) Then 黑名单 = JsonSerializer.Deserialize(Of List(Of String))(ReadAllText(黑名单文件)) 已发送字节 = 0 已接收字节 = 0 已发送个数 = 0 已接收个数 = 0 最近处理时长.Clear() Ping任务 = Task.Run(AddressOf 计算所有客户端的延迟并发送下一次Ping, 取消令牌源.Token) - 是否正在运行 = True - DebugPrint($"服务器已经启动,地址:{获取本地IPv4()}:{服务器端口}", Color.YellowGreen) + DebugPrint($"服务器已在 {获取本地IPv4()}:{服务器端口} 上启动", Color.YellowGreen) Form服务器.Show() Catch ex As Exception - 停止服务器() DebugPrint(ex.Message, Color.Tomato,, True) + 停止服务器() End Try End Sub @@ -94,7 +101,6 @@ Public Class 服务器 Public Shared Sub 监听消息() While 是否正在运行 AndAlso Not 取消令牌源.Token.IsCancellationRequested - Try Dim 发送者地址 As New IPEndPoint(IPAddress.Any, 服务器端口) Dim 数据_接收到的字节 As Byte() = UDP服务器.Receive(发送者地址) @@ -102,7 +108,7 @@ Public Class 服务器 已接收字节 += 数据_接收到的字节.LongLength 已接收个数 += 1 SyncLock 黑名单 - If 黑名单.Contains(发送者地址) Then + If 黑名单.Contains(发送者地址.Address.ToString) Then 发送消息(发送者地址, New List(Of String) From {"iw_sever_message", "你已被此服务器封禁"}) DebugPrint($"已拒绝黑名单 {发送者地址} 的请求", Color.YellowGreen) Continue While @@ -121,7 +127,7 @@ Public Class 服务器 End If End If Else - If Not 保留的客户端列表.Contains(发送者地址) Then + If Not 保留的客户端列表.Contains(发送者地址.Address.ToString) Then 发送消息(发送者地址, New List(Of String) From {"iw_sever_message", "此服务器已禁止新玩家加入,而您不在设备列表中,所以无法加入此服务器"}) DebugPrint($"已拒绝 {发送者地址} 的请求", Color.YellowGreen) Continue While @@ -140,10 +146,12 @@ Public Class 服务器 最近处理时长.Add(计时器.ElapsedMilliseconds) If 最近处理时长.Count > 10 Then 最近处理时长.RemoveRange(0, 最近处理时长.Count - 10) End SyncLock + Catch ex As SocketException When ex.SocketErrorCode = SocketError.TimedOut Catch ex As Exception DebugPrint(ex.Message, Color.Tomato) End Try End While + UI同步上下文.Post(Sub() DebugPrint("服务器消息处理线程已停止运行", Color.Tomato), Nothing) End Sub Public Shared Sub 发送消息(IP As IPEndPoint, message As List(Of String)) @@ -159,15 +167,21 @@ Public Class 服务器 End Try End Sub - Shared ReadOnly 心跳包数据 As Byte() = Encoding.UTF8.GetBytes(String.Join("", {"iw_sever_ping", ""})) + Shared ReadOnly 心跳包数据 As Byte() = Encoding.UTF8.GetBytes(String.Join("", {"iw_sever_ping"})) Public Shared Sub 计算所有客户端的延迟并发送下一次Ping() While 是否正在运行 AndAlso Not 取消令牌源.Token.IsCancellationRequested For Each 客户端信息 In 客户端列表 Dim 延迟 As Integer = (客户端信息.Value.心跳包接收时间 - 客户端信息.Value.心跳包发送时间).Milliseconds - 客户端信息.Value.延迟 = 延迟 - If 客户端信息.Value.延迟 > 自动踢出延迟 Then + + If 延迟 < 0 Then + 客户端信息.Value.延迟 = Integer.MaxValue + Else + 客户端信息.Value.延迟 = 延迟 + End If + + If 客户端信息.Value.延迟 >= 自动踢出延迟 Then 客户端信息.Value.连续超时次数 += 1 If 客户端信息.Value.连续超时次数 >= 10 Then 客户端列表.Remove(客户端信息.Key) @@ -204,8 +218,10 @@ Public Class 服务器 End Sub Public Shared Async Sub 停止服务器() + DebugPrint("已开始进行服务器停止流程,网络上的任务可能不会立即停止", Color.Gold) + DebugPrint("请在再次启动服务器之前耐心等待其超时自动停止", Color.Gold) 是否正在运行 = False - 广播全体消息(New List(Of String) From {"iw_sever_powerdown"}) + Await Task.Run(Sub() 广播全体消息(New List(Of String) From {"iw_sever_powerdown"})) If 取消广播任务令牌源 IsNot Nothing Then 取消广播任务令牌源.Cancel() Await 广播任务 @@ -215,6 +231,10 @@ Public Class 服务器 End If End If UDP广播?.Close() + UDP广播?.Dispose() + UDP广播 = Nothing + 广播任务 = Nothing + If 取消令牌源 IsNot Nothing Then 取消令牌源.Cancel() Await Ping任务 @@ -225,11 +245,18 @@ Public Class 服务器 End If End If UDP服务器?.Close() + UDP服务器?.Dispose() UDP服务器 = Nothing + Ping任务 = Nothing + 响应任务列表.Clear() 客户端列表?.Clear() + Form服务器.Close() - GC.Collect() + + Dim 黑名单文件 = Path.Combine(Application.StartupPath, "PlayerData", "SeverBan.json") + WriteAllText(黑名单文件, JsonSerializer.Serialize(黑名单, JSON序列化选项), False) DebugPrint("服务器已停止", Color.Tomato) + GC.Collect() End Sub Public Shared Function 获取本地IPv4() As String diff --git "a/ImaginWorld/\345\272\225\345\261\202\350\260\203\345\272\246/Module1.vb" "b/ImaginWorld/\345\272\225\345\261\202\350\260\203\345\272\246/Module1.vb" index eeb0a14..3d1f514 100644 --- "a/ImaginWorld/\345\272\225\345\261\202\350\260\203\345\272\246/Module1.vb" +++ "b/ImaginWorld/\345\272\225\345\261\202\350\260\203\345\272\246/Module1.vb" @@ -5,6 +5,7 @@ Imports Svg Imports Microsoft.VisualBasic.FileIO.FileSystem Imports System.IO Imports Sunny.UI +Imports System.Threading Module Module1 @@ -12,6 +13,9 @@ Module Module1 Public JSON序列化选项 As New JsonSerializerOptions With {.WriteIndented = True} + Public UI同步上下文 As SynchronizationContext = SynchronizationContext.Current + + Public Sub DoubleBuffer(control As Control) Dim propertyInfo As PropertyInfo = control.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance Or BindingFlags.NonPublic) @@ -28,8 +32,7 @@ Module Module1 If String.IsNullOrEmpty(文本) Then Exit Sub If 时间戳 Then 文本 = $"{TimeString} " & 文本 Dim 文本长度 = Len(文本) - Form1.重新创建句柄() - Form1.Invoke(Sub() + UI同步上下文.Post(Sub() 控制台界面实例.RichTextBox1.AppendText(vbCrLf & 文本) Dim 添加起始位 As Integer = 控制台界面实例.RichTextBox1.TextLength - 文本长度 控制台界面实例.RichTextBox1.Select(添加起始位, 文本长度) @@ -37,7 +40,7 @@ Module Module1 控制台界面实例.RichTextBox1.Select(控制台界面实例.RichTextBox1.TextLength, 0) 控制台界面实例.RichTextBox1.ScrollToCaret() If 强制切换到控制台 Then 界面控制.切换界面(界面控制.主界面图层.顶层, 控制台界面实例) - End Sub) + End Sub, Nothing) End Sub Public Function LaunchSvgToImage(SvgPath As String) As Image diff --git "a/ImaginWorld/\346\240\270\345\277\203/\346\270\270\346\210\217\350\256\276\347\275\256.vb" "b/ImaginWorld/\346\240\270\345\277\203/\346\270\270\346\210\217\350\256\276\347\275\256.vb" index 7a9e856..bab30b6 100644 --- "a/ImaginWorld/\346\240\270\345\277\203/\346\270\270\346\210\217\350\256\276\347\275\256.vb" +++ "b/ImaginWorld/\346\240\270\345\277\203/\346\270\270\346\210\217\350\256\276\347\275\256.vb" @@ -17,6 +17,20 @@ Public Class 游戏设置 Public Property ColonyCalculationThreads As Integer = 1 Public Property WorldStateCalculationThreads As Integer = 1 Public Property RandomEventsTriggerCalculationThreads As Integer = 1 + Public Property BattleModeSelection As Integer = 0 + + Public Property Sever_Port As String = "" + Public Property Sever_Name As String = "" + Public Property Sever_Description As String = "" + Public Property Sever_DefaultPermission As Integer = -1 + Public Property Sever_MaxPing As Integer = -1 + Public Property Sever_Broadcast As Integer = -1 + Public Property Sever_AllowedConnection As Integer = -1 + Public Property Sever_MessageProcessMultithread As Integer = -1 + Public Property Sever_OpenSinglePlayerLocation As Integer = -1 + Public Property ConnectSever_IP As String = "" + Public Property ConnectSever_Port As String = "" + End Class Public Shared Sub 保存() diff --git "a/ImaginWorld/\347\225\214\351\235\242/Form1.vb" "b/ImaginWorld/\347\225\214\351\235\242/Form1.vb" index ce6ce59..7584f5f 100644 --- "a/ImaginWorld/\347\225\214\351\235\242/Form1.vb" +++ "b/ImaginWorld/\347\225\214\351\235\242/Form1.vb" @@ -1,6 +1,4 @@ -Imports System.IO -Imports Microsoft.VisualBasic.FileIO.FileSystem -Imports System.ComponentModel +Imports System.ComponentModel Public Class Form1 Protected Overrides Sub WndProc(ByRef m As Message) @@ -80,4 +78,20 @@ Public Class Form1 全局键盘钩子.Unhook() End End Sub + + Public Sub 释放所有资源回主菜单() + 界面图层_主层?.Dispose() + 界面图层_二层?.Dispose() + 界面图层_三层?.Dispose() + If 界面图层_顶层 IsNot Nothing Then + If 界面图层_顶层.GetType = GetType(界面顶层_控制台) Then + 控制台界面实例.UiButton关闭控制台.PerformClick() + Else + 界面图层_顶层?.Dispose() + End If + End If + 界面控制.切换界面(界面控制.主界面图层.主层, New 界面主层_主菜单) + End Sub + + End Class diff --git "a/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.Designer.vb" "b/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.Designer.vb" index 500ce21..491c96a 100644 --- "a/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.Designer.vb" +++ "b/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.Designer.vb" @@ -83,17 +83,17 @@ Partial Class Form服务器 ColumnHeader3 = New ColumnHeader() ColumnHeader4 = New ColumnHeader() ImageList1 = New ImageList(components) - Panel11 = New Panel() - UiButton3 = New Sunny.UI.UIButton() - Label16 = New Label() - UiButton2 = New Sunny.UI.UIButton() - Label18 = New Label() - UiButton7 = New Sunny.UI.UIButton() Panel4 = New Panel() Panel21 = New Panel() - UiButton8 = New Sunny.UI.UIButton() + UiButton封禁 = New Sunny.UI.UIButton() + Label16 = New Label() + UiButton移出 = New Sunny.UI.UIButton() + Label18 = New Label() + UiButton权限 = New Sunny.UI.UIButton() + Label33 = New Label() + UiButton全部执行 = New Sunny.UI.UIButton() Label12 = New Label() - UiButton9 = New Sunny.UI.UIButton() + UiButton选中执行 = New Sunny.UI.UIButton() Panel20 = New Panel() UiTextBox3 = New Sunny.UI.UITextBox() Panel19 = New Panel() @@ -139,7 +139,6 @@ Partial Class Form服务器 TabPage3.SuspendLayout() Panel10.SuspendLayout() Panel59.SuspendLayout() - Panel11.SuspendLayout() Panel4.SuspendLayout() Panel21.SuspendLayout() Panel20.SuspendLayout() @@ -228,9 +227,9 @@ Partial Class Form服务器 Label19.ForeColor = Color.Gray Label19.Location = New Point(0, 40) Label19.Name = "Label19" - Label19.Size = New Size(345, 20) + Label19.Size = New Size(387, 20) Label19.TabIndex = 68 - Label19.Text = "开启后除这台设备之外的玩家可以选择单人模式的位置" + Label19.Text = "开启后所有玩家都可以选择单人模式的位置,否则只能本机选" Label19.TextAlign = ContentAlignment.BottomLeft ' ' Label27 @@ -239,9 +238,9 @@ Partial Class Form服务器 Label27.Dock = DockStyle.Top Label27.Location = New Point(0, 10) Label27.Name = "Label27" - Label27.Size = New Size(266, 21) + Label27.Size = New Size(154, 21) Label27.TabIndex = 67 - Label27.Text = "本机之外的玩家可使用单人模式数据" + Label27.Text = "开放单人模式数据位" ' ' Panel23 ' @@ -810,7 +809,7 @@ Partial Class Form服务器 UiComboBox8.ItemHeight = 30 UiComboBox8.ItemHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) UiComboBox8.ItemRectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiComboBox8.Items.AddRange(New Object() {"不自动踢出任何延迟的玩家", "500ms", "1000ms", "2000ms", "3000ms"}) + UiComboBox8.Items.AddRange(New Object() {"默认(建议)", "500ms", "1000ms", "2000ms", "3000ms"}) UiComboBox8.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) UiComboBox8.ItemSelectForeColor = Color.Silver UiComboBox8.Location = New Point(-240, 10) @@ -903,7 +902,6 @@ Partial Class Form服务器 ' Panel10 ' Panel10.Controls.Add(Panel59) - Panel10.Controls.Add(Panel11) Panel10.Controls.Add(Panel4) Panel10.Dock = DockStyle.Fill Panel10.Location = New Point(0, 0) @@ -917,7 +915,7 @@ Partial Class Form服务器 Panel59.BackColor = Color.FromArgb(CByte(36), CByte(36), CByte(36)) Panel59.Controls.Add(ListView1) Panel59.Dock = DockStyle.Fill - Panel59.Location = New Point(20, 276) + Panel59.Location = New Point(20, 220) Panel59.Name = "Panel59" Panel59.Padding = New Padding(0, 10, 0, 10) Panel59.Size = New Size(160, 0) @@ -947,120 +945,6 @@ Partial Class Form服务器 ImageList1.ImageSize = New Size(1, 30) ImageList1.TransparentColor = Color.Transparent ' - ' Panel11 - ' - Panel11.Controls.Add(UiButton3) - Panel11.Controls.Add(Label16) - Panel11.Controls.Add(UiButton2) - Panel11.Controls.Add(Label18) - Panel11.Controls.Add(UiButton7) - Panel11.Dock = DockStyle.Top - Panel11.Location = New Point(20, 220) - Panel11.Name = "Panel11" - Panel11.Padding = New Padding(0, 0, 0, 20) - Panel11.Size = New Size(160, 56) - Panel11.TabIndex = 50 - ' - ' UiButton3 - ' - UiButton3.Dock = DockStyle.Left - UiButton3.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton3.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton3.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) - UiButton3.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) - UiButton3.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton3.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton3.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiButton3.ForeColor = Color.Silver - UiButton3.ForeDisableColor = Color.Gray - UiButton3.ForeHoverColor = Color.Silver - UiButton3.ForePressColor = Color.Silver - UiButton3.ForeSelectedColor = Color.Silver - UiButton3.Location = New Point(420, 0) - UiButton3.MinimumSize = New Size(1, 1) - UiButton3.Name = "UiButton3" - UiButton3.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton3.RectDisableColor = Color.Black - UiButton3.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton3.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton3.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton3.Size = New Size(200, 36) - UiButton3.TabIndex = 45 - UiButton3.Text = "封禁" - UiButton3.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - ' - ' Label16 - ' - Label16.Dock = DockStyle.Left - Label16.Location = New Point(410, 0) - Label16.Name = "Label16" - Label16.Size = New Size(10, 36) - Label16.TabIndex = 46 - ' - ' UiButton2 - ' - UiButton2.Dock = DockStyle.Left - UiButton2.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton2.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton2.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) - UiButton2.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) - UiButton2.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton2.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton2.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiButton2.ForeColor = Color.Silver - UiButton2.ForeDisableColor = Color.Gray - UiButton2.ForeHoverColor = Color.Silver - UiButton2.ForePressColor = Color.Silver - UiButton2.ForeSelectedColor = Color.Silver - UiButton2.Location = New Point(210, 0) - UiButton2.MinimumSize = New Size(1, 1) - UiButton2.Name = "UiButton2" - UiButton2.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton2.RectDisableColor = Color.Black - UiButton2.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton2.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton2.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton2.Size = New Size(200, 36) - UiButton2.TabIndex = 43 - UiButton2.Text = "移出" - UiButton2.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - ' - ' Label18 - ' - Label18.Dock = DockStyle.Left - Label18.Location = New Point(200, 0) - Label18.Name = "Label18" - Label18.Size = New Size(10, 36) - Label18.TabIndex = 53 - ' - ' UiButton7 - ' - UiButton7.Dock = DockStyle.Left - UiButton7.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton7.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton7.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) - UiButton7.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) - UiButton7.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton7.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton7.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiButton7.ForeColor = Color.Silver - UiButton7.ForeDisableColor = Color.Gray - UiButton7.ForeHoverColor = Color.Silver - UiButton7.ForePressColor = Color.Silver - UiButton7.ForeSelectedColor = Color.Silver - UiButton7.Location = New Point(0, 0) - UiButton7.MinimumSize = New Size(1, 1) - UiButton7.Name = "UiButton7" - UiButton7.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton7.RectDisableColor = Color.Black - UiButton7.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton7.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton7.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton7.Size = New Size(200, 36) - UiButton7.TabIndex = 50 - UiButton7.Text = "修改权限" - UiButton7.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - ' ' Panel4 ' Panel4.AutoSize = True @@ -1075,9 +959,15 @@ Partial Class Form服务器 ' ' Panel21 ' - Panel21.Controls.Add(UiButton8) + Panel21.Controls.Add(UiButton封禁) + Panel21.Controls.Add(Label16) + Panel21.Controls.Add(UiButton移出) + Panel21.Controls.Add(Label18) + Panel21.Controls.Add(UiButton权限) + Panel21.Controls.Add(Label33) + Panel21.Controls.Add(UiButton全部执行) Panel21.Controls.Add(Label12) - Panel21.Controls.Add(UiButton9) + Panel21.Controls.Add(UiButton选中执行) Panel21.Dock = DockStyle.Top Panel21.Location = New Point(0, 155) Panel21.Name = "Panel21" @@ -1085,69 +975,177 @@ Partial Class Form服务器 Panel21.Size = New Size(160, 45) Panel21.TabIndex = 6 ' - ' UiButton8 - ' - UiButton8.Dock = DockStyle.Fill - UiButton8.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton8.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton8.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) - UiButton8.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) - UiButton8.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton8.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton8.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiButton8.ForeColor = Color.Silver - UiButton8.ForeDisableColor = Color.Gray - UiButton8.ForeHoverColor = Color.Silver - UiButton8.ForePressColor = Color.Silver - UiButton8.ForeSelectedColor = Color.Silver - UiButton8.Location = New Point(324, 0) - UiButton8.MinimumSize = New Size(1, 1) - UiButton8.Name = "UiButton8" - UiButton8.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton8.RectDisableColor = Color.Black - UiButton8.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton8.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton8.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton8.Size = New Size(1, 35) - UiButton8.TabIndex = 51 - UiButton8.Text = "对全体客户端执行" - UiButton8.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' UiButton封禁 + ' + UiButton封禁.Dock = DockStyle.Left + UiButton封禁.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton封禁.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton封禁.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton封禁.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton封禁.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton封禁.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton封禁.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton封禁.ForeColor = Color.Silver + UiButton封禁.ForeDisableColor = Color.Gray + UiButton封禁.ForeHoverColor = Color.Silver + UiButton封禁.ForePressColor = Color.Silver + UiButton封禁.ForeSelectedColor = Color.Silver + UiButton封禁.Location = New Point(520, 0) + UiButton封禁.MinimumSize = New Size(1, 1) + UiButton封禁.Name = "UiButton封禁" + UiButton封禁.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton封禁.RectDisableColor = Color.Black + UiButton封禁.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton封禁.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton封禁.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton封禁.Size = New Size(120, 35) + UiButton封禁.TabIndex = 55 + UiButton封禁.Text = "封禁" + UiButton封禁.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' + ' Label16 + ' + Label16.Dock = DockStyle.Left + Label16.Location = New Point(510, 0) + Label16.Name = "Label16" + Label16.Size = New Size(10, 35) + Label16.TabIndex = 56 + ' + ' UiButton移出 + ' + UiButton移出.Dock = DockStyle.Left + UiButton移出.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton移出.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton移出.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton移出.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton移出.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton移出.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton移出.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton移出.ForeColor = Color.Silver + UiButton移出.ForeDisableColor = Color.Gray + UiButton移出.ForeHoverColor = Color.Silver + UiButton移出.ForePressColor = Color.Silver + UiButton移出.ForeSelectedColor = Color.Silver + UiButton移出.Location = New Point(390, 0) + UiButton移出.MinimumSize = New Size(1, 1) + UiButton移出.Name = "UiButton移出" + UiButton移出.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton移出.RectDisableColor = Color.Black + UiButton移出.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton移出.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton移出.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton移出.Size = New Size(120, 35) + UiButton移出.TabIndex = 54 + UiButton移出.Text = "移出" + UiButton移出.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' + ' Label18 + ' + Label18.Dock = DockStyle.Left + Label18.Location = New Point(380, 0) + Label18.Name = "Label18" + Label18.Size = New Size(10, 35) + Label18.TabIndex = 58 + ' + ' UiButton权限 + ' + UiButton权限.Dock = DockStyle.Left + UiButton权限.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton权限.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton权限.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton权限.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton权限.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton权限.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton权限.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton权限.ForeColor = Color.Silver + UiButton权限.ForeDisableColor = Color.Gray + UiButton权限.ForeHoverColor = Color.Silver + UiButton权限.ForePressColor = Color.Silver + UiButton权限.ForeSelectedColor = Color.Silver + UiButton权限.Location = New Point(260, 0) + UiButton权限.MinimumSize = New Size(1, 1) + UiButton权限.Name = "UiButton权限" + UiButton权限.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton权限.RectDisableColor = Color.Black + UiButton权限.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton权限.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton权限.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton权限.Size = New Size(120, 35) + UiButton权限.TabIndex = 57 + UiButton权限.Text = "权限" + UiButton权限.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' + ' Label33 + ' + Label33.Dock = DockStyle.Left + Label33.Location = New Point(250, 0) + Label33.Name = "Label33" + Label33.Size = New Size(10, 35) + Label33.TabIndex = 59 + ' + ' UiButton全部执行 + ' + UiButton全部执行.Dock = DockStyle.Left + UiButton全部执行.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton全部执行.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton全部执行.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton全部执行.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton全部执行.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton全部执行.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton全部执行.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton全部执行.ForeColor = Color.Silver + UiButton全部执行.ForeDisableColor = Color.Gray + UiButton全部执行.ForeHoverColor = Color.Silver + UiButton全部执行.ForePressColor = Color.Silver + UiButton全部执行.ForeSelectedColor = Color.Silver + UiButton全部执行.Location = New Point(130, 0) + UiButton全部执行.MinimumSize = New Size(1, 1) + UiButton全部执行.Name = "UiButton全部执行" + UiButton全部执行.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton全部执行.RectDisableColor = Color.Black + UiButton全部执行.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton全部执行.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton全部执行.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton全部执行.Size = New Size(120, 35) + UiButton全部执行.TabIndex = 51 + UiButton全部执行.Text = "全部执行" + UiButton全部执行.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) ' ' Label12 ' Label12.Dock = DockStyle.Left - Label12.Location = New Point(314, 0) + Label12.Location = New Point(120, 0) Label12.Name = "Label12" Label12.Size = New Size(10, 35) Label12.TabIndex = 52 ' - ' UiButton9 - ' - UiButton9.Dock = DockStyle.Left - UiButton9.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton9.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton9.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) - UiButton9.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) - UiButton9.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton9.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) - UiButton9.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiButton9.ForeColor = Color.Silver - UiButton9.ForeDisableColor = Color.Gray - UiButton9.ForeHoverColor = Color.Silver - UiButton9.ForePressColor = Color.Silver - UiButton9.ForeSelectedColor = Color.Silver - UiButton9.Location = New Point(0, 0) - UiButton9.MinimumSize = New Size(1, 1) - UiButton9.Name = "UiButton9" - UiButton9.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton9.RectDisableColor = Color.Black - UiButton9.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton9.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton9.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiButton9.Size = New Size(314, 35) - UiButton9.TabIndex = 50 - UiButton9.Text = "对选择的客户端执行" - UiButton9.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' UiButton选中执行 + ' + UiButton选中执行.Dock = DockStyle.Left + UiButton选中执行.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton选中执行.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton选中执行.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton选中执行.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton选中执行.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton选中执行.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton选中执行.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton选中执行.ForeColor = Color.Silver + UiButton选中执行.ForeDisableColor = Color.Gray + UiButton选中执行.ForeHoverColor = Color.Silver + UiButton选中执行.ForePressColor = Color.Silver + UiButton选中执行.ForeSelectedColor = Color.Silver + UiButton选中执行.Location = New Point(0, 0) + UiButton选中执行.MinimumSize = New Size(1, 1) + UiButton选中执行.Name = "UiButton选中执行" + UiButton选中执行.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton选中执行.RectDisableColor = Color.Black + UiButton选中执行.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton选中执行.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton选中执行.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton选中执行.Size = New Size(120, 35) + UiButton选中执行.TabIndex = 50 + UiButton选中执行.Text = "选中执行" + UiButton选中执行.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) ' ' Panel20 ' @@ -1204,6 +1202,7 @@ Partial Class Form服务器 ' UiComboBox1.DataSource = Nothing UiComboBox1.Dock = DockStyle.Fill + UiComboBox1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList UiComboBox1.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) UiComboBox1.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) UiComboBox1.FillDisableColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) @@ -1519,7 +1518,6 @@ Partial Class Form服务器 Panel10.ResumeLayout(False) Panel10.PerformLayout() Panel59.ResumeLayout(False) - Panel11.ResumeLayout(False) Panel4.ResumeLayout(False) Panel21.ResumeLayout(False) Panel20.ResumeLayout(False) @@ -1574,14 +1572,9 @@ Partial Class Form服务器 Friend WithEvents UiComboBox8 As Sunny.UI.UIComboBox Friend WithEvents Label10 As Label Friend WithEvents Panel10 As Panel - Friend WithEvents Panel11 As Panel - Friend WithEvents UiButton7 As Sunny.UI.UIButton Friend WithEvents Panel12 As Panel Friend WithEvents Panel13 As Panel Friend WithEvents Label21 As Label - Friend WithEvents UiButton3 As Sunny.UI.UIButton - Friend WithEvents Label16 As Label - Friend WithEvents UiButton2 As Sunny.UI.UIButton Friend WithEvents Label23 As Label Friend WithEvents Label22 As Label Friend WithEvents Panel59 As Panel @@ -1611,10 +1604,9 @@ Partial Class Form服务器 Friend WithEvents UiComboBox1 As Sunny.UI.UIComboBox Friend WithEvents Panel20 As Panel Friend WithEvents Panel21 As Panel - Friend WithEvents UiButton8 As Sunny.UI.UIButton - Friend WithEvents UiButton9 As Sunny.UI.UIButton + Friend WithEvents UiButton全部执行 As Sunny.UI.UIButton + Friend WithEvents UiButton选中执行 As Sunny.UI.UIButton Friend WithEvents UiTextBox3 As Sunny.UI.UITextBox - Friend WithEvents Label18 As Label Friend WithEvents Label12 As Label Friend WithEvents Panel22 As Panel Friend WithEvents Label19 As Label @@ -1633,4 +1625,10 @@ Partial Class Form服务器 Friend WithEvents Label32 As Label Friend WithEvents ColumnHeader4 As ColumnHeader Friend WithEvents ImageList1 As ImageList + Friend WithEvents UiButton封禁 As Sunny.UI.UIButton + Friend WithEvents Label16 As Label + Friend WithEvents UiButton移出 As Sunny.UI.UIButton + Friend WithEvents Label18 As Label + Friend WithEvents UiButton权限 As Sunny.UI.UIButton + Friend WithEvents Label33 As Label End Class diff --git "a/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.vb" "b/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.vb" index 3043bef..536e896 100644 --- "a/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.vb" +++ "b/ImaginWorld/\347\225\214\351\235\242/Form\346\234\215\345\212\241\345\231\250.vb" @@ -1,4 +1,5 @@  +Imports System.Net Imports System.Net.NetworkInformation Imports System.Threading Imports System.Timers @@ -42,6 +43,7 @@ Public Class Form服务器 SetControlFont(Me) 初始化网络适配器监视器() 暗黑列表视图自绘制.绑定列表视图事件(ListView1) + Me.UiTabControl1.ItemSize = New Size(100 * Form1.DPI, 50 * Form1.DPI) Me.ImageList1.ImageSize = New Size(1, 30 * Form1.DPI) Me.Label1.Text = $"{服务器.获取本地IPv4()}:{服务器.服务器端口}" 顶部显示的地址端口 = Me.Label1.Text @@ -79,6 +81,7 @@ Public Class Form服务器 End Sub Private Async Sub Form服务器_Shown(sender As Object, e As EventArgs) Handles Me.Shown + Await Task.Run(Sub() CPU性能计数器 = New PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName, True)) End Sub @@ -88,12 +91,19 @@ Public Class Form服务器 Private Sub Form服务器_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing Dim a As New 多项单选对话框("", {"确认关闭服务器", "取消"}, "确认关闭服务器?") - If a.ShowDialog(Form1) = 0 Then + If a.ShowDialog(Me) = 0 Then + 网络适配器监视器.Close() 网络适配器监视器.Dispose() + 每秒刷新计时器.Close() 每秒刷新计时器.Dispose() + 成员列表刷新计时器.Close() 成员列表刷新计时器.Dispose() + CPU性能计数器?.Close() + CPU性能计数器?.Dispose() 服务器.停止服务器() + e.Cancel = False Else + e.Cancel = True Exit Sub End If End Sub @@ -103,10 +113,11 @@ Public Class Form服务器 End Sub Sub 调整界面() - Me.UiButton9.Width = (Me.Panel21.Width - Me.Label12.Width) * 0.5 - Me.UiButton7.Width = (Me.Panel11.Width - Me.Label18.Width * 2) / 3 - Me.UiButton2.Width = Me.UiButton7.Width - Me.UiButton3.Width = Me.UiButton7.Width + Me.UiButton选中执行.Width = (Me.Panel21.Width - Me.Label12.Width * 4) * 0.2 + Me.UiButton全部执行.Width = Me.UiButton选中执行.Width + Me.UiButton权限.Width = Me.UiButton选中执行.Width + Me.UiButton移出.Width = Me.UiButton选中执行.Width + Me.UiButton封禁.Width = Me.UiButton选中执行.Width Me.ListView1.Width = Me.ListView1.Parent.Width + SystemInformation.VerticalScrollBarWidth * Form1.DPI Me.ListView1.Columns(0).Width = Me.ListView1.Parent.Width * 0.3 Me.ListView1.Columns(1).Width = Me.ListView1.Parent.Width * 0.2 @@ -125,6 +136,7 @@ Public Class Form服务器 Sub 每秒刷新界面() Me.Invoke(Sub() + If Not 服务器.是否正在运行 Then Exit Sub Dim 要显示的服务器发送速度 As String Select Case 服务器.已发送字节 - 服务器上一秒发送总量 Case >= 1024 * 1024 @@ -244,7 +256,7 @@ Public Class Form服务器 item.Name = key.ToString() item.Text = key.ToString() item.SubItems(1).Text = client.权限.ToString - If client.延迟 > 服务器.自动踢出延迟 Then + If client.延迟 >= 服务器.自动踢出延迟 Then item.SubItems(2).Text = $"已超时 ({client.连续超时次数})" Else item.SubItems(2).Text = client.延迟 & "ms" @@ -254,7 +266,7 @@ Public Class Form服务器 ' 创建一个新的项并添加 item = New ListViewItem(key.ToString()) With {.Name = key.ToString()} item.SubItems.Add(client.权限.ToString) - If client.延迟 > 服务器.自动踢出延迟 Then + If client.延迟 >= 服务器.自动踢出延迟 Then item.SubItems.Add($"已超时 ({client.连续超时次数})") Else item.SubItems.Add(client.延迟 & "ms") @@ -332,10 +344,84 @@ Public Class Form服务器 End Select End Sub + Private Sub Form服务器_DpiChanged(sender As Object, e As DpiChangedEventArgs) Handles Me.DpiChanged + End Sub + Private Sub UiButton选中执行_Click(sender As Object, e As EventArgs) Handles UiButton选中执行.Click + If ListView1.SelectedItems.Count = 0 Then Exit Sub + If Me.UiComboBox1.SelectedIndex < 0 Then Exit Sub + If Me.UiComboBox1.Text = "" Then Exit Sub + For Each item In ListView1.SelectedItems + Dim data As New List(Of String) From {Me.UiComboBox1.Text} + For Each line In Me.UiTextBox3.Lines + data.Add(line) + Next + 服务器.发送消息(服务器.客户端列表(item.Name).IP, data) + Next + End Sub + Private Sub UiButton全部执行_Click(sender As Object, e As EventArgs) Handles UiButton全部执行.Click + If ListView1.Items.Count = 0 Then Exit Sub + If Me.UiComboBox1.SelectedIndex < 0 Then Exit Sub + If Me.UiComboBox1.Text = "" Then Exit Sub + For Each item In ListView1.Items + Dim data As New List(Of String) From {Me.UiComboBox1.Text} + For Each line In Me.UiTextBox3.Lines + data.Add(line) + Next + 服务器.发送消息(服务器.客户端列表(item.Name).IP, data) + Next + End Sub + Private Sub UiButton权限_Click(sender As Object, e As EventArgs) Handles UiButton权限.Click + Dim a As New 暗黑菜单条控件本体 + AddHandler a.Items.Add("普通玩家").Click, Sub() + For Each item As ListViewItem In ListView1.SelectedItems + Dim ipPortParts = item.Text.Split(":"c) + 服务器.客户端列表(New IPEndPoint(IPAddress.Parse(ipPortParts(0)), ipPortParts(1))).权限 = 服务器.玩家权限类型.普通玩家 + item.SubItems(1).Text = "普通玩家" + Next + End Sub + AddHandler a.Items.Add("管理员").Click, Sub() + For Each item As ListViewItem In ListView1.SelectedItems + Dim ipPortParts = item.Text.Split(":"c) + 服务器.客户端列表(New IPEndPoint(IPAddress.Parse(ipPortParts(0)), ipPortParts(1))).权限 = 服务器.玩家权限类型.管理员 + item.SubItems(1).Text = "管理员" + Next + End Sub + AddHandler a.Items.Add("超级管理员").Click, Sub() + For Each item As ListViewItem In ListView1.SelectedItems + Dim ipPortParts = item.Text.Split(":"c) + 服务器.客户端列表(New IPEndPoint(IPAddress.Parse(ipPortParts(0)), ipPortParts(1))).权限 = 服务器.玩家权限类型.超级管理员 + item.SubItems(1).Text = "超级管理员" + Next + End Sub + a.Show(MousePosition) + End Sub + + Private Sub UiButton移出_Click(sender As Object, e As EventArgs) Handles UiButton移出.Click + Dim a As New 多项单选对话框("", {"确认移出", "取消"}, "确认移出选中的玩家?") + If a.ShowDialog(Me) <> 0 Then Exit Sub + For Each item As ListViewItem In ListView1.SelectedItems + Dim ipPortParts = item.Text.Split(":"c) + 服务器.发送消息(New IPEndPoint(IPAddress.Parse(ipPortParts(0)), ipPortParts(1)), New List(Of String) From {"iw_sever_remove"}) + 服务器.客户端列表.Remove(New IPEndPoint(IPAddress.Parse(ipPortParts(0)), ipPortParts(1))) + item.Remove() + Next + End Sub + + Private Sub UiButton封禁_Click(sender As Object, e As EventArgs) Handles UiButton封禁.Click + Dim a As New 多项单选对话框("", {"确认封禁", "取消"}, $"确认封禁选中玩家?{vbCrLf & vbCrLf}请详细了解这些:封禁文件位于 PlayerData\SeverBan.json,若要解封,请先关闭服务器,然后手动编辑 json 文件后再重启服务器。{vbCrLf & vbCrLf}关于内网穿透的远程客户端:如果该玩家通过内网穿透服务连接,则封禁是无效的,因为内网穿透的技术原理导致其地址是本机地址,封禁该地址等同于封禁本机,请从内网穿透服务、宣传途径、平台人员管理等途径进行安排,而不是在这里操作。{vbCrLf & vbCrLf}由于客户端每次启动都会随机一个新的端口,因此封禁是直接封禁 IP 地址,不管其端口,所以请谨慎决定封禁,避免误伤正常玩家。", 300, 500) + If a.ShowDialog(Me) <> 0 Then Exit Sub + For Each item As ListViewItem In ListView1.SelectedItems + Dim ipPortParts = item.Text.Split(":"c) + If Not 服务器.黑名单.Contains(ipPortParts(0)) Then 服务器.黑名单.Add(ipPortParts(0)) + 服务器.发送消息(New IPEndPoint(ipPortParts(0), ipPortParts(1)), New List(Of String) From {"iw_sever_ban"}) + 服务器.客户端列表.Remove(New IPEndPoint(IPAddress.Parse(ipPortParts(0)), ipPortParts(1))) + item.Remove() + Next + End Sub diff --git "a/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.Designer.vb" "b/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.Designer.vb" index 679766e..7d2cf04 100644 --- "a/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.Designer.vb" +++ "b/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.Designer.vb" @@ -45,6 +45,10 @@ Partial Class 界面主层_主菜单 Label78 = New Label() Panel46 = New Panel() Label3 = New Label() + Panel68 = New Panel() + UiComboBox13 = New Sunny.UI.UIComboBox() + Label111 = New Label() + UiButton17 = New Sunny.UI.UIButton() TabPage新游戏 = New TabPage() Panel4 = New Panel() Panel9 = New Panel() @@ -98,6 +102,9 @@ Partial Class 界面主层_主菜单 TabPage服务器 = New TabPage() Panel47 = New Panel() Panel50 = New Panel() + Panel67 = New Panel() + UiButton16 = New Sunny.UI.UIButton() + Label110 = New Label() Panel62 = New Panel() Label104 = New Label() UiComboBox7 = New Sunny.UI.UIComboBox() @@ -198,6 +205,9 @@ Partial Class 界面主层_主菜单 Panel30 = New Panel() UiButton15 = New Sunny.UI.UIButton() Label62 = New Label() + Panel66 = New Panel() + UiComboBox12 = New Sunny.UI.UIComboBox() + Label109 = New Label() Panel17 = New Panel() Label17 = New Label() UiTrackBar5 = New Sunny.UI.UITrackBar() @@ -279,7 +289,6 @@ Partial Class 界面主层_主菜单 Panel42 = New Panel() Label64 = New Label() Label56 = New Label() - Label55 = New Label() Label54 = New Label() Label48 = New Label() Label63 = New Label() @@ -305,6 +314,7 @@ Partial Class 界面主层_主菜单 Panel2.SuspendLayout() Panel29.SuspendLayout() Panel46.SuspendLayout() + Panel68.SuspendLayout() TabPage新游戏.SuspendLayout() Panel4.SuspendLayout() Panel9.SuspendLayout() @@ -320,6 +330,7 @@ Partial Class 界面主层_主菜单 TabPage服务器.SuspendLayout() Panel47.SuspendLayout() Panel50.SuspendLayout() + Panel67.SuspendLayout() Panel62.SuspendLayout() Panel65.SuspendLayout() Panel64.SuspendLayout() @@ -351,6 +362,7 @@ Partial Class 界面主层_主菜单 TabPage设置.SuspendLayout() Panel8.SuspendLayout() Panel30.SuspendLayout() + Panel66.SuspendLayout() Panel17.SuspendLayout() Panel16.SuspendLayout() Panel14.SuspendLayout() @@ -601,9 +613,9 @@ Partial Class 界面主层_主菜单 Label79.Location = New Point(30, 246) Label79.Name = "Label79" Label79.Padding = New Padding(1, 0, 0, 10) - Label79.Size = New Size(299, 31) + Label79.Size = New Size(283, 31) Label79.TabIndex = 44 - Label79.Text = "多数界面都可以暂停游戏,无需专门操作" + Label79.Text = "右侧区域上方下拉框可以自选播放音乐" ' ' Label85 ' @@ -687,6 +699,7 @@ Partial Class 界面主层_主菜单 ' Panel46.BackColor = Color.FromArgb(CByte(36), CByte(36), CByte(36)) Panel46.Controls.Add(Label3) + Panel46.Controls.Add(Panel68) Panel46.Dock = DockStyle.Right Panel46.Location = New Point(648, 30) Panel46.Name = "Panel46" @@ -699,13 +712,98 @@ Partial Class 界面主层_主菜单 Label3.BackColor = Color.Transparent Label3.Dock = DockStyle.Fill Label3.ForeColor = Color.Gray - Label3.Location = New Point(20, 20) + Label3.Location = New Point(20, 75) Label3.Name = "Label3" Label3.Padding = New Padding(1, 0, 0, 10) - Label3.Size = New Size(410, 559) + Label3.Size = New Size(410, 504) Label3.TabIndex = 40 Label3.Text = resources.GetString("Label3.Text") ' + ' Panel68 + ' + Panel68.Controls.Add(UiComboBox13) + Panel68.Controls.Add(Label111) + Panel68.Controls.Add(UiButton17) + Panel68.Dock = DockStyle.Top + Panel68.Location = New Point(20, 20) + Panel68.Name = "Panel68" + Panel68.Padding = New Padding(0, 0, 0, 20) + Panel68.Size = New Size(410, 55) + Panel68.TabIndex = 56 + ' + ' UiComboBox13 + ' + UiComboBox13.DataSource = Nothing + UiComboBox13.Dock = DockStyle.Fill + UiComboBox13.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList + UiComboBox13.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox13.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox13.FillDisableColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox13.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiComboBox13.ForeColor = Color.Silver + UiComboBox13.ForeDisableColor = Color.Silver + UiComboBox13.ItemFillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox13.ItemForeColor = Color.Silver + UiComboBox13.ItemHeight = 30 + UiComboBox13.ItemHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiComboBox13.ItemRectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiComboBox13.Items.AddRange(New Object() {"(建议)仅限本机加入可使用单人模式位", "(危险)允许其他玩家使用单人模式位"}) + UiComboBox13.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox13.ItemSelectForeColor = Color.Silver + UiComboBox13.Location = New Point(0, 0) + UiComboBox13.Margin = New Padding(4, 5, 4, 5) + UiComboBox13.MaxDropDownItems = 15 + UiComboBox13.MinimumSize = New Size(63, 0) + UiComboBox13.Name = "UiComboBox13" + UiComboBox13.Padding = New Padding(0, 0, 30, 2) + UiComboBox13.RectColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox13.RectDisableColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox13.ScrollBarBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox13.ScrollBarColor = Color.Silver + UiComboBox13.ScrollBarHandleWidth = 20 + UiComboBox13.ScrollBarStyleInherited = False + UiComboBox13.Size = New Size(360, 35) + UiComboBox13.SymbolSize = 24 + UiComboBox13.TabIndex = 2 + UiComboBox13.TextAlignment = ContentAlignment.MiddleLeft + UiComboBox13.Watermark = "(所有已加载的音乐)" + ' + ' Label111 + ' + Label111.Dock = DockStyle.Right + Label111.Location = New Point(360, 0) + Label111.Name = "Label111" + Label111.Size = New Size(10, 35) + Label111.TabIndex = 3 + ' + ' UiButton17 + ' + UiButton17.Dock = DockStyle.Right + UiButton17.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton17.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton17.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton17.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton17.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton17.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton17.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton17.ForeColor = Color.Silver + UiButton17.ForeDisableColor = Color.Gray + UiButton17.ForeHoverColor = Color.Silver + UiButton17.ForePressColor = Color.Silver + UiButton17.ForeSelectedColor = Color.Silver + UiButton17.Location = New Point(370, 0) + UiButton17.MinimumSize = New Size(1, 1) + UiButton17.Name = "UiButton17" + UiButton17.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton17.RectDisableColor = Color.Black + UiButton17.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton17.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton17.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton17.Size = New Size(40, 35) + UiButton17.TabIndex = 43 + UiButton17.Text = "▶" + UiButton17.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' ' TabPage新游戏 ' TabPage新游戏.BackColor = Color.FromArgb(CByte(24), CByte(24), CByte(24)) @@ -1460,6 +1558,7 @@ Partial Class 界面主层_主菜单 ' ' Panel50 ' + Panel50.Controls.Add(Panel67) Panel50.Controls.Add(Panel62) Panel50.Controls.Add(Panel65) Panel50.Controls.Add(Panel64) @@ -1478,6 +1577,55 @@ Partial Class 界面主层_主菜单 Panel50.Size = New Size(668, 599) Panel50.TabIndex = 45 ' + ' Panel67 + ' + Panel67.Controls.Add(UiButton16) + Panel67.Controls.Add(Label110) + Panel67.Dock = DockStyle.Bottom + Panel67.Location = New Point(20, 554) + Panel67.Name = "Panel67" + Panel67.Padding = New Padding(0, 10, 0, 0) + Panel67.Size = New Size(648, 45) + Panel67.TabIndex = 56 + ' + ' UiButton16 + ' + UiButton16.Dock = DockStyle.Right + UiButton16.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton16.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton16.FillDisableColor = Color.FromArgb(CByte(12), CByte(12), CByte(12)) + UiButton16.FillHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiButton16.FillPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton16.FillSelectedColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiButton16.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiButton16.ForeColor = Color.Silver + UiButton16.ForeDisableColor = Color.Gray + UiButton16.ForeHoverColor = Color.Silver + UiButton16.ForePressColor = Color.Silver + UiButton16.ForeSelectedColor = Color.Silver + UiButton16.Location = New Point(518, 10) + UiButton16.MinimumSize = New Size(1, 1) + UiButton16.Name = "UiButton16" + UiButton16.RectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton16.RectDisableColor = Color.Black + UiButton16.RectHoverColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton16.RectPressColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton16.RectSelectedColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiButton16.Size = New Size(130, 35) + UiButton16.TabIndex = 42 + UiButton16.Text = "保存" + UiButton16.TipsFont = New Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + ' + ' Label110 + ' + Label110.Dock = DockStyle.Fill + Label110.Location = New Point(0, 10) + Label110.Name = "Label110" + Label110.Size = New Size(648, 35) + Label110.TabIndex = 3 + Label110.Text = "保存本页设置" + Label110.TextAlign = ContentAlignment.MiddleLeft + ' ' Panel62 ' Panel62.Controls.Add(Label104) @@ -1731,7 +1879,7 @@ Partial Class 界面主层_主菜单 UiComboBox8.ItemHeight = 30 UiComboBox8.ItemHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) UiComboBox8.ItemRectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiComboBox8.Items.AddRange(New Object() {"不自动踢出任何延迟的玩家", "500ms", "1000ms", "2000ms", "3000ms"}) + UiComboBox8.Items.AddRange(New Object() {"默认(建议)", "500ms", "1000ms", "2000ms", "3000ms"}) UiComboBox8.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) UiComboBox8.ItemSelectForeColor = Color.Silver UiComboBox8.Location = New Point(248, 0) @@ -2971,8 +3119,10 @@ Partial Class 界面主层_主菜单 ' ' Panel8 ' + Panel8.AutoScroll = True Panel8.Controls.Add(Panel30) Panel8.Controls.Add(Label62) + Panel8.Controls.Add(Panel66) Panel8.Controls.Add(Panel17) Panel8.Controls.Add(Panel16) Panel8.Controls.Add(Panel14) @@ -2985,7 +3135,7 @@ Partial Class 界面主层_主菜单 Panel8.Dock = DockStyle.Fill Panel8.Location = New Point(0, 0) Panel8.Name = "Panel8" - Panel8.Padding = New Padding(30, 30, 300, 30) + Panel8.Padding = New Padding(30, 30, 400, 30) Panel8.Size = New Size(1128, 659) Panel8.TabIndex = 0 ' @@ -2993,10 +3143,10 @@ Partial Class 界面主层_主菜单 ' Panel30.Controls.Add(UiButton15) Panel30.Dock = DockStyle.Top - Panel30.Location = New Point(30, 476) + Panel30.Location = New Point(30, 516) Panel30.Name = "Panel30" Panel30.Padding = New Padding(5, 0, 0, 0) - Panel30.Size = New Size(798, 35) + Panel30.Size = New Size(698, 35) Panel30.TabIndex = 23 ' ' UiButton15 @@ -3031,14 +3181,68 @@ Partial Class 界面主层_主菜单 ' Label62.AutoSize = True Label62.Dock = DockStyle.Top - Label62.Font = New Font("微软雅黑", 14.25F, FontStyle.Bold, GraphicsUnit.Point, CByte(134)) - Label62.Location = New Point(30, 435) + Label62.Location = New Point(30, 480) Label62.Name = "Label62" Label62.Padding = New Padding(0, 15, 0, 0) - Label62.Size = New Size(18, 41) + Label62.Size = New Size(15, 36) Label62.TabIndex = 22 Label62.Text = " " ' + ' Panel66 + ' + Panel66.Controls.Add(UiComboBox12) + Panel66.Controls.Add(Label109) + Panel66.Dock = DockStyle.Top + Panel66.Location = New Point(30, 435) + Panel66.Name = "Panel66" + Panel66.Padding = New Padding(0, 0, 0, 15) + Panel66.Size = New Size(698, 45) + Panel66.TabIndex = 25 + ' + ' UiComboBox12 + ' + UiComboBox12.DataSource = Nothing + UiComboBox12.Dock = DockStyle.Right + UiComboBox12.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList + UiComboBox12.FillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox12.FillColor2 = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox12.FillDisableColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox12.Font = New Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) + UiComboBox12.ForeColor = Color.Silver + UiComboBox12.ForeDisableColor = Color.Silver + UiComboBox12.ItemFillColor = Color.FromArgb(CByte(48), CByte(48), CByte(48)) + UiComboBox12.ItemForeColor = Color.Silver + UiComboBox12.ItemHeight = 30 + UiComboBox12.ItemHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) + UiComboBox12.ItemRectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiComboBox12.Items.AddRange(New Object() {"在游戏中询问我(默认)", "自动使用回合制", "自动使用即时制"}) + UiComboBox12.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox12.ItemSelectForeColor = Color.Silver + UiComboBox12.Location = New Point(429, 0) + UiComboBox12.Margin = New Padding(4, 5, 4, 5) + UiComboBox12.MaxDropDownItems = 15 + UiComboBox12.MinimumSize = New Size(63, 0) + UiComboBox12.Name = "UiComboBox12" + UiComboBox12.Padding = New Padding(0, 0, 30, 2) + UiComboBox12.RectColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox12.RectDisableColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox12.ScrollBarHandleWidth = 20 + UiComboBox12.Size = New Size(269, 30) + UiComboBox12.SymbolSize = 24 + UiComboBox12.TabIndex = 2 + UiComboBox12.TextAlignment = ContentAlignment.MiddleLeft + UiComboBox12.Watermark = "" + ' + ' Label109 + ' + Label109.Dock = DockStyle.Fill + Label109.Location = New Point(0, 0) + Label109.Name = "Label109" + Label109.Size = New Size(698, 30) + Label109.TabIndex = 0 + Label109.Text = "选择战斗模式" + Label109.TextAlign = ContentAlignment.MiddleLeft + ' ' Panel17 ' Panel17.Controls.Add(Label17) @@ -3048,13 +3252,13 @@ Partial Class 界面主层_主菜单 Panel17.Location = New Point(30, 390) Panel17.Name = "Panel17" Panel17.Padding = New Padding(0, 0, 0, 15) - Panel17.Size = New Size(798, 45) + Panel17.Size = New Size(698, 45) Panel17.TabIndex = 7 ' ' Label17 ' Label17.Dock = DockStyle.Right - Label17.Location = New Point(454, 0) + Label17.Location = New Point(354, 0) Label17.Name = "Label17" Label17.Padding = New Padding(0, 0, 10, 0) Label17.Size = New Size(75, 30) @@ -3069,7 +3273,7 @@ Partial Class 界面主层_主菜单 UiTrackBar5.Dock = DockStyle.Right UiTrackBar5.FillColor = Color.FromArgb(CByte(24), CByte(24), CByte(24)) UiTrackBar5.Font = New Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiTrackBar5.Location = New Point(529, 0) + UiTrackBar5.Location = New Point(429, 0) UiTrackBar5.Maximum = 32 UiTrackBar5.Minimum = 1 UiTrackBar5.MinimumSize = New Size(1, 1) @@ -3085,9 +3289,9 @@ Partial Class 界面主层_主菜单 Label35.Dock = DockStyle.Fill Label35.Location = New Point(0, 0) Label35.Name = "Label35" - Label35.Size = New Size(798, 30) + Label35.Size = New Size(698, 30) Label35.TabIndex = 0 - Label35.Text = "随机事件触发计算线程数量" + Label35.Text = "随机事件计算线程数量" Label35.TextAlign = ContentAlignment.MiddleLeft ' ' Panel16 @@ -3099,13 +3303,13 @@ Partial Class 界面主层_主菜单 Panel16.Location = New Point(30, 345) Panel16.Name = "Panel16" Panel16.Padding = New Padding(0, 0, 0, 15) - Panel16.Size = New Size(798, 45) + Panel16.Size = New Size(698, 45) Panel16.TabIndex = 6 ' ' Label13 ' Label13.Dock = DockStyle.Right - Label13.Location = New Point(454, 0) + Label13.Location = New Point(354, 0) Label13.Name = "Label13" Label13.Padding = New Padding(0, 0, 10, 0) Label13.Size = New Size(75, 30) @@ -3120,7 +3324,7 @@ Partial Class 界面主层_主菜单 UiTrackBar4.Dock = DockStyle.Right UiTrackBar4.FillColor = Color.FromArgb(CByte(24), CByte(24), CByte(24)) UiTrackBar4.Font = New Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiTrackBar4.Location = New Point(529, 0) + UiTrackBar4.Location = New Point(429, 0) UiTrackBar4.Maximum = 32 UiTrackBar4.Minimum = 1 UiTrackBar4.MinimumSize = New Size(1, 1) @@ -3136,7 +3340,7 @@ Partial Class 界面主层_主菜单 Label34.Dock = DockStyle.Fill Label34.Location = New Point(0, 0) Label34.Name = "Label34" - Label34.Size = New Size(798, 30) + Label34.Size = New Size(698, 30) Label34.TabIndex = 0 Label34.Text = "世界状态计算线程数量" Label34.TextAlign = ContentAlignment.MiddleLeft @@ -3150,13 +3354,13 @@ Partial Class 界面主层_主菜单 Panel14.Location = New Point(30, 300) Panel14.Name = "Panel14" Panel14.Padding = New Padding(0, 0, 0, 15) - Panel14.Size = New Size(798, 45) + Panel14.Size = New Size(698, 45) Panel14.TabIndex = 4 ' ' Label11 ' Label11.Dock = DockStyle.Right - Label11.Location = New Point(454, 0) + Label11.Location = New Point(354, 0) Label11.Name = "Label11" Label11.Padding = New Padding(0, 0, 10, 0) Label11.Size = New Size(75, 30) @@ -3171,7 +3375,7 @@ Partial Class 界面主层_主菜单 UiTrackBar3.Dock = DockStyle.Right UiTrackBar3.FillColor = Color.FromArgb(CByte(24), CByte(24), CByte(24)) UiTrackBar3.Font = New Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiTrackBar3.Location = New Point(529, 0) + UiTrackBar3.Location = New Point(429, 0) UiTrackBar3.Maximum = 32 UiTrackBar3.Minimum = 1 UiTrackBar3.MinimumSize = New Size(1, 1) @@ -3187,9 +3391,9 @@ Partial Class 界面主层_主菜单 Label32.Dock = DockStyle.Fill Label32.Location = New Point(0, 0) Label32.Name = "Label32" - Label32.Size = New Size(798, 30) + Label32.Size = New Size(698, 30) Label32.TabIndex = 0 - Label32.Text = "殖民地数据计算线程数量" + Label32.Text = "殖民地计算线程数量" Label32.TextAlign = ContentAlignment.MiddleLeft ' ' Panel13 @@ -3201,18 +3405,18 @@ Partial Class 界面主层_主菜单 Panel13.Location = New Point(30, 255) Panel13.Name = "Panel13" Panel13.Padding = New Padding(0, 0, 0, 15) - Panel13.Size = New Size(798, 45) + Panel13.Size = New Size(698, 45) Panel13.TabIndex = 3 ' ' Label9 ' Label9.Dock = DockStyle.Right - Label9.Location = New Point(454, 0) + Label9.Location = New Point(354, 0) Label9.Name = "Label9" Label9.Padding = New Padding(0, 0, 10, 0) Label9.Size = New Size(75, 30) Label9.TabIndex = 3 - Label9.Text = "75" + Label9.Text = "50" Label9.TextAlign = ContentAlignment.MiddleRight ' ' UiTrackBar2 @@ -3222,22 +3426,22 @@ Partial Class 界面主层_主菜单 UiTrackBar2.Dock = DockStyle.Right UiTrackBar2.FillColor = Color.FromArgb(CByte(24), CByte(24), CByte(24)) UiTrackBar2.Font = New Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiTrackBar2.ForeColor = Color.FromArgb(CByte(0), CByte(192), CByte(0)) - UiTrackBar2.Location = New Point(529, 0) + UiTrackBar2.ForeColor = Color.YellowGreen + UiTrackBar2.Location = New Point(429, 0) UiTrackBar2.MinimumSize = New Size(1, 1) UiTrackBar2.Name = "UiTrackBar2" - UiTrackBar2.RectColor = Color.FromArgb(CByte(0), CByte(192), CByte(0)) + UiTrackBar2.RectColor = Color.YellowGreen UiTrackBar2.Size = New Size(269, 30) UiTrackBar2.TabIndex = 1 UiTrackBar2.Text = "UiTrackBar2" - UiTrackBar2.Value = 75 + UiTrackBar2.Value = 50 ' ' Label31 ' Label31.Dock = DockStyle.Fill Label31.Location = New Point(0, 0) Label31.Name = "Label31" - Label31.Size = New Size(798, 30) + Label31.Size = New Size(698, 30) Label31.TabIndex = 0 Label31.Text = "特效声音音量" Label31.TextAlign = ContentAlignment.MiddleLeft @@ -3251,18 +3455,18 @@ Partial Class 界面主层_主菜单 Panel12.Location = New Point(30, 210) Panel12.Name = "Panel12" Panel12.Padding = New Padding(0, 0, 0, 15) - Panel12.Size = New Size(798, 45) + Panel12.Size = New Size(698, 45) Panel12.TabIndex = 2 ' ' Label4 ' Label4.Dock = DockStyle.Right - Label4.Location = New Point(454, 0) + Label4.Location = New Point(354, 0) Label4.Name = "Label4" Label4.Padding = New Padding(0, 0, 10, 0) Label4.Size = New Size(75, 30) Label4.TabIndex = 2 - Label4.Text = "75" + Label4.Text = "50" Label4.TextAlign = ContentAlignment.MiddleRight ' ' UiTrackBar1 @@ -3272,22 +3476,22 @@ Partial Class 界面主层_主菜单 UiTrackBar1.Dock = DockStyle.Right UiTrackBar1.FillColor = Color.FromArgb(CByte(24), CByte(24), CByte(24)) UiTrackBar1.Font = New Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, CByte(134)) - UiTrackBar1.ForeColor = Color.FromArgb(CByte(0), CByte(192), CByte(0)) - UiTrackBar1.Location = New Point(529, 0) + UiTrackBar1.ForeColor = Color.YellowGreen + UiTrackBar1.Location = New Point(429, 0) UiTrackBar1.MinimumSize = New Size(1, 1) UiTrackBar1.Name = "UiTrackBar1" - UiTrackBar1.RectColor = Color.FromArgb(CByte(0), CByte(192), CByte(0)) + UiTrackBar1.RectColor = Color.YellowGreen UiTrackBar1.Size = New Size(269, 30) UiTrackBar1.TabIndex = 1 UiTrackBar1.Text = "UiTrackBar1" - UiTrackBar1.Value = 75 + UiTrackBar1.Value = 50 ' ' Label30 ' Label30.Dock = DockStyle.Fill Label30.Location = New Point(0, 0) Label30.Name = "Label30" - Label30.Size = New Size(798, 30) + Label30.Size = New Size(698, 30) Label30.TabIndex = 0 Label30.Text = "背景音乐音量" Label30.TextAlign = ContentAlignment.MiddleLeft @@ -3300,7 +3504,7 @@ Partial Class 界面主层_主菜单 Panel11.Location = New Point(30, 165) Panel11.Name = "Panel11" Panel11.Padding = New Padding(0, 0, 0, 15) - Panel11.Size = New Size(798, 45) + Panel11.Size = New Size(698, 45) Panel11.TabIndex = 1 ' ' Label29 @@ -3308,18 +3512,19 @@ Partial Class 界面主层_主菜单 Label29.Dock = DockStyle.Fill Label29.Location = New Point(0, 0) Label29.Name = "Label29" - Label29.Size = New Size(529, 30) + Label29.Size = New Size(429, 30) Label29.TabIndex = 0 Label29.Text = "全屏模式(需重启)" Label29.TextAlign = ContentAlignment.MiddleLeft ' ' UiCheckBox1 ' + UiCheckBox1.CheckBoxColor = Color.ForestGreen UiCheckBox1.CheckBoxSize = 25 UiCheckBox1.Dock = DockStyle.Right UiCheckBox1.Font = New Font("微软雅黑", 12F) UiCheckBox1.ForeColor = Color.Silver - UiCheckBox1.Location = New Point(529, 0) + UiCheckBox1.Location = New Point(429, 0) UiCheckBox1.MinimumSize = New Size(1, 1) UiCheckBox1.Name = "UiCheckBox1" UiCheckBox1.Size = New Size(269, 30) @@ -3334,7 +3539,7 @@ Partial Class 界面主层_主菜单 Panel34.Location = New Point(30, 120) Panel34.Name = "Panel34" Panel34.Padding = New Padding(0, 0, 0, 15) - Panel34.Size = New Size(798, 45) + Panel34.Size = New Size(698, 45) Panel34.TabIndex = 24 ' ' Label25 @@ -3342,7 +3547,7 @@ Partial Class 界面主层_主菜单 Label25.Dock = DockStyle.Fill Label25.Location = New Point(0, 0) Label25.Name = "Label25" - Label25.Size = New Size(529, 30) + Label25.Size = New Size(429, 30) Label25.TabIndex = 0 Label25.Text = "窗口化的尺寸" Label25.TextAlign = ContentAlignment.MiddleLeft @@ -3366,7 +3571,7 @@ Partial Class 界面主层_主菜单 UiComboBox3.Items.AddRange(New Object() {"1280x720", "1366x768", "1600x900"}) UiComboBox3.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) UiComboBox3.ItemSelectForeColor = Color.Silver - UiComboBox3.Location = New Point(529, 0) + UiComboBox3.Location = New Point(429, 0) UiComboBox3.Margin = New Padding(4, 5, 4, 5) UiComboBox3.MinimumSize = New Size(63, 0) UiComboBox3.Name = "UiComboBox3" @@ -3388,7 +3593,7 @@ Partial Class 界面主层_主菜单 Panel23.Location = New Point(30, 75) Panel23.Name = "Panel23" Panel23.Padding = New Padding(0, 0, 0, 15) - Panel23.Size = New Size(798, 45) + Panel23.Size = New Size(698, 45) Panel23.TabIndex = 8 ' ' Label52 @@ -3396,7 +3601,7 @@ Partial Class 界面主层_主菜单 Label52.Dock = DockStyle.Fill Label52.Location = New Point(0, 0) Label52.Name = "Label52" - Label52.Size = New Size(529, 30) + Label52.Size = New Size(429, 30) Label52.TabIndex = 0 Label52.Text = "全局字体" Label52.TextAlign = ContentAlignment.MiddleLeft @@ -3420,7 +3625,7 @@ Partial Class 界面主层_主菜单 UiComboBox2.Items.AddRange(New Object() {"微软雅黑"}) UiComboBox2.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) UiComboBox2.ItemSelectForeColor = Color.Silver - UiComboBox2.Location = New Point(529, 0) + UiComboBox2.Location = New Point(429, 0) UiComboBox2.Margin = New Padding(4, 5, 4, 5) UiComboBox2.MaxDropDownItems = 15 UiComboBox2.MinimumSize = New Size(63, 0) @@ -3428,7 +3633,10 @@ Partial Class 界面主层_主菜单 UiComboBox2.Padding = New Padding(0, 0, 30, 2) UiComboBox2.RectColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) UiComboBox2.RectDisableColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) + UiComboBox2.ScrollBarBackColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) + UiComboBox2.ScrollBarColor = Color.Silver UiComboBox2.ScrollBarHandleWidth = 20 + UiComboBox2.ScrollBarStyleInherited = False UiComboBox2.Size = New Size(269, 30) UiComboBox2.SymbolSize = 24 UiComboBox2.TabIndex = 2 @@ -3443,7 +3651,7 @@ Partial Class 界面主层_主菜单 Panel10.Location = New Point(30, 30) Panel10.Name = "Panel10" Panel10.Padding = New Padding(0, 0, 0, 15) - Panel10.Size = New Size(798, 45) + Panel10.Size = New Size(698, 45) Panel10.TabIndex = 0 ' ' Label28 @@ -3451,7 +3659,7 @@ Partial Class 界面主层_主菜单 Label28.Dock = DockStyle.Fill Label28.Location = New Point(0, 0) Label28.Name = "Label28" - Label28.Size = New Size(529, 30) + Label28.Size = New Size(429, 30) Label28.TabIndex = 0 Label28.Text = "游戏语言" Label28.TextAlign = ContentAlignment.MiddleLeft @@ -3472,10 +3680,10 @@ Partial Class 界面主层_主菜单 UiComboBox1.ItemHeight = 30 UiComboBox1.ItemHoverColor = Color.FromArgb(CByte(56), CByte(56), CByte(56)) UiComboBox1.ItemRectColor = Color.FromArgb(CByte(64), CByte(64), CByte(64)) - UiComboBox1.Items.AddRange(New Object() {"简体中文", "English"}) + UiComboBox1.Items.AddRange(New Object() {"简体中文"}) UiComboBox1.ItemSelectBackColor = Color.FromArgb(CByte(80), CByte(80), CByte(80)) UiComboBox1.ItemSelectForeColor = Color.Silver - UiComboBox1.Location = New Point(529, 0) + UiComboBox1.Location = New Point(429, 0) UiComboBox1.Margin = New Padding(4, 5, 4, 5) UiComboBox1.MinimumSize = New Size(63, 0) UiComboBox1.Name = "UiComboBox1" @@ -3527,6 +3735,7 @@ Partial Class 界面主层_主菜单 Panel45.Padding = New Padding(6, 30, 0, 0) Panel45.Size = New Size(1068, 120) Panel45.TabIndex = 34 + Panel45.Visible = False ' ' Label88 ' @@ -3537,7 +3746,7 @@ Partial Class 界面主层_主菜单 Label88.Padding = New Padding(1, 10, 0, 0) Label88.Size = New Size(892, 69) Label88.TabIndex = 34 - Label88.Text = "古老的黑暗力量被释放,天空破碎,迷雾笼罩" + Label88.Text = "敬请期待" ' ' Label89 ' @@ -3582,6 +3791,7 @@ Partial Class 界面主层_主菜单 Panel44.Padding = New Padding(6, 30, 0, 0) Panel44.Size = New Size(1068, 120) Panel44.TabIndex = 33 + Panel44.Visible = False ' ' Label68 ' @@ -3592,7 +3802,7 @@ Partial Class 界面主层_主菜单 Label68.Padding = New Padding(1, 10, 0, 0) Label68.Size = New Size(892, 69) Label68.TabIndex = 34 - Label68.Text = "旧城的灾难已经过去许久,是时候回到最初的家园了" & vbCrLf & "在废墟之下开启地底探险" + Label68.Text = "敬请期待" ' ' Label86 ' @@ -3646,7 +3856,7 @@ Partial Class 界面主层_主菜单 Label14.Padding = New Padding(1, 10, 0, 0) Label14.Size = New Size(892, 69) Label14.TabIndex = 34 - Label14.Text = "从新家园开始重建,学习游戏的各种操作" & vbCrLf & "探索世界各处,聚集旧城的幸存者" + Label14.Text = "经典的文字游戏体验,简单易懂的故事" & vbCrLf & "包含至少 4 小时的内容,以及 23 首来自 Suno AI 的各种风格音乐" ' ' Label10 ' @@ -3656,9 +3866,9 @@ Partial Class 界面主层_主菜单 Label10.Location = New Point(176, 30) Label10.Name = "Label10" Label10.Padding = New Padding(1, 0, 0, 0) - Label10.Size = New Size(235, 21) + Label10.Size = New Size(299, 21) Label10.TabIndex = 32 - Label10.Text = "此内容免费,包含在游戏本体中" + Label10.Text = "从新家园开始重建,学习游戏的各种操作" & vbCrLf ' ' Label12 ' @@ -3686,9 +3896,9 @@ Partial Class 界面主层_主菜单 Label125.Location = New Point(30, 87) Label125.Name = "Label125" Label125.Padding = New Padding(1, 5, 0, 0) - Label125.Size = New Size(395, 26) + Label125.Size = New Size(459, 26) Label125.TabIndex = 30 - Label125.Text = "游戏本体内容的主要目的是教学,我会尽可能续写它们" + Label125.Text = "游戏本体内容的主要目的是教学,你也可以创作自己的宏大故事" ' ' Label123 ' @@ -4100,7 +4310,6 @@ Partial Class 界面主层_主菜单 ' Panel42.Controls.Add(Label64) Panel42.Controls.Add(Label56) - Panel42.Controls.Add(Label55) Panel42.Controls.Add(Label54) Panel42.Controls.Add(Label48) Panel42.Controls.Add(Label63) @@ -4125,7 +4334,7 @@ Partial Class 界面主层_主菜单 Label64.AutoSize = True Label64.Dock = DockStyle.Top Label64.ForeColor = Color.DarkGray - Label64.Location = New Point(30, 518) + Label64.Location = New Point(30, 492) Label64.Name = "Label64" Label64.Padding = New Padding(1, 5, 0, 0) Label64.Size = New Size(212, 26) @@ -4137,25 +4346,13 @@ Partial Class 界面主层_主菜单 Label56.AutoSize = True Label56.Dock = DockStyle.Top Label56.ForeColor = Color.DarkGray - Label56.Location = New Point(30, 492) + Label56.Location = New Point(30, 466) Label56.Name = "Label56" Label56.Padding = New Padding(1, 5, 0, 0) Label56.Size = New Size(191, 26) Label56.TabIndex = 34 Label56.Text = "艺术图:StableDiffusion" ' - ' Label55 - ' - Label55.AutoSize = True - Label55.Dock = DockStyle.Top - Label55.ForeColor = Color.DarkGray - Label55.Location = New Point(30, 466) - Label55.Name = "Label55" - Label55.Padding = New Padding(1, 5, 0, 0) - Label55.Size = New Size(247, 26) - Label55.TabIndex = 33 - Label55.Text = "音效:FL Studio 的内置乐器变调" - ' ' Label54 ' Label54.AutoSize = True @@ -4176,9 +4373,9 @@ Partial Class 界面主层_主菜单 Label48.Location = New Point(30, 369) Label48.Name = "Label48" Label48.Padding = New Padding(0, 40, 0, 0) - Label48.Size = New Size(88, 66) + Label48.Size = New Size(224, 66) Label48.TabIndex = 31 - Label48.Text = "艺术资源" + Label48.Text = "艺术资源(FinalTown)" ' ' Label63 ' @@ -4425,6 +4622,7 @@ Partial Class 界面主层_主菜单 Panel29.ResumeLayout(False) Panel29.PerformLayout() Panel46.ResumeLayout(False) + Panel68.ResumeLayout(False) TabPage新游戏.ResumeLayout(False) Panel4.ResumeLayout(False) Panel4.PerformLayout() @@ -4444,6 +4642,7 @@ Partial Class 界面主层_主菜单 TabPage服务器.ResumeLayout(False) Panel47.ResumeLayout(False) Panel50.ResumeLayout(False) + Panel67.ResumeLayout(False) Panel62.ResumeLayout(False) Panel65.ResumeLayout(False) Panel64.ResumeLayout(False) @@ -4478,6 +4677,7 @@ Partial Class 界面主层_主菜单 Panel8.ResumeLayout(False) Panel8.PerformLayout() Panel30.ResumeLayout(False) + Panel66.ResumeLayout(False) Panel17.ResumeLayout(False) Panel16.ResumeLayout(False) Panel14.ResumeLayout(False) @@ -4683,7 +4883,6 @@ Partial Class 界面主层_主菜单 Friend WithEvents Label53 As Label Friend WithEvents Label64 As Label Friend WithEvents Label56 As Label - Friend WithEvents Label55 As Label Friend WithEvents Label63 As Label Friend WithEvents Label61 As Label Friend WithEvents Label60 As Label @@ -4791,5 +4990,15 @@ Partial Class 界面主层_主菜单 Friend WithEvents Panel62 As Panel Friend WithEvents Label104 As Label Friend WithEvents UiComboBox7 As Sunny.UI.UIComboBox + Friend WithEvents Panel66 As Panel + Friend WithEvents Label109 As Label + Friend WithEvents UiComboBox12 As Sunny.UI.UIComboBox + Friend WithEvents Panel67 As Panel + Friend WithEvents UiButton16 As Sunny.UI.UIButton + Friend WithEvents Label110 As Label + Friend WithEvents Panel68 As Panel + Friend WithEvents Label111 As Label + Friend WithEvents UiComboBox13 As Sunny.UI.UIComboBox + Friend WithEvents UiButton17 As Sunny.UI.UIButton End Class diff --git "a/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.resx" "b/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.resx" index 480560c..7080b00 100644 --- "a/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.resx" +++ "b/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.resx" @@ -120,8 +120,6 @@ 本游戏由纯 WinForm 桌面技术构建,没有游戏引擎,因此在展现形式上受限,请勿要求任何高级视觉和特效;最低配置在 Intel N100 处理器的触控设备上测试。 -在主菜单中,您有机会听到所有被载入的音乐,在控制台发送 nextbgm 来随机播放下一曲,发送 listbgm 查看所有音乐名称, bgm [ID] 可随时播放指定的音乐。 - 使用您喜欢的任何字体,编辑或删除设置文件来挽救错误的设置;考虑使用 MacType 文字渲染软件来得到更好的体验。 使用 Alt+F4 或直接关闭窗口也会保存进度;即便 Windows 直接关机也可以,但最好不要这样做。 diff --git "a/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.vb" "b/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.vb" index ea320da..0c10a6e 100644 --- "a/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.vb" +++ "b/ImaginWorld/\347\225\214\351\235\242/\347\225\214\351\235\242\344\270\273\345\261\202_\344\270\273\350\217\234\345\215\225.vb" @@ -6,7 +6,6 @@ Imports System.Threading Imports System.Timers Imports ImaginWorld.模组管理 Imports Microsoft.VisualBasic.FileIO.FileSystem -Imports NAudio.Wave Imports Newtonsoft.Json Imports Windows.System @@ -23,6 +22,12 @@ Public Class 界面主层_主菜单 暗黑列表视图自绘制.绑定列表视图事件(ListView5) 暗黑列表视图自绘制.绑定列表视图事件(ListView6) + Me.UiComboBox13.Items.Clear() + For Each item In 数据中心.所有背景音乐 + Me.UiComboBox13.Items.Add(item.Key) + Next + AddHandler Me.UiButton17.Click, Sub() 指令系统.切换BGM(New List(Of String) From {Me.UiComboBox13.Text}) + AddHandler UiButton重新扫描.Click, AddressOf 刷新模组列表 AddHandler UiButton启用模组.Click, AddressOf 启用选中模组 AddHandler UiButton禁用模组.Click, AddressOf 禁用所选模组 @@ -65,35 +70,30 @@ Public Class 界面主层_主菜单 AddHandler UiButtonKOOK频道.Click, Async Sub() Await Launcher.LaunchUriAsync(New Uri("https://kook.top/C7XWyz")) AddHandler UiButton开发者群.Click, Async Sub() Await Launcher.LaunchUriAsync(New Uri("https://qm.qq.com/cgi-bin/qm/qr?k=Q9iyczf0U4Vevro4YX-x1kczATQDLbHq&jump_from=webapi&authKey=Q8CIt3aEn+mltj2NjnLTJiku6T7GUAgGysyfkQ2W7q0a3wDcXbyWismuKSlViek4")) - - AddHandler UiButton7.Click, Async Sub() Await Launcher.LaunchUriAsync(New Uri("https://steamcommunity.com/id/1059Studio/")) AddHandler UiButton8.Click, Async Sub() Await Launcher.LaunchUriAsync(New Uri("https://space.bilibili.com/319785096")) AddHandler UiButton10.Click, Async Sub() Await Launcher.LaunchUriAsync(New Uri("https://github.com/Lake1059/ImaginWorld")) - AddHandler Me.UiButton9.Click, Sub() 界面控制.切换界面(界面控制.主界面图层.主层, New 界面主层_殖民地) AddHandler Me.UiButton22.Click, Sub() 界面控制.切换界面(界面控制.主界面图层.顶层, 控制台界面实例) AddHandler Me.UiButton上传创意工坊.Click, AddressOf 上传创意工坊 - 初始化设置选项卡内容() - AddHandler Me.UiButton15.Click, AddressOf 保存设置 + AddHandler Me.UiButton15.Click, AddressOf 保存设置 AddHandler Me.UiButton11.Click, AddressOf 启动服务器 + AddHandler Me.UiButton16.Click, AddressOf 保存服务器选项卡设置 AddHandler Me.UiButton14.Click, AddressOf 开始寻找广播服务器 - AddHandler Me.UiButton13.Click, AddressOf 连接选中的服务器 AddHandler Me.ListView6.DoubleClick, Sub() If Me.ListView6.SelectedItems.Count = 1 Then 连接选中的服务器() AddHandler Me.UiButton12.Click, AddressOf 连接自定义输入的服务器 - Me.ImageList1.ImageSize = New Size(1, 35 * Form1.DPI) Me.ImageList2.ImageSize = New Size(1, 30 * Form1.DPI) 调整界面() Me.Label1.Text = $"ImaginWorld Dev3 - 已加载 {模组管理.实际加载的模组列表.Count} 个模组 - {If(状态信息.Steam_是否完成了初始化, "Steamworks 已连接", "Steamworks 未连接")}" Me.PictureBox2.Image = LoadImageFromFile(Path.Combine(Application.StartupPath, "Image", "FinalTown.png")) - Me.PictureBox3.Image = LoadImageFromFile(Path.Combine(Application.StartupPath, "Image", "UnderJourney.png")) + 'Me.PictureBox3.Image = LoadImageFromFile(Path.Combine(Application.StartupPath, "Image", "UnderJourney.png")) Me.UiComboBox1.ItemHeight = 30 * Form1.DPI Me.UiComboBox2.ItemHeight = 30 * Form1.DPI Me.UiComboBox3.ItemHeight = 30 * Form1.DPI @@ -104,6 +104,9 @@ Public Class 界面主层_主菜单 Me.UiComboBox8.ItemHeight = 30 * Form1.DPI Me.UiComboBox9.ItemHeight = 30 * Form1.DPI Me.UiComboBox10.ItemHeight = 30 * Form1.DPI + Me.UiComboBox11.ItemHeight = 30 * Form1.DPI + Me.UiComboBox12.ItemHeight = 30 * Form1.DPI + Me.UiComboBox13.ItemHeight = 30 * Form1.DPI Me.UiCheckBox1.CheckBoxSize = 25 * Form1.DPI Me.UiTrackBar1.BarSize = 20 * Form1.DPI Me.UiTrackBar2.BarSize = 20 * Form1.DPI @@ -112,8 +115,8 @@ Public Class 界面主层_主菜单 Me.UiTrackBar5.BarSize = 20 * Form1.DPI 是否已初始化 = True If 声音控制.特效声音输出设备 Is Nothing Then - If 数据中心.所有背景音乐.ContainsKey("WarmHome") Then - 声音控制.切换BGM("WarmHome") + If 数据中心.所有背景音乐.ContainsKey("温暖的家") Then + 声音控制.切换BGM("温暖的家") Else 声音控制.自动选择下一首BGM进行播放(True) End If @@ -160,6 +163,7 @@ Public Class 界面主层_主菜单 Me.ListView6.Columns(2).Width = Me.ListView6.Parent.Width * 0.2 Me.ListView6.Columns(3).Width = Me.ListView6.Parent.Width * 0.3 Me.ListView6.Columns(4).Width = Me.ListView6.Parent.Width * 0.2 + Me.Label103.Text = "或使用双击来连接" Case 子选项卡.IsEqual(TabPage模组) Panel模组管理顶部功能区.Visible = True Panel24.Width = Panel24.Parent.Width * 0.35 @@ -220,7 +224,6 @@ Public Class 界面主层_主菜单 End Sub #Region "设置" - Sub 初始化设置选项卡内容() Dim 字体列表 As New List(Of String) For Each 字体 As FontFamily In FontFamily.Families @@ -259,6 +262,19 @@ Public Class 界面主层_主菜单 UiTrackBar3.Value = 游戏设置.实例对象.ColonyCalculationThreads UiTrackBar4.Value = 游戏设置.实例对象.WorldStateCalculationThreads UiTrackBar5.Value = 游戏设置.实例对象.RandomEventsTriggerCalculationThreads + UiComboBox12.SelectedIndex = 游戏设置.实例对象.BattleModeSelection + + UiTextBox4.Text = 游戏设置.实例对象.Sever_Port + UiTextBox5.Text = 游戏设置.实例对象.Sever_Name + UiTextBox6.Text = 游戏设置.实例对象.Sever_Description + UiComboBox6.SelectedIndex = 游戏设置.实例对象.Sever_DefaultPermission + UiComboBox8.SelectedIndex = 游戏设置.实例对象.Sever_MaxPing + UiComboBox9.SelectedIndex = 游戏设置.实例对象.Sever_Broadcast + UiComboBox10.SelectedIndex = 游戏设置.实例对象.Sever_AllowedConnection + UiComboBox11.SelectedIndex = 游戏设置.实例对象.Sever_MessageProcessMultithread + UiComboBox7.SelectedIndex = 游戏设置.实例对象.Sever_OpenSinglePlayerLocation + UiTextBox3.Text = 游戏设置.实例对象.ConnectSever_IP + UiTextBox7.Text = 游戏设置.实例对象.ConnectSever_Port End Sub Sub 保存设置() @@ -276,6 +292,7 @@ Public Class 界面主层_主菜单 游戏设置.实例对象.ColonyCalculationThreads = UiTrackBar3.Value 游戏设置.实例对象.WorldStateCalculationThreads = UiTrackBar4.Value 游戏设置.实例对象.RandomEventsTriggerCalculationThreads = UiTrackBar5.Value + 游戏设置.实例对象.BattleModeSelection = UiComboBox12.SelectedIndex 游戏设置.保存() SetControlFont(Me) SetControlFont(控制台界面实例) @@ -580,8 +597,22 @@ Public Class 界面主层_主菜单 Case Else 服务器.自动踢出延迟 = Integer.MaxValue End Select - 服务器.自动开始广播 = Me.UiComboBox9.SelectedIndex = 0 - 服务器.是否允许新地址加入 = Me.UiComboBox10.SelectedIndex = 0 + Select Case Me.UiComboBox9.SelectedIndex + Case 0 + 服务器.自动开始广播 = True + Case 1 + 服务器.自动开始广播 = False + Case Else + 服务器.自动开始广播 = True + End Select + Select Case Me.UiComboBox10.SelectedIndex + Case 0 + 服务器.是否允许新地址加入 = True + Case 1 + 服务器.是否允许新地址加入 = False + Case Else + 服务器.是否允许新地址加入 = True + End Select Select Case Me.UiComboBox10.SelectedIndex Case 0 服务器.响应线程数量 = 1 @@ -615,6 +646,7 @@ Public Class 界面主层_主菜单 Try Me.ListView6.Items.Clear() 广播接收端 = New UdpClient(1059) + 广播接收端.Client.ReceiveTimeout = 1000 广播接收任务取消令牌源 = New CancellationTokenSource 广播接收任务 = Task.Run(AddressOf 寻找广播服务器, 广播接收任务取消令牌源.Token) 广播接收计时器 = New Timers.Timer(10000) @@ -623,7 +655,7 @@ Public Class 界面主层_主菜单 广播接收计时器.Start() Me.UiButton14.Enabled = False Catch ex As Exception - DebugPrint(ex.Message, Color.OrangeRed) + DebugPrint(ex.Message, Color.Tomato) End Try End Sub @@ -639,8 +671,9 @@ Public Class 界面主层_主菜单 Form1.Invoke(Sub() 向服务器列表添加信息(severinfo)) End If If 广播接收计时器.Enabled = False Then Exit While + Catch ex As SocketException When ex.SocketErrorCode = SocketError.TimedOut Catch ex As Exception - DebugPrint(ex.Message, Color.OrangeRed) + DebugPrint(ex.Message, Color.Tomato) If 广播接收计时器.Enabled = False Then Exit While End Try Thread.Sleep(500) @@ -656,7 +689,10 @@ Public Class 界面主层_主菜单 广播接收任务取消令牌源 = Nothing End If End If + 广播接收任务 = Nothing 广播接收端?.Close() + 广播接收端?.Dispose() + 广播接收计时器?.Dispose() Form1.重新创建句柄() Form1.Invoke(Sub() Me.UiButton14.Enabled = True) End Sub @@ -675,6 +711,20 @@ Public Class 界面主层_主菜单 Me.ListView6.Items.Add(item) End Sub + Sub 保存服务器选项卡设置() + 游戏设置.实例对象.Sever_Port = UiTextBox4.Text + 游戏设置.实例对象.Sever_Name = UiTextBox5.Text + 游戏设置.实例对象.Sever_Description = UiTextBox6.Text + 游戏设置.实例对象.Sever_DefaultPermission = UiComboBox6.SelectedIndex + 游戏设置.实例对象.Sever_MaxPing = UiComboBox8.SelectedIndex + 游戏设置.实例对象.Sever_Broadcast = UiComboBox9.SelectedIndex + 游戏设置.实例对象.Sever_AllowedConnection = UiComboBox10.SelectedIndex + 游戏设置.实例对象.Sever_MessageProcessMultithread = UiComboBox11.SelectedIndex + 游戏设置.实例对象.Sever_OpenSinglePlayerLocation = UiComboBox7.SelectedIndex + 游戏设置.实例对象.ConnectSever_IP = UiTextBox3.Text + 游戏设置.实例对象.ConnectSever_Port = UiTextBox7.Text + 游戏设置.保存() + End Sub #End Region #Region "连接主机" @@ -719,6 +769,9 @@ Public Class 界面主层_主菜单 If a.ShowDialog(Form1) <> 0 Then Exit Sub End If Me.Label103.Text = "客户端服务已启动,已发送请求" + 游戏设置.实例对象.ConnectSever_IP = UiTextBox3.Text + 游戏设置.实例对象.ConnectSever_Port = UiTextBox7.Text + 游戏设置.保存() 客户端.启动客户端(Me.UiTextBox3.Text, Me.UiTextBox7.Text) 客户端.发送消息(New List(Of String) From {"iw_client_login_beta3"}) Await Task.Run(Sub() @@ -732,7 +785,6 @@ Public Class 界面主层_主菜单 End If End Sub - #End Region