Skip to content

Commit 9956b6d

Browse files
committed
add: base implantation localize services
1 parent db36c9c commit 9956b6d

File tree

22 files changed

+3360
-492
lines changed

22 files changed

+3360
-492
lines changed

Assets/Code/Editor/Localization/LocalizationEditorWindow.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ private void ApplyLocalizationKeyChangesToAssets()
197197
LocalizeBase[] localizers = prefab.GetComponentsInChildren<LocalizeBase>(true);
198198
foreach (LocalizeBase localizer in localizers)
199199
{
200-
if (localizer.gameObject.name != entry.GameObjectName) continue;
200+
if (localizer.gameObject.name != entry.GameObjectName)
201+
continue;
201202

202203
string oldKey = localizer.localizationKey;
203204
string newKey = entry.LocalizationKey;
@@ -237,13 +238,13 @@ private void AddTMP_LocalizersToResources()
237238
int addedCount = 0;
238239

239240
GameObject[] allPrefabs = Resources.LoadAll<GameObject>("");
240-
foreach (var prefab in allPrefabs)
241+
foreach (GameObject prefab in allPrefabs)
241242
{
242243
if (prefab == null)
243244
continue;
244245

245246
string path = AssetDatabase.GetAssetPath(prefab);
246-
if (string.IsNullOrEmpty(path))
247+
if (string.IsNullOrEmpty(path) || !path.EndsWith(".prefab"))
247248
continue;
248249

249250
GameObject root = PrefabUtility.LoadPrefabContents(path);

Assets/Code/Infrastructure/Installers/BootstrapInstaller.cs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Code.Infrastructure.StateMachine;
22
using Code.Infrastructure.StateMachine.Game;
33
using Code.Infrastructure.StateMachine.Game.States;
4+
using Code.Localization.Code.Services.LocalizeLanguageService;
45
using Code.Services.BallController;
56
using Code.Services.Factories.Game;
67
using Code.Services.Factories.UIFactory;
@@ -60,9 +61,8 @@ private void BindMonoServices()
6061
private void BindServices()
6162
{
6263
BindStaticDataService();
64+
BindFactory();
6365

64-
Container.BindInterfacesTo<UIFactory>().AsSingle();
65-
Container.BindInterfacesTo<GameFactory>().AsSingle();
6666
Container.BindInterfacesTo<WindowService>().AsSingle();
6767
Container.BindInterfacesTo<InputService>().AsSingle();
6868
Container.BindInterfacesTo<PersistenceProgressService>().AsSingle();
@@ -71,13 +71,25 @@ private void BindServices()
7171
Container.BindInterfacesTo<BallProvider>().AsSingle();
7272
Container.BindInterfacesTo<WidgetProvider>().AsSingle();
7373
Container.BindInterfacesTo<LevelService>().AsSingle();
74-
Container.BindInterfacesTo<FinishService>().AsSingle();
75-
Container.BindInterfacesTo<WinService>().AsSingle();
76-
Container.BindInterfacesTo<LoseService>().AsSingle();
7774
Container.BindInterfacesTo<BallChainController>().AsSingle();
7875
Container.BindInterfacesTo<LevelLocalProgressService>().AsSingle();
79-
76+
77+
BindFinishServices();
8078
BindAudioVibration();
79+
BindLocalizeLanguage();
80+
}
81+
82+
private void BindFactory()
83+
{
84+
Container.BindInterfacesTo<UIFactory>().AsSingle();
85+
Container.BindInterfacesTo<GameFactory>().AsSingle();
86+
}
87+
88+
private void BindFinishServices()
89+
{
90+
Container.BindInterfacesTo<FinishService>().AsSingle();
91+
Container.BindInterfacesTo<WinService>().AsSingle();
92+
Container.BindInterfacesTo<LoseService>().AsSingle();
8193
}
8294

8395
private void BindAudioVibration()
@@ -86,6 +98,11 @@ private void BindAudioVibration()
8698
Container.Bind<IMusicService>().To<MusicService>().AsSingle();
8799
Container.Bind<IVibrationService>().To<VibrationService>().AsSingle();
88100
}
101+
102+
private void BindLocalizeLanguage()
103+
{
104+
Container.BindInterfacesTo<LocalizeLanguageService>().AsSingle();
105+
}
89106

90107
private void BindGameStateMachine()
91108
{

Assets/Code/Localization/Code/TMP_Localizer.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
using TMPro;
22
using UnityEngine;
3-
using Code.Localization.Code.Services.LocalizeLanguageService;
43

54
namespace Code.Localization.Code
65
{
76
[DisallowMultipleComponent]
87
public class TMP_Localizer : LocalizeBase
98
{
109
[SerializeField] private TMP_Text _text;
11-
12-
private ILocalizeLanguageService _localizeLanguageService;
10+
[SerializeField] private bool _isDynamic = false;
1311

1412
private void OnValidate()
1513
{
16-
if(_text == null)
14+
if(_text == null)
1715
_text = GetComponent<TMP_Text>();
1816
}
1917

20-
public void Start()
18+
private void Start()
2119
{
22-
UpdateLocale();
20+
if(!_isDynamic)
21+
UpdateLocale();
2322
}
2423

2524
public override void UpdateLocale()
@@ -30,7 +29,7 @@ public override void UpdateLocale()
3029
return;
3130
}
3231

33-
if (!System.String.IsNullOrEmpty(localizationKey) &&
32+
if (!System.String.IsNullOrEmpty(localizationKey) &&
3433
Locale.currentLanguageStrings.ContainsKey(localizationKey))
3534
{
3635
_text.text = Locale.currentLanguageStrings[localizationKey].Replace(@"\n", "" + '\n');

Assets/Code/Localization/Code/UI/DropDownSwitcherLanguage.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Assets/Code/Localization/Intro/Resources/Localization/Dutch.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

Assets/Code/Localization/Intro/Resources/Localization/Dutch.txt.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
eng=English
22
ru=Russian
33
uk=Ukrainian
4-
pla=Play
5-
go=GameOver
6-
ex=Exit
7-
so=Sounds
4+
lose=Lose
5+
win=Win
6+
restart=Restart
7+
namelvl=Zuma
8+
timeinlvl=Time
9+
loading=Loading
10+
shop=Shop
11+
chapter=Chapter
12+
meta=Meta
13+
map=Map
14+
lvl=Level
15+
whensprialsattack=When Sprirals Attack
16+
score=Score
17+
exittomenu=Exit To Menu
18+
continue=Continue
19+
gamepause=Game Pause
20+
sound=Sound
21+
quittomenu=Quit To Menu
22+
vibration=Vibration
23+
music=Music
24+
restrat=Restrat Level

Assets/Code/Localization/Intro/Resources/Localization/Polish.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

Assets/Code/Localization/Intro/Resources/Localization/Polish.txt.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
eng=Английский
22
ru=Русский
33
uk=Украинский
4-
pla=Играть
5-
go=Поражение
6-
ex=Выход
7-
so=Звуки
4+
lose=Поражение
5+
win=Победа
6+
restart=Перезапуск
7+
namelvl=Зума
8+
timeinlvl=Время
9+
loading=Загрузка
10+
shop=Магазин
11+
chapter=Глава
12+
meta=Мета
13+
map=Карта
14+
lvl=Уровень
15+
whensprialsattack=Когда Спирали Атакуют
16+
score=Очки
17+
exittomenu=Выход в Меню
18+
continue=Продолжить
19+
gamepause=Пауза
20+
sound=Звук
21+
quittomenu=Выйти в Меню
22+
vibration=Вибрация
23+
music=Музыка
24+
restrat=Перезапуск Уровня

0 commit comments

Comments
 (0)