fix: MyToggleButton本地化+厂区间距提示本地化+测距按钮翻译
- MyToggleButton: 使用LocalizationManager.Get翻译切换按钮文本 - EditorAppraiser: CheckAreaDistance/CheckAreaToWaterDistance使用Format - 新增翻译: 开始测距/结束测距/Ctrl提示/边界间距提示/水源距离提示
This commit is contained in:
parent
fa6020a681
commit
64d16aa5ec
@ -478,6 +478,12 @@ public class LocalizationManager : MonoBehaviour
|
||||
{ "厂区位置规划完成", new[] { "厂区位置规划完成", "Area Planning Complete", "Planification de la zone terminée", "Планирование зоны завершено" } },
|
||||
{ "规划完成", new[] { "规划完成", "Planning Complete", "Planification terminée", "Планирование завершено" } },
|
||||
{ "左键可重新改变厂区规划位置 右键取消厂区规划功能", new[] { "左键可重新改变厂区规划位置 右键取消厂区规划功能", "Left click to replan area position, right click to cancel", "Clic gauche pour replanifier, clic droit pour annuler", "ЛКМ — перепланировать, ПКМ — отменить" } },
|
||||
{ "开始测距", new[] { "开始测距", "Start Measuring", "Commencer la mesure", "Начать измерение" } },
|
||||
{ "结束测距", new[] { "结束测距", "Stop Measuring", "Arrêter la mesure", "Остановить измерение" } },
|
||||
{ "左Ctrl+鼠标左键可重新改变厂区规划位置 右键取消厂区规划功能", new[] { "左Ctrl+鼠标左键可重新改变厂区规划位置 右键取消厂区规划功能", "Ctrl+Left click to replan area position, right click to cancel", "Ctrl+Clic gauche pour replanifier, clic droit pour annuler", "Ctrl+ЛКМ — перепланировать, ПКМ — отменить" } },
|
||||
{ "{0}与{1}边界间距为{2}M,小于200M", new[] { "{0}与{1}边界间距为{2}M,小于200M", "Distance between {0} and {1} boundary is {2}M, less than 200M", "Distance entre {0} et {1} : {2}M, inférieure à 200M", "Расстояние между {0} и {1}: {2}м, менее 200м" } },
|
||||
{ "{0}与{1}边界间距为{2}M,小于100M", new[] { "{0}与{1}边界间距为{2}M,小于100M", "Distance between {0} and {1} boundary is {2}M, less than 100M", "Distance entre {0} et {1} : {2}M, inférieure à 100M", "Расстояние между {0} и {1}: {2}м, менее 100м" } },
|
||||
{ "{0}距离水源距离为{1}M,超出100M", new[] { "{0}距离水源距离为{1}M,超出100M", "{0} distance to water source is {1}M, exceeds 100M", "Distance de {0} à la source d'eau : {1}M, supérieure à 100M", "Расстояние от {0} до источника воды {1}м, более 100м" } },
|
||||
};
|
||||
|
||||
[SerializeField] private int language;
|
||||
|
||||
@ -450,14 +450,14 @@ public class EditorAppraiser
|
||||
{
|
||||
if (distance < 200)
|
||||
{
|
||||
return $"{allPlanedAreas[i].AreaName}与{allPlanedAreas[j].AreaName}边界间距为{(distance).ToString("0.0")}M,小于200M";
|
||||
return LocalizationManager.Format("{0}与{1}边界间距为{2}M,小于200M", allPlanedAreas[i].AreaName, allPlanedAreas[j].AreaName, distance.ToString("0.0"));
|
||||
}
|
||||
}
|
||||
else //其他厂区间距限制在100M
|
||||
{
|
||||
if (distance < 100)
|
||||
{
|
||||
return $"{allPlanedAreas[i].AreaName}与{allPlanedAreas[j].AreaName}边界间距为{(distance).ToString("0.0")}M,小于100M";
|
||||
return LocalizationManager.Format("{0}与{1}边界间距为{2}M,小于100M", allPlanedAreas[i].AreaName, allPlanedAreas[j].AreaName, distance.ToString("0.0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -475,7 +475,7 @@ public class EditorAppraiser
|
||||
float distance= GetXiXiaoToWaterDistance(new List<Transform>() { xixiaoPos });
|
||||
|
||||
if (distance > 100)
|
||||
return $"{AreaNameEnum.洗消场.ToString()}距离水源距离为{distance.ToString("0.0")}M,超出100M";
|
||||
return LocalizationManager.Format("{0}距离水源距离为{1}M,超出100M", AreaNameEnum.洗消场.ToString(), distance.ToString("0.0"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@ -24,11 +24,11 @@ public class MyToggleButton : Selectable, IPointerClickHandler
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
acticveStr.text = isOnActiveStr;
|
||||
acticveStr.text = LocalizationManager.Get(isOnActiveStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
acticveStr.text = notOnActiveStr;
|
||||
acticveStr.text = LocalizationManager.Get(notOnActiveStr);
|
||||
}
|
||||
}
|
||||
valueChange?.Invoke(isOn);
|
||||
@ -39,10 +39,22 @@ public class MyToggleButton : Selectable, IPointerClickHandler
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
// Start is called before the first update
|
||||
protected override void Start()
|
||||
{
|
||||
IsOn = isOn;
|
||||
LocalizationManager.LanguageChanged += OnLanguageChanged;
|
||||
}
|
||||
|
||||
private void OnLanguageChanged()
|
||||
{
|
||||
if (acticveStr != null)
|
||||
acticveStr.text = LocalizationManager.Get(isOn ? isOnActiveStr : notOnActiveStr);
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
LocalizationManager.LanguageChanged -= OnLanguageChanged;
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user