private void HandleLocaleChanged(string locale) { var type = GetType(); var managedText = ManagedTextUtils.GetManagedTextFromType(type); foreach (var text in managedText) { var fieldName = text.FieldId.GetAfter(".").Replace("_", string.Empty); if (gameObject.name.EqualsFastIgnoreCase(fieldName)) { SetManagedTextValue(text.FieldValue); break; } } }
public async Task ApplyManagedTextAsync() { records.Clear(); documentLoader.UnloadAll(); var documents = await documentLoader.LoadAllAsync(); foreach (var document in documents) { var managedTextSet = ManagedTextUtils.GetManagedTextFromScript(document); foreach (var text in managedTextSet) { records.Add(new ManagedTextRecord(text.FieldId, text.FieldValue, text.Category)); } ManagedTextUtils.SetManagedTextValues(managedTextSet); } }
public virtual async UniTask ApplyManagedTextAsync() { records.Clear(); var documentResources = await documentLoader.LoadAndHoldAllAsync(this); foreach (var documentResource in documentResources) { if (!documentResource.Valid) { Debug.LogWarning($"Failed to load `{documentResource.Path}` managed text document."); continue; } var managedTextSet = ManagedTextUtils.ParseDocument(documentResource.Object.text, documentLoader.GetLocalPath(documentResource)); foreach (var text in managedTextSet) { records.Add(new ManagedTextRecord(text.Key, text.Value, text.Category)); } ManagedTextUtils.ApplyRecords(managedTextSet); } }