Skip to content

Commit 30eb854

Browse files
committed
up 暂时这样
1 parent aab49d4 commit 30eb854

16 files changed

Lines changed: 859 additions & 534 deletions

src/ColorMC.Gui/Resource/Language/zh-cn.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@
727727
"AddGameWindow.Tab2.Text14": "没有选择压缩包类型",
728728
"AddGameWindow.Tab2.Text15": "该压缩包无法判断类型",
729729
"AddGameWindow.Tab2.Text16": "是否下载压缩包",
730+
"AddGameWindow.Tab2.Text17": "创建时间",
730731
"AddGameWindow.Tab3.Text1": "导入路径",
731732
"AddGameWindow.Tab3.Text2": "选择路径",
732733
"AddGameWindow.Tab3.Text3": "扫描文件",

src/ColorMC.Gui/Resource/ResourceDictionary1.axaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,20 @@
7171
<DataTemplate x:Key="ModCell8" DataType="vm:ModNodeModel">
7272
<TextBlock Text="{Binding Text, Mode=TwoWay}" />
7373
</DataTemplate>
74+
<DataTemplate x:Key="ZipNameCell1" DataType="vm:ZipTreeNodeModel">
75+
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" />
76+
</DataTemplate>
77+
<DataTemplate x:Key="ZipNameCell" DataType="vm:ZipTreeNodeModel">
78+
<StackPanel Orientation="Horizontal">
79+
<TextBlock Width="30" HorizontalAlignment="Center">
80+
<TextBlock.Text>
81+
<MultiBinding Converter="{x:Static icon:IconConverter.FileIconConverter}">
82+
<Binding Path="IsDirectory" />
83+
<Binding Path="IsExpanded" />
84+
</MultiBinding>
85+
</TextBlock.Text>
86+
</TextBlock>
87+
<TextBlock Text="{Binding Name}" />
88+
</StackPanel>
89+
</DataTemplate>
7490
</ResourceDictionary>

src/ColorMC.Gui/UI/Controls/Add/AddGameTab2Control.axaml

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,62 @@
1212
d:DesignWidth="800"
1313
x:DataType="model:AddGameModel"
1414
mc:Ignorable="d">
15-
<ScrollViewer VerticalScrollBarVisibility="Visible">
16-
<Border Margin="20,10,20,20" Classes="t2">
17-
<DockPanel Margin="15,15,5,15">
18-
<Button
19-
Width="100"
20-
Height="35"
21-
Margin="-2,-2,7,-2"
22-
HorizontalAlignment="Right"
23-
VerticalAlignment="Center"
24-
Classes="top"
25-
Command="{Binding AddPackGame}"
26-
Content="{setting:Localize AddGameWindow.Text1}"
27-
DockPanel.Dock="Bottom"
28-
ToolTip.Tip="{setting:Localize ToolTip.Text84}" />
29-
<StackPanel>
15+
<Border Margin="20,10,20,20" Classes="t2">
16+
<DockPanel Margin="15,15,5,15">
17+
<Button
18+
Width="100"
19+
Height="35"
20+
Margin="-2,-2,7,-2"
21+
HorizontalAlignment="Right"
22+
VerticalAlignment="Center"
23+
Classes="top"
24+
Command="{Binding AddPackGame}"
25+
Content="{setting:Localize AddGameWindow.Text1}"
26+
DockPanel.Dock="Bottom"
27+
ToolTip.Tip="{setting:Localize ToolTip.Text84}" />
28+
<StackPanel DockPanel.Dock="Top">
29+
<TextBox
30+
Margin="0,0,10,10"
31+
HorizontalAlignment="Stretch"
32+
Text="{Binding Name}"
33+
Watermark="{setting:Localize AddGameWindow.Tab1.Text2}" />
34+
<DockPanel Margin="0,0,10,10">
35+
<Button
36+
Width="100"
37+
Height="35"
38+
Margin="-2,-2,-3,-2"
39+
HorizontalAlignment="Right"
40+
VerticalAlignment="Center"
41+
Classes="top"
42+
Command="{Binding SelectPack}"
43+
Content="{setting:Localize AddGameWindow.Tab2.Text3}"
44+
DockPanel.Dock="Right"
45+
ToolTip.Tip="{setting:Localize ToolTip.Text85}" />
3046
<TextBox
31-
Margin="0,0,10,10"
47+
Margin="0,0,10,0"
3248
HorizontalAlignment="Stretch"
33-
Text="{Binding Name}"
34-
Watermark="{setting:Localize AddGameWindow.Tab1.Text2}" />
35-
<DockPanel Margin="0,0,10,10">
36-
<Button
37-
Width="100"
38-
Height="35"
39-
Margin="-2,-2,-3,-2"
40-
HorizontalAlignment="Right"
41-
VerticalAlignment="Center"
42-
Classes="top"
43-
Command="{Binding SelectPack}"
44-
Content="{setting:Localize AddGameWindow.Tab2.Text3}"
45-
DockPanel.Dock="Right"
46-
ToolTip.Tip="{setting:Localize ToolTip.Text85}" />
47-
<TextBox
48-
Margin="0,0,10,0"
49+
Text="{Binding ZipLocal}"
50+
Watermark="{setting:Localize AddGameWindow.Tab2.Text1}" />
51+
</DockPanel>
52+
<Grid ColumnDefinitions="*,*">
53+
<DockPanel Margin="0,0,10,0">
54+
<TextBlock Margin="0,0,5,0" Text="{setting:Localize AddGameWindow.Tab2.Text2}" />
55+
<ComboBox
4956
HorizontalAlignment="Stretch"
50-
Text="{Binding ZipLocal}"
51-
Watermark="{setting:Localize AddGameWindow.Tab2.Text1}" />
57+
ItemsSource="{Binding PackTypeList}"
58+
SelectedIndex="{Binding Type}" />
5259
</DockPanel>
53-
<Grid ColumnDefinitions="*,*">
54-
<DockPanel Margin="0,0,10,0">
55-
<TextBlock Margin="0,0,5,0" Text="{setting:Localize AddGameWindow.Tab2.Text2}" />
56-
<ComboBox
57-
HorizontalAlignment="Stretch"
58-
ItemsSource="{Binding PackTypeList}"
59-
SelectedIndex="{Binding Type}" />
60-
</DockPanel>
61-
<DockPanel Grid.Column="1" Margin="0,0,10,0">
62-
<TextBlock Margin="0,0,5,0" Text="{setting:Localize AddGameWindow.Tab1.Text5}" />
63-
<ComboBox
64-
HorizontalAlignment="Stretch"
65-
IsEditable="True"
66-
ItemsSource="{Binding GroupList}"
67-
Text="{Binding Group}" />
68-
</DockPanel>
69-
</Grid>
70-
<TreeDataGrid Margin="0,0,10,0" Source="{Binding ZipFiles}" />
71-
72-
</StackPanel>
73-
</DockPanel>
74-
</Border>
75-
</ScrollViewer>
60+
<DockPanel Grid.Column="1" Margin="0,0,10,0">
61+
<TextBlock Margin="0,0,5,0" Text="{setting:Localize AddGameWindow.Tab1.Text5}" />
62+
<ComboBox
63+
HorizontalAlignment="Stretch"
64+
IsEditable="True"
65+
ItemsSource="{Binding GroupList}"
66+
Text="{Binding Group}" />
67+
</DockPanel>
68+
</Grid>
69+
</StackPanel>
70+
<TreeDataGrid Margin="0,10,10,10" Source="{Binding ZipFiles}" />
71+
</DockPanel>
72+
</Border>
7673
</UserControl>

src/ColorMC.Gui/UI/Controls/Main/MainGamesControl.axaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
d:DesignWidth="800"
1111
x:DataType="model:MainModel"
1212
mc:Ignorable="d">
13-
<ItemsControl Background="Transparent" ItemsSource="{Binding Games}">
13+
<ItemsControl
14+
Background="Transparent"
15+
DataContext="{Binding OneGroup}"
16+
ItemsSource="{Binding GameList}">
1417
<ItemsControl.ItemsPanel>
1518
<ItemsPanelTemplate>
1619
<WrapPanel />

src/ColorMC.Gui/UI/Controls/Main/MainGamesControl.axaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ public void OnDragOver(object? sender, DragEventArgs e)
3939

4040
if (pos.X > targetBorder.Bounds.Width / 2)
4141
{
42-
vm?.PutPla(targetItem, false);
42+
vm?.OneGroup.PutPla(targetItem, false);
4343
}
4444
else
4545
{
46-
vm?.PutPla(targetItem, true);
46+
vm?.OneGroup.PutPla(targetItem, true);
4747
}
4848
}
4949
else
5050
{
51-
vm?.PutPla();
51+
vm?.OneGroup.PutPla();
5252
}
5353
}
5454

@@ -72,16 +72,16 @@ public void OnDrop(object? sender, DragEventArgs e)
7272

7373
if (pos.X > targetBorder.Bounds.Width / 2)
7474
{
75-
vm?.PutDrap(targetItem, false);
75+
vm?.OneGroup.PutDrap(targetItem, false);
7676
}
7777
else
7878
{
79-
vm?.PutDrap(targetItem, true);
79+
vm?.OneGroup.PutDrap(targetItem, true);
8080
}
8181
}
8282
else
8383
{
84-
vm?.PutDrap();
84+
vm?.OneGroup.PutDrap();
8585
}
8686
}
8787
}

src/ColorMC.Gui/UI/Controls/Main/SimpleControl.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
Classes="t1"
3636
ClipToBounds="False"
3737
DisplayMemberBinding="{Binding Name}"
38-
ItemsSource="{Binding Games}"
38+
ItemsSource="{Binding GameList}"
3939
SelectedItem="{Binding Game}" />
4040
<UniformGrid
4141
Margin="0,10,0,0"

src/ColorMC.Gui/UI/Model/Add/AddGameTab2Model.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public partial class AddGameModel
2626
/// 压缩包文件列表
2727
/// </summary>
2828
[ObservableProperty]
29-
private HierarchicalTreeDataGridSource<FileTreeNodeModel>? _zipFiles;
29+
private HierarchicalTreeDataGridSource<ZipTreeNodeModel>? _zipFiles;
3030

3131
/// <summary>
3232
/// 文件列表
@@ -74,7 +74,9 @@ async partial void OnZipLocalChanged(string? value)
7474
return new ZipPage(value);
7575
});
7676

77-
var res = await GameBinding.CheckTypeAsync(value);
77+
ZipFiles = _zipFileModel.Source;
78+
79+
var res = await GameBinding.CheckTypeAsync(value, _zipFileModel.Zip);
7880
Window.CloseDialog(dialog);
7981
if (res == null)
8082
{

src/ColorMC.Gui/UI/Model/Add/AddGameTab3Model.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ public async Task RefashFiles()
6363
if (list.Count > 0)
6464
{
6565
res = await Window.ShowChoice(string.Format(LangUtils.Get("AddGameWindow.Tab3.Text7"), list.Count));
66-
if (!res)
66+
if (res)
6767
{
68+
Window.CloseDialog(dialog);
6869
await ImportAsync(list);
6970
return;
7071
}

src/ColorMC.Gui/UI/Model/Items/FileTreeNodeModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ public partial class FileTreeNodeModel : ObservableObject
5959
/// <summary>
6060
/// 父文件夹
6161
/// </summary>
62-
private readonly FileTreeNodeModel _par;
62+
private readonly FileTreeNodeModel _parent;
6363

6464
public FileTreeNodeModel(FileTreeNodeModel? par, string path, bool isDirectory, bool check = true, bool isRoot = false)
6565
{
66-
_par = par ?? this;
66+
_parent = par ?? this;
6767
_path = System.IO.Path.GetFullPath(path + (isDirectory ? "/" : ""));
6868
_name = isRoot ? path : System.IO.Path.GetFileName(path);
6969
_isExpanded = isRoot;
@@ -92,7 +92,7 @@ partial void OnIsCheckedChanged(bool value)
9292
{
9393
item.IsChecked = true;
9494
}
95-
_par.IsAllCheck();
95+
_parent.IsAllCheck();
9696
}
9797
else if (IsChecked == false)
9898
{

0 commit comments

Comments
 (0)