update to show full gametype name on webfront
This commit is contained in:
parent
15cb114c15
commit
5d7ac7498f
@ -57,7 +57,7 @@ namespace IW4MAdmin
|
||||
serverConfiguration,
|
||||
serviceProvider.GetRequiredService<IManager>(),
|
||||
serviceProvider.GetRequiredService<IRConConnectionFactory>(),
|
||||
serviceProvider.GetRequiredService<IGameLogReaderFactory>())
|
||||
serviceProvider.GetRequiredService<IGameLogReaderFactory>(), serviceProvider)
|
||||
{
|
||||
_translationLookup = lookup;
|
||||
_metaService = metaService;
|
||||
|
@ -13,11 +13,13 @@ using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
using Data.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace SharedLibraryCore
|
||||
{
|
||||
public abstract class Server : IGameServer
|
||||
{
|
||||
protected readonly DefaultSettings DefaultSettings;
|
||||
public enum Game
|
||||
{
|
||||
COD = -1,
|
||||
@ -36,7 +38,7 @@ namespace SharedLibraryCore
|
||||
|
||||
public Server(ILogger<Server> logger, SharedLibraryCore.Interfaces.ILogger deprecatedLogger,
|
||||
ServerConfiguration config, IManager mgr, IRConConnectionFactory rconConnectionFactory,
|
||||
IGameLogReaderFactory gameLogReaderFactory)
|
||||
IGameLogReaderFactory gameLogReaderFactory, IServiceProvider serviceProvider)
|
||||
{
|
||||
Password = config.Password;
|
||||
IP = config.IPAddress;
|
||||
@ -55,6 +57,7 @@ namespace SharedLibraryCore
|
||||
this.gameLogReaderFactory = gameLogReaderFactory;
|
||||
RConConnectionFactory = rconConnectionFactory;
|
||||
ServerLogger = logger;
|
||||
DefaultSettings = serviceProvider.GetRequiredService<DefaultSettings>();
|
||||
InitializeTokens();
|
||||
InitializeAutoMessages();
|
||||
}
|
||||
@ -307,6 +310,8 @@ namespace SharedLibraryCore
|
||||
public string Hostname { get => ServerConfig.CustomHostname ?? hostname; protected set => hostname = value; }
|
||||
public string Website { get; protected set; }
|
||||
public string Gametype { get; set; }
|
||||
public string GametypeName => DefaultSettings.Gametypes.FirstOrDefault(gt => gt.Game == GameName)?.Gametypes
|
||||
?.FirstOrDefault(gt => gt.Name == Gametype)?.Alias ?? Gametype;
|
||||
public string GamePassword { get; protected set; }
|
||||
public Map CurrentMap { get; set; }
|
||||
public int ClientNum
|
||||
|
@ -4,14 +4,17 @@ using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Linq;
|
||||
using Data.Models.Client.Stats;
|
||||
using SharedLibraryCore.Configuration;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ServerController : BaseController
|
||||
{
|
||||
public ServerController(IManager manager) : base(manager)
|
||||
private readonly DefaultSettings _defaultSettings;
|
||||
|
||||
public ServerController(IManager manager, DefaultSettings defaultSettings) : base(manager)
|
||||
{
|
||||
|
||||
_defaultSettings = defaultSettings;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -33,7 +36,7 @@ namespace WebfrontCore.Controllers
|
||||
Map = s.CurrentMap.Alias,
|
||||
ClientCount = s.Clients.Count(client => client != null),
|
||||
MaxClients = s.MaxClients,
|
||||
GameType = s.Gametype,
|
||||
GameType = s.GametypeName,
|
||||
Players = s.GetClientsAsList()
|
||||
.Select(p => new PlayerInfo
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace WebfrontCore.ViewComponents
|
||||
Map = server.CurrentMap.Alias,
|
||||
ClientCount = server.Clients.Count(client => client != null),
|
||||
MaxClients = server.MaxClients,
|
||||
GameType = server.Gametype,
|
||||
GameType = server.GametypeName,
|
||||
PlayerHistory = server.ClientHistory.ToArray(),
|
||||
Players = server.GetClientsAsList()
|
||||
.Select(p => new PlayerInfo()
|
||||
@ -92,4 +92,4 @@ namespace WebfrontCore.ViewComponents
|
||||
return View("_List", serverInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
@if (!string.IsNullOrEmpty(Model.GameType) && Model.GameType.Length > 1)
|
||||
{
|
||||
<span>–</span>
|
||||
<span>@Model.GameType.ToUpper()</span>
|
||||
<span>@Model.GameType</span>
|
||||
}
|
||||
</div>
|
||||
<div class="text-center text-md-right col-md-4 d-flex align-self-center justify-content-center justify-content-md-end flex-column-reverse flex-sm-row">
|
||||
@ -54,4 +54,4 @@
|
||||
data-clienthistory='@Html.Raw(Json.Serialize(Model.PlayerHistory))'
|
||||
data-clienthistory-ex='@Html.Raw(Json.Serialize(Model.ClientCountHistory))'
|
||||
data-online="@Model.Online"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user