/// <summary> /// Get the quest name in the setted language. /// </summary> /// <param name="language">The language or the current if don't exists.</param> /// <returns>The name as string.</returns> public string GetName(string language = "") { language = string.IsNullOrEmpty(language) ? DiplomataManager.Data.options.currentLanguage : language; var name = DictionariesHelper.ContainsKey(Name, language); return(name != null ? name.value : string.Empty); }
/// <summary> /// Get the long description as string the setted language. /// </summary> /// <param name="language">The language desired.</param> /// <returns>The string value of the long description.</returns> public string GetLongDescription(string language = "") { language = string.IsNullOrEmpty(language) ? DiplomataManager.Data.options.currentLanguage : language; var longDescription = DictionariesHelper.ContainsKey(LongDescription, language); return(longDescription != null ? longDescription.value : string.Empty); }
public void DrawEditWindow() { var name = DictionariesHelper.ContainsKey(context.name, Controller.Instance.Options.currentLanguage); if (name != null) { GUILayout.Label("Name: "); GUI.SetNextControlName("name"); name.value = EditorGUILayout.TextField(name.value); GUIHelper.Focus("name"); EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Update", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { UpdateContext(); } if (GUILayout.Button("Cancel", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { UpdateContext(); } GUILayout.EndHorizontal(); } }
/// <summary> /// Return the description of the item. /// </summary> /// <param name="language">The language of the name.</param> /// <returns>The description of the item or empty.</returns> public string DisplayDescription(string language) { var nameResult = DictionariesHelper.ContainsKey(description, language); if (nameResult == null) { return(string.Empty); } return(nameResult.value); }
/// <summary> /// Find a item by name in a specific language. /// </summary> /// <param name="items">A array of items.</param> /// <param name="name">The name of the item.</param> /// <param name="language">The specific language.</param> /// <returns>The item if found, or null.s</returns> public static Item Find(Item[] items, string name, string language = "English") { // TODO: use the Helpers.Find class here. foreach (Item item in items) { LanguageDictionary itemName = DictionariesHelper.ContainsKey(item.name, language); if (itemName.value == name && itemName != null) { return(item); } } Debug.LogError($"This item \"{name}\" doesn't exist."); return(null); }
/// <summary> /// Equip a item by the name in a specific language. /// </summary> /// <param name="name">The item name.</param> /// <param name="language">The item name language.</param> public void Equip(string name, string language = "English") { foreach (Item item in items) { LanguageDictionary itemName = DictionariesHelper.ContainsKey(item.name, language); if (itemName.value == name && itemName != null) { Equip(item.id); break; } } if (equipped == -1) { Debug.LogError("Cannot find the item \"" + name + "\" in " + language + " in the inventory."); } }
/// <summary> /// Return a text with local variables replaced. /// </summary> /// <param name="text">The text to replace.</param> /// <returns>The text with all the local variables replaced.</returns> public string ReplaceVariables(string text) { if (!Application.isPlaying) { return(text); } var replacedText = string.Copy(text); var matches = Regex.Matches(replacedText, "{{(.*?)}}"); foreach (var match in matches) { var varName = match.ToString().Replace("{{", ""); varName = varName.Replace("}}", ""); var localVariable = GetLocalVariable(varName); if (localVariable != null && !string.IsNullOrEmpty(varName)) { switch (localVariable.Type) { case VariableType.String: replacedText = replacedText.Replace(match.ToString(), DictionariesHelper.ContainsKey(localVariable.StringValue, DiplomataManager.Data.options.currentLanguage) .value); break; case VariableType.Int: replacedText = replacedText.Replace(match.ToString(), localVariable.IntValue.ToString()); break; case VariableType.Float: replacedText = replacedText.Replace(match.ToString(), localVariable.FloatValue.ToString()); break; } } else { replacedText = replacedText.Replace(match.ToString(), ""); } } return(replacedText); }
/// <summary> /// To set a choice by the player. /// </summary> /// <param name="content">The choice text.</param> public void ChooseMessage(string content) { var character = (Character)talkable; if (currentColumn != null) { foreach (var msg in choices) { var localContent = DictionariesHelper.ContainsKey(msg.content, DiplomataManager.Data.options.currentLanguage).value; if (currentContext.ReplaceVariables(localContent) == content) { currentMessage = msg; OnStartCallbacks(); break; } } if (currentMessage != null) { if (OnMessageChosen != null) { OnMessageChosen(currentMessage); } choiceMenu = false; choices = new List <Message>(); character.influence = SetInfluence(); } else { Debug.LogError("Unable to found the message with the content \"" + content + "\"."); EndTalk(); } } else { Debug.LogError("No column setted."); EndTalk(); } }
/// <summary> /// Get all the choices in a list. /// </summary> /// <returns>A list with all the choices of the current column.</returns> public List <string> MessageChoices() { var choicesText = new List <string>(); if (choices.Count > 0) { foreach (var choice in choices) { var content = DictionariesHelper.ContainsKey(choice.content, DiplomataManager.Data.options.currentLanguage).value; if (!choice.alreadySpoked && choice.disposable) { choicesText.Add(currentContext.ReplaceVariables(content)); } else if (!choice.disposable) { choicesText.Add(currentContext.ReplaceVariables(content)); } } } else { Debug.Log("There's no choice this time."); if (IsLastMessage()) { EndTalk(); } else { controlIndexes["column"] += 1; controlIndexes["message"] = 0; Next(false); } } return(choicesText); }
public void DrawEditWindow() { GUILayout.Label(string.Format("Name: {0}", interactable.name)); GUIHelper.Separator(); var description = DictionariesHelper.ContainsKey(interactable.description, Controller.Instance.Options.currentLanguage); if (description == null) { interactable.description = ArrayHelper.Add(interactable.description, new LanguageDictionary(Controller.Instance.Options.currentLanguage, "")); description = DictionariesHelper.ContainsKey(interactable.description, Controller.Instance.Options.currentLanguage); } GUIHelper.textContent.text = description.value; var height = GUIHelper.textAreaStyle.CalcHeight(GUIHelper.textContent, position.width - (2 * GUIHelper.MARGIN)); GUILayout.Label("Description: "); description.value = EditorGUILayout.TextArea(description.value, GUIHelper.textAreaStyle, GUILayout.Height(height)); EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Save(); Close(); } if (GUILayout.Button("Close", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Save(); Close(); } GUILayout.EndHorizontal(); }
public void DrawEditWindow() { GUILayout.Label(string.Format("Name: {0}", character.name)); GUIHelper.Separator(); var description = DictionariesHelper.ContainsKey(character.description, Controller.Instance.Options.currentLanguage); if (description == null) { character.description = ArrayHelper.Add(character.description, new LanguageDictionary(Controller.Instance.Options.currentLanguage, "")); description = DictionariesHelper.ContainsKey(character.description, Controller.Instance.Options.currentLanguage); } GUIHelper.textContent.text = description.value; var height = GUIHelper.textAreaStyle.CalcHeight(GUIHelper.textContent, position.width - (2 * GUIHelper.MARGIN)); GUILayout.Label("Description: "); description.value = EditorGUILayout.TextArea(description.value, GUIHelper.textAreaStyle, GUILayout.Height(height)); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); var player = false; if (Controller.Instance.Options.playerCharacterName == character.name) { player = true; } player = GUILayout.Toggle(player, " Is player"); if (player) { Controller.Instance.Options.playerCharacterName = character.name; } EditorGUILayout.EndHorizontal(); if (character.name != Controller.Instance.Options.playerCharacterName) { GUIHelper.Separator(); GUILayout.Label("Character attributes (influenceable by): "); foreach (string attrName in Controller.Instance.Options.attributes) { if (character.attributes.Length == 0) { character.attributes = ArrayHelper.Add(character.attributes, new AttributeDictionary(attrName)); } else { for (int i = 0; i < character.attributes.Length; i++) { if (character.attributes[i].key == attrName) { break; } else if (i == character.attributes.Length - 1) { character.attributes = ArrayHelper.Add(character.attributes, new AttributeDictionary(attrName)); } } } } for (int i = 0; i < character.attributes.Length; i++) { if (ArrayHelper.Contains(Controller.Instance.Options.attributes, character.attributes[i].key)) { character.attributes[i].value = (byte)EditorGUILayout.Slider(character.attributes[i].key, character.attributes[i].value, 0, 100); } } GUIHelper.Separator(); } else { EditorGUILayout.Separator(); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Save", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Save(); Close(); } if (GUILayout.Button("Close", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Save(); Close(); } GUILayout.EndHorizontal(); }
public void OnGUI() { GUIHelper.Init(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); GUILayout.BeginVertical(GUIHelper.windowStyle); switch (state) { case State.None: Init(State.Close); break; case State.CreateEdit: // Set quest name. GUILayout.Label("Name: "); var questName = DictionariesHelper.ContainsKey(quest.Name, Controller.Instance.Options.currentLanguage); if (questName == null) { quest.Name = ArrayHelper.Add(quest.Name, new LanguageDictionary(Controller.Instance.Options.currentLanguage, "")); } GUI.SetNextControlName("name"); DictionariesHelper.ContainsKey(quest.Name, Controller.Instance.Options.currentLanguage).value = EditorGUILayout.TextField(DictionariesHelper.ContainsKey(quest.Name, Controller.Instance.Options.currentLanguage).value); GUIHelper.Focus("name"); EditorGUILayout.Space(); EditorGUILayout.SelectableLabel(string.Format("Quest Unique ID: {0}", quest.GetId())); // Set label properties for quest states header. GUILayout.BeginHorizontal(); if (EditorGUIUtility.isProSkin) { GUIHelper.labelStyle.normal.textColor = Color.white; } GUIHelper.labelStyle.alignment = TextAnchor.MiddleLeft; GUILayout.Label("Quest states:", GUIHelper.labelStyle); GUILayout.EndHorizontal(); GUIHelper.Separator(); // Loop of the quest states. foreach (var questState in quest.questStates) { GUILayout.BeginHorizontal(); var index = ArrayHelper.GetIndex(quest.questStates, questState); GUILayout.Label(string.Format("{0}.", (index + 1).ToString()), GUILayout.Width(25)); // Descriptions. EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField("Short description:"); var questStateShortDescription = DictionariesHelper.ContainsKey(questState.ShortDescription, Controller.Instance.Options.currentLanguage); if (questStateShortDescription == null) { questState.ShortDescription = ArrayHelper.Add(questState.ShortDescription, new LanguageDictionary(Controller.Instance.Options.currentLanguage, "")); } DictionariesHelper.ContainsKey(questState.ShortDescription, Controller.Instance.Options.currentLanguage).value = EditorGUILayout.TextArea(DictionariesHelper .ContainsKey(questState.ShortDescription, Controller.Instance.Options.currentLanguage).value); EditorGUILayout.Space(); EditorGUILayout.LabelField("Long description:"); var questStateLongDescription = DictionariesHelper.ContainsKey(questState.LongDescription, Controller.Instance.Options.currentLanguage); if (questStateLongDescription == null) { questState.LongDescription = ArrayHelper.Add(questState.LongDescription, new LanguageDictionary(Controller.Instance.Options.currentLanguage, "")); } DictionariesHelper.ContainsKey(questState.LongDescription, Controller.Instance.Options.currentLanguage).value = EditorGUILayout.TextArea(DictionariesHelper .ContainsKey(questState.LongDescription, Controller.Instance.Options.currentLanguage).value); EditorGUILayout.Space(); EditorGUILayout.SelectableLabel(string.Format("Quest State Unique ID: {0}", questState.GetId())); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Up", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { if (index > 0) { quest.questStates = ArrayHelper.Swap(quest.questStates, index, index - 1); QuestsController.Save(Controller.Instance.Quests, Controller.Instance.Options.jsonPrettyPrint); } } if (GUILayout.Button("Down", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { if (index < quest.questStates.Length - 1) { quest.questStates = ArrayHelper.Swap(quest.questStates, index, index + 1); QuestsController.Save(Controller.Instance.Quests, Controller.Instance.Options.jsonPrettyPrint); } } if (GUILayout.Button("Delete", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { if (EditorUtility.DisplayDialog("Are you sure?", "Do you really want to delete?\nThis data will be lost forever.", "Yes", "No")) { quest.questStates = ArrayHelper.Remove(quest.questStates, questState); QuestsController.Save(Controller.Instance.Quests, Controller.Instance.Options.jsonPrettyPrint); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); GUIHelper.Separator(); } // Buttons. EditorGUILayout.Space(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add quest state", GUILayout.Width(position.width / 2), GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { quest.AddState("Short description.", "Long description."); Save(); } GUILayout.EndHorizontal(); EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save and close", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Save(); Close(); } GUILayout.EndHorizontal(); // Save and close on press Enter. if (focusedWindow != null) { if (focusedWindow.ToString() == "(Diplomata.Editor.Windows.QuestEditor)") { if (Event.current.keyCode == KeyCode.Return) { Save(); Close(); } } } break; } GUILayout.EndVertical(); EditorGUILayout.EndScrollView(); }
public void DrawEditWindow() { var name = DictionariesHelper.ContainsKey(item.name, Controller.Instance.Options.currentLanguage); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Name: "); name.value = EditorGUILayout.TextField(name.value); EditorGUILayout.Separator(); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Category: "); EditorGUI.BeginChangeCheck(); var category = item.Category; category = EditorGUILayout.TextField(category); if (EditorGUI.EndChangeCheck()) { item.Category = category; } EditorGUILayout.Separator(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); var description = DictionariesHelper.ContainsKey(item.description, Controller.Instance.Options.currentLanguage); if (description == null) { item.description = ArrayHelper.Add(item.description, new LanguageDictionary(Controller.Instance.Options.currentLanguage, "")); description = DictionariesHelper.ContainsKey(item.description, Controller.Instance.Options.currentLanguage); } GUIHelper.textContent.text = description.value; var descriptionHeight = GUIHelper.textAreaStyle.CalcHeight(GUIHelper.textContent, position.width - 2 * GUIHelper.MARGIN); GUILayout.Label("Description: "); description.value = EditorGUILayout.TextArea(description.value, GUIHelper.textAreaStyle, GUILayout.Height(descriptionHeight)); EditorGUILayout.Separator(); item.image = (Texture2D)Resources.Load(item.imagePath); if (item.image == null && item.imagePath != string.Empty) { Debug.LogWarning(string.Format("Cannot find the file \"{0}\" in Resources folder.", item.imagePath)); } item.highlightImage = (Texture2D)Resources.Load(item.highlightImagePath); if (item.highlightImage == null && item.highlightImagePath != string.Empty) { Debug.LogWarning("Cannot find the file \"" + item.highlightImagePath + "\" in Resources folder."); } item.pressedImage = (Texture2D)Resources.Load(item.pressedImagePath); // if (item.pressedImage == null && item.pressedImagePath != string.Empty) // { // Debug.LogWarning("Cannot find the file \"" + item.pressedImagePath + "\" in Resources folder."); // } item.disabledImage = (Texture2D)Resources.Load(item.disabledImagePath); // if (item.disabledImage == null && item.disabledImagePath != string.Empty) // { // Debug.LogWarning("Cannot find the file \"" + item.disabledImagePath + "\" in Resources folder."); // } GUILayout.Label("Image: "); EditorGUI.BeginChangeCheck(); item.image = (Texture2D)EditorGUILayout.ObjectField(item.image, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { item.imagePath = FilenameExtract(item.image); } GUILayout.Label("Highlighted Image: "); EditorGUI.BeginChangeCheck(); item.highlightImage = (Texture2D)EditorGUILayout.ObjectField(item.highlightImage, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { item.highlightImagePath = FilenameExtract(item.highlightImage); } GUILayout.Label("Pressed Image: "); EditorGUI.BeginChangeCheck(); item.pressedImage = (Texture2D)EditorGUILayout.ObjectField(item.pressedImage, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { item.pressedImagePath = FilenameExtract(item.pressedImage); } GUILayout.Label("Disabled Image: "); EditorGUI.BeginChangeCheck(); item.disabledImage = (Texture2D)EditorGUILayout.ObjectField(item.disabledImage, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { item.disabledImagePath = FilenameExtract(item.disabledImage); } EditorGUILayout.Separator(); EditorGUILayout.HelpBox("\nMake sure to store all textures in Resources folder.\n", MessageType.Info); EditorGUILayout.Separator(); if (GUILayout.Button("Save and Close", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Save(); Close(); } }
/// <summary> /// Get the item name. /// </summary> /// <returns>The name in the setted language.</returns> public string GetName(string language) { return(DictionariesHelper.ContainsKey(name, language).value); }
/// <summary> /// Get the item name. /// </summary> /// <returns>The name in the current language.</returns> public string GetName() { return(DictionariesHelper.ContainsKey(name, DiplomataManager.Data.options.currentLanguage).value); }
public void OnGUI() { GUIHelper.Init(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); GUILayout.BeginVertical(GUIHelper.windowStyle); // If empty show this message. if (Controller.Instance.Quests.Length <= 0) { EditorGUILayout.HelpBox("No quests yet.", MessageType.Info); } // Quests loop to list. foreach (Quest quest in Controller.Instance.Quests) { GUILayout.BeginHorizontal(); // Set label properties. GUILayout.BeginHorizontal(); if (EditorGUIUtility.isProSkin) { GUIHelper.labelStyle.normal.textColor = Color.white; } GUIHelper.labelStyle.alignment = TextAnchor.MiddleLeft; var questName = DictionariesHelper.ContainsKey(quest.Name, Controller.Instance.Options.currentLanguage); if (questName != null) { GUILayout.Label(questName.value, GUIHelper.labelStyle); } GUILayout.EndHorizontal(); GUILayout.Space(10.0f); // Setting buttons. GUILayout.BeginHorizontal(GUILayout.MaxWidth(position.width / 2)); if (GUILayout.Button("Edit", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { QuestEditor.Open(quest); } if (GUILayout.Button("Delete", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { if (EditorUtility.DisplayDialog("Are you sure?", "Do you really want to delete?\nThis data will be lost forever.", "Yes", "No")) { QuestEditor.Init(QuestEditor.State.Close); Controller.Instance.Quests = ArrayHelper.Remove(Controller.Instance.Quests, quest); QuestsController.Save(Controller.Instance.Quests, Controller.Instance.Options.jsonPrettyPrint); } } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); } // Add button. if (GUILayout.Button("Add Quest", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { var quest = new Quest(); Controller.Instance.Quests = ArrayHelper.Add(Controller.Instance.Quests, quest); quest.questStates = ArrayHelper.Add(quest.questStates, new QuestState()); foreach (var language in Controller.Instance.Options.languagesList) { quest.questStates[0].ShortDescription = ArrayHelper.Add(quest.questStates[0].ShortDescription, new LanguageDictionary(language, "in progress.")); quest.questStates[0].LongDescription = ArrayHelper.Add(quest.questStates[0].LongDescription, new LanguageDictionary(language, "")); } QuestsController.Save(Controller.Instance.Quests, Controller.Instance.Options.jsonPrettyPrint); QuestEditor.Open(quest); } GUILayout.EndVertical(); EditorGUILayout.EndScrollView(); }
public void OnGUI() { GUIHelper.Init(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); GUILayout.BeginVertical(GUIHelper.windowStyle); if (Controller.Instance.Inventory.items.Length <= 0) { EditorGUILayout.HelpBox("No items yet.", MessageType.Info); } foreach (var item in Controller.Instance.Inventory.items) { if (item.SetId()) { InventoryController.Save(Controller.Instance.Inventory, Controller.Instance.Options.jsonPrettyPrint); } GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal(); var name = DictionariesHelper.ContainsKey(item.name, Controller.Instance.Options.currentLanguage); if (EditorGUIUtility.isProSkin) { GUIHelper.labelStyle.normal.textColor = Color.white; } GUIHelper.labelStyle.alignment = TextAnchor.MiddleLeft; if (name != null) { var nameLabel = name.value; if (!string.IsNullOrEmpty(item.Category)) { nameLabel += string.Format(" [{0}]", item.Category); } GUILayout.Label(nameLabel, GUIHelper.labelStyle); } else { GUILayout.Label("(!) Name not found (!)", GUIHelper.labelStyle); } GUIHelper.labelStyle.alignment = TextAnchor.MiddleRight; GUIHelper.labelStyle.normal.textColor = GUIHelper.grey; GUILayout.Label("id: " + item.id, GUIHelper.labelStyle); GUIHelper.labelStyle.normal.textColor = Color.black; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(GUILayout.MaxWidth(position.width / 2)); if (GUILayout.Button("Edit", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { ItemEditor.OpenEdit(item); } if (GUILayout.Button("Delete", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) { if (EditorUtility.DisplayDialog("Are you sure?", "Do you really want to delete?\nThis data will be lost forever.", "Yes", "No")) { ItemEditor.Init(ItemEditor.State.Close); Controller.Instance.Inventory.items = ArrayHelper.Remove(Controller.Instance.Inventory.items, item); Controller.Instance.Inventory.RemoveNotUsedCategory(); InventoryController.Save(Controller.Instance.Inventory, Controller.Instance.Options.jsonPrettyPrint); } } // if (GUILayout.Button("Duplicate", GUILayout.Height(GUIHelper.BUTTON_HEIGHT_SMALL))) // { // Controller.Instance.Inventory.items = ArrayHelper.Add(Controller.Instance.Inventory.items, item.Copy(Controller.Instance.Inventory.GenerateId(), Controller.Instance.Options)); // InventoryController.Save(Controller.Instance.Inventory, Controller.Instance.Options.jsonPrettyPrint); // } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); } EditorGUILayout.Separator(); if (GUILayout.Button("Create", GUILayout.Height(GUIHelper.BUTTON_HEIGHT))) { Controller.Instance.Inventory.items = ArrayHelper.Add(Controller.Instance.Inventory.items, new Item(Controller.Instance.Inventory.GenerateId(), Controller.Instance.Options)); InventoryController.Save(Controller.Instance.Inventory, Controller.Instance.Options.jsonPrettyPrint); } GUILayout.EndVertical(); EditorGUILayout.EndScrollView(); }
private static RTFDocument AddTalkable(RTFDocument document, Talkable character, Options options) { RTFTextStyle style = new RTFTextStyle(false, false, 12, "Courier", Color.black); RTFTextStyle styleAllcaps = new RTFTextStyle(false, false, false, false, true, false, 12, "Courier", Color.black, Underline.None); RTFParagraphStyle noIndent = new RTFParagraphStyle(Alignment.Left, new Indent(0, 0, 0), 0, 400); RTFParagraphStyle messageContentIndent = new RTFParagraphStyle(Alignment.Left, new Indent(0, 2.54f, 0), 0, 400); var presentation = document.AppendParagraph(noIndent); presentation.AppendText(character.name, styleAllcaps); var characterDescription = DictionariesHelper.ContainsKey(character.description, options.currentLanguage); var text = string.Empty; text = ", " + characterDescription.value; if (text[text.Length - 1] != '.') { text += "."; } presentation.AppendText(text, style); for (var i = 0; i < character.contexts.Length; i++) { var context = character.contexts[i]; var contextPar = document.AppendParagraph(noIndent); var name = DictionariesHelper.ContainsKey(context.name, options.currentLanguage); contextPar.AppendText(string.Format("CTX {0}\n", i), styleAllcaps); contextPar.AppendText(name.value, style); foreach (var column in context.columns) { for (var j = 0; j < column.messages.Length; j++) { var messagePar = document.AppendParagraph(messageContentIndent); messagePar.AppendText("\t\t" + column.emitter + "\n", styleAllcaps); var screenplayNotes = DictionariesHelper.ContainsKey(column.messages[j].screenplayNotes, options.currentLanguage); if (screenplayNotes != null) { if (screenplayNotes.value != "") { messagePar.AppendText("\t(" + screenplayNotes.value + ")\n", style); } } var content = DictionariesHelper.ContainsKey(column.messages[j].content, options.currentLanguage); if (column.messages.Length > 1) { messagePar.AppendText("(" + j + "): " + content.value, style); } else { messagePar.AppendText(content.value, style); } } } } return(document); }
/// <summary> /// Get the item description. /// </summary> /// <returns>The description in the current language.</returns> public string GetDescription() { return(DictionariesHelper.ContainsKey(description, DiplomataManager.Data.options.currentLanguage).value); }
/// <summary> /// Get the item description. /// </summary> /// <returns>The description in the setted language.</returns> public string GetDescription(string language) { return(DictionariesHelper.ContainsKey(description, language).value); }