示例#1
0
        static void AddObjectPath(ref string sPath, Localize localizeCmp, Object NewObj)
        {
            if (I2Utils.RemoveResourcesPath(ref sPath))
            {
                return;
            }

            // If its not in the Resources folder and there is no object reference already in the
            // Reference array, then add that to the Localization component or the Language Source
            if (HasObjectInReferences(NewObj, localizeCmp))
            {
                return;
            }

            if (localizeCmp != null)
            {
                localizeCmp.AddTranslatedObject(NewObj);
                EditorUtility.SetDirty(localizeCmp);
            }
            else
            if (mLanguageSource != null)
            {
                mLanguageSource.AddAsset(NewObj);
                mLanguageSource.Editor_SetDirty();
            }
        }
        public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm)
        {
            if (mTarget == null)
            {
                primaryTerm = secondaryTerm = null;
            }
            else
            {
                MeshFilter filter = mTarget.GetComponent <MeshFilter>();
                if (filter == null || filter.sharedMesh == null)
                {
                    primaryTerm = null;
                }
                else
                {
                    #if UNITY_EDITOR
                    primaryTerm = UnityEditor.AssetDatabase.GetAssetPath(filter.sharedMesh);
                    I2Utils.RemoveResourcesPath(ref primaryTerm);
                    #else
                    primaryTerm = filter.sharedMesh.name;
                    #endif
                }
            }

            if (mTarget == null || mTarget.sharedMaterial == null)
            {
                secondaryTerm = null;
            }
            else
            {
                #if UNITY_EDITOR
                secondaryTerm = UnityEditor.AssetDatabase.GetAssetPath(mTarget.sharedMaterial);
                I2Utils.RemoveResourcesPath(ref secondaryTerm);
                #else
                secondaryTerm = mTarget.sharedMaterial.name;
                #endif
            }
        }