新增管理控制台

This commit is contained in:
ZouJin 2023-01-26 00:23:09 +08:00
parent 892761066c
commit 2babad03a2
8 changed files with 89 additions and 9 deletions

View File

@ -56,6 +56,8 @@ namespace VPet_Simulator.Core
Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate, Core.Graph.GraphConfig.TouchRaisedSize, DisplayRaised, true));
var ig = Core.Graph.FindGraph(GraphCore.GraphType.Default, core.Save.Mode);
PetGrid.Child = ig.This;
var ig2 = Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_A_Start, core.Save.Mode);
PetGrid2.Child = ig2.This; //用于缓存
ig.Run(DisplayNomal);

View File

@ -988,20 +988,22 @@ namespace VPet_Simulator.Core
DisplayType = graph.GraphType;
if (PetGrid.Child == graph.This)
{
((IGraph)(PetGrid2.Child)).Stop(true);
Dispatcher.Invoke(() =>
{
PetGrid.Visibility = Visibility.Visible;
PetGrid2.Visibility = Visibility.Collapsed;
PetGrid2.Visibility = Visibility.Hidden;
});
graph.Run(EndAction);
return;
}
else if (PetGrid2.Child == graph.This)
{
((IGraph)(PetGrid.Child)).Stop(true);
Dispatcher.Invoke(() =>
{
PetGrid2.Visibility = Visibility.Visible;
PetGrid.Visibility = Visibility.Collapsed;
PetGrid.Visibility = Visibility.Hidden;
});
graph.Run(EndAction);
return;
@ -1015,7 +1017,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() =>
{
PetGrid2.Child = graph.This;
PetGrid.Visibility = Visibility.Collapsed;
PetGrid.Visibility = Visibility.Hidden;
PetGrid2.Visibility = Visibility.Visible;
});
//Task.Run(() =>
@ -1030,7 +1032,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() =>
{
PetGrid.Child = graph.This;
PetGrid2.Visibility = Visibility.Collapsed;
PetGrid2.Visibility = Visibility.Hidden;
PetGrid.Visibility = Visibility.Visible;
});
//Task.Run(() =>

View File

@ -85,7 +85,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
if (DisplayType == GraphCore.GraphType.Default && !isPress)
switch (17)//Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal)))
switch (Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal)))
{
case 0:
//随机向右

View File

@ -244,8 +244,8 @@ namespace VPet_Simulator.Core
/// <param name="path">位置</param>
/// <param name="modetype">状态类型</param>
/// <param name="graphtype">动画类型</param>
/// <param name="storemem">是否储存到内存以节约加载</param>
public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype, bool storemem = false)
///// <param name="storemem">是否储存到内存以节约加载</param>
public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype)//, bool storemem = false)
{
var paths = new DirectoryInfo(path).GetFiles();
if (paths.Length == 0)
@ -254,7 +254,7 @@ namespace VPet_Simulator.Core
AddGraph(new Picture(paths[0].FullName, modetype, graphtype,
int.Parse(paths[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last())), graphtype);
else
AddGraph(new PNGAnimation(paths, modetype, graphtype, storemem), graphtype);
AddGraph(new PNGAnimation(paths, modetype, graphtype), graphtype);
}
/// <summary>
/// 随机数字典(用于确保随机动画不会错位)

View File

@ -79,6 +79,7 @@ namespace VPet_Simulator.Windows
}
Task.Run(GameLoad);
}
private long lastclicktime;
public void GameLoad()
{
//加载所有MOD
@ -134,9 +135,16 @@ namespace VPet_Simulator.Windows
LoadingText.Visibility = Visibility.Collapsed;
winSetting = new winGameSetting(this);
Main = new Main(Core) { };
Main.DefaultClickAction = () => { Dispatcher.Invoke(() => { Main.Say("你知道吗? 鼠标右键可以打开菜单栏"); }); };
Main.DefaultClickAction = () => {
if (new TimeSpan(DateTime.Now.Ticks - lastclicktime).TotalMinutes > 1)
{
lastclicktime = DateTime.Now.Ticks;
Dispatcher.Invoke(() => { Main.Say("你知道吗? 鼠标右键可以打开菜单栏"); });
}
};
DisplayGrid.Child = Main;
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "退出桌宠", () => { Close(); });
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "管理控制台", () => { new winConsole(this).Show(); });
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "反馈中心", () => { new winReport(this).Show(); });
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "设置面板", () =>
{

View File

@ -118,6 +118,9 @@
<Compile Include="WinDesign\winCharacterPanel.xaml.cs">
<DependentUpon>winCharacterPanel.xaml</DependentUpon>
</Compile>
<Compile Include="WinDesign\winConsole.xaml.cs">
<DependentUpon>winConsole.xaml</DependentUpon>
</Compile>
<Compile Include="WinDesign\winGameSetting.xaml.cs">
<DependentUpon>winGameSetting.xaml</DependentUpon>
</Compile>
@ -145,6 +148,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WinDesign\winConsole.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WinDesign\winGameSetting.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,15 @@
<Window x:Class="VPet_Simulator.Windows.winConsole" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="桌宠管理控制台" Height="450" Width="450">
<TabControl>
<TabItem Header="动画列表">
<Grid>
<Label Background="{x:Null}" Content="双击查看动画效果" />
<Label x:Name="LabelNowPlay" Background="{x:Null}" Content="" HorizontalAlignment="Right" />
<ListBox x:Name="GraphListBox" Margin="0,20,0,0" MouseDoubleClick="GraphListBox_MouseDoubleClick" />
</Grid>
</TabItem>
</TabControl>
</Window>

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using static VPet_Simulator.Core.GraphCore;
namespace VPet_Simulator.Windows
{
/// <summary>
/// winConsole.xaml 的交互逻辑
/// </summary>
public partial class winConsole : Window
{
MainWindow mw;
public winConsole(MainWindow mw)
{
InitializeComponent();
this.mw = mw;
foreach (string v in Enum.GetNames(typeof(GraphType)))
{
GraphListBox.Items.Add(v);
}
}
public void DisplayLoop(GraphType graphType)
{
mw.Main.Display(graphType, () => DisplayLoop(graphType));
}
private void GraphListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (GraphListBox.SelectedItem == null)
return;
LabelNowPlay.Content = $"当前正在播放: {GraphListBox.SelectedItem}";
DisplayLoop((GraphType)Enum.Parse(typeof(GraphType), (string)GraphListBox.SelectedItem));
}
}
}