-- Squash:
- In progress implementation of services model.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
#region ModConfigurationInfo
|
||||
|
||||
public partial record ModConfigInfo : IModConfigInfo
|
||||
{
|
||||
public ContentPackage Package { get; init; }
|
||||
public string PackageName { get; init; }
|
||||
public TargetRunMode RunModes { get; init; }
|
||||
|
||||
public ImmutableArray<CultureInfo> SupportedCultures { get; init; }
|
||||
public ImmutableArray<IAssemblyResourceInfo> Assemblies { get; init; }
|
||||
public ImmutableArray<ILocalizationResourceInfo> Localizations { get; init; }
|
||||
public ImmutableArray<ILuaResourceInfo> LuaScripts { get; init; }
|
||||
public ImmutableArray<IConfigResourceInfo> Configs { get; init; }
|
||||
public ImmutableArray<IConfigProfileResourceInfo> ConfigProfiles { get; init; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DataContracts
|
||||
|
||||
public record AssemblyResourceInfo : IAssemblyResourceInfo
|
||||
{
|
||||
public ContentPackage OwnerPackage { get; init; }
|
||||
public string FriendlyName { get; init; }
|
||||
public bool IsScript { get; init; }
|
||||
public string InternalName { get; init; }
|
||||
public bool LazyLoad { get; init; }
|
||||
public Platform SupportedPlatforms { get; init; }
|
||||
public Target SupportedTargets { get; init; }
|
||||
public int LoadPriority { get; init; }
|
||||
public ImmutableArray<string> FilePaths { get; init; }
|
||||
public ImmutableArray<CultureInfo> SupportedCultures { get; init; }
|
||||
public ImmutableArray<IPackageDependencyInfo> Dependencies { get; init; }
|
||||
public bool Optional { get; init; }
|
||||
}
|
||||
|
||||
public record DependencyInfo : IPackageDependencyInfo
|
||||
{
|
||||
public ContentPackage OwnerPackage { get; init; }
|
||||
public string FolderPath { get; init; }
|
||||
public string PackageName { get; init; }
|
||||
public ulong SteamWorkshopId { get; init; }
|
||||
public ContentPackage DependencyPackage { get; init; }
|
||||
}
|
||||
|
||||
public record LocalizationResourceInfo : ILocalizationResourceInfo
|
||||
{
|
||||
public ContentPackage OwnerPackage { get; init; }
|
||||
public CultureInfo TargetCulture { get; init; }
|
||||
public Platform SupportedPlatforms { get; init; }
|
||||
public Target SupportedTargets { get; init; }
|
||||
public int LoadPriority { get; init; }
|
||||
public ImmutableArray<string> FilePaths { get; init; }
|
||||
public ImmutableArray<CultureInfo> SupportedCultures { get; init; }
|
||||
public ImmutableArray<IPackageDependencyInfo> Dependencies { get; init; }
|
||||
public bool Optional { get; init; }
|
||||
}
|
||||
|
||||
public readonly struct LuaScriptResourceInfo : ILuaResourceInfo
|
||||
{
|
||||
public ContentPackage OwnerPackage { get; init; }
|
||||
public Platform SupportedPlatforms { get; init; }
|
||||
public Target SupportedTargets { get; init; }
|
||||
public int LoadPriority { get; init; }
|
||||
public ImmutableArray<string> FilePaths { get; init; }
|
||||
public ImmutableArray<CultureInfo> SupportedCultures { get; init; }
|
||||
public ImmutableArray<IPackageDependencyInfo> Dependencies { get; init; }
|
||||
public bool Optional { get; init; }
|
||||
public string InternalName { get; init; }
|
||||
public bool LazyLoad { get; init; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
[Flags]
|
||||
public enum Platform
|
||||
{
|
||||
Linux=0x1,
|
||||
OSX=0x2,
|
||||
Windows=0x4
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum Target
|
||||
{
|
||||
Client=0x1,
|
||||
Server=0x2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum TargetRunMode
|
||||
{
|
||||
ClientEnabled = 0x1,
|
||||
ClientAlways = 0x2,
|
||||
ServerEnabled = 0x4,
|
||||
ServerAlways = 0x8
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public interface IPlatformInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Platforms that these localization files should be loaded for.
|
||||
/// </summary>
|
||||
[Required]
|
||||
Platform SupportedPlatforms { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Targets that these localization files should be loaded for.
|
||||
/// </summary>
|
||||
[Required]
|
||||
Target SupportedTargets { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Which package does the following data belong to?
|
||||
/// </summary>
|
||||
public interface IPackageInfo
|
||||
{
|
||||
ContentPackage OwnerPackage { get; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ResourceInfos contain metadata about a resource.
|
||||
/// </summary>
|
||||
public interface IResourceInfo : IPlatformInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// [Optional]
|
||||
/// Allows you to specify the loading order for all assets of the same type (ie. styles, assemblies, etc.).
|
||||
/// </summary>
|
||||
int LoadPriority { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Resource absolute file paths.
|
||||
/// </summary>
|
||||
[Required]
|
||||
ImmutableArray<string> FilePaths { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Marks this resource as optional (ie. Cross-CP content). Setting this to true will allow the dependency system to
|
||||
/// try and order the loading but not fail if it runs into circular dependency issues.
|
||||
/// </summary>
|
||||
bool Optional { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Information about supported cultures. It is intended to be ignored if the array is ImmutableArray.Empty .
|
||||
/// </summary>
|
||||
public interface IResourceCultureInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// List of supported cultures by this resource.
|
||||
/// </summary>
|
||||
ImmutableArray<CultureInfo> SupportedCultures { get; }
|
||||
}
|
||||
|
||||
|
||||
public interface ILoadableResourceInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// [UNIQUE] The name that will be used when trying to reference this resource for execution or loading.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string InternalName { get; }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
// TODO: Finish
|
||||
public partial interface IConfigInfo
|
||||
{
|
||||
string Name { get; }
|
||||
string PackageName { get; }
|
||||
ConfigDataType Type { get; }
|
||||
string DefaultValue { get; }
|
||||
ClientPermissions RequiredPermissions { get; }
|
||||
}
|
||||
|
||||
public enum ConfigDataType
|
||||
{
|
||||
Boolean, Int32, Int64, Single, Double, String,
|
||||
Color, Vector2, Vector3, List,
|
||||
RangeInt32, RangeSingle, ControlInput
|
||||
}
|
||||
|
||||
public enum NetSync
|
||||
{
|
||||
None, TwoWay, ServerAuthority, ClientOneWay
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public interface IConfigProfileInfo
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public interface ILocalizationInfo
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public partial interface IModConfigInfo : IResourceCultureInfo, IAssembliesResourcesInfo,
|
||||
ILocalizationsResourcesInfo, ILuaScriptsResourcesInfo, IConfigsResourcesInfo,
|
||||
IConfigProfilesResourcesInfo
|
||||
{
|
||||
// package info
|
||||
ContentPackage Package { get; }
|
||||
string PackageName { get; }
|
||||
// configuration
|
||||
TargetRunMode RunModes { get; }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public interface IPackageDependencyInfo : IPackageInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Root folder of the content package.
|
||||
/// </summary>
|
||||
public string FolderPath { get; }
|
||||
/// <summary>
|
||||
/// Name of the package.
|
||||
/// </summary>
|
||||
public string PackageName { get; }
|
||||
/// <summary>
|
||||
/// Steam ID of the package.
|
||||
/// </summary>
|
||||
public ulong SteamWorkshopId { get; }
|
||||
/// <summary>
|
||||
/// The dependency package, if found in the ALL Packages List.
|
||||
/// </summary>
|
||||
public ContentPackage DependencyPackage { get; }
|
||||
}
|
||||
|
||||
public interface IPackageDependenciesInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// List of required packages.
|
||||
/// </summary>
|
||||
ImmutableArray<IPackageDependencyInfo> Dependencies { get; }
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
public interface IConfigResourceInfo : IResourceInfo, IResourceCultureInfo, IPackageDependenciesInfo, IPackageInfo { }
|
||||
public interface IConfigProfileResourceInfo : IResourceInfo, IResourceCultureInfo, IPackageDependenciesInfo, IPackageInfo { }
|
||||
public interface ILocalizationResourceInfo : IResourceInfo, IResourceCultureInfo, IPackageDependenciesInfo, IPackageInfo { }
|
||||
/// <summary>
|
||||
/// Represents loadable Lua files.
|
||||
/// </summary>
|
||||
public interface ILuaResourceInfo : IResourceInfo, IResourceCultureInfo, IPackageDependenciesInfo, ILoadableResourceInfo, IPackageInfo { }
|
||||
public interface IAssemblyResourceInfo : IResourceInfo, IResourceCultureInfo, IPackageDependenciesInfo, ILoadableResourceInfo, IPackageInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The friendly name of the assembly. Script files belonging to the same assembly should all have the same name.
|
||||
/// Legacy scripts will all be given the sanitized name of the Content Package they belong to.
|
||||
/// </summary>
|
||||
public string FriendlyName { get; }
|
||||
/// <summary>
|
||||
/// Is this entry referring to a script file collection.
|
||||
/// </summary>
|
||||
public bool IsScript { get; }
|
||||
}
|
||||
|
||||
|
||||
#region Collections
|
||||
|
||||
public interface IAssembliesResourcesInfo
|
||||
{
|
||||
ImmutableArray<IAssemblyResourceInfo> Assemblies { get; }
|
||||
}
|
||||
|
||||
public interface ILocalizationsResourcesInfo
|
||||
{
|
||||
ImmutableArray<ILocalizationResourceInfo> Localizations { get; }
|
||||
}
|
||||
|
||||
public interface ILuaScriptsResourcesInfo
|
||||
{
|
||||
ImmutableArray<ILuaResourceInfo> LuaScripts { get; }
|
||||
}
|
||||
|
||||
public interface IConfigsResourcesInfo
|
||||
{
|
||||
ImmutableArray<IConfigResourceInfo> Configs { get; }
|
||||
}
|
||||
|
||||
public interface IConfigProfilesResourcesInfo
|
||||
{
|
||||
ImmutableArray<IConfigProfileResourceInfo> ConfigProfiles { get; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Legacy data contract for the old run configuration system. Should be deprecated
|
||||
/// once no longer needed.
|
||||
/// </summary>
|
||||
public interface IRunConfig
|
||||
{
|
||||
bool UseNonPublicizedAssemblies { get; }
|
||||
bool AutoGenerated { get; }
|
||||
bool UseInternalAssemblyName { get; }
|
||||
string Client { get; }
|
||||
string Server { get; }
|
||||
|
||||
bool IsForced();
|
||||
bool IsStandard();
|
||||
bool IsForcedOrStandard();
|
||||
}
|
||||
Reference in New Issue
Block a user