/// <summary> /// Gets the current sequence field: the localized field if using localization and the /// localized field exists; otherwise the default field. /// </summary> /// <returns> /// The current sequence field. /// </returns> private Field GetCurrentSequenceField() { return(Field.AssignedField(fields, Field.LocalizedTitle("Sequence")) ?? Field.Lookup(fields, "Sequence")); }
/// <summary> /// Gets the current menu text field: the localized field if using localization and the /// localized field exists; otherwise the default field. /// </summary> /// <returns> /// The current menu text field. /// </returns> private Field GetCurrentMenuTextField() { return(Field.AssignedField(fields, Field.LocalizedTitle("Menu Text")) ?? Field.Lookup(fields, "Menu Text")); }
/// <summary> /// Gets the current dialogue text field: the localized field if using localization and the /// localized field exists; otherwise the default field. /// </summary> /// <returns> /// The current dialogue text field. /// </returns> private Field GetCurrentDialogueTextField() { if (string.IsNullOrEmpty(Localization.language)) return Field.Lookup(fields, "Dialogue Text"); return Field.AssignedField(fields, Localization.language) ?? Field.Lookup(fields, "Dialogue Text"); }
/// <summary> /// Gets the current response menu sequence field: the localized field if using localization /// and the localized field exists; otherwise the default field. /// </summary> /// <returns> /// The current response menu sequence field. /// </returns> private Field GetCurrentResponseMenuSequenceField() { return Field.AssignedField(fields, Field.LocalizedTitle("Response Menu Sequence")) ?? Field.Lookup(fields, "Response Menu Sequence"); }
private void FindPortraitTextures(Actor actor) { if (actor == null) { return; } var field = Field.Lookup(actor.fields, DialogueSystemFields.Pictures); if ((field == null) || (field.value == null)) { return; } var names = new List <string>(field.value.Split(new char[] { '[', ';', ']' })); names.RemoveAll(s => string.IsNullOrEmpty(s.Trim())); for (int i = 0; i < names.Count; i++) { string textureName = names[i]; if (!string.IsNullOrEmpty(textureName.Trim())) { string filename = Path.GetFileName(textureName).Replace('\\', '/'); string assetPath = string.Format("{0}/{1}", prefs.portraitFolder, filename); switch (prefs.portraitType) { default: case PortraitType.Texture: Texture2D texture = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture2D)) as Texture2D; if (texture == null) { Debug.LogWarning(string.Format("{0}: Can't find portrait texture {1} for {2}.", DialogueDebug.Prefix, assetPath, actor.Name)); } else if (i == 0) // First portrait. { actor.portrait = texture; } else { actor.alternatePortraits.Add(texture); } break; case PortraitType.Sprite: Sprite sprite = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Sprite)) as Sprite; if (sprite == null) { Debug.LogWarning(string.Format("{0}: Can't find portrait sprite {1} for {2}.", DialogueDebug.Prefix, assetPath, actor.Name)); } else if (i == 0) // First portrait. { actor.spritePortrait = sprite; } else { actor.spritePortraits.Add(sprite); } break; } } } }