Example #1
0
        public void SaveWord(string key, string[] data)
        {
#if UNITY_EDITOR
            bool isKeyExist = false;
            Localizator.Keys.ForEach((string oldKey) =>
            {
                isKeyExist |= string.Equals(oldKey, key, System.StringComparison.OrdinalIgnoreCase);
            });

            if (isKeyExist)
            {
                Debug.LogError("Key " + key + " is already in use!");
                return;
            }

            string keyValue = string.Empty;
            for (int i = 0; i < data.Length; i++)
            {
                keyValue = string.Format("\n'{0}' : '{1}'", key, data[i]);
                File.AppendAllText(string.Format(Application.dataPath + "/Resources/Languages/{0}.txt", Localizator.Languages[i]), keyValue);
            }

            Debug.Log("Word " + key + " has been writen!");
            AssetDatabase.Refresh();

            Localizator.Init();
#endif
        }
Example #2
0
        public void SaveWord()
        {
#if UNITY_EDITOR
            string keyValue = string.Empty;
            for (int i = 0; i < NewWords.Length; i++)
            {
                keyValue = string.Format("\n'{0}' : '{1}'", NewKey, NewWords[i]);
                File.AppendAllText(string.Format(Application.dataPath + "/Resources/Languages/{0}.txt", Localizator.Languages[i]), keyValue);
            }

            webWordsAppender.ShowWordWritten();

            Localizator.Init();
#endif
        }
        public override void OnInspectorGUI()
        {
            if (!instance.enabled)
            {
                return;
            }
            GUI.enabled = false;
            EditorGUILayout.ObjectField(SScript);
            GUI.enabled = true;
            EditorGUI.BeginChangeCheck();
            instance.IsSteam = EditorGUILayout.Toggle("Steam application?", instance.IsSteam);
            if (EditorGUI.EndChangeCheck())
            {
                Defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
                if (!instance.IsSteam)
                {
                    Defines = Defines.Replace("STEAM_APP", "");
                }
                else
                {
                    if (Defines.Equals(string.Empty))
                    {
                        Defines += "STEAM_APP";
                    }
                    else
                    {
                        if (!Defines.Contains("STEAM_APP"))
                        {
                            Defines += ";STEAM_APP";
                        }
                    }
                }

                PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, Defines);
            }
            string[] l = instance.Languages.ToArray();
            instance.defaultLInt     = EditorGUILayout.Popup("Dafault Language", instance.defaultLInt, l);
            instance.defaultLanguage = instance.Languages[instance.defaultLInt];

            instance.ParserIndex = EditorGUILayout.Popup("Used parser", instance.ParserIndex, instance.ParsersName);
            if (instance.ParserIndex != parserIndex)
            {
                instance.Init();
                parserIndex = instance.ParserIndex;
            }

            instance.isCustomInitialize = EditorGUILayout.Toggle("Custom Initialization", instance.isCustomInitialize);
        }