private NovelAssetElement CreateDataGUI(VisualElement root, NovelAsset asset) { var assetElem = new NovelAssetElement { text = $"Conversations ({asset.Conversations.Count})", value = false, }; var theme = EditorGUIUtility.isProSkin ? "Dark" : "Light"; assetElem.styleSheets.Add(Resources.Load <StyleSheet>($"{nameof(NovelAsset)}/Layout")); assetElem.styleSheets.Add(Resources.Load <StyleSheet>($"{nameof(NovelAsset)}/{theme}Theme")); foreach (var kv in asset.Conversations) { CreateConversationGUI(assetElem, asset, kv.Value); } root.Add(assetElem); return(assetElem); }
private ConversationElement CreateConversationGUI(VisualElement root, NovelAsset asset, ConversationRow conversation) { var contentElems = new List <ContentElement>(); var conversationElem = new ConversationElement { userData = contentElems, text = conversation.Id }; var languages = new List <string>(asset.Languages); var languagesPopup = new LanguagePopup("Language Id", languages, 0); languagesPopup.RegisterValueChangedCallback(OnChangeLanguage); conversationElem.Add(languagesPopup); foreach (var kv in conversation.Dialogues) { CreateDialogueGUI(conversationElem.Content, conversation, kv.Value, contentElems, languages[0]); } root.Add(conversationElem); return(conversationElem); }
private void OnEnable() { this.asset = this.target as NovelAsset; }