Repository navigation
Expand file tree
/
Copy pathMainWindow.axaml
More file actions
660 lines (644 loc) · 51.4 KB
/
Copy pathMainWindow.axaml
File metadata and controls
660 lines (644 loc) · 51.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maps="using:UTSLManager.Maps"
x:Class="UTSLManager.MainWindow"
Title="UTSLManager" Width="900" Height="620" MinWidth="760" MinHeight="480" WindowStartupLocation="CenterScreen" WindowState="Maximized"
Background="{DynamicResource MatWindow}"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaTitleBarHeightHint="40">
<Window.Styles>
<Style Selector="Border.tl:pointerover TextBlock">
<Setter Property="Opacity" Value="1"/>
</Style>
<Style Selector="Button.menu">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="12,9"/>
<Setter Property="FontSize" Value="12"/>
</Style>
<!-- ★ P2:导航按钮的 hover / pressed 反馈(原来只有"选中"态有反馈,鼠标划过毫无变化 → 不像可点) -->
<Style Selector="Button.menu:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource FillTertiary}"/>
</Style>
<Style Selector="Button.menu:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource FillPrimary}"/>
</Style>
<!-- ★ 当前视图高亮 #66CCFF(用户指定);圆角必须同时设到模板内的 ContentPresenter 上 -->
<Style Selector="Button.menu /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="CornerRadius" Value="9"/>
</Style>
<Style Selector="Button.menu.active /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource Accent}"/>
<Setter Property="CornerRadius" Value="9"/>
</Style>
<Style Selector="Button.menu.active">
<Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style Selector="Button.menu.active:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentHover}"/>
</Style>
<!-- ★ 多服务器:卡片样式(用 Classes 而不是直接绑 Background,:pointerover 才覆盖得动) -->
<!-- ★ L3:压平成一个"列表行" —— 不画面板底、不画边框,只靠 hover/选中表达状态(macOS 源列表的做法) -->
<Style Selector="Border.srvcard">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
<Style Selector="Border.srvcard:pointerover">
<Setter Property="Background" Value="{DynamicResource FillTertiary}"/>
</Style>
<Style Selector="Border.srvcard TextBlock.srvname">
<Setter Property="Foreground" Value="{DynamicResource TextPrimary}"/>
</Style>
<Style Selector="Border.srvcard TextBlock.srvworlds">
<Setter Property="Foreground" Value="{DynamicResource TextSecondary}"/>
</Style>
<Style Selector="Border.srvcard TextBlock.srvaddr">
<Setter Property="Foreground" Value="{DynamicResource TextSecondary}"/>
</Style>
<Style Selector="Border.srvcard TextBlock.srvstate">
<Setter Property="Foreground" Value="{DynamicResource SysGreen}"/>
</Style>
<Style Selector="Border.srvcard TextBlock.srvmetric">
<Setter Property="Foreground" Value="{DynamicResource TextSecondary}"/>
<Setter Property="FontFamily" Value="Cascadia Mono,Consolas,monospace"/>
</Style>
<!-- 激活档:★ macOS 源列表的选中态是【实心 accent + 白字】,不是描边(UTSL-UI-优化建议.md §二) -->
<Style Selector="Border.srvcard.active">
<Setter Property="Background" Value="{DynamicResource Accent}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
<Style Selector="Border.srvcard.active:pointerover">
<Setter Property="Background" Value="{DynamicResource AccentHover}"/>
</Style>
<Style Selector="Border.srvcard.active TextBlock.srvname">
<Setter Property="Foreground" Value="{DynamicResource OnAccent}"/>
</Style>
<Style Selector="Border.srvcard.active TextBlock.srvworlds">
<Setter Property="Foreground" Value="{DynamicResource OnAccentDim}"/>
</Style>
<Style Selector="Border.srvcard.active TextBlock.srvaddr">
<Setter Property="Foreground" Value="{DynamicResource OnAccentDim}"/>
</Style>
<Style Selector="Border.srvcard.active TextBlock.srvstate">
<Setter Property="Foreground" Value="{DynamicResource OnAccent}"/>
</Style>
<Style Selector="Border.srvcard.active TextBlock.srvmetric">
<Setter Property="Foreground" Value="{DynamicResource OnAccentDim}"/>
</Style>
</Window.Styles>
<Panel>
<Grid ColumnDefinitions="300,*,216" RowDefinitions="40,*">
<!-- ★ 标题栏:只留交通灯 + 标题(功能按钮已移到右侧菜单) -->
<Border Grid.Row="0" Grid.ColumnSpan="3" Background="Transparent" x:Name="TitleBar" PointerPressed="OnTitleBarPressed">
<Grid ColumnDefinitions="Auto,*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="8" Margin="14,0,0,0" VerticalAlignment="Center">
<Border x:Name="BtnClose" Classes="tl" Width="12" Height="12" CornerRadius="6" Background="#FF5F57" Cursor="Hand" PointerPressed="OnClose" ToolTip.Tip="关闭"><TextBlock Text="✕" FontSize="7" Foreground="#7A0B06" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0"/></Border>
<Border x:Name="BtnMin" Classes="tl" Width="12" Height="12" CornerRadius="6" Background="{DynamicResource SysYellow}" Cursor="Hand" PointerPressed="OnMin" ToolTip.Tip="最小化"><TextBlock Text="−" FontSize="8" Foreground="#8A5A00" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0"/></Border>
<Border x:Name="BtnMax" Classes="tl" Width="12" Height="12" CornerRadius="6" Background="#28C840" Cursor="Hand" PointerPressed="OnMax" ToolTip.Tip="最大化"><TextBlock Text="+" FontSize="8" Foreground="#0B5A18" HorizontalAlignment="Center" VerticalAlignment="Center" Opacity="0"/></Border>
</StackPanel>
<TextBlock Grid.Column="1" Text="UTSLManager" FontSize="13" Foreground="{DynamicResource TextTertiary}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Border Grid.Column="2" Width="1"/>
</Grid>
</Border>
<!-- 左侧栏:服务器卡片(一台一张)+ 当前服务器的世界列表 -->
<Border Grid.Row="1" Grid.Column="0" Background="{DynamicResource MatSidebar}" Padding="14,10,14,12">
<DockPanel>
<StackPanel DockPanel.Dock="Top" Margin="8,0,8,10">
<TextBlock Text="UTSLManager" FontSize="15" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock Text="UnifierTSL 多世界管理器" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<TextBlock DockPanel.Dock="Bottom" x:Name="ChainText" Text="世界链: —" FontSize="11" Foreground="{DynamicResource TextTertiary}" Margin="8,8,8,2" TextWrapping="Wrap"/>
<!-- 服务器区:标题 + 新增 -->
<Grid DockPanel.Dock="Top" ColumnDefinitions="*,Auto" Margin="8,0,2,4">
<TextBlock Grid.Column="0" Text="服务器" FontSize="11" Foreground="{DynamicResource TextTertiary}" VerticalAlignment="Center"/>
<Button Grid.Column="1" x:Name="BtnAddServer" Content="" FontSize="13" Padding="7,0" CornerRadius="6"
Background="Transparent" Foreground="{DynamicResource Accent}" VerticalAlignment="Center"
ToolTip.Tip="新增一台服务器(复制当前档的连接设置)" Click="OnAddServer">
<Path Classes="icon" Data="{StaticResource IcoPlus}" Stroke="{DynamicResource Accent}" Width="13" Height="13" Margin="0"/>
</Button>
</Grid>
<!-- ★ Avalonia 的滚动条是覆盖式的:必须给右侧留 12px,否则会压住卡片右边缘("3 世界"会被切掉) -->
<ScrollViewer DockPanel.Dock="Top" MaxHeight="330" Margin="0,0,0,10" Padding="0,0,12,0"
VerticalScrollBarVisibility="Auto" ScrollViewer.AllowAutoHide="False">
<ItemsControl x:Name="ServerCards">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Classes="srvcard" Margin="0,0,0,6" CornerRadius="8" Padding="10,8"
BorderThickness="1" Tag="{Binding Id}" Cursor="Hand"
PointerPressed="OnServerCardPressed"
Classes.active="{Binding IsActive}">
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto">
<Border Grid.RowSpan="4" Grid.Column="0" Width="8" Height="8" CornerRadius="4"
Background="{Binding StatusBrush}" VerticalAlignment="Top" Margin="0,5,8,0"/>
<!-- 第 1 行:名称 + 状态 + 世界数 -->
<Grid Grid.Row="0" Grid.Column="1" ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="6">
<TextBlock Classes="srvname" Text="{Binding Name}" FontSize="13" FontWeight="SemiBold" TextTrimming="CharacterEllipsis"/>
<TextBlock Classes="srvstate" Text="{Binding State}" FontSize="11" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Grid.Column="1" Classes="srvworlds" Text="{Binding Worlds}" FontSize="11" VerticalAlignment="Center" Margin="6,0,0,0"/>
</Grid>
<!-- 第 2 行:IP:端口 + 方式 -->
<TextBlock Grid.Row="1" Grid.Column="1" Classes="srvaddr" Text="{Binding Address}"
FontSize="11" Margin="0,3,0,0" TextTrimming="CharacterEllipsis"/>
<!-- 第 3 行:CPU / 内存 -->
<Grid Grid.Row="2" Grid.Column="1" ColumnDefinitions="*,*" Margin="0,3,0,0">
<TextBlock Grid.Column="0" Classes="srvmetric" Text="{Binding CpuText}" FontSize="11"/>
<TextBlock Grid.Column="1" Classes="srvmetric" Text="{Binding MemText}" FontSize="11"/>
</Grid>
<!-- 第 4 行:上下行流量 -->
<TextBlock Grid.Row="3" Grid.Column="1" Classes="srvmetric" Text="{Binding NetText}"
FontSize="11" Margin="0,2,0,0" TextTrimming="CharacterEllipsis"/>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<TextBlock DockPanel.Dock="Top" Text="世界" FontSize="11" Foreground="{DynamicResource TextTertiary}" Margin="8,0,0,6"/>
<ListBox x:Name="WorldList" Background="Transparent" BorderThickness="0" Padding="0">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="16,*,Auto" Margin="0,1">
<Border Grid.Column="0" Width="7" Height="7" CornerRadius="3.5" VerticalAlignment="Center" Background="{Binding DotBrush}"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="13" Margin="6,0,0,0" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="{Binding Size}" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Border>
<!-- 中间:控制台(收窄 ✓ 居中 ✓) -->
<Panel Grid.Row="1" Grid.Column="1" Margin="18,0">
<Grid x:Name="ConsoleView" RowDefinitions="Auto,Auto,Auto,*" HorizontalAlignment="Stretch">
<Grid Grid.Row="0" Margin="0,4,0,12" ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="控制台" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="TargetText" Text="目标: 全部世界" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
</Grid>
<TextBlock Grid.Row="1" x:Name="ErrText" Margin="0,0,0,8" FontSize="11" Foreground="{DynamicResource SysRed}" TextWrapping="Wrap"/>
<!-- 监控卡片 -->
<Grid Grid.Row="2" ColumnDefinitions="*,*,*" Margin="0,0,0,20">
<Border Classes="card" Grid.Column="0" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" Padding="16,14" Margin="0,0,5,0">
<StackPanel>
<Grid ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Path Classes="icon" Data="{StaticResource IcoPulse}" Stroke="{DynamicResource TextSecondary}" Width="13" Height="13" Margin="0,0,7,0"/>
<TextBlock x:Name="CpuTitle" Text="CPU 使用量" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Grid.Column="1" x:Name="CpuNow" Text="—" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
</Grid>
<Grid ColumnDefinitions="Auto,*" Margin="0,8,0,0">
<Canvas x:Name="CpuYLabels" Grid.Column="0" Width="52" Height="118"/>
<Canvas x:Name="CpuChart" Grid.Column="1" Height="118" ClipToBounds="True"/>
</Grid>
<Canvas x:Name="CpuXLabels" Height="14" Margin="52,4,0,0"/>
</StackPanel>
</Border>
<Border Classes="card" Grid.Column="1" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" Padding="16,14" Margin="5,0">
<StackPanel>
<Grid ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Path Classes="icon" Data="{StaticResource IcoMem}" Stroke="{DynamicResource TextSecondary}" Width="13" Height="13" Margin="0,0,7,0"/>
<TextBlock x:Name="MemTitle" Text="内存使用量" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Grid.Column="1" x:Name="MemNow" Text="—" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
</Grid>
<Grid ColumnDefinitions="Auto,*" Margin="0,8,0,0">
<Canvas x:Name="MemYLabels" Grid.Column="0" Width="52" Height="118"/>
<Canvas x:Name="MemChart" Grid.Column="1" Height="118" ClipToBounds="True"/>
</Grid>
<Canvas x:Name="MemXLabels" Height="14" Margin="52,4,0,0"/>
</StackPanel>
</Border>
<Border Classes="card" Grid.Column="2" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" Padding="16,14" Margin="5,0,0,0">
<StackPanel>
<Grid ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Path Classes="icon" Data="{StaticResource IcoNet}" Stroke="{DynamicResource TextSecondary}" Width="13" Height="13" Margin="0,0,7,0"/>
<TextBlock x:Name="NetTitle" Text="网络流量" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Grid.Column="1" x:Name="NetNow" Text="—" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
</Grid>
<Grid ColumnDefinitions="Auto,*" Margin="0,8,0,0">
<Canvas x:Name="NetYLabels" Grid.Column="0" Width="52" Height="118"/>
<Canvas x:Name="NetChart" Grid.Column="1" Height="118" ClipToBounds="True"/>
</Grid>
<Canvas x:Name="NetXLabels" Height="14" Margin="52,4,0,0"/>
</StackPanel>
</Border>
</Grid>
<!-- ★ 服务器终端(指令输出 + 服务器日志 合并,类 MCSManager 终端面板) -->
<Border Classes="card" Grid.Row="3" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" Margin="0,0,0,10" ClipToBounds="True">
<DockPanel>
<Grid DockPanel.Dock="Top" ColumnDefinitions="*,Auto" Margin="14,9,14,7">
<TextBlock Grid.Column="0" x:Name="TermTitle" Text="服务器终端" FontSize="11" Foreground="{DynamicResource TextSecondary}"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="10">
<TextBox x:Name="TbTermFilter" Width="150" FontSize="11" Padding="6,1" CornerRadius="6"
Watermark="过滤日志(关键字/正则)" ToolTip.Tip="只影响显示:原始缓冲保留,清空过滤即恢复;切档各自记住"
TextChanged="OnTermFilterChanged"/>
<CheckBox x:Name="ChkMergeRepeats" Content="合并重复" FontSize="11" IsChecked="False"
ToolTip.Tip="连续相同的日志压成一行并在行尾显示 ×次数(只影响显示,原始缓冲保留)"
Click="OnMergeRepeatsToggle"/>
<CheckBox x:Name="ChkAutoScroll" Content="自动滚动" FontSize="11" IsChecked="True" Click="OnAutoScrollToggle"/>
<Button x:Name="BtnClearTerm" Content="清屏" FontSize="11" Padding="8,1" CornerRadius="6" Click="OnClearTerm"/>
</StackPanel>
</Grid>
<Border DockPanel.Dock="Bottom" BorderBrush="{DynamicResource Hairline}" BorderThickness="0,1,0,0" Padding="12,9,12,11" Background="{DynamicResource MatWell}">
<Grid ColumnDefinitions="Auto,*,Auto">
<TextBlock Grid.Column="0" x:Name="PromptText" Text="@ 全部世界" FontSize="13" FontWeight="SemiBold" Foreground="#0A84FF" VerticalAlignment="Center" Margin="0,0,9,0" FontFamily="Cascadia Mono,Consolas,monospace"/>
<TextBox Grid.Column="1" x:Name="CmdBox" Watermark="输入指令回车执行:@Dev /save · @2 /save · 不写前缀 = 全部世界 · 以 > 开头 = 服务端控制台口径(输出显示在上方日志流)" FontSize="13" CornerRadius="6" FontFamily="Cascadia Mono,Consolas,monospace"/>
<Button Grid.Column="2" x:Name="SendBtn" Content="发送" Margin="9,0,0,0" CornerRadius="6"/>
</Grid>
</Border>
<!-- ★ 自检修复(卡顿主因):原来是 ScrollViewer + ItemsControl,Avalonia 的 ItemsControl 不虚拟化,
300~1500 个 TextBlock(且 TextWrapping=Wrap)会让任何布局变化都重新测量整个日志 —— 改成 ListBox(自带虚拟化)。 -->
<ListBox x:Name="TermLines" Padding="0,0,12,0" Background="{DynamicResource MatWell}" BorderThickness="0" CornerRadius="0"
ScrollViewer.AllowAutoHide="False" SelectionMode="Multiple" IsTabStop="False"
KeyDown="OnTermKeyDown">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="复制选中行 (Ctrl+C)" Click="OnCopyTermClick"/>
</ContextMenu>
</ListBox.ContextMenu>
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
</Style>
</ListBox.Styles>
<ListBox.ItemTemplate>
<DataTemplate>
<!-- ★ 三列:时间(定宽 150,暗)|级别(定宽 44,上色)|消息(中性色)。
不是日志行时前两列 IsVisible=False 且定宽列会缩到 0,管理层消息照旧从左边开始。 -->
<Grid ColumnDefinitions="Auto,Auto,*,Auto" Margin="12,0,12,1" ToolTip.Tip="{Binding Text}">
<TextBlock Grid.Column="0" Text="{Binding ColTime}" IsVisible="{Binding HasColumns}"
Width="168" FontSize="11" Foreground="{DynamicResource TextTertiary}"
FontFamily="Cascadia Mono,Consolas,monospace" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{Binding ColLevel}" IsVisible="{Binding HasColumns}"
Width="58" Margin="8,0,0,0" FontSize="11" FontWeight="SemiBold"
Foreground="{Binding ColLevelBrush}"
FontFamily="Cascadia Mono,Consolas,monospace" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="{Binding ColText}" Foreground="{Binding ColTextBrush}"
FontSize="13" FontFamily="Cascadia Mono,Consolas,monospace"
TextWrapping="Wrap"/>
<!-- ★ 合并计数:连续相同日志压成一行时在行尾显示 ×N(与浏览器 Console 一致) -->
<Border Grid.Column="3" IsVisible="{Binding HasRepeat}" Margin="8,0,4,0"
Background="{DynamicResource FillPrimary}" CornerRadius="4" Padding="5,0"
VerticalAlignment="Center">
<TextBlock Text="{Binding RepeatBadge}" FontSize="11" FontWeight="SemiBold"
Foreground="{DynamicResource Accent}"
FontFamily="Cascadia Mono,Consolas,monospace"/>
</Border>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Border>
</Grid>
<!-- 文件管理视图(类 MCSManager)+ 插件启用开关 -->
<Grid x:Name="PluginsView" IsVisible="False" RowDefinitions="Auto,Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="文件管理" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="FileInfo" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="6" Margin="0,0,0,10">
<Button Content="⬆ 上级" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnFileUp"/>
<Button Content=" 根目录" FontFamily="Segoe MDL2 Assets, Microsoft YaHei" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnFileRoot"/>
<Button Content="+ 新建文件夹" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnFileMkdir"/>
<Button Content="刷新" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnFileRefresh"/>
<Button Content="⬇ 上传文件" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnFileUpload"/>
<Button Content="✕ 取消传输" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnFileCancelTransfer"/>
<TextBlock x:Name="FilePathText" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
<Border Grid.Row="2" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<DockPanel>
<StackPanel DockPanel.Dock="Top">
<TextBlock Text="点文件名可编辑;点文件夹进入;.dll 行可勾选启用/停用" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="36,10,36,8" TextWrapping="Wrap"/>
<!-- ★ 表头的左右内缩必须与行一致:行在 ScrollViewer Padding(0,0,12,0) + PluginList Margin(10,0,10,12) + 行内 Padding(14) 里,
合计左右各 36;原来表头只缩进 14 → 行整体左移 8px(用户反馈"大小/修改时间/启用对不齐")。 -->
<Grid ColumnDefinitions="*,90,130,64,120" Margin="36,0,36,6">
<TextBlock Grid.Column="0" Text="名称" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextTertiary}"/>
<TextBlock Grid.Column="1" Text="大小" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextTertiary}"/>
<TextBlock Grid.Column="2" Text="修改时间" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextTertiary}"/>
<TextBlock Grid.Column="3" Text="启用" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextTertiary}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="4" Text="操作(下载/删除)" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextTertiary}" HorizontalAlignment="Center"/>
</Grid>
<Border Height="1" Background="{DynamicResource Hairline}" Margin="36,0,36,4"/>
</StackPanel>
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0">
<StackPanel x:Name="PluginList" Margin="10,0,10,12" Spacing="2"/>
</ScrollViewer>
</DockPanel>
</Border>
</Grid>
<!-- 管理器插件视图宿主 -->
<Grid x:Name="ExtView" IsVisible="False" RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock x:Name="ExtTitle" Text="扩展" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="ExtDesc" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<Border Grid.Row="1" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True" Padding="16,14">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,13,0">
<ContentControl x:Name="ExtContent"/>
</ScrollViewer>
</Border>
</Grid>
<!-- 管理器插件管理视图(P0-2:列表 / 启用停用 / 重载 / 打开目录 / 失败原因)-->
<Grid x:Name="MgrPluginsView" IsVisible="False" RowDefinitions="Auto,Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="插件管理" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="MgrPluginInfo" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="6" Margin="0,0,0,10">
<Button Content=" 重新加载" FontFamily="Segoe MDL2 Assets, Microsoft YaHei" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnMgrPluginsReload"/>
<Button Content=" 打开插件目录" FontFamily="Segoe MDL2 Assets, Microsoft YaHei" FontSize="13" Padding="10,5" CornerRadius="6" Click="OnMgrPluginsOpenDir"/>
<CheckBox x:Name="ChkPluginWatch" Content="监视目录自动重载" FontSize="13" VerticalAlignment="Center" Margin="6,0,0,0" ToolTip.Tip="plugins 目录里 dll/manifest 变化后自动卸载并重新加载(默认关闭)"/>
<TextBlock Text="插件语言" FontSize="13" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center" Margin="12,0,0,0"/>
<ComboBox x:Name="CmbLang" Width="104" FontSize="13" VerticalAlignment="Center" SelectionChanged="OnLangChanged" ToolTip.Tip="插件用 ctx.L(...) 取字符串时使用">
<ComboBoxItem>zh-CN</ComboBoxItem>
<ComboBoxItem>en-US</ComboBoxItem>
</ComboBox>
<TextBlock x:Name="MgrPluginPath" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
<Border Grid.Row="2" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0">
<StackPanel x:Name="MgrPluginList" Margin="12,10,12,12" Spacing="2"/>
</ScrollViewer>
</Border>
</Grid>
<!-- 维护视图(整链重置 / 备份 / 恢复 三合一) -->
<Grid x:Name="MaintView" IsVisible="False" RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="维护" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="MaintInfo" Text="整链重置 / 备份存档 / 恢复存档" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<Border Grid.Row="1" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0">
<StackPanel Margin="18,16,18,18" Spacing="10">
<TextBlock Text=" 整链重置" FontFamily="Segoe MDL2 Assets, Microsoft YaHei" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock Text="按启动器世界列表重新生成源地图,再切成 N 份替换所有世界。会覆盖现有世界文件 ✗ 过程中服务端会自动重启。" FontSize="11" Foreground="{DynamicResource TextSecondary}" TextWrapping="Wrap"/>
<Button Content="开始整链重置(需点两次确认)" FontSize="13" Padding="14,7" CornerRadius="6" HorizontalAlignment="Left" Click="OnResetClicked"/>
<Border Height="1" Background="{DynamicResource Hairline}" Margin="0,10"/>
<TextBlock Text=" 备份存档" FontFamily="Segoe MDL2 Assets, Microsoft YaHei" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock Text="把 Worlds 与 config 打包成 zip 存到 utsl-deploy\backup。建议在重置/改配置前先备份。" FontSize="11" Foreground="{DynamicResource TextSecondary}" TextWrapping="Wrap"/>
<Button Content="立即备份" FontSize="13" Padding="14,7" CornerRadius="6" HorizontalAlignment="Left" Click="OnBackup"/>
<Border Height="1" Background="{DynamicResource Hairline}" Margin="0,10"/>
<TextBlock Text="♻ 恢复存档" FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock Text="从 backup 目录里最新的 zip 恢复 Worlds 与 config。会覆盖当前文件 ✗ 建议先停服 ✗ 需点两次确认。" FontSize="11" Foreground="{DynamicResource SysYellow}" TextWrapping="Wrap"/>
<Button Content="从最近备份恢复(需点两次确认)" FontSize="13" Padding="14,7" CornerRadius="6" HorizontalAlignment="Left" Click="OnRestoreClicked"/>
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
<!-- 连接设置视图(远端管理) -->
<!-- ===== 文件编辑(类 MCSManager:一次一个文件,保存 / 重新加载 / 返回;编辑器控件在代码里创建) ===== -->
<Grid x:Name="EditView" IsVisible="False" RowDefinitions="Auto,Auto,*,Auto">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,8">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock x:Name="EditTitle" Text="编辑文件" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="EditPathText" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6">
<Button x:Name="BtnEditSave" Content="保存 (Ctrl+S)" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnEditSave"/>
<Button Content="↻ 重新加载" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnEditReload"/>
<Button Content="← 返回文件列表" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnEditBack"/>
<CheckBox x:Name="ChkEditorWrap" Content="自动换行" FontSize="13" VerticalAlignment="Center" Margin="6,0,0,0" Click="OnEditorWrapChanged"/>
</StackPanel>
</Grid>
<TextBlock x:Name="EditHint" Grid.Row="1" Text="" FontSize="11" Foreground="{DynamicResource SysYellow}" Margin="0,0,0,6" TextWrapping="Wrap"/>
<!-- 编辑区背景:深藏青(与编辑器控件内背景一致,避免边缘露出灰色底) -->
<Border Grid.Row="2" Background="#101B2E" BorderBrush="#22314D" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<Panel x:Name="EditHost"/>
</Border>
<TextBlock x:Name="EditStatus" Grid.Row="3" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,6,0,0" TextWrapping="NoWrap"/>
</Grid>
<Grid x:Name="ConnView" IsVisible="False" RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="连接设置" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="ConnInfo" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<Border Grid.Row="1" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0">
<StackPanel x:Name="ConnHostPanel" Margin="18,16,18,18" Spacing="8"/>
</ScrollViewer>
</Border>
</Grid>
<!-- 世界链可视化视图 -->
<Grid x:Name="ChainView" IsVisible="False" RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="世界链" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="ChainInfo" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="刷新" FontSize="13" Padding="12,5" CornerRadius="6" Margin="0,0,8,0" Click="OnShowChain"/>
<Button Grid.Column="2" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<Border Grid.Row="1" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0" HorizontalScrollBarVisibility="Auto">
<StackPanel x:Name="ChainHost" Margin="18,16,18,18" Spacing="16"/>
</ScrollViewer>
</Border>
</Grid>
<!-- 配置编辑视图(表单由代码生成) -->
<Grid x:Name="ConfigView" IsVisible="False" RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto,Auto" Margin="0,4,0,12">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="配置编辑" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="ConfigInfo" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="保存并备份旧配置" FontSize="13" Padding="12,5" CornerRadius="6" Margin="0,0,8,0" Click="OnSaveConfig"/>
<Button Grid.Column="2" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6" Click="OnBackToConsole"/>
</Grid>
<Border Grid.Row="1" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0">
<StackPanel x:Name="ConfigHost" Margin="16,14,16,18" Spacing="8"/>
</ScrollViewer>
</Border>
</Grid>
<!-- 地图预览视图(切换而非弹窗) -->
<Grid x:Name="MapView" IsVisible="False" RowDefinitions="Auto,Auto,*,Auto">
<!-- 行 0:标题 + 状态 + 返回。工具栏不挤在这一行,让它有整行宽度好自动换行 -->
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,4,0,8">
<StackPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock Text="地图预览" FontSize="22" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimary}"/>
<TextBlock x:Name="MapInfo" Text="—" FontSize="11" Foreground="{DynamicResource TextSecondary}" Margin="0,3,0,0"/>
</StackPanel>
<Button Grid.Column="1" Content="← 返回控制台" FontSize="13" Padding="12,5" CornerRadius="6"
VerticalAlignment="Center" Click="OnBackToConsole"/>
</Grid>
<!-- 行 1:工具栏。★ 用 WrapPanel 而非 StackPanel:控件多(宿主 6 个 + 插件若干)时窄窗口能自动换行,
否则会被挤出可视区。v4 的插件贡献点也把控件追加到这个面板里(MapPluginBar 就是它本身)。 -->
<WrapPanel Grid.Row="1" x:Name="MapPluginBar" Orientation="Horizontal" Margin="0,0,0,10">
<ComboBox x:Name="MapPicker" FontSize="13" Width="170" Margin="0,0,6,6" SelectionChanged="OnMapPickChanged"/>
<Button Content="导入世界…" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnImportWorld"
ToolTip.Tip="从任意位置导入 .wld 来框选模板(只存到管理器暂存区,不写入服务器世界目录)"/>
<Button Content="适应" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapFit"/>
<Button Content="1:1" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapActual"/>
<Button Content="−" FontSize="13" Width="32" Padding="0,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapZoomOut"/>
<Button Content="+" FontSize="13" Width="32" Padding="0,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapZoomIn"/>
<Button Content="刷新" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnRefreshMap"/>
<TextBox x:Name="MapGotoBox" Width="96" FontSize="13" Margin="0,0,4,6" Padding="6,4" CornerRadius="6"
Watermark="x,y 跳转" ToolTip.Tip="输入世界坐标,如 3120,840,回车跳到该处"/>
<Button Content="跳转" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapGoto"/>
<CheckBox x:Name="ChkMapGrid" Content="网格" FontSize="13" Margin="0,0,8,6" Click="OnMapOverlayToggle"/>
<CheckBox x:Name="ChkMapSpawn" Content="出生点" FontSize="13" Margin="0,0,8,6" Click="OnMapOverlayToggle"/>
<ComboBox x:Name="MapLayers" Width="118" FontSize="13" Margin="0,0,6,6" SelectionChanged="OnMapLayersChanged"
ToolTip.Tip="只影响显示与导出,不改动世界文件"/>
<Button Content="导出视口" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapExportView"/>
<Button Content="导出整图" FontSize="13" Padding="10,5" CornerRadius="6" Margin="0,0,6,6" Click="OnMapExportFull"/>
</WrapPanel>
<Grid Grid.Row="2">
<Border x:Name="MapCard" Background="{DynamicResource MatPanel}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="8" ClipToBounds="True"
Cursor="Hand" PointerWheelChanged="OnMapWheel"
PointerPressed="OnMapPointerPressed" PointerMoved="OnMapPointerMoved"
PointerReleased="OnMapPointerReleased" DoubleTapped="OnMapDoubleTapped">
<!-- 地图视口:用 RenderTransform 缩放/平移(不触发布局,缩放与位移同帧生效,
避免"新尺寸 + 旧偏移"渲染出的一帧错位/闪烁) -->
<!-- ★ 必须用 Canvas:Panel 会把子元素的排列矩形夹到视口大小,
Stretch=None 时就只画左上角一块(实测 Panel 下 Bounds=1440x1100,Canvas 下=12000x2400) -->
<Canvas x:Name="MapSurface" ClipToBounds="True">
<Image x:Name="MapImage" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top" PointerWheelChanged="OnMapWheel"/>
<maps:MapOverlay x:Name="MapOverlay" IsHitTestVisible="False" IsVisible="False"/>
<Rectangle x:Name="MapSelectRect" IsVisible="False" IsHitTestVisible="False"
Fill="{DynamicResource AccentSoft}" Stroke="{DynamicResource Accent}" StrokeThickness="1.5"/>
</Canvas>
</Border>
</Grid>
<!-- 卡片下方的加载进度条(渲染/解码时显示;浅蓝取管理器强调色 #66CCFF) -->
<ProgressBar Grid.Row="3" x:Name="MapProgress" Minimum="0" Maximum="1" Height="4" Margin="2,10,2,0"
Foreground="{DynamicResource Accent}" Background="{DynamicResource FillSecondary}" IsVisible="False">
<!-- 0.25s 过渡:进度值变化时是"滑过去"而不是"跳过去" -->
<ProgressBar.Transitions>
<Transitions>
<DoubleTransition Property="Value" Duration="0:0:0.25"/>
</Transitions>
</ProgressBar.Transitions>
</ProgressBar>
</Grid>
</Panel>
<!-- ★ 右侧功能菜单(插件/地图等迁移到这里) -->
<Border Grid.Row="1" Grid.Column="2" Background="{DynamicResource MatSidebar}" Padding="16,14">
<ScrollViewer ScrollViewer.AllowAutoHide="False" Padding="0,0,12,0" VerticalScrollBarVisibility="Auto">
<StackPanel x:Name="MenuPanel" Spacing="6">
<TextBlock Text="服务端" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondary}" Margin="4,0,0,6"/>
<Border Background="{DynamicResource FillPrimary}" BorderBrush="{DynamicResource Hairline}" BorderThickness="1" CornerRadius="6" Padding="10,7">
<StackPanel Orientation="Horizontal" Spacing="7">
<Border x:Name="SrvDot" Width="7" Height="7" CornerRadius="3.5" Background="{DynamicResource SysGray}" VerticalAlignment="Center"/>
<TextBlock x:Name="ConnState" Text="未运行" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<!-- ★ 连接健康三灯(移植 MCSManager 的显式连接状态思路):隧道 / 命令通道 / REST 接口
形态用 macOS「分段控件」的轨道(一条底 + 细分割线),但语义仍是三个状态灯,
所以没有"选中段填充"——颜色只表达健康度。 -->
<Border Classes="segment" Margin="0,4,0,0" ToolTip.Tip="绿灯=正常;橙灯=降级/回退;灰灯=未启用">
<Grid ColumnDefinitions="*,Auto,*,Auto,*">
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="5" HorizontalAlignment="Center" Margin="0,4">
<Border Classes="dot" x:Name="DotTunnel" Width="7" Height="7" CornerRadius="3.5" Background="{DynamicResource SysGray}" VerticalAlignment="Center"/>
<TextBlock Text="隧道" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center"/>
</StackPanel>
<Border Grid.Column="1" Width="1" Background="{DynamicResource Hairline}" Margin="0,5"/>
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="5" HorizontalAlignment="Center" Margin="0,4">
<Border Classes="dot" x:Name="DotShell" Width="7" Height="7" CornerRadius="3.5" Background="{DynamicResource SysGray}" VerticalAlignment="Center"/>
<TextBlock Text="通道" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center"/>
</StackPanel>
<Border Grid.Column="3" Width="1" Background="{DynamicResource Hairline}" Margin="0,5"/>
<StackPanel Grid.Column="4" Orientation="Horizontal" Spacing="5" HorizontalAlignment="Center" Margin="0,4">
<Border Classes="dot" x:Name="DotRest" Width="7" Height="7" CornerRadius="3.5" Background="{DynamicResource SysGray}" VerticalAlignment="Center"/>
<TextBlock Text="接口" FontSize="11" Foreground="{DynamicResource TextSecondary}" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Border>
<Grid ColumnDefinitions="*,*" Margin="0,4,0,0">
<Button Grid.Column="0" x:Name="BtnStart" Content="▶ 启动" FontSize="13" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Padding="0,6" CornerRadius="6" Margin="0,0,3,0" Click="OnStartServer"/>
<Button Grid.Column="1" x:Name="BtnStop" Content="■ 停止" FontSize="13" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Padding="0,6" CornerRadius="6" Margin="3,0,0,0" Click="OnStopServer"/>
</Grid>
<Button x:Name="BtnRestart" Content="⟳ 重启服务端" FontSize="13" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Padding="0,6" CornerRadius="6" Click="OnRestartServer"/>
<CheckBox x:Name="ChkWatchdog" Content="掉线自启" FontSize="13" Margin="4,2,0,0"/>
<TextBlock x:Name="PluginMetricsHeader" Text="插件指标" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondary}" Margin="4,14,0,6" IsVisible="False"/>
<StackPanel x:Name="PluginMetricsHost" Spacing="4"/>
<TextBlock Text="功能" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondary}" Margin="4,14,0,6"/>
<Button x:Name="BtnConn" Classes="menu" CornerRadius="6" AutomationProperties.Name="连接设置" Click="OnShowConn">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoConn}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="连接设置" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="BtnChain" Classes="menu" CornerRadius="6" AutomationProperties.Name="世界链" Click="OnShowChain">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoChain}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="世界链" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="BtnConfig" Classes="menu" CornerRadius="6" AutomationProperties.Name="配置编辑" Click="OnShowConfig">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoEdit}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="配置编辑" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="BtnPlugins" Classes="menu" CornerRadius="6" AutomationProperties.Name="文件管理" Click="OnShowPlugins">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoFolder}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="文件管理" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="BtnMap" Classes="menu" CornerRadius="6" AutomationProperties.Name="地图预览" Click="OnShowMap">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoMap}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="地图预览" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="BtnMaint" Classes="menu" CornerRadius="6" AutomationProperties.Name="维护" Click="OnShowMaint">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoShield}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="维护" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="BtnMgrPlugins" Classes="menu" CornerRadius="6" AutomationProperties.Name="插件管理" Click="OnShowMgrPlugins">
<Grid ColumnDefinitions="Auto,Auto" VerticalAlignment="Center">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource IcoBlocks}" Stroke="{Binding $parent[Button].Foreground}"/>
<TextBlock Grid.Column="1" Text="插件管理" VerticalAlignment="Center"/>
</Grid>
</Button>
<!-- 下面的按钮已合并进「维护」视图,保留元素是为了不破坏代码里对 BtnReset/BtnBackup/BtnRestore 的引用 -->
<StackPanel IsVisible="False">
<Button x:Name="BtnReset" Click="OnResetClicked"/>
<Button x:Name="BtnBackup" Click="OnBackup"/>
<Button x:Name="BtnRestore" Click="OnRestoreClicked"/>
</StackPanel>
<TextBlock x:Name="ExtHeader" Text="扩展" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondary}" Margin="4,14,0,6" IsVisible="False"/>
<StackPanel x:Name="ExtPanel" Spacing="6"/>
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
</Panel>
</Window>