mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Move to semversioning 2.0.0
This commit is contained in:
1 parent
4a49d39206
commit
0a0e5ea983
15 files changed
+232
-155
No files matched your search
+27
-23
@@ -1,4 +1,4 @@
|
||||
using BetterAmongUs.Enums;
|
||||
using Semver;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BetterAmongUs;
|
||||
@@ -11,9 +11,33 @@ internal partial class BAUPlugin
|
||||
internal static class ModInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the release type of the current build.
|
||||
/// The base version number of the mod in MAJOR.MINOR.PATCH format.
|
||||
/// </summary>
|
||||
internal static readonly ReleaseTypes ReleaseBuildType = ReleaseTypes.Release;
|
||||
internal const string VERSION_NUMBER = "1.3.4";
|
||||
|
||||
/// <summary>
|
||||
/// The beta release number. Increment this for each beta release.
|
||||
/// </summary>
|
||||
internal const string BETA_NUMBER = "0";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full version string for the current build configuration.
|
||||
/// </summary>
|
||||
#if RELEASE
|
||||
internal const string VERSION = VERSION_NUMBER;
|
||||
#elif BETA
|
||||
internal const string VERSION = $"{VERSION_NUMBER}-beta-{BETA_NUMBER}";
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full version string with a v prefix for the current build configuration.
|
||||
/// </summary>
|
||||
internal const string VERSION_STRING = "v" + VERSION;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parsed semantic version of the mod.
|
||||
/// </summary>
|
||||
internal static readonly SemVersion SemVersion = SemVersion.Parse(VERSION);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Git commit hash from assembly metadata.
|
||||
@@ -25,21 +49,6 @@ internal partial class BAUPlugin
|
||||
/// </summary>
|
||||
public static string BuildDate = ThisAssembly.Metadata.BuildDate;
|
||||
|
||||
/// <summary>
|
||||
/// The beta number for beta releases.
|
||||
/// </summary>
|
||||
internal const string BETA_NUM = "0";
|
||||
|
||||
/// <summary>
|
||||
/// The hotfix number for hotfix releases.
|
||||
/// </summary>
|
||||
internal const string HOTFIX_NUM = "1";
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this is a hotfix release.
|
||||
/// </summary>
|
||||
internal const bool IS_HOTFIX = true;
|
||||
|
||||
/// <summary>
|
||||
/// The name of BAU.
|
||||
/// </summary>
|
||||
@@ -50,11 +59,6 @@ internal partial class BAUPlugin
|
||||
/// </summary>
|
||||
internal const string PLUGIN_GUID = "com.d1gq.betteramongus";
|
||||
|
||||
/// <summary>
|
||||
/// The version of BAU.
|
||||
/// </summary>
|
||||
internal const string PLUGIN_VERSION = "1.3.3";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of supported Among Us versions.
|
||||
/// </summary>
|
||||
|
||||
+2
-40
@@ -7,7 +7,6 @@ using BetterAmongUs.Attributes;
|
||||
using BetterAmongUs.Data;
|
||||
using BetterAmongUs.Data.Config;
|
||||
using BetterAmongUs.Data.Json;
|
||||
using BetterAmongUs.Enums;
|
||||
using BetterAmongUs.Managers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.OptionItems;
|
||||
@@ -22,42 +21,10 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
namespace BetterAmongUs;
|
||||
|
||||
[BepInPlugin(ModInfo.PLUGIN_GUID, ModInfo.PLUGIN_NAME, ModInfo.PLUGIN_VERSION)]
|
||||
[BepInPlugin(ModInfo.PLUGIN_GUID, ModInfo.PLUGIN_NAME, ModInfo.VERSION)]
|
||||
[BepInProcess(ModInfo.AmongUs.PROCESS_NAME)]
|
||||
internal partial class BAUPlugin : BasePlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the formatted version text for display.
|
||||
/// </summary>
|
||||
/// <param name="newLine">Whether to use newline separation for additional info.</param>
|
||||
/// <returns>Formatted version string.</returns>
|
||||
internal static string GetVersionText(bool newLine = false)
|
||||
{
|
||||
string text = string.Empty;
|
||||
|
||||
string newLineText = newLine ? "\n" : " ";
|
||||
|
||||
switch (ModInfo.ReleaseBuildType)
|
||||
{
|
||||
case ReleaseTypes.Release:
|
||||
text = $"v{BetterAmongUsVersion}";
|
||||
break;
|
||||
case ReleaseTypes.Beta:
|
||||
text = $"v{BetterAmongUsVersion}{newLineText}Beta {ModInfo.BETA_NUM}";
|
||||
break;
|
||||
case ReleaseTypes.Dev:
|
||||
text = $"v{BetterAmongUsVersion}{newLineText}Dev {ModInfo.CommitHash}-{ModInfo.BuildDate}";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ModInfo.IS_HOTFIX)
|
||||
text += $"{newLineText}Hotfix {ModInfo.HOTFIX_NUM}";
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the BAUPlugin instance.
|
||||
/// </summary>
|
||||
@@ -68,11 +35,6 @@ internal partial class BAUPlugin : BasePlugin
|
||||
/// </summary>
|
||||
internal static Harmony Harmony { get; } = new Harmony(ModInfo.PLUGIN_GUID);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the BetterAmongUs version string.
|
||||
/// </summary>
|
||||
internal static string BetterAmongUsVersion => ModInfo.PLUGIN_VERSION;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application version string.
|
||||
/// </summary>
|
||||
@@ -170,7 +132,7 @@ internal partial class BAUPlugin : BasePlugin
|
||||
Logger_.Log("Better Among Us successfully loaded!");
|
||||
|
||||
string SupportedVersions = string.Join(" ", ModInfo.SupportedAmongUsVersions);
|
||||
Logger_.Log($"BetterAmongUs {BetterAmongUsVersion}-{ModInfo.BuildDate} - [{AppVersion} --> {SupportedVersions}] {Utils.GetPlatformName(PlatformData.Platform)}");
|
||||
Logger_.Log($"BetterAmongUs {ModInfo.VERSION_STRING}-{ModInfo.BuildDate} - [{AppVersion} --> {SupportedVersions}] {Utils.GetPlatformName(PlatformData.Platform)}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<OutputType>Library</OutputType>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<Configurations>Debug;Release;Beta</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Apply Null Notation Restrictions -->
|
||||
@@ -85,15 +86,19 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native" />
|
||||
<PackageReference Include="Costura.Fody" Version="5.8.0-alpha0098">
|
||||
<IncludeAssets>runtime; compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- NuGet Info Packages -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Semver" Version="3.0.0" />
|
||||
<PackageReference Include="GitInfo" Version="3.3.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
<PackageReference Include="ThisAssembly.Metadata" Version="2.1.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -7,10 +7,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterAmongUs", "BetterAmon
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Beta|Any CPU = Beta|Any CPU
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{41193AE4-8181-49F8-9DA4-F4B7B275A0EA}.Beta|Any CPU.ActiveCfg = Beta|Any CPU
|
||||
{41193AE4-8181-49F8-9DA4-F4B7B275A0EA}.Beta|Any CPU.Build.0 = Beta|Any CPU
|
||||
{41193AE4-8181-49F8-9DA4-F4B7B275A0EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{41193AE4-8181-49F8-9DA4-F4B7B275A0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{41193AE4-8181-49F8-9DA4-F4B7B275A0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -60,14 +60,14 @@ internal sealed class DumpCommand : BaseCommand
|
||||
{
|
||||
Directory.CreateDirectory(logFolderPath);
|
||||
}
|
||||
string logFileName = "log-" + BAUPlugin.GetVersionText().Replace(' ', '-').ToLower() + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bau" + ".log";
|
||||
string logFileName = "log-" + BAUPlugin.ModInfo.VERSION_STRING + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bau" + ".log";
|
||||
string logFile = Path.Combine(logFolderPath, logFileName);
|
||||
File.WriteAllText(logFile, newLog);
|
||||
|
||||
string bepInExLog = Path.Combine(Paths.BepInExRootPath, "LogOutput.log");
|
||||
if (File.Exists(bepInExLog))
|
||||
{
|
||||
string logFileBepInExeName = "log-" + BAUPlugin.GetVersionText().Replace(' ', '-').ToLower() + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bepinex" + ".log";
|
||||
string logFileBepInExeName = "log-" + BAUPlugin.ModInfo.VERSION_STRING + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bepinex" + ".log";
|
||||
string logFileBepInExe = Path.Combine(logFolderPath, logFileBepInExeName);
|
||||
File.Copy(bepInExLog, logFileBepInExe);
|
||||
}
|
||||
@@ -93,14 +93,14 @@ internal sealed class DumpCommand : BaseCommand
|
||||
string androidLogContent = File.ReadAllText(logFilePath);
|
||||
string androidNewLog = DecryptLog(androidLogContent);
|
||||
|
||||
string androidLogFileName = "log-" + BAUPlugin.GetVersionText().Replace(' ', '-').ToLower() + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bau" + ".log";
|
||||
string androidLogFileName = "log-" + BAUPlugin.ModInfo.VERSION_STRING + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bau" + ".log";
|
||||
string androidNewLogFilePath = Path.Combine(logFolderPath, androidLogFileName);
|
||||
File.WriteAllText(androidNewLogFilePath, androidNewLog);
|
||||
|
||||
string bepInExLog = Path.Combine(Paths.BepInExRootPath, "LogOutput.log");
|
||||
if (File.Exists(bepInExLog))
|
||||
{
|
||||
string logFileBepInExeName = "log-" + BAUPlugin.GetVersionText().Replace(' ', '-').ToLower() + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bepinex" + ".log";
|
||||
string logFileBepInExeName = "log-" + BAUPlugin.ModInfo.VERSION_STRING + "-" + DateTime.Now.ToString("yyyy.MM.dd-HH.mm.ss") + "-bepinex" + ".log";
|
||||
string logFileBepInExe = Path.Combine(logFolderPath, logFileBepInExeName);
|
||||
File.Copy(bepInExLog, logFileBepInExe);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<!-- FodyWeavers.xml -->
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura>
|
||||
<IncludeAssemblies>
|
||||
Semver
|
||||
</IncludeAssemblies>
|
||||
</Costura>
|
||||
</Weavers>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -84,7 +84,7 @@ internal sealed class BetterPingTracker : MonoBehaviour
|
||||
sb.AppendFormat("{0}: <b>{1}</b>\n", TranslationStrings.Timer.LocalizedString.ToUpper(), $"<{timeColor}>{lobbyTimerDisplay}</color>");
|
||||
}
|
||||
|
||||
sb.Append($"<color=#00dbdb><size=75%>BetterAmongUs {BAUPlugin.GetVersionText(true)}</size></color>\n");
|
||||
sb.Append($"<color=#00dbdb><size=75%>BetterAmongUs {BAUPlugin.ModInfo.VERSION_STRING}</size></color>\n");
|
||||
sb.Append($"<color=#8A8A8A>{BAUPlugin.ModInfo.GITHUB}</color>\n".Size(52f));
|
||||
|
||||
if (BAUConfigs.ShowFPS.Value)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using BetterAmongUs.Enums;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules;
|
||||
using Semver;
|
||||
using System.Collections;
|
||||
using System.Text.Json.Serialization;
|
||||
using UnityEngine;
|
||||
@@ -12,6 +12,12 @@ namespace BetterAmongUs.Network.Configs;
|
||||
[Serializable]
|
||||
internal sealed class BAUUpdateData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the download link for the updated DLL file.
|
||||
/// </summary>
|
||||
[JsonPropertyName("valid")]
|
||||
public bool Valid { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the download link for the updated DLL file.
|
||||
/// </summary>
|
||||
@@ -24,82 +30,23 @@ internal sealed class BAUUpdateData
|
||||
[JsonPropertyName("version")]
|
||||
public string Version { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release type as an integer value.
|
||||
/// </summary>
|
||||
[JsonPropertyName("releaseType")]
|
||||
public int ReleaseType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether this update is a hotfix.
|
||||
/// </summary>
|
||||
[JsonPropertyName("isHotfix")]
|
||||
public bool IsHotfix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the hotfix number if this is a hotfix update.
|
||||
/// </summary>
|
||||
[JsonPropertyName("hotfixNumber")]
|
||||
public int HotfixNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the beta number if this is a beta release.
|
||||
/// </summary>
|
||||
[JsonPropertyName("betaNumber")]
|
||||
public int BetaNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this update is newer than the currently installed version.
|
||||
/// </summary>
|
||||
/// <returns>True if the update is newer, false otherwise.</returns>
|
||||
/// <remarks>
|
||||
/// Compares version numbers, release types, and specific build numbers
|
||||
/// to determine if an update should be applied.
|
||||
/// </remarks>
|
||||
internal bool IsNewUpdate()
|
||||
{
|
||||
try
|
||||
{
|
||||
var updateVersion = new Version(Version);
|
||||
var modVersion = new Version(BAUPlugin.ModInfo.PLUGIN_VERSION);
|
||||
|
||||
// 1. Compare main version (major.minor.build)
|
||||
if (updateVersion > modVersion)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (updateVersion < modVersion)
|
||||
if (!Valid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. Versions are equal, compare release types
|
||||
var updateReleaseType = (ReleaseTypes)ReleaseType;
|
||||
var currentReleaseType = BAUPlugin.ModInfo.ReleaseBuildType;
|
||||
var updateVersion = SemVersion.Parse(Version);
|
||||
var modVersion = BAUPlugin.ModInfo.SemVersion;
|
||||
|
||||
// Release is always preferred over Beta
|
||||
if (updateReleaseType == ReleaseTypes.Release && currentReleaseType == ReleaseTypes.Beta)
|
||||
return true;
|
||||
|
||||
// Don't downgrade from Release to Beta
|
||||
if (updateReleaseType == ReleaseTypes.Beta && currentReleaseType == ReleaseTypes.Release)
|
||||
return false;
|
||||
|
||||
// 3. Same version and release type, compare specific numbers
|
||||
if (updateReleaseType == ReleaseTypes.Beta)
|
||||
{
|
||||
return BetaNumber > int.Parse(BAUPlugin.ModInfo.BETA_NUM);
|
||||
}
|
||||
|
||||
// Release version - check hotfixes
|
||||
if (IsHotfix && !BAUPlugin.ModInfo.IS_HOTFIX)
|
||||
return true;
|
||||
|
||||
if (IsHotfix && BAUPlugin.ModInfo.IS_HOTFIX)
|
||||
return HotfixNumber > int.Parse(BAUPlugin.ModInfo.HOTFIX_NUM);
|
||||
|
||||
// Same version, same type, no newer hotfix
|
||||
return false;
|
||||
return updateVersion.ComparePrecedenceTo(modVersion) > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -152,6 +99,6 @@ internal sealed class BAUUpdateData
|
||||
/// <returns>A formatted string containing version information.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Version}:{ReleaseType}:{BetaNumber}:{HotfixNumber}";
|
||||
return $"{SemVersion.Parse(Version)}";
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,6 @@ internal sealed class BAUUpdateLoader : MonoBehaviour
|
||||
/// Coroutine to fetch update data from the remote repository.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerator for coroutine execution.</returns>
|
||||
/// <remarks>
|
||||
/// If no internet connection is detected, it retries several times before giving up.
|
||||
/// After successfully loading update data, it initializes the UpdateManager.
|
||||
/// </remarks>
|
||||
[HideFromIl2Cpp]
|
||||
internal IEnumerator CoFetchUpdateData()
|
||||
{
|
||||
@@ -47,7 +43,7 @@ internal sealed class BAUUpdateLoader : MonoBehaviour
|
||||
}
|
||||
|
||||
string callBack = "";
|
||||
yield return GitHubFile.CoFetchTextFile(GitUrlPath.RepositoryApi.Combine("update.json").ToString(), (string text) =>
|
||||
yield return GitHubFile.CoFetchTextFile(GitUrlPath.RepositoryApi.Combine("update-V2.json").ToString(), (string text) =>
|
||||
{
|
||||
callBack = text;
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ internal static class ClientPatch
|
||||
|
||||
// Show warning popup for newer Among Us version
|
||||
Utils.ShowPopUp($"<size=200%>-= <color=#ff2200><b>Warning</b></color> =-</size>\n\n" +
|
||||
$"<size=125%><color=#0dff00>Better Among Us {BAUPlugin.GetVersionText()}</color>\nsupports <color=#4f92ff>Among Us {verText}</color>,\n" +
|
||||
$"<size=125%><color=#0dff00>Better Among Us {BAUPlugin.ModInfo.VERSION_STRING}</color>\nsupports <color=#4f92ff>Among Us {verText}</color>,\n" +
|
||||
$"<color=#4f92ff>Among Us <b>{BAUPlugin.AppVersion}</b></color> is above the supported versions!\n" +
|
||||
$"<color=#ae1700>You may encounter minor to game breaking bugs.</color></size>");
|
||||
}
|
||||
@@ -71,7 +71,7 @@ internal static class ClientPatch
|
||||
|
||||
// Show warning popup for older Among Us version
|
||||
Utils.ShowPopUp($"<size=200%>-= <color=#ff2200><b>Warning</b></color> =-</size>\n\n" +
|
||||
$"<size=125%><color=#0dff00>Better Among Us {BAUPlugin.GetVersionText()}</color>\nsupports <color=#4f92ff>Among Us {verText}</color>,\n" +
|
||||
$"<size=125%><color=#0dff00>Better Among Us {BAUPlugin.ModInfo.VERSION_STRING}</color>\nsupports <color=#4f92ff>Among Us {verText}</color>,\n" +
|
||||
$"<color=#4f92ff>Among Us <b>{BAUPlugin.AppVersion}</b></color> is below the supported versions!\n" +
|
||||
$"<color=#ae1700>You may encounter minor to game breaking bugs.</color></size>");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ internal static class DiscordPatch
|
||||
if (activity == null)
|
||||
return;
|
||||
|
||||
string details = $"BAU {BAUPlugin.GetVersionText()}";
|
||||
string details = $"BAU {BAUPlugin.ModInfo.VERSION_STRING}";
|
||||
activity.Details = details;
|
||||
|
||||
// Skip lobby info processing if Discord already shows "In Menus"
|
||||
@@ -50,7 +50,7 @@ internal static class DiscordPatch
|
||||
{
|
||||
// Streamer mode hides lobby code, only show mode info
|
||||
if (GameState.IsHideNSeek)
|
||||
details = $"BAU v{BAUPlugin.ModInfo.PLUGIN_VERSION} - Hide & Seek";
|
||||
details = $"BAU v{BAUPlugin.ModInfo.VERSION_STRING} - Hide & Seek";
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -13,6 +13,6 @@ internal static class VersionShowerPatch
|
||||
{
|
||||
string mark = TranslationStrings.BAUMark.LocalizedString;
|
||||
string bau = TranslationStrings.BAU.LocalizedString;
|
||||
__instance.text.text = $"<color=#0dff00>{mark}{bau}{mark} {BAUPlugin.GetVersionText()}</color> <color=#ababab>~</color> {Utils.GetPlatformName(BAUPlugin.PlatformData.Platform)} v{BAUPlugin.AmongUsVersion} ({BAUPlugin.AppVersion})";
|
||||
__instance.text.text = $"<color=#0dff00>{mark}{bau}{mark} {BAUPlugin.ModInfo.VERSION_STRING}</color> <color=#ababab>~</color> {Utils.GetPlatformName(BAUPlugin.PlatformData.Platform)} v{BAUPlugin.AmongUsVersion} ({BAUPlugin.AppVersion})";
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace BetterAmongUs.Patches.Gameplay.Managers;
|
||||
[HarmonyPatch]
|
||||
internal static class HudManagerPatch
|
||||
{
|
||||
internal static string WelcomeMessage => $"<b><color=#00b530><size=125%><align=\"center\">{TranslationStrings.WelcomeMsg_WelcomeToBAU.Format(TranslationStrings.BetterAmongUs)}\n{BAUPlugin.GetVersionText()}</size>\n" +
|
||||
internal static string WelcomeMessage => $"<b><color=#00b530><size=125%><align=\"center\">{TranslationStrings.WelcomeMsg_WelcomeToBAU.Format(TranslationStrings.BetterAmongUs)}\n{BAUPlugin.ModInfo.VERSION_STRING}</size>\n" +
|
||||
$"{TranslationStrings.WelcomeMsg_ThanksForDownloading}</align></color></b>\n<size=120%> </size>\n" +
|
||||
TranslationStrings.WelcomeMsg_BAUDescription1.Format(TranslationStrings.BAU, TranslationStrings.BetterOption_AntiCheat);
|
||||
|
||||
|
||||
@@ -10,21 +10,32 @@ namespace BetterAmongUs.Patches.Unity;
|
||||
[HarmonyPatch]
|
||||
internal static class UnityWebRequestPatch
|
||||
{
|
||||
// Build mod version header string
|
||||
/// <summary>
|
||||
/// Builds a mod version header string for network transmission.
|
||||
/// Format: "major;minor;patch;metadata1/metadata2/metadata3"
|
||||
/// </summary>
|
||||
public static string GetHeader()
|
||||
{
|
||||
var stringBuilder = new StringBuilder();
|
||||
var version = BAUPlugin.ModInfo.SemVersion;
|
||||
|
||||
// Format: "Version;BuildType;IsHotfix/HotfixNum/BetaNum"
|
||||
stringBuilder.Append(BAUPlugin.ModInfo.PLUGIN_VERSION);
|
||||
stringBuilder.Append(version.Major);
|
||||
stringBuilder.Append(';');
|
||||
stringBuilder.Append(Enum.GetName(BAUPlugin.ModInfo.ReleaseBuildType));
|
||||
stringBuilder.Append(version.Minor);
|
||||
stringBuilder.Append(';');
|
||||
stringBuilder.Append(BAUPlugin.ModInfo.IS_HOTFIX);
|
||||
stringBuilder.Append('/');
|
||||
stringBuilder.Append(BAUPlugin.ModInfo.HOTFIX_NUM);
|
||||
stringBuilder.Append('/');
|
||||
stringBuilder.Append(BAUPlugin.ModInfo.BETA_NUM);
|
||||
stringBuilder.Append(version.Patch);
|
||||
stringBuilder.Append(';');
|
||||
|
||||
var buildMetadata = version.Metadata;
|
||||
if (buildMetadata.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < buildMetadata.Length; i++)
|
||||
{
|
||||
stringBuilder.Append(buildMetadata[i]);
|
||||
if (i < buildMetadata.Length - 1)
|
||||
stringBuilder.Append('/');
|
||||
}
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user