List <GameObject> FindObjectsUsingKey(string Key)
        {
            List <GameObject> SelectedObjs = new List <GameObject>();

            Localize[] Locals = (Localize[])Resources.FindObjectsOfTypeAll(typeof(Localize));

            if (Locals == null)
            {
                return(SelectedObjs);
            }

            for (int i = 0, imax = Locals.Length; i < imax; ++i)
            {
                Localize localize = Locals[i];
                if (localize == null || localize.gameObject == null || !GUITools.ObjectExistInScene(localize.gameObject))
                {
                    continue;
                }

                string Term, SecondaryTerm;
                localize.GetFinalTerms(out Term, out SecondaryTerm);

                if (Key == Term || Key == SecondaryTerm)
                {
                    SelectedObjs.Add(localize.gameObject);
                }
            }

            return(SelectedObjs);
        }
        public static void ApplyInferredTerm(Localize localize)
        {
            if (mLanguageSource == null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(localize.mTerm) && !string.IsNullOrEmpty(localize.mTermSecondary))
            {
                return;
            }

            string sTerm, sSecTerm;

            localize.GetFinalTerms(out sTerm, out sSecTerm);

            if (string.IsNullOrEmpty(localize.mTerm))
            {
                var termData = mLanguageSource.GetTermData(sTerm, true);
                if (termData != null)
                {
                    localize.mTerm = termData.Term;
                }
            }

            if (string.IsNullOrEmpty(localize.mTermSecondary))
            {
                var termData = mLanguageSource.GetTermData(sSecTerm, true);
                if (termData != null)
                {
                    localize.mTermSecondary = termData.Term;
                }
            }

            //localize.Source = mLanguageSource;
        }
        static void FindTermsInCurrentScene()
        {
            Localize[] Locals = (Localize[])Resources.FindObjectsOfTypeAll(typeof(Localize));

            if (Locals == null)
            {
                return;
            }

            for (int i = 0, imax = Locals.Length; i < imax; ++i)
            {
                Localize localize = Locals[i];
                if (localize == null || (localize.Source != null && localize.Source.SourceData != mLanguageSource) || localize.gameObject == null || !GUITools.ObjectExistInScene(localize.gameObject))
                {
                    continue;
                }

                string Term, SecondaryTerm;
                //Term = localize.Term;
                //SecondaryTerm = localize.SecondaryTerm;
                localize.GetFinalTerms(out Term, out SecondaryTerm);

                if (!string.IsNullOrEmpty(Term))
                {
                    GetParsedTerm(Term).Usage++;
                }

                if (!string.IsNullOrEmpty(SecondaryTerm))
                {
                    GetParsedTerm(SecondaryTerm).Usage++;
                }
            }
        }
Пример #4
0
        TermData OnGUI_PrimaryTerm(bool OnOpen)
        {
            string Key = mLocalize.mTerm;

            if (string.IsNullOrEmpty(Key))
            {
                string SecondaryTerm;
                mLocalize.GetFinalTerms(out Key, out SecondaryTerm);
            }

            if (OnOpen)
            {
                mNewKeyName = Key;
            }
            if (OnGUI_SelectKey(ref Key, string.IsNullOrEmpty(mLocalize.mTerm)))
            {
                mProp_mTerm.stringValue = Key;
            }
            return(LocalizationEditor.OnGUI_Keys_Languages(Key, mLocalize, true));
        }
Пример #5
0
        void SelectObjectsUsingKey(string Key)
        {
            List <GameObject> SelectedObjs = new List <GameObject>();

            Localize[] Locals = (Localize[])Resources.FindObjectsOfTypeAll(typeof(Localize));

            if (Locals == null)
            {
                return;
            }

            for (int i = 0, imax = Locals.Length; i < imax; ++i)
            {
                Localize localize = Locals[i];
                if (localize == null || localize.gameObject == null || !GUITools.ObjectExistInScene(localize.gameObject))
                {
                    continue;
                }

                string Term, SecondaryTerm;
                localize.GetFinalTerms(out Term, out SecondaryTerm);

                if (Key == Term || Key == SecondaryTerm)
                {
                    SelectedObjs.Add(localize.gameObject);
                }
            }

            if (SelectedObjs.Count > 0)
            {
                Selection.objects = SelectedObjs.ToArray();
            }
            else
            {
                ShowWarning("The selected Terms are not used in this Scene. Try opening other scenes");
            }
        }