コード例 #1
0
        public void SaveDeleted()
        {
#if UNITY_EDITOR
            string newText = string.Empty;
            string key     = "'" + OldKey + "'";

            for (int i = 0; i < Localizator.Languages.Count; i++)
            {
                TextAsset text = Resources.Load <TextAsset>("Languages/" + Localizator.Languages[i]);
                if (text != null)
                {
                    int startIndex = text.text.IndexOf(key, System.StringComparison.OrdinalIgnoreCase);
                    if (startIndex > -1)
                    {
                        int endIndex = text.text.IndexOf("\n", startIndex, System.StringComparison.OrdinalIgnoreCase);
                        if (endIndex < 0)
                        {
                            endIndex = text.text.Length;
                        }
                        newText = text.text.Remove(startIndex - 1, endIndex - startIndex + 1);
                        System.IO.File.WriteAllText(string.Format(Application.dataPath + "/Resources/Languages/{0}.txt", Localizator.Languages[i]), newText);
                    }
                    else
                    {
                        Debug.LogWarning("No key: " + key);
                    }
                }
                else
                {
                    Debug.LogWarning("No file: " + "Languages/" + Localizator.Languages[i]);
                }
            }

            webWordsEraser.ShowWordErased();

            Localizator.Invoke("Init", 0.1f);
#endif
        }