mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 18:01:26 +08:00
refactor.完成主界面的重构
This commit is contained in:
@@ -193,6 +193,7 @@
|
||||
},
|
||||
"MedicineConfirm": {
|
||||
"action": "clickSelf",
|
||||
"cache": false,
|
||||
"maxTimes": 0,
|
||||
"roi": [
|
||||
1000,
|
||||
@@ -225,6 +226,7 @@
|
||||
"StoneConfirm": {
|
||||
"template": "MedicineConfirm.png",
|
||||
"action": "clickSelf",
|
||||
"cache": false,
|
||||
"maxTimes": 0,
|
||||
"roi": [
|
||||
1000,
|
||||
@@ -364,6 +366,7 @@
|
||||
],
|
||||
"next": [
|
||||
"LastBattle",
|
||||
"Terminal",
|
||||
"CloseAnno",
|
||||
"TodaysSupplies"
|
||||
]
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace MeoAsstGui
|
||||
tvm.AddLog("当前任务:" + taskChain);
|
||||
}
|
||||
break;
|
||||
|
||||
case AsstMsg.TaskCompleted:
|
||||
{
|
||||
string taskName = detail["name"].ToString();
|
||||
@@ -115,6 +116,7 @@ namespace MeoAsstGui
|
||||
case AsstMsg.AllTasksCompleted:
|
||||
{
|
||||
tvm.AddLog("任务队列已全部完成");
|
||||
tvm.Idle = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -126,19 +128,21 @@ namespace MeoAsstGui
|
||||
{
|
||||
string itemName = item["itemName"].ToString();
|
||||
int count = (int)item["quantity"];
|
||||
cur_drops += itemName + " : " + count + " \n";
|
||||
}
|
||||
tvm.AddLog("当次掉落:" + cur_drops);
|
||||
cur_drops += $"{itemName} : {count}\n";
|
||||
}
|
||||
cur_drops = cur_drops.EndsWith("\n") ? cur_drops.TrimEnd('\n') : "无";
|
||||
tvm.AddLog("当次掉落:\n" + cur_drops);
|
||||
|
||||
string all_drops = "";
|
||||
JArray statistics = (JArray)detail["statistics"];
|
||||
foreach (var item in statistics)
|
||||
{
|
||||
string itemName = item["itemName"].ToString();
|
||||
int count = (int)item["count"];
|
||||
all_drops += itemName + " : " + count + " \n";
|
||||
all_drops += $"{itemName} : {count}\n";
|
||||
}
|
||||
tvm.AddLog("掉落统计:" + all_drops);
|
||||
|
||||
all_drops = all_drops.EndsWith("\n") ? all_drops.TrimEnd('\n') : "无";
|
||||
tvm.AddLog("掉落统计:\n" + all_drops);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
@@ -21,11 +22,23 @@ namespace MeoAsstGui
|
||||
{
|
||||
public LogItemViewModel(string content, string color = "Black", string weight = "Regular")
|
||||
{
|
||||
Time = DateTime.Now.ToString("MM'-'dd' 'HH':'mm':'ss") + " ";
|
||||
this.Content = content;
|
||||
this.Color = color;
|
||||
this.Weight = weight;
|
||||
}
|
||||
|
||||
private string _time;
|
||||
|
||||
public string Time
|
||||
{
|
||||
get { return _time; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _time, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _content;
|
||||
|
||||
public string Content
|
||||
@@ -38,6 +51,7 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
private string _color;
|
||||
|
||||
public string Color
|
||||
{
|
||||
get { return _color; }
|
||||
|
||||
@@ -218,6 +218,9 @@
|
||||
<Resource Include="favicon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CalcBinding">
|
||||
<Version>2.5.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Costura.Fody">
|
||||
<Version>5.7.0</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
mc:Ignorable="d"
|
||||
xmlns:local="clr-namespace:MeoAsstGui"
|
||||
d:DesignHeight="150" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -13,27 +15,27 @@
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||
<CheckBox IsChecked="{Binding UseMedicine}" Content="吃理智药" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding MedicineNumber}" Margin="5, 10, 5, 10" TextWrapping="Wrap" VerticalAlignment="Center"
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center">
|
||||
<CheckBox IsChecked="{Binding UseMedicine}" IsHitTestVisible="{Binding Idle}" Content="吃理智药" Margin="10" />
|
||||
<TextBox Text="{Binding MedicineNumber}" IsReadOnly="{c:Binding Path=!Idle}" TextWrapping="Wrap" Margin="10"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="个" VerticalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="个" />
|
||||
<!--<TextBlock Style="{StaticResource TextBlockDefaultBold}" Text="{Binding MedicineInfo}" Margin="30, 0, 0, 0" VerticalAlignment="Center" />-->
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1">
|
||||
<CheckBox IsChecked="{Binding UseStone}" Content="吃石头 " Margin="10, 10, 5, 10" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding StoneNumber}" Margin="5, 10, 5, 10" TextWrapping="Wrap" VerticalAlignment="Center"
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center">
|
||||
<CheckBox IsChecked="{Binding UseStone}" IsHitTestVisible="{Binding Idle}" Content="吃石头 " Margin="10" />
|
||||
<TextBox Text="{Binding StoneNumber}" IsReadOnly="{c:Binding Path=!Idle}" TextWrapping="Wrap" Margin="10"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="颗" VerticalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="颗" />
|
||||
<!--<TextBlock Style="{StaticResource TextBlockDefaultBold}" Text="{Binding StoneInfo}" Margin="30, 0, 0, 0" VerticalAlignment="Center" />-->
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2">
|
||||
<CheckBox IsChecked="{Binding HasTimesLimited}" Margin="10, 10, 5, 10" Content="指定次数 " VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding MaxTimes}" TextWrapping="Wrap" Margin="5, 10, 5, 10" VerticalAlignment="Center"
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" VerticalAlignment="Center">
|
||||
<CheckBox IsChecked="{Binding HasTimesLimited}" IsHitTestVisible="{Binding Idle}" Content="指定次数" Margin="10" />
|
||||
<TextBox Text="{Binding MaxTimes}" IsReadOnly="{c:Binding Path=!Idle}" TextWrapping="Wrap" Margin="10"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="次" VerticalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="次" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="550">
|
||||
<Grid Margin="20, 20">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="550">
|
||||
<Grid Margin="20, 20">
|
||||
<Grid>
|
||||
<!--IsEnabled="{Binding CreditShoppingCheckBoxIsEnable}"-->
|
||||
<CheckBox IsChecked="{Binding CreditShopping}"
|
||||
Content=" 信用商店随缘买 (不买碳和家具)" />
|
||||
|
||||
@@ -198,9 +198,10 @@ namespace MeoAsstGui
|
||||
SetAndNotify(ref _infrastWorkMode, value);
|
||||
}
|
||||
}
|
||||
|
||||
/* 信用商店设置 */
|
||||
|
||||
private bool _creditShopping = false;
|
||||
private bool _creditShopping = System.Convert.ToBoolean(ViewStatusStorage.Get("Mall.CreditShopping", bool.FalseString));
|
||||
|
||||
public bool CreditShopping
|
||||
{
|
||||
@@ -208,6 +209,7 @@ namespace MeoAsstGui
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _creditShopping, value);
|
||||
ViewStatusStorage.Set("Mall.CreditShopping", value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,14 +38,19 @@ namespace MeoAsstGui
|
||||
|
||||
public void AddLog(string content, string color = "Black", string weight = "Regular")
|
||||
{
|
||||
string time = DateTime.Now.ToString("MM'-'dd' 'HH':'mm':'ss") + " ";
|
||||
LogItemViewModels.Add(new LogItemViewModel(time + content, color, weight));
|
||||
LogItemViewModels.Add(new LogItemViewModel(content, color, weight));
|
||||
//LogItemViewModels.Insert(0, new LogItemViewModel(time + content, color, weight));
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
{
|
||||
LogItemViewModels.Clear();
|
||||
}
|
||||
|
||||
public async void LinkStart()
|
||||
{
|
||||
ClearLog();
|
||||
|
||||
AddLog("正在捕获模拟器窗口……");
|
||||
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
@@ -98,6 +103,7 @@ namespace MeoAsstGui
|
||||
{
|
||||
AddLog("出现未知错误");
|
||||
}
|
||||
Idle = !ret;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
@@ -105,6 +111,7 @@ namespace MeoAsstGui
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
asstProxy.AsstStop();
|
||||
AddLog("已停止");
|
||||
Idle = true;
|
||||
}
|
||||
|
||||
private bool appendFight()
|
||||
@@ -155,7 +162,18 @@ namespace MeoAsstGui
|
||||
return asstProxy.AsstAppendMall(settings.CreditShopping);
|
||||
}
|
||||
|
||||
private bool _shutdown;
|
||||
private bool _idle = true;
|
||||
|
||||
public bool Idle
|
||||
{
|
||||
get { return _idle; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _idle, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _shutdown = false;
|
||||
|
||||
public bool Shutdown
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="495" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="150" />
|
||||
@@ -29,7 +29,7 @@
|
||||
<CheckBox IsChecked="{Binding ChooseLevel6}" Content="自动选择6星Tags" HorizontalAlignment="Left" Margin="0,2" VerticalAlignment="Bottom" />
|
||||
</StackPanel>
|
||||
<!--<Label x:Name="prompt" Content="提示:本辅助仅会帮你选择最优Tags,
但是不会帮你点击确定按钮!!!
请自行检查辅助选择的是否正确,
若辅助出现识别错误,遗漏了高星干员,
作者概不负责哦__(:з」∠)_"-->
|
||||
<!--HorizontalAlignment="Center" VerticalAlignment="Center" Height="121" Width="292" FontSize="16" />-->
|
||||
<!--HorizontalAlignment="Center" VerticalAlignment="Center" Height="121" Width="292" FontSize="16" />-->
|
||||
<Button Command="{s:Action StartCalc}" Content="开始识别" Margin="30" HorizontalAlignment="Center" VerticalAlignment="Center" Width="150" Height="60" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
<ColumnDefinition Width="175" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox ItemsSource="{Binding ListTitle}" Grid.Column="0"
|
||||
<ListBox ItemsSource="{Binding ListTitle}" Grid.Column="0" Margin="10"
|
||||
IsSynchronizedWithCurrentItem="true" />
|
||||
<ScrollViewer HorizontalAlignment="Center" Grid.Column="1">
|
||||
<ScrollViewer HorizontalAlignment="Stretch" Grid.Column="1" Margin="10">
|
||||
<StackPanel>
|
||||
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />
|
||||
<local:InfrastSettingsUserControl Margin="10" />
|
||||
<local:InfrastSettingsUserControl Margin="20" />
|
||||
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />
|
||||
<local:MallSettingsUserControl Margin="10" />
|
||||
<local:MallSettingsUserControl Margin="20" />
|
||||
<!--<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />-->
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
xmlns:local="clr-namespace:MeoAsstGui"
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
Height="495" Width="800">
|
||||
d:DesignHeight="495" d:DesignWidth="800">
|
||||
<Grid Margin="20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
@@ -22,33 +23,36 @@
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox Grid.Row="0" Width="200" Margin="10" HorizontalAlignment="Center"
|
||||
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True"
|
||||
<ListBox x:Name="TaskList" Grid.Row="0" Width="200" Margin="10" HorizontalAlignment="Center"
|
||||
dd:DragDrop.IsDragSource="{Binding Idle}" dd:DragDrop.IsDropTarget="{Binding Idle}"
|
||||
ItemsSource="{Binding Path=TaskItemViewModels}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<!--<TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding ID}" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text=". " />-->
|
||||
<CheckBox IsChecked="{Binding IsChecked}" Content="{Binding Name}" />
|
||||
<CheckBox IsChecked="{Binding IsChecked}" IsHitTestVisible="{Binding ElementName=TaskList, Path=DataContext.Idle}" Content="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<CheckBox Grid.Row="1" IsChecked="{Binding Shutdown}" Content="自动关机" HorizontalAlignment="Center" Margin="5" />
|
||||
<Button Grid.Row="2" Command="{s:Action LinkStart}" Content="LinkStart !" HorizontalAlignment="Center" Width="120" Height="50" Margin="5" />
|
||||
<Button Grid.Row="2" Command="{s:Action LinkStart}" IsEnabled="{Binding Idle}" Content="LinkStart !" HorizontalAlignment="Center" Width="120" Height="50" Margin="5" />
|
||||
<Button Grid.Row="3" Command="{s:Action Stop}" Content="停止" HorizontalAlignment="Center" Width="120" Height="50" Margin="5" />
|
||||
</Grid>
|
||||
<local:FightSettingsUserControl Grid.Column="1" VerticalAlignment ="Top" Margin="10" />
|
||||
<local:FightSettingsUserControl Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="10" />
|
||||
<!--<GridSplitter Grid.Column="2" Width="5" HorizontalAlignment="Stretch" />-->
|
||||
<!--<Rectangle Grid.Column="2" VerticalAlignment="Stretch" Fill="LightGray" Width="4" />-->
|
||||
<ScrollViewer Grid.Column="2"
|
||||
<ScrollViewer Grid.Column="2" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10"
|
||||
local:AutoScroll.AutoScroll="True">
|
||||
<ItemsControl ItemsSource="{Binding Path=LogItemViewModels}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontWeight="{Binding Weight}" Text="{Binding Content}" Foreground="{Binding Color}" />
|
||||
<TextBlock Text="{Binding Time}"
|
||||
Style="{StaticResource TextBlockDefault}" TextWrapping="Wrap" Margin="5, 5" />
|
||||
<TextBlock Text="{Binding Content}" Foreground="{Binding Color}" FontWeight="{Binding Weight}"
|
||||
Style="{StaticResource TextBlockDefault}" TextWrapping="Wrap" Margin="5, 5" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
|
||||
Reference in New Issue
Block a user