1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- namespace TBL.GodotSharp.Content
- {
- /// <summary>
- /// 内容模块扩展功能类
- /// </summary>
- public static class Content
- {
- /// <summary>
- /// 判断 <paramref name="actualVersion"/> 能否满足 <paramref name="targetVersion"/> 的版本要求
- /// <para>用于内容包之间的依赖可用性检测</para>
- /// </summary>
- /// <param name="actualVersion">当前版本</param>
- /// <param name="targetVersion">要求的版本</param>
- /// <param name="level">兼容级别</param>
- public static bool IsCompatibleWith(Version actualVersion, Version targetVersion, int level)
- {
- // 主版本号
- if (actualVersion.Major != targetVersion.Major)
- return false;
- if (level < 1)
- return true;
- // 次版本号
- if (actualVersion.Minor != targetVersion.Minor)
- return false;
- if (level < 2)
- return true;
- // 构建版本号
- if (actualVersion.Build != targetVersion.Build)
- return false;
- return true;
- }
- }
- }
|