public override void OnInspectorGUI() { Init(); serializedObject.Update(); GUI.changed = false; EditorGUILayout.PropertyField(m_M10NDB); if (GUI.changed) { MultiLangStringDatabase db = m_M10NDB.objectReferenceValue as MultiLangStringDatabase; if (db != null) { m_M10NIndex.intValue = db.IndexOfKey(m_M10NSelectedKey.stringValue); } StringTableEditorWindow.RepaintEditor(); } DoM10NStringReferenceGUI(); EditorGUILayout.PropertyField(m_FontData); AppearanceControlsGUI(); RaycastControlsGUI(); serializedObject.ApplyModifiedProperties(); }
private void DoM10NStringReferenceGUI() { MultiLangStringDatabase db = m_M10NDB.objectReferenceValue as MultiLangStringDatabase; //select the language you want to display EditorGUILayout.LabelField("Key", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); float vspace = EditorGUIUtility.standardVerticalSpacing; float lineH = EditorGUIUtility.singleLineHeight; GUILayoutUtility.GetRect(vspace, vspace, lineH, lineH); m_keyGUI.OnKeyGUI(db, m_M10NSelectedKey.stringValue); EditorGUILayout.EndHorizontal(); if (keyMissing) { EditorGUILayout.LabelField("Key was:" + m_M10NSelectedKey.stringValue); if (GUILayout.Button("Add key to current database")) { db.AddTextEntry(m_M10NSelectedKey.stringValue); m_M10NIndex.intValue = db.IndexOfKey(m_M10NSelectedKey.stringValue); EditorUtility.SetDirty(db); } } GUILayoutUtility.GetRect(vspace, vspace, lineH, lineH); EditorGUILayout.LabelField("Text", EditorStyles.boldLabel); if (db != null && !keyMissing) { EditorGUILayout.BeginHorizontal(); GUILayoutUtility.GetRect(vspace, vspace, lineH, lineH); GUILayout.TextArea(db.current.values[m_M10NIndex.intValue].text, GUILayout.Height(60)); //EditorGUILayout.LabelField(db.current.values[m_M10NIndex.intValue].text); EditorGUILayout.EndHorizontal(); } }