mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
style.格式化
This commit is contained in:
@@ -307,5 +307,5 @@ namespace asst
|
||||
// }
|
||||
// return str;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,50 +5,50 @@
|
||||
|
||||
bool asst::GeneralConfiger::parse(const json::value& json)
|
||||
{
|
||||
LogTraceFunction;
|
||||
LogTraceFunction;
|
||||
|
||||
m_version = json.at("version").as_string();
|
||||
m_version = json.at("version").as_string();
|
||||
|
||||
{
|
||||
const json::value& options_json = json.at("options");
|
||||
m_options.task_delay = options_json.at("taskDelay").as_integer();
|
||||
m_options.control_delay_lower = options_json.at("controlDelayRange")[0].as_integer();
|
||||
m_options.control_delay_upper = options_json.at("controlDelayRange")[1].as_integer();
|
||||
//m_options.print_window = options_json.at("printWindow").as_boolean();
|
||||
m_options.adb_extra_swipe_dist = options_json.get("adbExtraSwipeDist", 100);
|
||||
m_options.adb_extra_swipe_duration = options_json.get("adbExtraSwipeDuration", -1);
|
||||
{
|
||||
const json::value& options_json = json.at("options");
|
||||
m_options.task_delay = options_json.at("taskDelay").as_integer();
|
||||
m_options.control_delay_lower = options_json.at("controlDelayRange")[0].as_integer();
|
||||
m_options.control_delay_upper = options_json.at("controlDelayRange")[1].as_integer();
|
||||
//m_options.print_window = options_json.at("printWindow").as_boolean();
|
||||
m_options.adb_extra_swipe_dist = options_json.get("adbExtraSwipeDist", 100);
|
||||
m_options.adb_extra_swipe_duration = options_json.get("adbExtraSwipeDuration", -1);
|
||||
|
||||
auto& penguin_report = options_json.at("penguinReport");
|
||||
m_options.penguin_report.cmd_format = penguin_report.get("cmdFormat", std::string());
|
||||
auto& penguin_report = options_json.at("penguinReport");
|
||||
m_options.penguin_report.cmd_format = penguin_report.get("cmdFormat", std::string());
|
||||
|
||||
if (options_json.contains("aipOcr")) {
|
||||
auto& aip_ocr = options_json.at("aipOcr");
|
||||
m_options.aip_ocr.enable = aip_ocr.get("enable", false);
|
||||
m_options.aip_ocr.accurate = aip_ocr.get("accurate", false);
|
||||
m_options.aip_ocr.client_id = aip_ocr.get("clientId", std::string());
|
||||
m_options.aip_ocr.client_secret = aip_ocr.get("clientSerect", std::string());
|
||||
}
|
||||
}
|
||||
if (options_json.contains("aipOcr")) {
|
||||
auto& aip_ocr = options_json.at("aipOcr");
|
||||
m_options.aip_ocr.enable = aip_ocr.get("enable", false);
|
||||
m_options.aip_ocr.accurate = aip_ocr.get("accurate", false);
|
||||
m_options.aip_ocr.client_id = aip_ocr.get("clientId", std::string());
|
||||
m_options.aip_ocr.client_secret = aip_ocr.get("clientSerect", std::string());
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [name, cfg_json] : json.at("connection").as_object()) {
|
||||
AdbCfg adb;
|
||||
for (const auto& [name, cfg_json] : json.at("connection").as_object()) {
|
||||
AdbCfg adb;
|
||||
|
||||
adb.devices = cfg_json.at("devices").as_string();
|
||||
adb.address_regex = cfg_json.at("addressRegex").as_string();
|
||||
adb.connect = cfg_json.at("connect").as_string();
|
||||
adb.display_id = cfg_json.get("displayId", std::string());
|
||||
adb.uuid = cfg_json.at("uuid").as_string();
|
||||
adb.click = cfg_json.at("click").as_string();
|
||||
adb.swipe = cfg_json.at("swipe").as_string();
|
||||
adb.display = cfg_json.at("display").as_string();
|
||||
adb.display_format = cfg_json.at("displayFormat").as_string();
|
||||
adb.screencap_raw_with_gzip = cfg_json.at("screencapRawWithGzip").as_string();
|
||||
adb.screencap_encode = cfg_json.at("screencapEncode").as_string();
|
||||
adb.release = cfg_json.at("release").as_string();
|
||||
//adb.pullscreen = cfg_json.at("pullscreen").as_string();
|
||||
adb.devices = cfg_json.at("devices").as_string();
|
||||
adb.address_regex = cfg_json.at("addressRegex").as_string();
|
||||
adb.connect = cfg_json.at("connect").as_string();
|
||||
adb.display_id = cfg_json.get("displayId", std::string());
|
||||
adb.uuid = cfg_json.at("uuid").as_string();
|
||||
adb.click = cfg_json.at("click").as_string();
|
||||
adb.swipe = cfg_json.at("swipe").as_string();
|
||||
adb.display = cfg_json.at("display").as_string();
|
||||
adb.display_format = cfg_json.at("displayFormat").as_string();
|
||||
adb.screencap_raw_with_gzip = cfg_json.at("screencapRawWithGzip").as_string();
|
||||
adb.screencap_encode = cfg_json.at("screencapEncode").as_string();
|
||||
adb.release = cfg_json.at("release").as_string();
|
||||
//adb.pullscreen = cfg_json.at("pullscreen").as_string();
|
||||
|
||||
m_adb_cfg[name] = std::move(adb);
|
||||
}
|
||||
m_adb_cfg[name] = std::move(adb);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,6 @@ bool asst::StageDropsTaskPlugin::recognize_drops()
|
||||
auto last_time = last_time_opt ? last_time_opt.value() : 0;
|
||||
m_status->set_data("LastRecognizeDrops", last_time + RecognizationTimeOffset);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
asst::TilePack::~TilePack() = default;
|
||||
|
||||
bool asst::TilePack::load(const std::string & dir)
|
||||
bool asst::TilePack::load(const std::string& dir)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -28,7 +28,7 @@ bool asst::TilePack::load(const std::string & dir)
|
||||
}
|
||||
|
||||
std::unordered_map<asst::Point, asst::TilePack::TileInfo> asst::TilePack::calc(
|
||||
const std::string & stage_code, bool side) const
|
||||
const std::string& stage_code, bool side) const
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ public static class Constants
|
||||
public const string MaaWpfProjectFilePath = $"{MaaWpfProjectDirectory}/MeoAsstGui.csproj";
|
||||
|
||||
public const string MaaBuildOutputDirectory = $"{MaaProjectRootDirectory}/x64";
|
||||
|
||||
|
||||
public const string MaaCoreBuildIntermediatOutputDirectory = $"{MaaCoreProjectDirectory}/x64";
|
||||
|
||||
public static readonly string[] MaaCoreExtraFiles = new [] { "MeoAssistant.pdb", "MeoAssistant.lib", "MeoAssistant.exp" };
|
||||
public static readonly string[] MaaCoreExtraFiles = new[] { "MeoAssistant.pdb", "MeoAssistant.lib", "MeoAssistant.exp" };
|
||||
|
||||
public static readonly string[] MaaWpfExtraFiles = new[] { "MeoAsstGui.pdb", "MeoAsstGui.exe.config" };
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using Cake.Common.Diagnostics;
|
||||
using Cake.Common.IO;
|
||||
|
||||
namespace MeoAssistantBuilder.Helper;
|
||||
|
||||
public static class CleanDirectoryHelper
|
||||
{
|
||||
public static void CleanArtifacts(this MaaBuildContext context)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MeoAssistantBuilder;
|
||||
public class MaaBuildContext : FrostingContext
|
||||
{
|
||||
public string MsBuildExecutable { get; set; }
|
||||
|
||||
|
||||
public MaaBuildContext(ICakeContext context) : base(context)
|
||||
{
|
||||
MsBuildExecutable = context.Argument<string>("tool", "");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Cake.Common.Build;
|
||||
using Cake.Common.Diagnostics;
|
||||
using Cake.Frosting;
|
||||
using MeoAssistantBuilder.Helper;
|
||||
|
||||
@@ -45,7 +45,7 @@ public sealed class ReleaseBundleTask : FrostingTask<MaaBuildContext>
|
||||
{
|
||||
version += $"-{ghActions.Environment.Workflow.RunId}";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
var tag = ghActions.Environment.Workflow.Ref.Replace("refs/tags/", "");
|
||||
if (tag != version)
|
||||
|
||||
@@ -45,7 +45,7 @@ public sealed class ReleaseCoreTask : FrostingTask<MaaBuildContext>
|
||||
{
|
||||
version += $"-{ghActions.Environment.Workflow.RunId}";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
var tag = ghActions.Environment.Workflow.Ref.Replace("refs/tags/", "");
|
||||
if (tag != version)
|
||||
@@ -78,7 +78,7 @@ public sealed class ReleaseCoreTask : FrostingTask<MaaBuildContext>
|
||||
context.Information("--------------------------------------------------");
|
||||
|
||||
var thirdPartyDlls = Directory.GetFiles(Path.Combine(Constants.MaaProjectThirdPartyDirectory, "bin"));
|
||||
foreach(var f in thirdPartyDlls)
|
||||
foreach (var f in thirdPartyDlls)
|
||||
{
|
||||
var fileName = new FileInfo(f).Name;
|
||||
File.Copy(f, Path.Combine(buildOutput, fileName));
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Cake.Common.Build;
|
||||
using Cake.Common.Diagnostics;
|
||||
using Cake.Frosting;
|
||||
using MeoAssistantBuilder.Helper;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Cake.Common.Build;
|
||||
using Cake.Common.Diagnostics;
|
||||
using Cake.Frosting;
|
||||
using MeoAssistantBuilder.Helper;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -224,7 +224,6 @@ namespace MeoAsstGui
|
||||
|
||||
private static void BindRectangleVerticalOffsetList(ScrollViewer scrollViewer)
|
||||
{
|
||||
|
||||
if (scrollViewer.GetValue(RectangleVerticalOffsetListBindingProperty) != null)
|
||||
return;
|
||||
|
||||
@@ -257,6 +256,5 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
#endregion RectangleVerticalOffsetList attached property
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace MeoAsstGui
|
||||
// 最大显示宽度
|
||||
NotificationConstants.MaxWidth = 460d;
|
||||
|
||||
#endregion
|
||||
#endregion 初始化 Notification.Wpf 默认静态配置
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -130,7 +130,7 @@ namespace MeoAsstGui
|
||||
None
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 通知提示音列表枚举
|
||||
|
||||
/// <summary>
|
||||
/// 播放通知提示音
|
||||
@@ -180,19 +180,23 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 通知提示音
|
||||
|
||||
#region 通知按钮设置
|
||||
|
||||
#region 通知按钮变量
|
||||
|
||||
// 左边按钮
|
||||
protected string _buttonLeftText = null;
|
||||
|
||||
protected Action _buttonLeftAction = null;
|
||||
|
||||
// 右边按钮
|
||||
protected string _buttonRightText = null;
|
||||
|
||||
protected Action _buttonRightAction = null;
|
||||
#endregion
|
||||
|
||||
#endregion 通知按钮变量
|
||||
|
||||
/// <summary>
|
||||
/// 给通知添加一个在左边的按钮,比如确定按钮,多次设置只会按最后一次设置生效
|
||||
@@ -220,7 +224,7 @@ namespace MeoAsstGui
|
||||
return this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 通知按钮设置
|
||||
|
||||
#region 通知显示
|
||||
|
||||
@@ -279,7 +283,7 @@ namespace MeoAsstGui
|
||||
return content;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 通知基本字体样式和内容模板
|
||||
|
||||
#region 显示通知方法
|
||||
|
||||
@@ -373,9 +377,9 @@ namespace MeoAsstGui
|
||||
notificationContent: content);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 显示通知方法
|
||||
|
||||
#endregion
|
||||
#endregion 通知显示
|
||||
|
||||
#region 任务栏闪烁
|
||||
|
||||
@@ -457,7 +461,7 @@ namespace MeoAsstGui
|
||||
return FlashWindowEx(ref fInfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 任务栏闪烁
|
||||
|
||||
/// <summary>
|
||||
/// 通知使用完后释放已使用的数据
|
||||
@@ -472,6 +476,5 @@ namespace MeoAsstGui
|
||||
_buttonLeftText = _buttonRightText = null;
|
||||
_buttonLeftAction = _buttonRightAction = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +1,84 @@
|
||||
// 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
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
// 界面设置存储(读写json文件)
|
||||
public class ViewStatusStorage
|
||||
{
|
||||
private static readonly string _configFilename = System.Environment.CurrentDirectory + "\\gui.json";
|
||||
private static JObject _viewStatus = new JObject();
|
||||
|
||||
public static string Get(string key, string defalut_value)
|
||||
{
|
||||
if (_viewStatus.ContainsKey(key))
|
||||
{
|
||||
return _viewStatus[key].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return defalut_value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Set(string key, string value)
|
||||
{
|
||||
_viewStatus[key] = value;
|
||||
Save();
|
||||
}
|
||||
|
||||
public static bool Load()
|
||||
{
|
||||
if (File.Exists(_configFilename))
|
||||
{
|
||||
try
|
||||
{
|
||||
string jsonStr = File.ReadAllText(_configFilename);
|
||||
|
||||
// 文件存在但为空,会读出来一个null,感觉c#这库有bug,如果是null 就赋值一个空JObject
|
||||
_viewStatus = (JObject)JsonConvert.DeserializeObject(jsonStr) ?? new JObject();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_viewStatus = new JObject();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_viewStatus = new JObject();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(_configFilename))
|
||||
{
|
||||
sw.Write(_viewStatus.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
// 界面设置存储(读写json文件)
|
||||
public class ViewStatusStorage
|
||||
{
|
||||
private static readonly string _configFilename = System.Environment.CurrentDirectory + "\\gui.json";
|
||||
private static JObject _viewStatus = new JObject();
|
||||
|
||||
public static string Get(string key, string defalut_value)
|
||||
{
|
||||
if (_viewStatus.ContainsKey(key))
|
||||
{
|
||||
return _viewStatus[key].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return defalut_value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Set(string key, string value)
|
||||
{
|
||||
_viewStatus[key] = value;
|
||||
Save();
|
||||
}
|
||||
|
||||
public static bool Load()
|
||||
{
|
||||
if (File.Exists(_configFilename))
|
||||
{
|
||||
try
|
||||
{
|
||||
string jsonStr = File.ReadAllText(_configFilename);
|
||||
|
||||
// 文件存在但为空,会读出来一个null,感觉c#这库有bug,如果是null 就赋值一个空JObject
|
||||
_viewStatus = (JObject)JsonConvert.DeserializeObject(jsonStr) ?? new JObject();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_viewStatus = new JObject();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_viewStatus = new JObject();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(_configFilename))
|
||||
{
|
||||
sw.Write(_viewStatus.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
VerticalAlignment="Bottom" Content="↘ 右下"
|
||||
IsChecked="{Binding ToastPositionBottomRight}" />
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Button
|
||||
@@ -95,4 +94,4 @@
|
||||
Command="{s:Action ToastPositionTest}"
|
||||
Content="测试通知" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
@@ -1,158 +1,158 @@
|
||||
// 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
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
public class RecruitViewModel : Screen
|
||||
{
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly IContainer _container;
|
||||
|
||||
public RecruitViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
DisplayName = "公招识别";
|
||||
}
|
||||
|
||||
private string _recruitInfo = "小提示:和主界面的自动公招是两个独立的功能,请手动打开游戏公招Tags界面后使用~";
|
||||
|
||||
public string RecruitInfo
|
||||
{
|
||||
get { return _recruitInfo; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _recruitInfo, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _recruitResult;
|
||||
|
||||
public string RecruitResult
|
||||
{
|
||||
get { return _recruitResult; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _recruitResult, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel3 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel3", bool.FalseString));
|
||||
|
||||
public bool ChooseLevel3
|
||||
{
|
||||
get { return _chooseLevel3; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel3, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel3", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel4 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel4", bool.TrueString));
|
||||
|
||||
public bool ChooseLevel4
|
||||
{
|
||||
get { return _chooseLevel4; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel4, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel4", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel5 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel5", bool.TrueString));
|
||||
|
||||
public bool ChooseLevel5
|
||||
{
|
||||
get { return _chooseLevel5; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel5, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel5", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel6 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel6", bool.TrueString));
|
||||
|
||||
public bool ChooseLevel6
|
||||
{
|
||||
get { return _chooseLevel6; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel6, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel6", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _autoSetTime = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.AutoSetTime", bool.TrueString));
|
||||
|
||||
public bool AutoSetTime
|
||||
{
|
||||
get { return _autoSetTime; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _autoSetTime, value);
|
||||
ViewStatusStorage.Set("Recruit.AutoSetTime", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _catched = false;
|
||||
|
||||
public async void StartCalc()
|
||||
{
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
if (!_catched)
|
||||
{
|
||||
RecruitInfo = "正在连接模拟器……";
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
return asstProxy.AsstConnect();
|
||||
});
|
||||
_catched = await task;
|
||||
}
|
||||
if (!_catched)
|
||||
{
|
||||
RecruitInfo = "连接模拟器失败,请参考使用说明处理";
|
||||
return;
|
||||
}
|
||||
RecruitInfo = "正在识别……";
|
||||
RecruitResult = "";
|
||||
|
||||
var levelList = new List<int>();
|
||||
|
||||
if (ChooseLevel3)
|
||||
{
|
||||
levelList.Add(3);
|
||||
}
|
||||
if (ChooseLevel4)
|
||||
{
|
||||
levelList.Add(4);
|
||||
}
|
||||
if (ChooseLevel5)
|
||||
{
|
||||
levelList.Add(5);
|
||||
}
|
||||
if (ChooseLevel6)
|
||||
{
|
||||
levelList.Add(6);
|
||||
}
|
||||
|
||||
asstProxy.AsstStartRecruitCalc(levelList.ToArray(), levelList.Count, AutoSetTime);
|
||||
asstProxy.AsstStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
public class RecruitViewModel : Screen
|
||||
{
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly IContainer _container;
|
||||
|
||||
public RecruitViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
DisplayName = "公招识别";
|
||||
}
|
||||
|
||||
private string _recruitInfo = "小提示:和主界面的自动公招是两个独立的功能,请手动打开游戏公招Tags界面后使用~";
|
||||
|
||||
public string RecruitInfo
|
||||
{
|
||||
get { return _recruitInfo; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _recruitInfo, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _recruitResult;
|
||||
|
||||
public string RecruitResult
|
||||
{
|
||||
get { return _recruitResult; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _recruitResult, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel3 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel3", bool.FalseString));
|
||||
|
||||
public bool ChooseLevel3
|
||||
{
|
||||
get { return _chooseLevel3; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel3, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel3", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel4 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel4", bool.TrueString));
|
||||
|
||||
public bool ChooseLevel4
|
||||
{
|
||||
get { return _chooseLevel4; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel4, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel4", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel5 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel5", bool.TrueString));
|
||||
|
||||
public bool ChooseLevel5
|
||||
{
|
||||
get { return _chooseLevel5; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel5, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel5", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel6 = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.ChooseLevel6", bool.TrueString));
|
||||
|
||||
public bool ChooseLevel6
|
||||
{
|
||||
get { return _chooseLevel6; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _chooseLevel6, value);
|
||||
ViewStatusStorage.Set("Recruit.ChooseLevel6", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _autoSetTime = System.Convert.ToBoolean(ViewStatusStorage.Get("Recruit.AutoSetTime", bool.TrueString));
|
||||
|
||||
public bool AutoSetTime
|
||||
{
|
||||
get { return _autoSetTime; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _autoSetTime, value);
|
||||
ViewStatusStorage.Set("Recruit.AutoSetTime", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _catched = false;
|
||||
|
||||
public async void StartCalc()
|
||||
{
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
if (!_catched)
|
||||
{
|
||||
RecruitInfo = "正在连接模拟器……";
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
return asstProxy.AsstConnect();
|
||||
});
|
||||
_catched = await task;
|
||||
}
|
||||
if (!_catched)
|
||||
{
|
||||
RecruitInfo = "连接模拟器失败,请参考使用说明处理";
|
||||
return;
|
||||
}
|
||||
RecruitInfo = "正在识别……";
|
||||
RecruitResult = "";
|
||||
|
||||
var levelList = new List<int>();
|
||||
|
||||
if (ChooseLevel3)
|
||||
{
|
||||
levelList.Add(3);
|
||||
}
|
||||
if (ChooseLevel4)
|
||||
{
|
||||
levelList.Add(4);
|
||||
}
|
||||
if (ChooseLevel5)
|
||||
{
|
||||
levelList.Add(5);
|
||||
}
|
||||
if (ChooseLevel6)
|
||||
{
|
||||
levelList.Add(6);
|
||||
}
|
||||
|
||||
asstProxy.AsstStartRecruitCalc(levelList.ToArray(), levelList.Count, AutoSetTime);
|
||||
asstProxy.AsstStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +1,90 @@
|
||||
// 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
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
public class RootViewModel : Conductor<Screen>.Collection.OneActive
|
||||
{
|
||||
private readonly IContainer _container;
|
||||
private readonly IWindowManager _windowManager;
|
||||
|
||||
public RootViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
}
|
||||
|
||||
protected override void OnViewLoaded()
|
||||
{
|
||||
CheckAndUpdateNow();
|
||||
InitProxy();
|
||||
InitViewModels();
|
||||
ShowUpdateOrDownload();
|
||||
}
|
||||
|
||||
private async void InitProxy()
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
var p = _container.Get<AsstProxy>();
|
||||
p.Init();
|
||||
});
|
||||
|
||||
await task;
|
||||
}
|
||||
|
||||
private void InitViewModels()
|
||||
{
|
||||
var tvm = _container.Get<TaskQueueViewModel>();
|
||||
var rvm = _container.Get<RecruitViewModel>();
|
||||
//var ivm = _container.Get<InfrastViewModel>();
|
||||
var svm = _container.Get<SettingsViewModel>();
|
||||
|
||||
Items.Add(tvm);
|
||||
Items.Add(rvm);
|
||||
//Items.Add(ivm);
|
||||
Items.Add(svm);
|
||||
ActiveItem = tvm;
|
||||
}
|
||||
|
||||
private bool CheckAndUpdateNow()
|
||||
{
|
||||
var vuvm = _container.Get<VersionUpdateViewModel>();
|
||||
return vuvm.CheckAndUpdateNow();
|
||||
}
|
||||
|
||||
private async void ShowUpdateOrDownload()
|
||||
{
|
||||
var vuvm = _container.Get<VersionUpdateViewModel>();
|
||||
|
||||
if (vuvm.IsFirstBootAfterUpdate)
|
||||
{
|
||||
_windowManager.ShowWindow(vuvm);
|
||||
}
|
||||
else
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
if (!vuvm.CheckAndDownloadUpdate())
|
||||
{
|
||||
vuvm.ResourceOTA();
|
||||
}
|
||||
});
|
||||
|
||||
await task;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
public class RootViewModel : Conductor<Screen>.Collection.OneActive
|
||||
{
|
||||
private readonly IContainer _container;
|
||||
private readonly IWindowManager _windowManager;
|
||||
|
||||
public RootViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
}
|
||||
|
||||
protected override void OnViewLoaded()
|
||||
{
|
||||
CheckAndUpdateNow();
|
||||
InitProxy();
|
||||
InitViewModels();
|
||||
ShowUpdateOrDownload();
|
||||
}
|
||||
|
||||
private async void InitProxy()
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
var p = _container.Get<AsstProxy>();
|
||||
p.Init();
|
||||
});
|
||||
|
||||
await task;
|
||||
}
|
||||
|
||||
private void InitViewModels()
|
||||
{
|
||||
var tvm = _container.Get<TaskQueueViewModel>();
|
||||
var rvm = _container.Get<RecruitViewModel>();
|
||||
//var ivm = _container.Get<InfrastViewModel>();
|
||||
var svm = _container.Get<SettingsViewModel>();
|
||||
|
||||
Items.Add(tvm);
|
||||
Items.Add(rvm);
|
||||
//Items.Add(ivm);
|
||||
Items.Add(svm);
|
||||
ActiveItem = tvm;
|
||||
}
|
||||
|
||||
private bool CheckAndUpdateNow()
|
||||
{
|
||||
var vuvm = _container.Get<VersionUpdateViewModel>();
|
||||
return vuvm.CheckAndUpdateNow();
|
||||
}
|
||||
|
||||
private async void ShowUpdateOrDownload()
|
||||
{
|
||||
var vuvm = _container.Get<VersionUpdateViewModel>();
|
||||
|
||||
if (vuvm.IsFirstBootAfterUpdate)
|
||||
{
|
||||
_windowManager.ShowWindow(vuvm);
|
||||
}
|
||||
else
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
if (!vuvm.CheckAndDownloadUpdate())
|
||||
{
|
||||
vuvm.ResourceOTA();
|
||||
}
|
||||
});
|
||||
|
||||
await task;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user