- Added extra source code translation (for CTS).
- Added localization to SettingList.cs display dropdown.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.Toolkit.Diagnostics;
|
||||
@@ -100,10 +101,16 @@ public class SettingList<T> : SettingEntry<T>, ISettingList<T> where T : IEquata
|
||||
#if CLIENT
|
||||
public override void AddDisplayComponent(GUILayoutGroup layoutGroup, Vector2 relativeSize, Action<string> onSerializedValue)
|
||||
{
|
||||
GUIUtil.Dropdown(layoutGroup, (T val) => val.ToString(), null, Options, Value, (T val) =>
|
||||
GUIUtil.Dropdown(layoutGroup, (T val) => GetLocalizedString(val.ToString(), val.ToString()), null, Options, Value, (T val) =>
|
||||
{
|
||||
onSerializedValue?.Invoke(val.ToString());
|
||||
}, new Vector2(relativeSize.X, 1f));
|
||||
|
||||
string GetLocalizedString(string identifier, string defaultValue)
|
||||
{
|
||||
var lstr = TextManager.Get($"{XmlConvert.EncodeLocalName(OwnerPackage.Name)}.{InternalName}.{identifier}.DisplayName");
|
||||
return lstr.IsNullOrWhiteSpace() ? defaultValue : lstr.Value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -660,7 +660,8 @@ public class PluginManagementService : IAssemblyManagementService
|
||||
{
|
||||
return sourceCode
|
||||
.Replace("GameMain.LuaCs", "LuaCsSetup.Instance")
|
||||
.Replace("Client.ClientList", "ModUtils.Client.ClientList")
|
||||
.Replace(" Client.ClientList", " ModUtils.Client.ClientList")
|
||||
.Replace(" Barotrauma.Networking.Client.ClientList", " ModUtils.Client.ClientList")
|
||||
.Replace("ItemPrefab.GetItemPrefab", "ModUtils.ItemPrefab.GetItemPrefab");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user