public AssetScanner(List<IGameProcessor> customProcessors = null) { var stringFormatToIgnore = new List<string>() { "XXXX" }; _customProcessorState = new CustomScriptProcessorState(toIgnore, TranslationUtility.getUtilityInstanceForDebugging(), stringFormatToIgnore); if(customProcessors != null) _gameProcessors.AddRange(customProcessors); _gameProcessors.Add(new GameSpecificMigration.ButtonViewProcessor()); _gameProcessors.Add(new TextMeshProcessor()); _gameProcessors.Add(new GUITextProcessor()); }
public void process(GameObject go, CustomScriptProcessorState processorState) { #if TRANSFLUENT_EXAMPLE var button = go.GetComponent<ButtonView>(); if(button == null) return; if(button.labelMesh != null) { if(processorState.shouldIgnoreString(button.label)) { processorState.addToBlacklist(go); return; } string newKey = button.label; button.labelData.globalizationKey = newKey; processorState.addToDB(newKey, newKey); processorState.addToBlacklist(go); //make sure the button gets saved properly when the scene is closed //custom script objects have to manually declare themselves as "dirty" EditorUtility.SetDirty(button); } }
public void process(GameObject go, CustomScriptProcessorState processorState) { var guiText = go.GetComponent<GUIText>(); if(guiText == null) return; string newKey = guiText.text; processorState.addToDB(newKey, newKey); processorState.addToBlacklist(go); var translatable = guiText.GetComponent<LocalizedGUIText>(); if(processorState.shouldIgnoreString(guiText.text)) { processorState.addToBlacklist(go); return; } if(translatable == null) { translatable = guiText.gameObject.AddComponent<LocalizedGUIText>(); translatable.guiTextToModify = guiText; //just use whatever the source text is upfront, and allow the user to } translatable.localizableText.globalizationKey = guiText.text; //For guitext and other unity managed objects, this setDirty is not needed according to http://docs.unity3d.com/Documentation/ScriptReference/EditorUtility.SetDirty.html EditorUtility.SetDirty(guiText.gameObject); EditorUtility.SetDirty(guiText); }
public void process(GameObject go, CustomScriptProcessorState processorState) { var textMesh = go.GetComponent<TextMesh>(); if(textMesh == null) return; string newKey = textMesh.text; processorState.addToDB(newKey, newKey); processorState.addToBlacklist(go); var translatable = textMesh.GetComponent<LocalizedTextMesh>(); if(processorState.shouldIgnoreString(textMesh.text)) { processorState.addToBlacklist(go); return; } if(translatable == null) { translatable = textMesh.gameObject.AddComponent<LocalizedTextMesh>(); translatable.textmesh = textMesh; //just use whatever the source text is upfront, and allow the user to } translatable.localizableText.globalizationKey = textMesh.text; //For textmesh specificially, this setDirty is not needed according to http://docs.unity3d.com/Documentation/ScriptReference/EditorUtility.SetDirty.html //EditorUtility.SetDirty(textMesh); }