public override void OnInspectorGUI() { EditorGUILayout.LabelField("Style"); style = EditorGUILayout.TextField(mTextFormat.style); EditorGUILayout.LabelField("KeyWord"); textKey = EditorGUILayout.TextField(mTextFormat.textKey); if (textKey != mTextFormat.textKey) { mTextFormat.textKey = textKey; text.text = LocalString.GetWord(mTextFormat.textKey); EditorUtility.SetDirty(mTextFormat); EditorUtility.SetDirty(text); } if (style != mTextFormat.style) { mTextFormat.style = style; EditorUtility.SetDirty(mTextFormat); changeTextStyle(); } base.DrawDefaultInspector(); }
public void merge_missing() { var source = new XmlDirectoryLocalizationStorage(new string[] { "localization1", "localization2", "localization3" }); write("localization1", new CultureInfo("en-US"), @" a=us-a b=us-b f=us-f "); source.WriteMissing("c", "us-c", new CultureInfo("en-US")); source.WriteMissing("d", "us-d", new CultureInfo("en-US")); source.WriteMissing("a", "gb-A", new CultureInfo("en-GB")); source.MergeAllMissing(); source.Load(new CultureInfo("en-US")).ShouldHaveTheSameElementsAs( LocalString.ReadAllFrom(@" a=us-a b=us-b c=us-c d=us-d f=us-f ") ); source.Load(new CultureInfo("en-GB")).ShouldHaveTheSameElementsAs(new LocalString("a", "gb-A")); new XmlDocument().FromFile( "localization1".AppendPath(XmlDirectoryLocalizationStorage.MissingLocaleConfigFile)) .DocumentElement.ChildNodes.Count.ShouldBe(0); }
void OnDestroy() { LocalString.Destroy(); PathManager.Destroy(); SpriteFaceCache.Destory(); GameManager.gameInit = false; }
public void read_from_sad_path_fails_with_descriptive_error() { Exception <ArgumentException> .ShouldBeThrownBy(() => { LocalString.ReadFrom("key:foo"); }).Message.ShouldBe("LocalString must be expressed as 'value=display', 'key:foo' is invalid"); }
public Product(int id, LocalString name, string type, string imagePath, Category category) : this() { Id = id; Name = name; Type = type; ImagePath = imagePath; Category = category; }
public void two_instances_with_the_same_key_should_equal_each_other() { var x = new LocalString { value = "foo" }; var y = new LocalString { value = "foo" }; x.ShouldEqual(y); y.ShouldEqual(x); }
public void read_all() { Assert.Equal(LocalString.ReadAllFrom(@" a=a-display b=b-display c=c-display "), new[] { new LocalString("a", "a-display"), new LocalString("b", "b-display"), new LocalString("c", "c-display") }); }
public static LocalString Create() { LocalString asset = ScriptableObject.CreateInstance <LocalString>(); AssetDatabase.CreateAsset(asset, "Assets/TranslationList.asset"); AssetDatabase.SaveAssets(); return(asset); }
public async Task <string> GetString(LocalString text) { if (text == null) { return(string.Empty); } return(await GetString(text.File, text.Id)); }
public void read_all() { LocalString.ReadAllFrom(@" a=a-display b=b-display c=c-display ").ShouldHaveTheSameElementsAs(new LocalString("a", "a-display"), new LocalString("b", "b-display"), new LocalString("c", "c-display")); }
public CreateProductCommand(LocalString name, string type, IFile image, LocalString description, int categoryId) { Name = name; Type = type; Image = image; Description = description; CategoryId = categoryId; }
public void two_instances_with_the_same_key_should_be_considered_the_same_for_hashing_purposes() { var x = new LocalString { value = "foo" }; var y = new LocalString { value = "foo" }; var dict = new Dictionary<LocalString, int> { { x, 0 } }; dict.ContainsKey(y).ShouldBeTrue(); }
public static string Translate(this LocalString input, ICurrentCulture currentCulture) { if (input == null) { return(string.Empty); } return(currentCulture.Culture == Culture.Slovak ? input.Slovak : input.English); }
public EditProductCommand(int id, LocalString name, string type, IFile?image, LocalString description, int categoryId) { Id = id; Name = name; Type = type; Image = image; Description = description; CategoryId = categoryId; }
public Product(LocalString name, string type, string image, LocalString description, Category category) : this() { Name = name; Type = type; Image = image; Description = description; Category = category; }
public ProductEdit(int id, LocalString name, string type, LocalString description, string image, int categoryId) { Id = id; Name = name; Type = type; Description = description; Image = image; CategoryId = categoryId; }
public override void Destroy() { LocalString.Destroy(); PathManager.Destroy(); ZTBattleSceneManager.GetInstance().Destroy(); //SpriteFaceCache.Destory(); //AssetManager.Destroy(); //ZTXLuaEnv.GetInstance().Destroy(); GameManager.GameInit = false; }
void OnEnable() { if (EditorPrefs.HasKey("ObjectPath")) { string objectPath = EditorPrefs.GetString("ObjectPath"); list = AssetDatabase.LoadAssetAtPath(objectPath, typeof(LocalString)) as LocalString; } index = list.getSelIndex(); previousIndex = index; }
public void two_instances_with_the_same_key_should_equal_each_other() { var x = new LocalString { value = "foo" }; var y = new LocalString { value = "foo" }; x.ShouldBe(y); y.ShouldBe(x); }
public void load_all() { write("localization1", new CultureInfo("en-US"), @" a=us-a b=us-b f=us-f "); write("localization2", new CultureInfo("en-US"), @" c=us-c d=us-d "); write("localization3", new CultureInfo("en-US"), @" e=us-e "); write("localization1", new CultureInfo("en-GB"), @" a=gb-a b=gb-b f=gb-f "); write("localization2", new CultureInfo("en-GB"), @" c=gb-c d=gb-d "); var allKeys = new Cache <string, IList <LocalString> >(key => new List <LocalString>()); var source = new XmlDirectoryLocalizationStorage(new string[] { "localization1", "localization2", "localization3" }); source.LoadAll(text => Debug.WriteLine(text), (c, strings) => allKeys[c.Name].AddRange(strings)); allKeys["en-US"].ShouldHaveTheSameElementsAs(LocalString.ReadAllFrom(@" a=us-a b=us-b f=us-f c=us-c d=us-d e=us-e ")); allKeys["en-GB"].ShouldHaveTheSameElementsAs(LocalString.ReadAllFrom(@" a=gb-a b=gb-b f=gb-f c=gb-c d=gb-d ")); }
public void two_instances_with_the_same_key_should_be_considered_the_same_for_hashing_purposes() { var x = new LocalString { value = "foo" }; var y = new LocalString { value = "foo" }; var dict = new Dictionary <LocalString, int> { { x, 0 } }; dict.ContainsKey(y).ShouldBeTrue(); }
//刷新文本显示 并保存 private static void rushText(Transform item, string style, string textKey) { UnityEngine.UI.Text txt = item.GetComponentInChildren <UnityEngine.UI.Text>(); Outline outline = item.GetComponentInChildren <Outline>(); txt.text = LocalString.GetWord(textKey); MTextFormatData data = TextFormatDefine.GetFormat(style); txt.color = data.color; txt.fontSize = data.fontSize; outline.enabled = data.isOutline; outline.effectColor = data.effectColor; EditorUtility.SetDirty(outline); EditorUtility.SetDirty(txt); }
//create a new item list void CreateNewItemList() { if (!AssetDatabase.Contains(list)) { viewIndex = 1; list = CreateTransList.Create(); if (list) { list.myList = new List <LocalStringWrapper>(); string aPath = AssetDatabase.GetAssetPath(list); EditorPrefs.SetString("ObjectPath", aPath); } } else { Debug.Log("List already exists. If list has been deleated manually create a new list in the assets>create>tools2>list and open the new list in the editor window. Remember to attach the new translation list to the Text object."); } }
//open the item list void OpenItemList() { string ofPath = EditorUtility.OpenFilePanel("Select Language List", "", ""); if (ofPath.StartsWith(Application.dataPath)) { string aPath = ofPath.Substring(Application.dataPath.Length - "Assets".Length); list = AssetDatabase.LoadAssetAtPath(aPath, typeof(LocalString)) as LocalString; if (list.myList == null) { list.myList = new List <LocalStringWrapper>(); } if (list) { EditorPrefs.SetString("ObjectPath", aPath); } } }
public override object Init(string[] rowList) { Dictionary<int, LocalString> dic = new Dictionary<int, LocalString>(); LocalString localString = null; foreach (var i in rowList) { string [] lie = i.Split(','); localString = new LocalString(); localString.id = PareInt(lie[0]); localString.chinese = lie[2]; localString.english = lie[3]; localString.korean = lie[4]; localString.japanese = lie[5]; dic.Add(localString.id, localString); } return dic; }
public void read_from_happy_path_trims() { LocalString.ReadFrom(" key=foo ").ShouldBe(new LocalString("key", "foo")); }
public CreateCategoryCommand(LocalString name, ushort order) { Name = name; Order = order; }
public Creature DeepCopy() { Creature other = (Creature)this.MemberwiseClone(); other.knownSpellsTags = new List<string>(); foreach (string s in this.knownSpellsTags) { other.knownSpellsTags.Add(s); } other.CreatureLocalInts = new List<LocalInt>(); foreach (LocalInt l in this.CreatureLocalInts) { LocalInt Lint = new LocalInt(); Lint.Key = l.Key; Lint.Value = l.Value; other.CreatureLocalInts.Add(Lint); } other.CreatureLocalStrings = new List<LocalString>(); foreach (LocalString l in this.CreatureLocalStrings) { LocalString Lstr = new LocalString(); Lstr.Key = l.Key; Lstr.Value = l.Value; other.CreatureLocalStrings.Add(Lstr); } //other.EffectsList = new Effects(); //other.onScoringHit = this.onScoringHit.DeepCopy(); return other; }
public EditCategoryCommand(int id, LocalString name, ushort order) { Id = id; Name = name; Order = order; }
public Prop DeepCopy() { Prop other = (Prop)this.MemberwiseClone(); other.PropLocalInts = new List<LocalInt>(); foreach (LocalInt l in this.PropLocalInts) { LocalInt Lint = new LocalInt(); Lint.Key = l.Key; Lint.Value = l.Value; other.PropLocalInts.Add(Lint); } other.PropLocalStrings = new List<LocalString>(); foreach (LocalString l in this.PropLocalStrings) { LocalString Lstr = new LocalString(); Lstr.Key = l.Key; Lstr.Value = l.Value; other.PropLocalStrings.Add(Lstr); } other.WayPointList = new List<WayPoint>(); foreach (WayPoint coor in this.WayPointList) { other.WayPointList.Add(coor.DeepCopy()); } return other; }
public CategoryEdit(int id, LocalString name, ushort order) { Id = id; Name = name; Order = order; }
public void Add(CultureInfo culture, string valuesText) { _cache[culture].AddRange(LocalString.ReadAllFrom(valuesText)); }
public Category(LocalString name, ushort order) : this() { Name = name; Order = order; }
// values = "value=display" private void write(string directory, CultureInfo culture, string values) { XmlDirectoryLocalizationStorage.Write(directory, culture, LocalString.ReadAllFrom(values)); }
public void Update(LocalString name, string type, LocalString description) { Name = name; Type = type; Description = description; }