mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
Merge pull request #1845 from MaaAssistantArknights/perf/csharp
perf: 优化 c# 部分代码
This commit is contained in:
@@ -936,7 +936,7 @@ namespace MeoAsstGui
|
||||
{
|
||||
string resultContent = string.Empty;
|
||||
JArray result_array = (JArray)subTaskDetails["result"];
|
||||
int level = (int)subTaskDetails["level"];
|
||||
/* int level = (int)subTaskDetails["level"]; */
|
||||
foreach (var combs in result_array)
|
||||
{
|
||||
int tag_level = (int)combs["level"];
|
||||
@@ -1243,6 +1243,7 @@ namespace MeoAsstGui
|
||||
/// <param name="dorm_threshold">宿舍进驻心情阈值。</param>
|
||||
/// <param name="dorm_filter_not_stationed_enabled">宿舍是否使用未进驻筛选标签</param>
|
||||
/// <param name="dorm_trust_enabled">宿舍是否使用蹭信赖功能</param>
|
||||
/// <param name="originium_shard_auto_replenishment">制造站搓玉是否补货</param>
|
||||
/// <returns>是否成功。</returns>
|
||||
public bool AsstAppendInfrast(string[] order, string uses_of_drones, double dorm_threshold, bool dorm_filter_not_stationed_enabled, bool dorm_trust_enabled, bool originium_shard_auto_replenishment)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
// <copyright file="ComboBoxExtensions.cs" company="MaaAssistantArknights">
|
||||
// MeoAsstGui - A part of the MeoAssistantArknights project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
// </copyright>
|
||||
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ namespace MeoAsstGui
|
||||
/// <summary>
|
||||
/// Determine whether the stage associated activity is closed
|
||||
/// </summary>
|
||||
/// <param name="dayOfWeek">Current day of week</param>
|
||||
/// <returns>Whether activity is closed</returns>
|
||||
public bool IsActivityClosed()
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
Content="{DynamicResource AssignedMaterial}"
|
||||
IsChecked="{Binding IsSpecifiedDrops}"
|
||||
ToolTip="{DynamicResource NoAutoNavigation}" />
|
||||
<Grid Height="42" Visibility="{Binding IsSpecifiedDrops, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||
<Grid Height="42" Visibility="{c:Binding IsSpecifiedDrops}">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
@@ -127,7 +127,7 @@
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
Text="{Binding DropsQuantity}"
|
||||
TextType="Int"
|
||||
Visibility="{Binding IsSpecifiedDrops, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
Visibility="{c:Binding IsSpecifiedDrops}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2">
|
||||
@@ -146,7 +146,7 @@
|
||||
TextAlignment="Center"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<Grid Height="42" Visibility="{Binding AlternateStageDisplay, Converter={StaticResource Boolean2VisibilityConverter}}">
|
||||
<Grid Height="42" Visibility="{c:Binding AlternateStageDisplay}">
|
||||
<TextBlock
|
||||
Margin="10,6"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -171,7 +171,7 @@
|
||||
ItemsSource="{Binding StageList}"
|
||||
SelectedValue="{Binding Stage1}"
|
||||
SelectedValuePath="Value"
|
||||
Visibility="{Binding NotCustomStageCode, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
Visibility="{c:Binding !CustomStageCode}" />
|
||||
<TextBox
|
||||
Height="30"
|
||||
Margin="0,6"
|
||||
@@ -180,7 +180,7 @@
|
||||
IsHitTestVisible="{c:Binding !FightTaskRunning}"
|
||||
Text="{Binding Stage1}"
|
||||
ToolTip="{DynamicResource CustomStageCodeTip}"
|
||||
Visibility="{Binding CustomStageCode, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
Visibility="{c:Binding CustomStageCode}" />
|
||||
<ComboBox
|
||||
Height="30"
|
||||
Margin="0,6"
|
||||
@@ -191,7 +191,7 @@
|
||||
ItemsSource="{Binding StageList}"
|
||||
SelectedValue="{Binding Stage2}"
|
||||
SelectedValuePath="Value"
|
||||
Visibility="{Binding AlternateStageDisplay, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
Visibility="{c:Binding AlternateStageDisplay}" />
|
||||
<ComboBox
|
||||
Height="30"
|
||||
Margin="0,6"
|
||||
@@ -202,7 +202,7 @@
|
||||
ItemsSource="{Binding StageList}"
|
||||
SelectedValue="{Binding Stage3}"
|
||||
SelectedValuePath="Value"
|
||||
Visibility="{Binding AlternateStageDisplay, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
Visibility="{c:Binding AlternateStageDisplay}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -37,9 +37,7 @@ namespace MeoAsstGui
|
||||
/// </summary>
|
||||
public class CopilotViewModel : Screen
|
||||
{
|
||||
#pragma warning disable IDE0052 // 删除未读的私有成员
|
||||
private readonly IWindowManager _windowManager;
|
||||
#pragma warning restore IDE0052 // 删除未读的私有成员
|
||||
private readonly IContainer _container;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// <copyright file="RecruitViewModel.cs" company="MaaAssistantArknights">
|
||||
// <copyright file="DepotViewModel.cs" company="MaaAssistantArknights">
|
||||
// MeoAsstGui - A part of the MeoAssistantArknights project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
@@ -12,6 +12,7 @@
|
||||
// </copyright>
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -62,18 +63,28 @@ namespace MeoAsstGui
|
||||
set => SetAndNotify(ref _depotResult, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ArkPlanner result.
|
||||
/// </summary>
|
||||
public string ArkPlannerResult { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Lolicon result.
|
||||
/// </summary>
|
||||
public string LoliconResult { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// parse of depot recognition result
|
||||
/// </summary>
|
||||
/// <param name="details">detailed json-style parameters</param>
|
||||
/// <returns>Success or not</returns>
|
||||
public bool Parse(JObject details)
|
||||
{
|
||||
string result = string.Empty;
|
||||
int count = 0;
|
||||
foreach (var item in details["arkplanner"]["object"]["items"])
|
||||
foreach (var item in details["arkplanner"]["object"]["items"].Cast<JObject>())
|
||||
{
|
||||
var itemObj = (JObject)item;
|
||||
result += (string)itemObj["name"] + " : " + (int)itemObj["have"] + "\t";
|
||||
result += (string)item["name"] + " : " + (int)item["have"] + "\t";
|
||||
if (++count == 4)
|
||||
{
|
||||
result += "\n";
|
||||
@@ -98,25 +109,34 @@ namespace MeoAsstGui
|
||||
|
||||
private bool _done = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether depot info is parsed.
|
||||
/// </summary>
|
||||
public bool Done
|
||||
{
|
||||
get => _done;
|
||||
set => SetAndNotify(ref _done, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export depot info to ArkPlanner.
|
||||
/// </summary>
|
||||
public void ExportToArkplanner()
|
||||
{
|
||||
Clipboard.SetDataObject(ArkPlannerResult);
|
||||
DepotInfo = Localization.GetString("CopiedToClipboard");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export depot info to Lolicon.
|
||||
/// </summary>
|
||||
public void ExportToLolicon()
|
||||
{
|
||||
Clipboard.SetDataObject(LoliconResult);
|
||||
DepotInfo = Localization.GetString("CopiedToClipboard");
|
||||
}
|
||||
|
||||
private void clear()
|
||||
private void Clear()
|
||||
{
|
||||
DepotResult = string.Empty;
|
||||
ArkPlannerResult = string.Empty;
|
||||
@@ -144,7 +164,7 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
DepotInfo = Localization.GetString("Identifying");
|
||||
clear();
|
||||
Clear();
|
||||
|
||||
asstProxy.AsstStartDepot();
|
||||
}
|
||||
|
||||
@@ -1702,6 +1702,9 @@ namespace MeoAsstGui
|
||||
|
||||
private bool _customStageCode = Convert.ToBoolean(ViewStatusStorage.Get("GUI.CustomStageCode", bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to use custom stage code.
|
||||
/// </summary>
|
||||
public bool CustomStageCode
|
||||
{
|
||||
get => _customStageCode;
|
||||
|
||||
@@ -1429,26 +1429,20 @@ namespace MeoAsstGui
|
||||
|
||||
private bool _customStageCode = Convert.ToBoolean(ViewStatusStorage.Get("GUI.CustomStageCode", bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to use custom stage code.
|
||||
/// </summary>
|
||||
public bool CustomStageCode
|
||||
{
|
||||
get => _customStageCode;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _customStageCode, value);
|
||||
NotCustomStageCode = !value;
|
||||
var settingsModel = _container.Get<SettingsViewModel>();
|
||||
AlternateStageDisplay = !value && settingsModel.UseAlternateStage;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _notCustomStageCode = !Convert.ToBoolean(ViewStatusStorage.Get("GUI.CustomStageCode", bool.FalseString));
|
||||
|
||||
public bool NotCustomStageCode
|
||||
{
|
||||
get => _notCustomStageCode;
|
||||
set => SetAndNotify(ref _notCustomStageCode, value);
|
||||
}
|
||||
|
||||
private bool _useMedicine = Convert.ToBoolean(ViewStatusStorage.Get("MainFunction.UseMedicine", bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user