mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
收藏工作功能
This commit is contained in:
parent
575fec115e
commit
860a26a50e
@ -1611,6 +1611,7 @@ namespace VPet_Simulator.Windows
|
||||
Main.ToolBar.Resources = Application.Current.Resources;
|
||||
Main.ToolBar.LoadClean();
|
||||
Main.WorkList(out List<Work> ws, out List<Work> ss, out List<Work> ps);
|
||||
|
||||
if (ws.Count == 0)
|
||||
{
|
||||
Main.ToolBar.MenuWork.Visibility = Visibility.Collapsed;
|
||||
@ -1647,7 +1648,21 @@ namespace VPet_Simulator.Windows
|
||||
ShowWorkMenu(Work.WorkType.Play);
|
||||
};
|
||||
}
|
||||
|
||||
WorkStarMenu = new System.Windows.Controls.MenuItem()
|
||||
{
|
||||
Header = "收藏".Translate(),
|
||||
HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
|
||||
};
|
||||
foreach (var w in WorkStar())
|
||||
{
|
||||
var mi = new System.Windows.Controls.MenuItem()
|
||||
{
|
||||
Header = w.NameTrans
|
||||
};
|
||||
mi.Click += (s, e) => Main.ToolBar.StartWork(w.Double(Set["workmenu"].GetInt("double_" + w.Name, 1)));
|
||||
WorkStarMenu.Items.Add(mi);
|
||||
}
|
||||
Main.ToolBar.MenuInteract.Items.Add(WorkStarMenu);
|
||||
|
||||
//加载主题:
|
||||
LoadTheme(Set.Theme);
|
||||
@ -2186,5 +2201,19 @@ namespace VPet_Simulator.Windows
|
||||
Main.DisplayCEndtoNomal("pinch");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取收藏的工作
|
||||
/// </summary>
|
||||
public List<Work> WorkStar()
|
||||
{
|
||||
List<Work> works = new List<Work>();
|
||||
foreach (var work in Core.Graph.GraphConfig.Works)
|
||||
{
|
||||
if (Set["work_star"].GetBool(work.Name))
|
||||
works.Add(work);
|
||||
}
|
||||
return works;
|
||||
}
|
||||
public System.Windows.Controls.MenuItem WorkStarMenu;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,9 @@
|
||||
<TabItem x:Name="tip" Header="{ll:Str '玩耍'}">
|
||||
<ListBox x:Name="lbPlay" SelectionChanged="lbPlay_SelectionChanged" />
|
||||
</TabItem>
|
||||
<TabItem x:Name="tstar" Header="{ll:Str '收藏'}">
|
||||
<ListBox x:Name="lbStar" SelectionChanged="lbStar_SelectionChanged" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Image x:Name="WorkViewImage" Grid.Column="1" Margin="10,10,10,33" Source="/Res/img/r_singlemoney_1.png" />
|
||||
<Button x:Name="btnStart" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Margin="5" Height="30"
|
||||
@ -31,8 +34,12 @@
|
||||
pu:ButtonHelper.CornerRadius="5" BorderBrush="{DynamicResource DARKPrimaryDarker}"
|
||||
Foreground="{DynamicResource DARKPrimaryText}" FontWeight="Bold" FontSize="20" IsEnabled="False"
|
||||
Click="btnStart_Click" />
|
||||
<Label x:Name="lName" Background="{x:Null}" Grid.Column="1" VerticalAlignment="Bottom" Content="{ll:Str 请从侧边栏选择}" FontSize="24"
|
||||
Foreground="{DynamicResource DARKPrimaryDark}" FontWeight="Bold" />
|
||||
<Label x:Name="lName" Background="{x:Null}" Grid.Column="1" VerticalAlignment="Bottom"
|
||||
Content="{ll:Str 请从侧边栏选择}" FontSize="24" Foreground="{DynamicResource DARKPrimaryDark}"
|
||||
FontWeight="Bold" />
|
||||
<ToggleButton x:Name="tbtn_star" Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right"
|
||||
Content="" FontFamily="remixicon" Style="{DynamicResource TextToggleButtonStyle}" FontSize="24"
|
||||
Margin="6" pu:ToggleButtonHelper.CheckedContent="" Click="tbtn_star_Click"/>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Top" Grid.Row="1" Margin="10,5,0,0" HorizontalAlignment="Left">
|
||||
<Run Text="{ll:Str '获得内容'}" /> : <LineBreak />
|
||||
<Run Text="{ll:Str '获取效率'}" /> : <LineBreak />
|
||||
|
@ -26,7 +26,6 @@ public partial class winWorkMenu : Window
|
||||
List<Work> ws;
|
||||
List<Work> ss;
|
||||
List<Work> ps;
|
||||
List<Work> starList;
|
||||
public void ShowImageDefault(Work.WorkType type) => WorkViewImage.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_t_" + type.ToString(), "work_" + type.ToString());
|
||||
public winWorkMenu(MainWindow mw, Work.WorkType type)
|
||||
{
|
||||
@ -54,11 +53,15 @@ public partial class winWorkMenu : Window
|
||||
{
|
||||
lbPlay.Items.Add(v.NameTrans);
|
||||
}
|
||||
|
||||
|
||||
foreach (var v in mw.WorkStar())
|
||||
{
|
||||
lbStar.Items.Add(v.NameTrans);
|
||||
}
|
||||
tbc.SelectedIndex = (int)type;
|
||||
ShowImageDefault(type);
|
||||
}
|
||||
public bool IsWorkStar(Work work) => mw.Set["work_star"].GetBool(work.Name);
|
||||
public void SetWorkStar(Work work, bool setvalue) => mw.Set["work_star"].SetBool(work.Name, setvalue);
|
||||
private bool AllowChange = false;
|
||||
Work nowwork;
|
||||
Work nowworkdisplay;
|
||||
@ -84,7 +87,7 @@ public partial class winWorkMenu : Window
|
||||
{
|
||||
wDouble.IsEnabled = true;
|
||||
wDouble.Maximum = max;
|
||||
wDouble.Value = mw.Set["workmenu"].GetInt("workmenu_" + nowwork.Name, 1);
|
||||
wDouble.Value = mw.Set["workmenu"].GetInt("double_" + nowwork.Name, 1);
|
||||
}
|
||||
}
|
||||
if (wDouble.Value == 1)
|
||||
@ -125,6 +128,7 @@ public partial class winWorkMenu : Window
|
||||
sb.AppendLine('x' + (1 + work.FinishBonus).ToString("f2"));
|
||||
sb.AppendLine('x' + wDouble.Value.ToString("f0"));
|
||||
tbDisplay.Text = sb.ToString();
|
||||
tbtn_star.IsChecked = IsWorkStar(work);
|
||||
}
|
||||
|
||||
private void tbc_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
@ -189,8 +193,32 @@ public partial class winWorkMenu : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void lbStart_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
private void lbStar_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!AllowChange) return;
|
||||
var works = mw.WorkStar();
|
||||
if (works.Count <= lbStar.SelectedIndex) return;
|
||||
nowwork = (works[lbStar.SelectedIndex]);
|
||||
ShowWork();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void tbtn_star_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetWorkStar(nowwork, tbtn_star.IsChecked == true);
|
||||
AllowChange = false;
|
||||
lbStar.Items.Clear();
|
||||
//更新星标
|
||||
foreach (var v in mw.WorkStar())
|
||||
{
|
||||
lbStar.Items.Add(v.NameTrans);
|
||||
var mi = new System.Windows.Controls.MenuItem()
|
||||
{
|
||||
Header = nowwork.NameTrans
|
||||
};
|
||||
mi.Click += (s, e) => mw.Main.ToolBar.StartWork(nowwork.Double(mw.Set["workmenu"].GetInt("double_" + nowwork.Name, 1)));
|
||||
mw.WorkStarMenu.Items.Add(mi);
|
||||
}
|
||||
AllowChange = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user