feat.界面新增关卡掉落统计

This commit is contained in:
MistEO
2021-10-05 20:12:41 +08:00
parent aad4ca08cb
commit 93495226a6
6 changed files with 90 additions and 63 deletions

View File

@@ -720,6 +720,13 @@ json::value asst::Assistance::organize_stage_drop(const json::value& rec)
info["count"] = count;
statistics_vec.emplace_back(std::move(info));
}
// 排个序,数量多的放前面
std::sort(statistics_vec.begin(), statistics_vec.end(),
[](const json::value& lhs, const json::value& rhs) ->bool
{
return lhs.at("count").as_integer() > rhs.at("count").as_integer();
});
dst["statistics"] = json::array(std::move(statistics_vec));
DebugTrace("organize_stage_drop | ", dst.to_string());

View File

@@ -171,6 +171,18 @@ namespace MeoAsstGui
_windowManager.ShowMessageBox("资源文件错误!请尝试重新解压或下载", "错误");
Environment.Exit(0);
break;
case AsstMsg.StageDrops:
string dropsInfo = "";
JArray statistics = (JArray)detail["statistics"];
foreach (var item in statistics)
{
string itemName = item["itemName"].ToString();
int count = (int)item["count"];
dropsInfo += itemName + " : " + count + " \n";
}
mfvm.StageDropsInfo = dropsInfo;
break;
}
}
@@ -271,41 +283,43 @@ namespace MeoAsstGui
public enum AsstMsg
{
/* Error Msg */
PtrIsNull, // 指针为空
ImageIsEmpty, // 图像为空
WindowMinimized, // [已弃用] 窗口被最小化了
InitFaild, // 初始化失败
TaskError, // 任务错误任务一直出错retry次数达到上限
OcrResultError, // Ocr识别结果错误
/* Info Msg: about Task */
TaskStart = 1000, // 任务开始
TaskMatched, // 任务匹配成功
ReachedLimit, // 单个原子任务达到次数上限
ReadyToSleep, // 准备开始睡眠
EndOfSleep, // 睡眠结束
AppendProcessTask, // 新增流程任务Assistance内部消息外部不需要处理
AppendTask, // 新增任务Assistance内部消息外部不需要处理
TaskCompleted, // 单个原子任务完成
PrintWindow, // 截图消息
ProcessTaskStopAction, // 流程任务执行到了Stop的动作
TaskChainCompleted, // 任务链完成
/* Info Msg: about Identify */
TextDetected = 2000, // 识别到文字
ImageFindResult, // 查找图像的结果
ImageMatched, // 图像匹配成功
/* Open Recruit Msg */
RecruitTagsDetected = 3000, // 公招识别到了Tags
RecruitSpecialTag, // 公招识别到了特殊的Tag
RecruitResult, // 公开招募结果
/* Infrast Msg */
OpersDetected = 4000, // 识别到了干员s
OpersIdtfResult, // 干员识别结果(总的)
InfrastComb, // 当前房间的最优干员组合
EnterStation, // 进入某个房间
StationInfo, // 当前房间信息
ReadyToShift, // 准备换班
ShiftCompleted, // 换班完成(单个房间)
NoNeedToShift // 无需换班(单个房间)
/* Error Msg */
PtrIsNull, // 指针为空
ImageIsEmpty, // 图像为空
WindowMinimized, // [已弃用] 窗口被最小化了
InitFaild, // 初始化失败
TaskError, // 任务错误任务一直出错retry次数达到上限
OcrResultError, // Ocr识别结果错误
/* Info Msg: about Task */
TaskStart = 1000, // 任务开始
TaskMatched, // 任务匹配成功
ReachedLimit, // 单个原子任务达到次数上限
ReadyToSleep, // 准备开始睡眠
EndOfSleep, // 睡眠结束
AppendProcessTask, // 新增流程任务Assistance内部消息外部不需要处理
AppendTask, // 新增任务Assistance内部消息外部不需要处理
TaskCompleted, // 单个原子任务完成
PrintWindow, // 截图消息
ProcessTaskStopAction, // 流程任务执行到了Stop的动作
TaskChainCompleted, // 任务链完成
ProcessTaskNotMatched, // 流程任务识别错误
/* Info Msg: about Identify */
TextDetected = 2000, // 识别到文字
ImageFindResult, // 查找图像的结果
ImageMatched, // 图像匹配成功
StageDrops, // 关卡掉落信息
/* Open Recruit Msg */
RecruitTagsDetected = 3000, // 公招识别到了Tags
RecruitSpecialTag, // 公招识别到了特殊的Tag
RecruitResult, // 公开招募结果
/* Infrast Msg */
OpersDetected = 4000, // 识别到了干员s
OpersIdtfResult, // 干员识别结果(总的)
InfrastComb, // 当前房间的最优干员组合
EnterStation, // 进入某个房间
StationInfo, // 当前房间信息
ReadyToShift, // 准备换班
ShiftCompleted, // 换班完成(单个房间)
NoNeedToShift // 无需换班(单个房间)
};
}

View File

@@ -180,17 +180,6 @@ namespace MeoAsstGui
}
}
private string _catchStatus;
public string CatchStatus
{
get { return _catchStatus; }
set
{
SetAndNotify(ref _catchStatus, value);
}
}
private bool _hasTimesLimited;
public bool HasTimesLimited
@@ -252,29 +241,44 @@ namespace MeoAsstGui
}
}
private string _stageDropsInfo = "";
public string StageDropsInfo
{
get { return _stageDropsInfo; }
set
{
SetAndNotify(ref _stageDropsInfo, value);
}
}
public void Stop()
{
var asstProxy = _container.Get<AsstProxy>();
asstProxy.AsstStop();
CatchStatus = "";
ExecInfo = "";
MedicineInfo = "";
StoneInfo = "";
RunStatus = "";
StageDropsInfo = "";
CreditShoppingCheckBoxIsEnable = true;
}
public async void StartSanity()
{
CatchStatus = "正在捕获模拟器窗口……";
RunStatus = "正在捕获模拟器窗口……";
var asstProxy = _container.Get<AsstProxy>();
var task = Task.Run(() =>
{
return asstProxy.AsstCatchDefault();
});
bool catched = await task;
CatchStatus = "捕获模拟器窗口:" + catched;
if (!catched)
{
RunStatus = "捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限";
return;
}
if (!asstProxy.AsstStartSanity())
{
return;
@@ -292,15 +296,18 @@ namespace MeoAsstGui
public async void Visit()
{
CatchStatus = "正在捕获模拟器窗口……";
RunStatus = "正在捕获模拟器窗口……";
var asstProxy = _container.Get<AsstProxy>();
var task = Task.Run(() =>
{
return asstProxy.AsstCatchDefault();
});
bool catched = await task;
CatchStatus = "捕获模拟器窗口:" + catched;
bool catched = await task;
if (!catched)
{
RunStatus = "捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限";
return;
}
if (!asstProxy.AsstStartVisit(CreditShopping))
{
return;

View File

@@ -111,7 +111,7 @@ namespace MeoAsstGui
bool catchd = await task;
if (!catchd)
{
RecruitInfo = "捕获模拟器窗口失败";
RecruitInfo = "捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限";
return;
}
RecruitInfo = "正在识别……";

View File

@@ -24,12 +24,10 @@
<Button Command="{s:Action Stop}" Content="停止" Margin="10" HorizontalAlignment="Center" Width="120" Height="50" />
</StackPanel>
<TextBlock Grid.Row="2" Style="{StaticResource TextBlockDefaultBold}" HorizontalAlignment="Left" Text="{Binding CatchStatus}"></TextBlock>
<!-- CatchStatus-->
<TextBlock Grid.Row="2" Style="{StaticResource TextBlockDefaultBold}" HorizontalAlignment="Center" Text="{Binding RunStatus}"></TextBlock>
<!-- RunStatus -->
<TextBlock Grid.Row="2" Style="{StaticResource TextBlockDefaultBold}" HorizontalAlignment="Right" Text="{Binding ExecInfo}"></TextBlock>
<!-- RunStatus -->
<!-- RunStatus-->
<TextBlock Grid.Row="2" Style="{StaticResource TextBlockDefaultBold}" HorizontalAlignment="Left" Text="{Binding RunStatus}"></TextBlock>
<TextBlock Grid.Row="2" Style="{StaticResource TextBlockDefaultBold}" HorizontalAlignment="Center" Text="{Binding ExecInfo}"></TextBlock>
<ScrollViewer Grid.Row="2" HorizontalAlignment="Right">
<TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding StageDropsInfo}"></TextBlock>
</ScrollViewer>
</Grid>
</UserControl>

View File

@@ -16,9 +16,10 @@ int main(int argc, char** argv)
char ch = 0;
while (ch != 'q') {
AsstStartSanity(ptr);
//AsstStartIndertifyOpers(ptr);
//AsstStartInfrast(ptr);
AsstStartDebugTask(ptr);
//AsstStartDebugTask(ptr);
//{
// const int required[] = { 3, 4, 5, 6 };
// AsstStartOpenRecruit(ptr, required, sizeof(required)/sizeof(int), true);