private void DrawData(IniGroup group, IniData data) { string value = data.Value; EditorGUILayout.BeginHorizontal(); { if (data.OptionValues != null && data.OptionValues.Length > 0) { value = EGUILayout.StringPopup(new GUIContent(data.Key, data.Comment), data.Value, data.OptionValues); } else { value = EditorGUILayout.TextField(new GUIContent(data.Key, data.Comment), data.Value); } if (GUILayout.Button(Contents.DeleteContent, GUILayout.Width(20))) { deleteData = new DeleteData() { groupName = group.Name, dataKey = data.Key }; } } EditorGUILayout.EndHorizontal(); if (data.Value != value) { data.Value = value; } }
public override void OnInspectorGUI() { EGUILayout.DrawScript(target); ruler.Platform = EGUILayout.StringPopup("Platform", ruler.Platform, PlatformContents); ruler.MaxSize = EGUILayout.DrawPopup <int>("MaxSize", MaxSizeContents, MaxSizeValues, ruler.MaxSize); if (ruler.Platform == PlatformContents[0]) { ruler.Format = EGUILayout.DrawPopup <int>("Format", StandaloneFormatContents, StandaloneFormatValues, ruler.Format); } else if (ruler.Platform == PlatformContents[1]) { ruler.Format = EGUILayout.DrawPopup <int>("Format", AndroidFormatContents, AndroidFormatValues, ruler.Format); } else if (ruler.Platform == PlatformContents[2]) { ruler.Format = EGUILayout.DrawPopup <int>("Format", iPhoneFormatContents, iPhoneFormatValues, ruler.Format); } }
public override void OnGUI(Rect rect) { GUILayout.BeginArea(rect); { scrollPos = EditorGUILayout.BeginScrollView(scrollPos); { EGUI.BeginLabelWidth(60); { EditorGUILayout.LabelField(Contents.NewDataContent, EGUIStyles.MiddleCenterLabel); EditorGUILayout.Space(); string dataKey = newData.Key; dataKey = EditorGUILayout.TextField(Contents.DataNameContent, dataKey); if (newData.Key != dataKey) { newData.Key = dataKey; if (string.IsNullOrEmpty(dataKey)) { errorMessage = Contents.DataNameEmptyStr; } else { if ((group.AsDynamic()).dataDic.ContainsKey(newData.Key)) { errorMessage = Contents.DataNameRepeatStr; } else { errorMessage = null; } } } if (newData.OptionValues != null && newData.OptionValues.Length > 0) { newData.Value = EGUILayout.StringPopup(Contents.DataValueContent, newData.Value, newData.OptionValues); } else { newData.Value = EditorGUILayout.TextField(Contents.DataValueContent, newData.Value); } newData.Comment = EditorGUILayout.TextField(Contents.DataCommentContent, newData.Comment); optionValuesRList.DoLayoutList(); if (!string.IsNullOrEmpty(errorMessage)) { EditorGUILayout.HelpBox(errorMessage, MessageType.Error); } else { GUILayout.FlexibleSpace(); if (GUILayout.Button(Contents.SaveStr)) { newData.OptionValues = optionValues.ToArray(); group.AddData(newData.Key, newData.Value, newData.Comment, newData.OptionValues); onCreatedCallback?.Invoke(group.Name, newData.Key); editorWindow.Close(); } } } EGUI.EndLableWidth(); } EditorGUILayout.EndScrollView(); } GUILayout.EndArea(); }