mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
对代码插件MOD作者提供部分MOD信息
This commit is contained in:
parent
31bed95a43
commit
6d523d464d
@ -1,6 +1,7 @@
|
||||
using LinePutScript.Dictionary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@ -212,6 +213,19 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// UI线程调用位置
|
||||
/// </summary>
|
||||
Dispatcher Dispatcher { get; }
|
||||
/// <summary>
|
||||
/// 获取当前所有MOD信息
|
||||
/// </summary>
|
||||
IEnumerable<IModInfo> ModInfo { get; }
|
||||
/// <summary>
|
||||
/// 获取当前所有已启用的MOD信息
|
||||
/// </summary>
|
||||
IEnumerable<IModInfo> OnModInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 所有MOD文件位置
|
||||
/// </summary>
|
||||
public List<DirectoryInfo> MODPath { get; }
|
||||
}
|
||||
|
||||
}
|
||||
|
58
VPet-Simulator.Windows.Interface/Mod/IModInfo.cs
Normal file
58
VPet-Simulator.Windows.Interface/Mod/IModInfo.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using LinePutScript.Converter;
|
||||
using LinePutScript.Dictionary;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using LinePutScript;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet_Simulator.Core;
|
||||
|
||||
namespace VPet_Simulator.Windows.Interface;
|
||||
|
||||
/// <summary>
|
||||
/// 模组信息接口
|
||||
/// </summary>
|
||||
public interface IModInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 模组名称
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
/// <summary>
|
||||
/// 模组作者
|
||||
/// </summary>
|
||||
public string Author { get; }
|
||||
/// <summary>
|
||||
/// 如果是上传至Steam,则为SteamUserID
|
||||
/// </summary>
|
||||
public long AuthorID { get; }
|
||||
/// <summary>
|
||||
/// 上传至Steam的ItemID
|
||||
/// </summary>
|
||||
public ulong ItemID { get; }
|
||||
/// <summary>
|
||||
/// 介绍
|
||||
/// </summary>
|
||||
public string Intro { get; }
|
||||
/// <summary>
|
||||
/// 模组路径
|
||||
/// </summary>
|
||||
public DirectoryInfo Path { get; }
|
||||
/// <summary>
|
||||
/// 游戏版本
|
||||
/// </summary>
|
||||
public int GameVer { get; }
|
||||
/// <summary>
|
||||
/// 模组版本
|
||||
/// </summary>
|
||||
public int Ver { get; }
|
||||
/// <summary>
|
||||
/// 模组标签
|
||||
/// </summary>
|
||||
public HashSet<string> Tag { get; }
|
||||
}
|
@ -14,7 +14,7 @@ using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
{
|
||||
internal class CoreMOD
|
||||
internal class CoreMOD : IModInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 自动启用MOD名称
|
||||
@ -29,21 +29,21 @@ namespace VPet_Simulator.Windows
|
||||
"CSCore.dll"
|
||||
};
|
||||
public static string NowLoading = null;
|
||||
public string Name;
|
||||
public string Author;
|
||||
public string Name { get; set; }
|
||||
public string Author { get; set; }
|
||||
/// <summary>
|
||||
/// 如果是上传至Steam,则为SteamUserID
|
||||
/// </summary>
|
||||
public long AuthorID;
|
||||
public long AuthorID { get; set; }
|
||||
/// <summary>
|
||||
/// 上传至Steam的ItemID
|
||||
/// </summary>
|
||||
public ulong ItemID;
|
||||
public string Intro;
|
||||
public DirectoryInfo Path;
|
||||
public int GameVer;
|
||||
public int Ver;
|
||||
public HashSet<string> Tag = new HashSet<string>();
|
||||
public ulong ItemID { get; set; }
|
||||
public string Intro { get; set; }
|
||||
public DirectoryInfo Path { get; set; }
|
||||
public int GameVer { get; set; }
|
||||
public int Ver { get; set; }
|
||||
public HashSet<string> Tag { get; set; } = new HashSet<string>();
|
||||
public bool SuccessLoad = true;
|
||||
public DateTime CacheDate;
|
||||
public string ErrorMessage;
|
||||
|
@ -1390,16 +1390,25 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
Task.Run(() => GameLoad(Path));
|
||||
}
|
||||
/// <summary>
|
||||
/// MOD地址
|
||||
/// </summary>
|
||||
public List<DirectoryInfo> MODPath { get; private set; }
|
||||
|
||||
public IEnumerable<IModInfo> ModInfo => CoreMODs;
|
||||
|
||||
public IEnumerable<IModInfo> OnModInfo => CoreMODs.FindAll(x => x.IsOnMOD(this));
|
||||
|
||||
/// <summary>
|
||||
/// 加载游戏
|
||||
/// </summary>
|
||||
/// <param name="Path">MOD地址</param>
|
||||
public async Task GameLoad(List<DirectoryInfo> Path)
|
||||
{
|
||||
Path = Path.Distinct().ToList();
|
||||
MODPath = Path.Distinct().ToList();
|
||||
await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "Loading MOD"));
|
||||
//加载mod
|
||||
foreach (DirectoryInfo di in Path)
|
||||
foreach (DirectoryInfo di in MODPath)
|
||||
{
|
||||
if (!File.Exists(di.FullName + @"\info.lps"))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user