private void ExpandedGUI(GameLanguageItem gameLanguageItem) { EditorGUILayout.BeginVertical(GUI.skin.box); createLabel("Flag Sprite", "", 7); EditorGUILayout.BeginHorizontal(EditorStyles.inspectorDefaultMargins); //Sprite gameLanguageItem.flag = EditorGUILayout.ObjectField("", gameLanguageItem.flag, typeof(Sprite), false, GUILayout.Width(65)) as Sprite; EditorGUILayout.EndHorizontal(); createLabel("Code: ", gameLanguageItem.gameLanguage.code, 7); createLabel("Name: ", gameLanguageItem.gameLanguage.name, 7); createLabel("Native Name: ", gameLanguageItem.gameLanguage.nativeName, 6.5f); EditorGUILayout.EndVertical(); }
private void AddLanguage(GameLanguage newGameLanguage) { // In first place check if the language is already present as a Game Language if (allLanguages.gameLanguagesList.Exists(x => x.gameLanguage.code == newGameLanguage.code)) { Debug.LogWarning(newGameLanguage.code + " " + newGameLanguage.name + " language is already present as a Game Language."); return; } // New game language added GameLanguageItem newLanguageItem = new GameLanguageItem(newGameLanguage); allLanguages.gameLanguagesList.Add(newLanguageItem); if (isExpanded.Length != allLanguages.gameLanguagesList.Count) { Array.Resize(ref isExpanded, allLanguages.gameLanguagesList.Count); } // Mark the object as changed, so the editor can save the changes EditorUtility.SetDirty(allLanguages); }