[Serializable] publicstruct LocalizationStringParmPack { [CustomValueDrawer("DrawPreviewText")] public LocalizedString TextLoc; public LocalizationParamsManager.ParamValue[] ParmsArray; publicoverridestringToString() { returnthis.GetRawEnglishString(); }
#if UNITY_EDITOR
static GUIStyle m_previewStyle; static GUIStyle PreviewStyle { get { if (m_previewStyle == null) { m_previewStyle = new GUIStyle(EditorStyles.textArea); m_previewStyle.wordWrap = true; } return m_previewStyle; } }
// use hacky stuff to get selected new lockey staticstring s_wtfKey = string.Empty; staticbool s_hasChanged = false; LocalizedString DrawPreviewText(LocalizedString value, GUIContent label) { using (new EditorGUILayout.VerticalScope(UnityEditor.EditorStyles.helpBox)) { // draw lockey using (new EditorGUILayout.HorizontalScope()) { if (label != null) { EditorGUILayout.LabelField(label, GUILayout.Width(EditorGUIUtility.labelWidth)); }
// weird stuff happin in dropdown if (EditorGUILayout.DropdownButton(new GUIContent(value.mTerm), FocusType.Keyboard)) { var terms = LocalizationManager.GetTermsList(); var selector = new GenericSelector<string>("Select Term", terms); selector.EnableSingleClickToSelect(); selector.SelectionConfirmed += s => { if (s.Any()) { s_wtfKey = s.First(); // WEIRD STUFF HERE /* if I do LocalizedString next = new LocalizedString(s.First()); and return 'next' and the end of method, it just doesnt work!!! cuz the GenericSelector is actually a editor window, and */ s_hasChanged = true; } }; selector.ShowInPopup(); }