2023-07-16 23:58:09 +00:00
|
|
|
|
using LinePutScript;
|
|
|
|
|
using LinePutScript.Localization.WPF;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
using System;
|
2023-06-05 09:18:27 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2023-07-03 23:17:17 +00:00
|
|
|
|
using System.Text;
|
2023-02-04 05:12:06 +00:00
|
|
|
|
using System.Timers;
|
2023-01-25 16:23:09 +00:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Input;
|
2023-02-04 05:12:06 +00:00
|
|
|
|
using VPet_Simulator.Core;
|
2023-01-25 16:23:09 +00:00
|
|
|
|
using static VPet_Simulator.Core.GraphCore;
|
2023-07-16 23:58:09 +00:00
|
|
|
|
using static VPet_Simulator.Core.GraphInfo;
|
2023-01-25 16:23:09 +00:00
|
|
|
|
|
|
|
|
|
namespace VPet_Simulator.Windows
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// winConsole.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class winConsole : Window
|
|
|
|
|
{
|
|
|
|
|
MainWindow mw;
|
|
|
|
|
public winConsole(MainWindow mw)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this.mw = mw;
|
2023-07-16 23:58:09 +00:00
|
|
|
|
foreach (var v in mw.Core.Graph.GraphsList)
|
2023-01-25 16:23:09 +00:00
|
|
|
|
{
|
2023-07-16 23:58:09 +00:00
|
|
|
|
foreach (AnimatType k in v.Value.Keys)
|
|
|
|
|
{
|
|
|
|
|
var str = v.Key.ToString() + "++" + k.ToString();
|
2023-07-17 15:38:06 +00:00
|
|
|
|
GraphListBox.Items.Add(str);
|
|
|
|
|
GraphListPlayerBox.Items.Add(str);
|
2023-07-16 23:58:09 +00:00
|
|
|
|
}
|
2023-03-28 13:18:14 +00:00
|
|
|
|
}
|
2023-07-16 23:58:09 +00:00
|
|
|
|
if (mw.Core.Graph.GraphsName.TryGetValue(GraphType.Say, out var gl))
|
|
|
|
|
foreach (string v in gl)
|
|
|
|
|
{
|
|
|
|
|
CombSay.Items.Add(v);
|
|
|
|
|
}
|
2023-02-04 05:12:06 +00:00
|
|
|
|
DestanceTimer.Elapsed += DestanceTimer_Elapsed;
|
|
|
|
|
}
|
2023-01-26 15:15:37 +00:00
|
|
|
|
|
2023-02-04 05:12:06 +00:00
|
|
|
|
private void DestanceTimer_Elapsed(object sender, ElapsedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
RLeft.Text = mw.Core.Controller.GetWindowsDistanceLeft().ToString("f2");
|
|
|
|
|
RRight.Text = mw.Core.Controller.GetWindowsDistanceRight().ToString("f2");
|
|
|
|
|
RTop.Text = mw.Core.Controller.GetWindowsDistanceUp().ToString("f2");
|
|
|
|
|
RDown.Text = mw.Core.Controller.GetWindowsDistanceDown().ToString("f2");
|
|
|
|
|
});
|
2023-01-25 16:23:09 +00:00
|
|
|
|
}
|
2023-02-04 05:12:06 +00:00
|
|
|
|
public void DisplayLoop(IGraph graph)
|
2023-01-25 16:23:09 +00:00
|
|
|
|
{
|
2023-02-04 05:12:06 +00:00
|
|
|
|
mw.Main.Display(graph, () => DisplayLoop(graph));
|
2023-01-25 16:23:09 +00:00
|
|
|
|
}
|
|
|
|
|
private void GraphListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (GraphListBox.SelectedItem == null)
|
|
|
|
|
return;
|
2023-07-16 23:58:09 +00:00
|
|
|
|
var kv = Sub.Split((string)GraphListBox.SelectedItem, "++");
|
|
|
|
|
var graph = mw.Main.Core.Graph.FindGraph(kv[0], (AnimatType)Enum.Parse(typeof(AnimatType), kv[1]), (GameSave.ModeType)ComboxMode.SelectedIndex);
|
2023-02-04 05:12:06 +00:00
|
|
|
|
if (graph == null)
|
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
LabelNowPlay.Content = "未找到对应类型图像资源".Translate();
|
2023-02-04 05:12:06 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-02 13:41:38 +00:00
|
|
|
|
LabelNowPlay.Content = "当前正在播放".Translate() + ": " + GraphListBox.SelectedItem;
|
2023-02-04 05:12:06 +00:00
|
|
|
|
DisplayLoop(graph);
|
2023-01-25 16:23:09 +00:00
|
|
|
|
}
|
2023-01-26 15:15:37 +00:00
|
|
|
|
|
|
|
|
|
private void DisplayListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (DisplayListBox.SelectedItem == null)
|
|
|
|
|
return;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
LabelSuccess.Content = "当前正在运行".Translate() + ": " + (string)((ListBoxItem)DisplayListBox.SelectedItem).Content;
|
2023-07-16 23:58:09 +00:00
|
|
|
|
// mw.RunAction((string)((ListBoxItem)DisplayListBox.SelectedItem).Content);
|
2023-01-26 15:15:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Say_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-16 23:58:09 +00:00
|
|
|
|
mw.Main.Say(SayTextBox.Text, CombSay.Text, true);
|
2023-01-26 15:15:37 +00:00
|
|
|
|
}
|
2023-02-04 05:12:06 +00:00
|
|
|
|
Timer DestanceTimer = new Timer()
|
|
|
|
|
{
|
|
|
|
|
AutoReset = true,
|
|
|
|
|
Interval = 100,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DestanceTimer.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DestanceTimer.Stop();
|
|
|
|
|
}
|
2023-07-16 23:58:09 +00:00
|
|
|
|
List<Tuple<string, GameSave.ModeType>> playlist = new List<Tuple<string, GameSave.ModeType>>();
|
2023-06-05 09:18:27 +00:00
|
|
|
|
private void GraphListPlayerBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-07-16 23:58:09 +00:00
|
|
|
|
playlist.Add(new Tuple<string, GameSave.ModeType>((string)GraphListPlayerBox.SelectedItem,
|
2023-06-05 09:18:27 +00:00
|
|
|
|
(GameSave.ModeType)Enum.Parse(typeof(GameSave.ModeType), (string)(((ComboBoxItem)ComboxPlayMode.SelectedItem).Content))));
|
|
|
|
|
GraphListWillPlayBox.Items.Add((string)GraphListPlayerBox.SelectedItem + "_" + (string)((ComboBoxItem)ComboxPlayMode.SelectedItem).Content);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Play_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-16 23:58:09 +00:00
|
|
|
|
DisplayList(new Queue<Tuple<string, GameSave.ModeType>>(playlist));
|
2023-06-05 09:18:27 +00:00
|
|
|
|
}
|
2023-07-16 23:58:09 +00:00
|
|
|
|
public void DisplayList(Queue<Tuple<string, GameSave.ModeType>> list)
|
2023-06-05 09:18:27 +00:00
|
|
|
|
{
|
|
|
|
|
if (list.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
mw.Main.DisplayToNomal();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var v = list.Dequeue();
|
2023-07-16 23:58:09 +00:00
|
|
|
|
var kv = Sub.Split(v.Item1, "++");
|
|
|
|
|
var graph = mw.Main.Core.Graph.FindGraph(kv[0], (AnimatType)Enum.Parse(typeof(AnimatType), kv[1]), v.Item2);
|
2023-06-05 09:18:27 +00:00
|
|
|
|
if (graph != null)
|
|
|
|
|
{
|
|
|
|
|
mw.Main.Display(graph, () => DisplayList(list));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DisplayList(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GraphListWillPlayBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
playlist.RemoveAt(GraphListWillPlayBox.SelectedIndex);
|
|
|
|
|
GraphListWillPlayBox.Items.RemoveAt(GraphListWillPlayBox.SelectedIndex);
|
|
|
|
|
}
|
2023-02-04 05:12:06 +00:00
|
|
|
|
|
2023-06-05 09:18:27 +00:00
|
|
|
|
private void PlayADD_Click(object sender, RoutedEventArgs e) => GraphListPlayerBox_MouseDoubleClick(sender, null);
|
2023-07-02 13:41:38 +00:00
|
|
|
|
|
|
|
|
|
private void Local_SelectAll_Click(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LocalTextBox.SelectAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Output_No_Local(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-03 23:17:17 +00:00
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
foreach (var v in LocalizeCore.StoreTranslationList)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(v.Replace("\n", @"\n").Replace("\r", @"\r"));
|
|
|
|
|
}
|
|
|
|
|
LocalTextBox.Text = sb.ToString();
|
2023-07-02 13:41:38 +00:00
|
|
|
|
}
|
2023-02-04 05:12:06 +00:00
|
|
|
|
//private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// switch(((TabControl)sender).SelectedIndex)
|
|
|
|
|
// {
|
|
|
|
|
// case 0:
|
|
|
|
|
// case 1:
|
|
|
|
|
// case 2:
|
|
|
|
|
// ComboxMode.Visibility = Visibility.Visible;
|
|
|
|
|
// break;
|
|
|
|
|
// default:
|
|
|
|
|
// ComboxMode.Visibility = Visibility.Collapsed;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2023-01-25 16:23:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|