Ejemplo n.º 1
0
        public static void AssociateSubHierarchyWithTransformInfo(Transform root, TransformInfo info)
        {
            var transforms = root.GetComponentsInChildren <Transform>(true);

            foreach (var transform in transforms)
            {
                transform.SetExtensionData(info);
            }

            SetTextCacheForAllObjectsInHierachy(root.gameObject, info.TextCache);
        }
Ejemplo n.º 2
0
        public static void SetTextCacheForAllObjectsInHierachy(GameObject go, IReadOnlyTextTranslationCache cache)
        {
            try
            {
                foreach (var comp in go.GetAllTextComponentsInChildren())
                {
                    var info = comp.GetOrCreateTextTranslationInfo();
                    info.TextCache = cache;
                }

                var ti = new TransformInfo {
                    TextCache = cache
                };
                foreach (var transform in go.GetComponentsInChildren <Transform>(true))
                {
                    transform.SetExtensionData(ti);
                }
            }
            catch (Exception e)
            {
                XuaLogger.AutoTranslator.Error(e, "An error occurred while scanning object hierarchy for text components.");
            }
        }