mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
支持清理缓存&动画查询兼容
This commit is contained in:
parent
07950780d0
commit
0d8a0573e6
@ -435,9 +435,26 @@ namespace VPet_Simulator.Core
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
|
||||
}
|
||||
int i = (int)mode + 1;
|
||||
if (i < 3)
|
||||
{
|
||||
//向下兼容的动画
|
||||
list = Graphs[type].FindAll(x => x.ModeType == (GameSave.ModeType)i);
|
||||
if (list.Count > 0)
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
i = (int)mode - 1;
|
||||
if (i >= 0)
|
||||
{
|
||||
//向上兼容的动画
|
||||
list = Graphs[type].FindAll(x => x.ModeType == (GameSave.ModeType)i);
|
||||
if (list.Count > 0)
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
}
|
||||
//如果实在找不到,就走随机数
|
||||
//if (mode != GameSave.ModeType.Ill)
|
||||
//{
|
||||
list = Graphs[type].FindAll(x => x.ModeType != GameSave.ModeType.Ill);
|
||||
list = Graphs[type];
|
||||
if (list.Count > 0)
|
||||
return list[Function.Rnd.Next(list.Count)];
|
||||
//}
|
||||
|
@ -130,6 +130,14 @@ namespace VPet_Simulator.Windows.Interface
|
||||
set => SetBool("topmost", !value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 上次清理缓存日期
|
||||
/// </summary>
|
||||
public DateTime LastCacheDate
|
||||
{
|
||||
get => GetDateTime("lastcachedate", DateTime.MinValue);
|
||||
set => SetDateTime("lastcachedate", value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据收集是否被禁止(当日)
|
||||
/// </summary>
|
||||
public bool DiagnosisDayEnable = true;
|
||||
|
@ -35,6 +35,7 @@ namespace VPet_Simulator.Windows
|
||||
public int Ver;
|
||||
public string Content = "";
|
||||
public bool SuccessLoad = true;
|
||||
public DateTime CacheDate;
|
||||
public static string INTtoVER(int ver) => $"{ver / 100}.{ver % 100:00}";
|
||||
public static void LoadImage(MainWindow mw, DirectoryInfo di)
|
||||
{
|
||||
@ -77,6 +78,7 @@ namespace VPet_Simulator.Windows
|
||||
ItemID = Convert.ToUInt64(modlps.FindLine("itemid").info);
|
||||
else
|
||||
ItemID = 0;
|
||||
CacheDate = modlps.GetDateTime("cachedate", DateTime.MinValue);
|
||||
if (IsBanMOD(mw))
|
||||
{
|
||||
Content = "该模组已停用";
|
||||
|
@ -22,6 +22,7 @@ using static VPet_Simulator.Core.IGraph;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media;
|
||||
using System.Linq;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
{
|
||||
@ -178,6 +179,7 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
Dispatcher.Invoke(new Action(() => LoadingText.Content = "尝试加载 Steam Workshop"));
|
||||
//加载mod
|
||||
foreach (DirectoryInfo di in Path)
|
||||
{
|
||||
@ -189,11 +191,21 @@ namespace VPet_Simulator.Windows
|
||||
foreach (CoreMOD cm in CoreMODs)
|
||||
if (!cm.SuccessLoad)
|
||||
if (Set.IsPassMOD(cm.Name))
|
||||
MessageBox.Show($"模组 {cm.Name} 的代码插件损坏\n虚拟桌宠模拟器未能成功加载该插件\n请联系作者修复该问题", $"{cm.Name} 未加载代码插件");
|
||||
MessageBoxX.Show($"模组 {cm.Name} 的代码插件损坏\n虚拟桌宠模拟器未能成功加载该插件\n请联系作者修复该问题", $"{cm.Name} 未加载代码插件");
|
||||
else if (Set.IsMSGMOD(cm.Name))
|
||||
MessageBox.Show($"由于 {cm.Name} 包含代码插件\n虚拟桌宠模拟器已自动停止加载该插件\n请手动前往设置允许启用该mod 代码插件", $"{cm.Name} 未加载代码插件");
|
||||
MessageBoxX.Show($"由于 {cm.Name} 包含代码插件\n虚拟桌宠模拟器已自动停止加载该插件\n请手动前往设置允许启用该mod 代码插件", $"{cm.Name} 未加载代码插件");
|
||||
|
||||
Dispatcher.Invoke(new Action(() => LoadingText.Content = "尝试加载游戏存档"));
|
||||
//判断是否需要清空缓存
|
||||
if (Set.LastCacheDate < CoreMODs.Max(x => x.CacheDate))
|
||||
{//需要清理缓存
|
||||
Set.LastCacheDate = DateTime.Now;
|
||||
if (Directory.Exists(CachePath))
|
||||
{
|
||||
Directory.Delete(CachePath, true);
|
||||
Directory.CreateDirectory(CachePath);
|
||||
}
|
||||
}
|
||||
Dispatcher.Invoke(new Action(() => LoadingText.Content = "尝试加载游戏MOD"));
|
||||
|
||||
//加载游戏内容
|
||||
Core.Controller = new MWController(this);
|
||||
@ -231,6 +243,19 @@ namespace VPet_Simulator.Windows
|
||||
Main.ToolBar.MainGrid.Children.Add(TalkBox);
|
||||
}
|
||||
LoadingText.Content = "正在加载游戏";
|
||||
var m = new System.Windows.Controls.MenuItem()
|
||||
{
|
||||
Header = "MOD管理",
|
||||
HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
|
||||
};
|
||||
m.Click += (x, y) =>
|
||||
{
|
||||
Main.ToolBar.Visibility = Visibility.Collapsed;
|
||||
Topmost = false;
|
||||
winSetting.MainTab.SelectedIndex = 5;
|
||||
winSetting.Show();
|
||||
};
|
||||
Main.ToolBar.MenuMODConfig.Items.Add(m);
|
||||
try
|
||||
{
|
||||
//加载游戏创意工坊插件
|
||||
|
@ -13,7 +13,7 @@
|
||||
</DataTemplate>
|
||||
</pu:WindowX.Resources>-->
|
||||
<Grid>
|
||||
<TabControl Margin="5" BorderThickness="0" pu:TabControlHelper.ItemsHeight="NaN" Background="Transparent"
|
||||
<TabControl x:Name="MainTab" Margin="5" BorderThickness="0" pu:TabControlHelper.ItemsHeight="NaN" Background="Transparent"
|
||||
pu:TabControlHelper.ItemsPadding="10,7" pu:TabControlHelper.ItemsCornerRadius="4"
|
||||
pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}"
|
||||
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryDark}"
|
||||
|
@ -2,3 +2,4 @@ vupmod#Core:|author#lorisyounger:|gamever#20:|ver#100:|
|
||||
intro#这是虚拟桌宠模拟器的核心运行文件/com可以参考此文件编写mod:|
|
||||
authorid#253101309:|
|
||||
itemid#1:|
|
||||
cachedate#2023/6/15:|
|
@ -2,3 +2,4 @@ vupmod#FontPet:|author#LorisYounger:|gamever#20:|ver#100:|
|
||||
intro#来试试这个文字版的单帧宠物吧/com这个算是单帧宠物示例模组:|
|
||||
authorid#253101309:|
|
||||
itemid#2934625683:|
|
||||
cachedate#2023/6/15:|
|
Loading…
Reference in New Issue
Block a user