mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
AnimeEidt 支持 Raised_Dynamic 和 Raised_Static
This commit is contained in:
parent
fa26de684b
commit
c6806e03b5
@ -68,6 +68,7 @@ public class AnimeTypeModel
|
|||||||
or GraphInfo.GraphType.Switch_Down
|
or GraphInfo.GraphType.Switch_Down
|
||||||
or GraphInfo.GraphType.Switch_Thirsty
|
or GraphInfo.GraphType.Switch_Thirsty
|
||||||
or GraphInfo.GraphType.Switch_Hunger
|
or GraphInfo.GraphType.Switch_Hunger
|
||||||
|
or GraphInfo.GraphType.Raised_Dynamic
|
||||||
)
|
)
|
||||||
LoadDefault(path);
|
LoadDefault(path);
|
||||||
else if (
|
else if (
|
||||||
@ -75,6 +76,7 @@ public class AnimeTypeModel
|
|||||||
is GraphInfo.GraphType.Touch_Head
|
is GraphInfo.GraphType.Touch_Head
|
||||||
or GraphInfo.GraphType.Touch_Body
|
or GraphInfo.GraphType.Touch_Body
|
||||||
or GraphInfo.GraphType.Sleep
|
or GraphInfo.GraphType.Sleep
|
||||||
|
or GraphInfo.GraphType.Raised_Static
|
||||||
)
|
)
|
||||||
LoadMultiType(path);
|
LoadMultiType(path);
|
||||||
else
|
else
|
||||||
@ -98,19 +100,39 @@ public class AnimeTypeModel
|
|||||||
foreach (var dir in Directory.EnumerateDirectories(path))
|
foreach (var dir in Directory.EnumerateDirectories(path))
|
||||||
{
|
{
|
||||||
var dirName = Path.GetFileName(dir);
|
var dirName = Path.GetFileName(dir);
|
||||||
if (dirName.Contains(nameof(GameSave.ModeType.Happy)))
|
if (
|
||||||
|
dirName.Contains(
|
||||||
|
nameof(GameSave.ModeType.Happy),
|
||||||
|
StringComparison.InvariantCultureIgnoreCase
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
AddAnime(HappyAnimes, dir);
|
AddAnime(HappyAnimes, dir);
|
||||||
}
|
}
|
||||||
else if (dirName.Contains(nameof(GameSave.ModeType.Nomal)))
|
else if (
|
||||||
|
dirName.Contains(
|
||||||
|
nameof(GameSave.ModeType.Nomal),
|
||||||
|
StringComparison.InvariantCultureIgnoreCase
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
AddAnime(NomalAnimes, dir);
|
AddAnime(NomalAnimes, dir);
|
||||||
}
|
}
|
||||||
else if (dirName.Contains(nameof(GameSave.ModeType.PoorCondition)))
|
else if (
|
||||||
|
dirName.Contains(
|
||||||
|
nameof(GameSave.ModeType.PoorCondition),
|
||||||
|
StringComparison.InvariantCultureIgnoreCase
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
AddAnime(PoorConditionAnimes, dir);
|
AddAnime(PoorConditionAnimes, dir);
|
||||||
}
|
}
|
||||||
else if (dirName.Contains(nameof(GameSave.ModeType.Ill)))
|
else if (
|
||||||
|
dirName.Contains(
|
||||||
|
nameof(GameSave.ModeType.Ill),
|
||||||
|
StringComparison.InvariantCultureIgnoreCase
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
AddAnime(IllAnimes, dir);
|
AddAnime(IllAnimes, dir);
|
||||||
}
|
}
|
||||||
@ -228,7 +250,7 @@ public class AnimeTypeModel
|
|||||||
or GraphInfo.GraphType.Touch_Body
|
or GraphInfo.GraphType.Touch_Body
|
||||||
or GraphInfo.GraphType.Sleep
|
or GraphInfo.GraphType.Sleep
|
||||||
)
|
)
|
||||||
SaveMultiType(path, this);
|
SaveWithModeType(path, this);
|
||||||
else if (
|
else if (
|
||||||
GraphType.Value
|
GraphType.Value
|
||||||
is GraphInfo.GraphType.Switch_Up
|
is GraphInfo.GraphType.Switch_Up
|
||||||
@ -237,6 +259,22 @@ public class AnimeTypeModel
|
|||||||
or GraphInfo.GraphType.Switch_Hunger
|
or GraphInfo.GraphType.Switch_Hunger
|
||||||
)
|
)
|
||||||
SaveSwitch(path, this);
|
SaveSwitch(path, this);
|
||||||
|
else if (
|
||||||
|
GraphType.Value
|
||||||
|
is GraphInfo.GraphType.Raised_Dynamic
|
||||||
|
or GraphInfo.GraphType.Raised_Static
|
||||||
|
)
|
||||||
|
SaveRaise(path, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveRaise(string path, AnimeTypeModel animeTypeModel)
|
||||||
|
{
|
||||||
|
var animePath = Path.Combine(path, "Raise");
|
||||||
|
Directory.CreateDirectory(animePath);
|
||||||
|
if (animeTypeModel.GraphType.Value is GraphInfo.GraphType.Raised_Dynamic)
|
||||||
|
SaveDefault(animePath, animeTypeModel);
|
||||||
|
else if (animeTypeModel.GraphType.Value is GraphInfo.GraphType.Raised_Static)
|
||||||
|
SaveWithModeType(animePath, animeTypeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveSwitch(string path, AnimeTypeModel animeTypeModel)
|
void SaveSwitch(string path, AnimeTypeModel animeTypeModel)
|
||||||
@ -247,7 +285,22 @@ public class AnimeTypeModel
|
|||||||
SaveWithAnimeType(Path.Combine(animePath, switchName), animeTypeModel);
|
SaveWithAnimeType(Path.Combine(animePath, switchName), animeTypeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveMultiType(string path, AnimeTypeModel animeTypeModel)
|
/// <summary>
|
||||||
|
/// 保存为 ModeType 划分的样式
|
||||||
|
/// <para><![CDATA[
|
||||||
|
/// Happy/A/0
|
||||||
|
/// Happy/A/1
|
||||||
|
/// Happy/B/0
|
||||||
|
/// Happy/B/1
|
||||||
|
/// Nomal/A/0
|
||||||
|
/// Nomal/A/1
|
||||||
|
/// ...
|
||||||
|
/// ]]>
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <param name="animeTypeModel"></param>
|
||||||
|
void SaveWithModeType(string path, AnimeTypeModel animeTypeModel)
|
||||||
{
|
{
|
||||||
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
|
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
|
||||||
Directory.CreateDirectory(animePath);
|
Directory.CreateDirectory(animePath);
|
||||||
@ -305,6 +358,11 @@ public class AnimeTypeModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存成默认样式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <param name="animeTypeModel"></param>
|
||||||
static void SaveDefault(string path, AnimeTypeModel animeTypeModel)
|
static void SaveDefault(string path, AnimeTypeModel animeTypeModel)
|
||||||
{
|
{
|
||||||
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
|
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
|
||||||
@ -312,6 +370,19 @@ public class AnimeTypeModel
|
|||||||
SaveWithAnimeType(animePath, animeTypeModel);
|
SaveWithAnimeType(animePath, animeTypeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存为 AnimeType 划分的样式
|
||||||
|
/// <para><![CDATA[
|
||||||
|
/// Happy/0
|
||||||
|
/// Happy/1
|
||||||
|
/// Nomal/0
|
||||||
|
/// Nomal/1
|
||||||
|
/// ...
|
||||||
|
/// ]]>
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="animePath"></param>
|
||||||
|
/// <param name="animeType"></param>
|
||||||
static void SaveWithAnimeType(string animePath, AnimeTypeModel animeType)
|
static void SaveWithAnimeType(string animePath, AnimeTypeModel animeType)
|
||||||
{
|
{
|
||||||
if (animeType.HappyAnimes.Count > 0)
|
if (animeType.HappyAnimes.Count > 0)
|
||||||
@ -346,6 +417,11 @@ public class AnimeTypeModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存图片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="imagesPath"></param>
|
||||||
|
/// <param name="model"></param>
|
||||||
static void SaveImages(string imagesPath, AnimeModel model)
|
static void SaveImages(string imagesPath, AnimeModel model)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(imagesPath);
|
Directory.CreateDirectory(imagesPath);
|
||||||
|
@ -77,29 +77,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
// TODO: 动画加载
|
// TODO: 动画加载
|
||||||
foreach (var p in pet.path)
|
foreach (var p in pet.path)
|
||||||
{
|
{
|
||||||
foreach (var dir in Directory.EnumerateDirectories(p))
|
LoadAnime(petModel, p);
|
||||||
{
|
|
||||||
var dirName = Path.GetFileName(dir);
|
|
||||||
Enum.TryParse<GraphInfo.GraphType>(dirName, true, out var animeType);
|
|
||||||
if (AnimeTypeModel.Create(animeType, dir) is AnimeTypeModel model)
|
|
||||||
petModel.Animes.Add(model);
|
|
||||||
else if (dirName.Equals("Switch", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
foreach (var switchDir in Directory.EnumerateDirectories(dir))
|
|
||||||
{
|
|
||||||
Enum.TryParse<GraphInfo.GraphType>(
|
|
||||||
$"{dirName}_{Path.GetFileName(switchDir)}",
|
|
||||||
true,
|
|
||||||
out var switchType
|
|
||||||
);
|
|
||||||
if (
|
|
||||||
AnimeTypeModel.Create(switchType, Path.Combine(dir, switchDir))
|
|
||||||
is AnimeTypeModel switchModel
|
|
||||||
)
|
|
||||||
petModel.Animes.Add(switchModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +86,49 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
OtherI18nDatas = loader.OtherI18nDatas;
|
OtherI18nDatas = loader.OtherI18nDatas;
|
||||||
|
|
||||||
LoadI18nData();
|
LoadI18nData();
|
||||||
|
|
||||||
|
static void LoadAnime(PetModel petModel, string path)
|
||||||
|
{
|
||||||
|
foreach (var animeDir in Directory.EnumerateDirectories(path))
|
||||||
|
{
|
||||||
|
var dirName = Path.GetFileName(animeDir);
|
||||||
|
Enum.TryParse<GraphInfo.GraphType>(dirName, true, out var animeType);
|
||||||
|
if (AnimeTypeModel.Create(animeType, animeDir) is AnimeTypeModel model)
|
||||||
|
petModel.Animes.Add(model);
|
||||||
|
else if (dirName.Equals("Switch", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
foreach (var dir in Directory.EnumerateDirectories(animeDir))
|
||||||
|
{
|
||||||
|
Enum.TryParse<GraphInfo.GraphType>(
|
||||||
|
$"{dirName}_{Path.GetFileName(dir)}",
|
||||||
|
true,
|
||||||
|
out var switchType
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
AnimeTypeModel.Create(switchType, Path.Combine(animeDir, dir))
|
||||||
|
is AnimeTypeModel switchModel
|
||||||
|
)
|
||||||
|
petModel.Animes.Add(switchModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dirName.Equals("Raise", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
foreach (var dir in Directory.EnumerateDirectories(animeDir))
|
||||||
|
{
|
||||||
|
Enum.TryParse<GraphInfo.GraphType>(
|
||||||
|
Path.GetFileName(dir),
|
||||||
|
true,
|
||||||
|
out var switchType
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
AnimeTypeModel.Create(switchType, Path.Combine(animeDir, dir))
|
||||||
|
is AnimeTypeModel switchModel
|
||||||
|
)
|
||||||
|
petModel.Animes.Add(switchModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadI18nData()
|
private void LoadI18nData()
|
||||||
|
@ -175,6 +175,11 @@ public class AnimeEditWindowVM
|
|||||||
MessageBox.Show("正在播放".Translate());
|
MessageBox.Show("正在播放".Translate());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (CurrentAnimeModel.Value is null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("未选中动画".Translate());
|
||||||
|
return;
|
||||||
|
}
|
||||||
_playing = true;
|
_playing = true;
|
||||||
_playerTask.Start();
|
_playerTask.Start();
|
||||||
}
|
}
|
||||||
|
@ -196,11 +196,13 @@
|
|||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
<ListBox
|
<ListBox
|
||||||
|
x:Name="ListBox_Animes"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||||
d:SelectedIndex="0"
|
d:SelectedIndex="0"
|
||||||
ItemContainerStyle="{StaticResource ListBoxItem_Style}"
|
ItemContainerStyle="{StaticResource ListBoxItem_Style}"
|
||||||
ItemTemplate="{StaticResource Expander_AnimeItem}"
|
ItemTemplate="{StaticResource Expander_AnimeItem}"
|
||||||
ItemsSource="{Binding Anime.Value.HappyAnimes, IsAsync=True}" />
|
ItemsSource="{Binding Anime.Value.HappyAnimes, IsAsync=True}"
|
||||||
|
SelectionChanged="ListBox_Animes_SelectionChanged" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem d:Header="Nomal (0)" Tag="Nomal">
|
<TabItem d:Header="Nomal (0)" Tag="Nomal">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using LinePutScript.Localization.WPF;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -62,6 +63,7 @@ public partial class AnimeEditWindow : Window
|
|||||||
if (Enum.TryParse<GameSave.ModeType>(str, true, out var mode))
|
if (Enum.TryParse<GameSave.ModeType>(str, true, out var mode))
|
||||||
{
|
{
|
||||||
ViewModel.CurrentMode = mode;
|
ViewModel.CurrentMode = mode;
|
||||||
|
ViewModel.CurrentImageModel.Value = null;
|
||||||
ViewModel.CurrentAnimeModel.Value = null;
|
ViewModel.CurrentAnimeModel.Value = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +108,7 @@ public partial class AnimeEditWindow : Window
|
|||||||
ViewModel.AddImages((AnimeModel)listBox.DataContext, array.Cast<string>());
|
ViewModel.AddImages((AnimeModel)listBox.DataContext, array.Cast<string>());
|
||||||
if (_dropSender is not null && sender.Equals(_dropSender) is false)
|
if (_dropSender is not null && sender.Equals(_dropSender) is false)
|
||||||
{
|
{
|
||||||
MessageBox.Show("无法移动不同动画的图片");
|
MessageBox.Show("无法移动不同动画的图片".Translate());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pos = e.GetPosition(listBox);
|
var pos = e.GetPosition(listBox);
|
||||||
@ -179,5 +181,11 @@ public partial class AnimeEditWindow : Window
|
|||||||
return;
|
return;
|
||||||
if (listBox.DataContext is AnimeModel model)
|
if (listBox.DataContext is AnimeModel model)
|
||||||
ViewModel.CurrentAnimeModel.Value = model;
|
ViewModel.CurrentAnimeModel.Value = model;
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListBox_Animes_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user