diff --git a/src/MeoAssistance/Assistance.cpp b/src/MeoAssistance/Assistance.cpp
index fccbf4b212..03b8dacdac 100644
--- a/src/MeoAssistance/Assistance.cpp
+++ b/src/MeoAssistance/Assistance.cpp
@@ -167,7 +167,7 @@ bool asst::Assistance::append_fight(int mecidine, int stone, int times, bool onl
bool asst::Assistance::append_award(bool only_append)
{
- return append_process_task("AwardBegin", "ReceiveAward");
+ return append_process_task("AwardBegin", "Award");
}
bool asst::Assistance::append_visit(bool only_append)
diff --git a/src/MeoAssistance/InfrastProductionTask.cpp b/src/MeoAssistance/InfrastProductionTask.cpp
index 7495404f64..d90f63a8a6 100644
--- a/src/MeoAssistance/InfrastProductionTask.cpp
+++ b/src/MeoAssistance/InfrastProductionTask.cpp
@@ -50,10 +50,21 @@ bool asst::InfrastProductionTask::shift_facility_list()
MultiMatchImageAnalyzer locked_analyzer;
locked_analyzer.set_task_info(*locked_task_ptr);
+ int index = 0;
for (const Rect& tab : m_facility_list_tabs) {
if (need_exit()) {
return false;
}
+ if (index != 0) {
+ json::value enter_json = json::object{
+ { "facility", m_facility },
+ { "index", index }
+ };
+ m_callback(AsstMsg::EnterFacility, enter_json, m_callback_arg);
+ }
+
+ ++index;
+
ctrler.click(tab);
sleep(tab_task_ptr->rear_delay);
diff --git a/src/MeoAsstGui/Helper/AsstProxy.cs b/src/MeoAsstGui/Helper/AsstProxy.cs
index 0ac897637f..a7c4c084ba 100644
--- a/src/MeoAsstGui/Helper/AsstProxy.cs
+++ b/src/MeoAsstGui/Helper/AsstProxy.cs
@@ -197,7 +197,7 @@ namespace MeoAsstGui
break;
case AsstMsg.EnterFacility:
- tvm.AddLog("当前正在换班:" + detail["facility"]);
+ tvm.AddLog("当前设施:" + detail["facility"] + " " + (int)detail["index"]);
break;
case AsstMsg.FacilityInfo:
diff --git a/src/MeoAsstGui/Helper/ScrollViewerBinding.cs b/src/MeoAsstGui/Helper/ScrollViewerBinding.cs
new file mode 100644
index 0000000000..17b56b9ae2
--- /dev/null
+++ b/src/MeoAsstGui/Helper/ScrollViewerBinding.cs
@@ -0,0 +1,125 @@
+// MeoAssistanceGui - A part of the MeoAssistance-Arknight 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+
+namespace MeoAsstGui
+{
+ public static class ScrollViewerBinding
+ {
+ #region VerticalOffset attached property
+
+ ///
+ /// VerticalOffset attached property
+ ///
+ public static readonly DependencyProperty VerticalOffsetProperty =
+ DependencyProperty.RegisterAttached("VerticalOffset", typeof(double),
+ typeof(ScrollViewerBinding), new FrameworkPropertyMetadata(double.NaN,
+ FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
+ OnVerticalOffsetPropertyChanged));
+
+ ///
+ /// Just a flag that the binding has been applied.
+ ///
+ private static readonly DependencyProperty VerticalScrollBindingProperty =
+ DependencyProperty.RegisterAttached("VerticalScrollBinding", typeof(bool?), typeof(ScrollViewerBinding));
+
+ public static double GetVerticalOffset(DependencyObject depObj)
+ {
+ ScrollViewer scrollViewer = depObj as ScrollViewer;
+ if (scrollViewer == null)
+ return 0;
+ double maxHeight = scrollViewer.ScrollableHeight;
+ return (double)depObj.GetValue(VerticalOffsetProperty) / maxHeight;
+ }
+
+ public static void SetVerticalOffset(DependencyObject depObj, double value)
+ {
+ if (value <= 1)
+ {
+ // by set
+ ScrollViewer scrollViewer = depObj as ScrollViewer;
+ if (scrollViewer == null)
+ return;
+ double maxHeight = scrollViewer.ScrollableHeight;
+
+ depObj.SetValue(VerticalOffsetProperty, value * maxHeight);
+ }
+ else
+ {
+ // by scroll
+ depObj.SetValue(VerticalOffsetProperty, value);
+ }
+ }
+
+ private static void OnVerticalOffsetPropertyChanged(DependencyObject d,
+ DependencyPropertyChangedEventArgs e)
+ {
+ ScrollViewer scrollViewer = d as ScrollViewer;
+ if (scrollViewer == null)
+ return;
+
+ BindVerticalOffset(scrollViewer);
+ scrollViewer.ScrollToVerticalOffset((double)e.NewValue);
+ }
+
+ public static void BindVerticalOffset(ScrollViewer scrollViewer)
+ {
+ if (scrollViewer.GetValue(VerticalScrollBindingProperty) != null)
+ return;
+
+ scrollViewer.SetValue(VerticalScrollBindingProperty, true);
+ scrollViewer.ScrollChanged += (s, se) =>
+ {
+ if (se.VerticalChange == 0)
+ return;
+ SetVerticalOffset(scrollViewer, se.VerticalOffset);
+ };
+ }
+
+ #endregion VerticalOffset attached property
+
+ #region ScrollableHeight attached property
+
+ //public static readonly DependencyProperty ScrollableHeightProperty =
+ // DependencyProperty.RegisterAttached("ScrollableHeight", typeof(double),
+ // typeof(ScrollViewerBinding), new FrameworkPropertyMetadata(double.NaN, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnScrollableHeightPropertyChanged));
+
+ //public static double GetScrollableHeight(DependencyObject depObj)
+ //{
+ // ScrollViewer scrollViewer = depObj as ScrollViewer;
+ // if (scrollViewer == null)
+ // return 0;
+ // return scrollViewer.ScrollableHeight;
+ //}
+
+ //public static void SetScrollableHeight(DependencyObject depObj, double value)
+ //{
+ // // pass
+ //}
+
+ //private static readonly DependencyProperty ScrollableHeightBindingProperty =
+ // DependencyProperty.RegisterAttached("ScrollableHeightBinding", typeof(bool?), typeof(ScrollViewerBinding));
+
+ //private static void OnScrollableHeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ //{
+ //}
+
+ #endregion ScrollableHeight attached property
+ }
+}
diff --git a/src/MeoAsstGui/MeoAsstGui.csproj b/src/MeoAsstGui/MeoAsstGui.csproj
index 90b054e415..3b0ace33cb 100644
--- a/src/MeoAsstGui/MeoAsstGui.csproj
+++ b/src/MeoAsstGui/MeoAsstGui.csproj
@@ -113,6 +113,7 @@
+
diff --git a/src/MeoAsstGui/ViewModels/SettingsViewModel.cs b/src/MeoAsstGui/ViewModels/SettingsViewModel.cs
index d049c2510b..52f5d5403a 100644
--- a/src/MeoAsstGui/ViewModels/SettingsViewModel.cs
+++ b/src/MeoAsstGui/ViewModels/SettingsViewModel.cs
@@ -32,8 +32,8 @@ namespace MeoAsstGui
_listTitle.Add("自动公招");
_listTitle.Add("信用商店");
_listTitle.Add("企鹅数据");
- _listTitle.Add("连接");
- _listTitle.Add("其他");
+ //_listTitle.Add("连接");
+ //_listTitle.Add("其他");
InfrastInit();
}
@@ -211,6 +211,60 @@ namespace MeoAsstGui
}
}
+ // 消息源,0:无;1:SelectedIndex;2:ScrollOffset
+ private int _notifySource = 0;
+
+ private int _selectedIndex = 0;
+
+ public int SelectedIndex
+ {
+ get { return _selectedIndex; }
+ set
+ {
+ if (_notifySource != 1)
+ {
+ if (_notifySource == 0)
+ {
+ _notifySource = 1;
+ }
+ ScrollOffset = (double)value / (ListTitle.Count - 1);
+ SetAndNotify(ref _selectedIndex, value);
+ }
+ _notifySource = 0;
+ }
+ }
+
+ private double _scrollOffset = 0;
+
+ public double ScrollOffset
+ {
+ get { return _scrollOffset; }
+ set
+ {
+ if (_notifySource != 2)
+ {
+ if (_notifySource == 0)
+ {
+ _notifySource = 2;
+ }
+ SelectedIndex = (int)(value / ScrollHeight * (ListTitle.Count - 1));
+ SetAndNotify(ref _scrollOffset, value);
+ }
+ _notifySource = 0;
+ }
+ }
+
+ private double _scrollHeight = 258; // ScrollViewer.ScrollableHeight, 不知道该咋获取,默认值是258
+
+ public double ScrollHeight
+ {
+ get { return _scrollHeight; }
+ set
+ {
+ SetAndNotify(ref _scrollHeight, value);
+ }
+ }
+
/* 信用商店设置 */
private bool _creditShopping = System.Convert.ToBoolean(ViewStatusStorage.Get("Mall.CreditShopping", bool.FalseString));
diff --git a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
index 44fd72052f..50d0004e66 100644
--- a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
+++ b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
@@ -38,7 +38,7 @@ namespace MeoAsstGui
TaskItemViewModels.Add(new DragItemViewModel("领取日常奖励", stroageKey));
}
- public void AddLog(string content, string color = "Black", string weight = "Regular")
+ public void AddLog(string content, string color = "Gray", string weight = "Regular")
{
LogItemViewModels.Add(new LogItemViewModel(content, color, weight));
//LogItemViewModels.Insert(0, new LogItemViewModel(time + content, color, weight));
diff --git a/src/MeoAsstGui/Views/SettingsView.xaml b/src/MeoAsstGui/Views/SettingsView.xaml
index 2480e97874..02acb28888 100644
--- a/src/MeoAsstGui/Views/SettingsView.xaml
+++ b/src/MeoAsstGui/Views/SettingsView.xaml
@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:s="https://github.com/canton7/Stylet"
+ xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:local="clr-namespace:MeoAsstGui"
mc:Ignorable="d"
d:DesignHeight="495" d:DesignWidth="800">
@@ -12,17 +13,24 @@
-
-
+
+
+
+
+
+
+
+
diff --git a/src/MeoAsstGui/Views/TaskQueueView.xaml b/src/MeoAsstGui/Views/TaskQueueView.xaml
index 4643afebdb..c25143e638 100644
--- a/src/MeoAsstGui/Views/TaskQueueView.xaml
+++ b/src/MeoAsstGui/Views/TaskQueueView.xaml
@@ -49,7 +49,7 @@
-