/// <summary>Adds the group from the given text. This allows loading new language variables at runtime.</summary> /// <param name="content">The xml structured variables.</param> /// <param name="group">The name of the group.</param> public LanguageSet AddGroup(string content, string group) { LanguageSet extraSet = new LanguageSet(content, group); extraSet.Loader = Loader; AddGroup(extraSet); return(extraSet); }
/// <summary>Adds the given group to this set. This allows loading new language variables at runtime.</summary> /// <param name="group">The group to add.</param> public void AddGroup(LanguageSet group) { if (group == null) { return; } if (ExtraGroups == null) { ExtraGroups = new Dictionary <string, LanguageSet>(); } string groupName = group.Group; if (groupName == null) { groupName = ""; } ExtraGroups[groupName] = group; }
/// <summary>Loads the group with the given name using this sets loader, if there is one.</summary> public LanguageSet LoadGroup(string groupName) { if (Loader == null) { return(null); } // Load the set: LanguageSet set = Loader.GetGroup(groupName, Code); if (set != null) { // Apply the group name: set.Group = groupName; // Add it: AddGroup(set); } return(set); }
//--------------------------------------
/// <summary>Gets all available languages.</summary> protected override LanguageSet[] GetAllLanguages() { if (Languages == null) { // Load all: object[] assets = Resources.LoadAll(Path, typeof(TextAsset)); // Create the set: Languages = new LanguageSet[assets.Length]; // For some reason Unity treats folders as TextAssets, so we've got to strip them if they exist. int directoryCount = 0; for (int i = 0; i < Languages.Length; i++) { // Create the set: LanguageSet set = new LanguageSet(((TextAsset)assets[i]).text, this); // Folder? if (set.Code == null) { // Yep - or no useable language code - skip. directoryCount++; continue; } // Write it: Languages[i] = set; } if (directoryCount != 0) { // Resize: LanguageSet[] tempSet = new LanguageSet[Languages.Length - directoryCount]; int index = 0; // For each one.. for (int i = 0; i < Languages.Length; i++) { // Grab the set: LanguageSet set = Languages[i]; if (set == null) { // It was skipped above. continue; } // Add to temp set: tempSet[index] = set; index++; } // Apply temp set to languages: Languages = tempSet; } } return(Languages); }
/// <summary>Gets all available languages.</summary> protected override LanguageSet[] GetAllLanguages(){ if(Languages==null){ // Load all: object[] assets=Resources.LoadAll(Path,typeof(TextAsset)); // Create the set: Languages=new LanguageSet[assets.Length]; // For some reason Unity treats folders as TextAssets, so we've got to strip them if they exist. int directoryCount=0; for(int i=0;i<Languages.Length;i++){ // Create the set: LanguageSet set=new LanguageSet(((TextAsset)assets[i]).text,this); // Folder? if(set.Code==null){ // Yep - or no useable language code - skip. directoryCount++; continue; } // Write it: Languages[i]=set; } if(directoryCount!=0){ // Resize: LanguageSet[] tempSet=new LanguageSet[Languages.Length-directoryCount]; int index=0; // For each one.. for(int i=0;i<Languages.Length;i++){ // Grab the set: LanguageSet set=Languages[i]; if(set==null){ // It was skipped above. continue; } // Add to temp set: tempSet[index]=set; index++; } // Apply temp set to languages: Languages=tempSet; } } return Languages; }
public LanguageElement(LanguageSet parent, MLLexer lexer, bool innerElement) { Parent = parent; ReadTag(lexer); }
public LanguageElement(LanguageSet parent, MLLexer lexer) { Parent = parent; // This is the 'top' tag - start reading it's content. ReadContent(lexer, false, false); }
public LanguageElement(LanguageSet parent,MLLexer lexer,bool innerElement){ Parent=parent; ReadTag(lexer); }
public LanguageElement(LanguageSet parent,MLLexer lexer){ Parent=parent; // This is the 'top' tag - start reading it's content. ReadContent(lexer,false,false); }