forked from FakeFishGames/Barotrauma
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor of Package Service to fix 3am programming errors.
- Loading branch information
1 parent
1a27ee2
commit 99959b0
Showing
14 changed files
with
147 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
Barotrauma/BarotraumaClient/ClientSource/LuaCs/Data/IStylesResourceInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
namespace Barotrauma.LuaCs.Data; | ||
using System.Collections.Immutable; | ||
|
||
namespace Barotrauma.LuaCs.Data; | ||
|
||
public interface IStylesResourceInfo : IResourceInfo, IResourceCultureInfo, ILazyLoadableResourceInfo, IPackageDependenciesInfo { } | ||
|
||
public interface IStylesResourcesInfo | ||
{ | ||
/// <summary> | ||
/// Collection of loadable styles data. | ||
/// </summary> | ||
ImmutableArray<IStylesResourceInfo> StylesResourceInfos { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 21 additions & 8 deletions
29
Barotrauma/BarotraumaClient/ClientSource/LuaCs/Services/PackageService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
using System; | ||
using System.Collections.Immutable; | ||
using Barotrauma.LuaCs.Data; | ||
using Barotrauma.LuaCs.Services.Processing; | ||
|
||
namespace Barotrauma.LuaCs.Services; | ||
|
||
public partial class PackageService | ||
public partial class PackageService : IStylesResourcesInfo | ||
{ | ||
private readonly Lazy<IXmlStylesToResConverterService> _stylesConverterService; | ||
private readonly Lazy<IStylesService> _stylesService; | ||
|
||
public PackageService( | ||
Lazy<IXmlModConfigConverterService> converterService, | ||
Lazy<ILegacyConfigService> legacyConfigService, | ||
Lazy<IXmlLocalizationResConverterService> localizationConverterService, | ||
Lazy<IXmlStylesToResConverterService> stylesConverterService, | ||
Lazy<ILuaScriptService> luaScriptService, | ||
Lazy<ILocalizationService> localizationService, | ||
Lazy<IPluginService> pluginService, | ||
Lazy<IStylesService> stylesService, | ||
IPluginManagementService pluginManagementService, | ||
IPackageManagementService packageManagementService, | ||
IStorageService storageService, | ||
ILoggerService loggerService) | ||
{ | ||
_modConfigConverterService = converterService; | ||
_legacyConfigService = legacyConfigService; | ||
_localizationConverterService = localizationConverterService; | ||
_stylesConverterService = stylesConverterService; | ||
_luaScriptService = luaScriptService; | ||
_localizationService = localizationService; | ||
_pluginService = pluginService; | ||
_stylesService = stylesService; | ||
_pluginManagementService = pluginManagementService; | ||
_packageManagementService = packageManagementService; | ||
_storageService = storageService; | ||
_loggerService = loggerService; | ||
} | ||
partial void TryParsePackageClient(ContentPackage package) | ||
|
||
public ImmutableArray<IStylesResourceInfo> StylesResourceInfos => ModConfigInfo?.StylesResourceInfos ?? ImmutableArray<IStylesResourceInfo>.Empty; | ||
|
||
public partial bool TryLoadStyles() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 17 additions & 4 deletions
21
Barotrauma/BarotraumaServer/ServerSource/LuaCs/Services/PackageService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
using System; | ||
using Barotrauma.LuaCs.Services.Processing; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Barotrauma.LuaCs.Services; | ||
|
||
public partial class PackageService | ||
{ | ||
public PackageService( | ||
Lazy<IXmlModConfigConverterService> converterService, | ||
Lazy<ILegacyConfigService> legacyConfigService, | ||
Lazy<IXmlLocalizationResConverterService> localizationConverterService, | ||
Lazy<ILuaScriptService> luaScriptService, | ||
Lazy<ILocalizationService> localizationService, | ||
Lazy<IPluginService> pluginService, | ||
IPluginManagementService pluginManagementService, | ||
IPackageManagementService packageManagementService, | ||
IStorageService storageService, | ||
ILoggerService loggerService) | ||
{ | ||
_modConfigConverterService = converterService; | ||
_legacyConfigService = legacyConfigService; | ||
_localizationConverterService = localizationConverterService; | ||
_luaScriptService = luaScriptService; | ||
_localizationService = localizationService; | ||
_pluginService = pluginService; | ||
_pluginManagementService = pluginManagementService; | ||
_packageManagementService = packageManagementService; | ||
_storageService = storageService; | ||
_loggerService = loggerService; | ||
} | ||
// No implementation | ||
partial void TryParsePackageClient(ContentPackage package) {} | ||
|
||
// The server doesn't use styles data. | ||
public partial bool TryLoadStyles() | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/PackageManagementService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
...rauma/BarotraumaShared/SharedSource/LuaCs/Services/Processing/IXmlResLoaderDefinitions.cs
This file was deleted.
Oops, something went wrong.