//! //! @brief テキスト入力の表示 //! public string Text(string previous, Attribute.LabelAttribute attr = null) { if (attr != null) { return(EditorGUILayout.TextField(label: attr.label, text: previous)); } else { return(EditorGUILayout.TextField(text: previous)); } }
//! //! @brief ラベルの表示 //! public void Label(Attribute.LabelAttribute attr) { if (attr.isFoldable) { var status = getFoldStatus(attr); status = EditorGUILayout.Foldout(status, attr.label); setFoldStatus(attr, status); } else { EditorGUILayout.LabelField(attr.label); } }
//! //! @brief FoldStatusを返す //! public bool getFoldStatus(Attribute.LabelAttribute attr) { if (!attr.isFoldable) { return(true); } var defaultValue = false; var key = attr.GetHashCode(); var status = defaultValue; if (foldStatus.ContainsKey(key)) { status = foldStatus[key]; } else { foldStatus[key] = status; } return(status); }
//! //! @brief カラー //! @brief "@"マークで予約語回避してるよ! //! public Color @Color(Color previous, Attribute.LabelAttribute labelAttr = null, Attribute.PresetAttribute presetAttr = null) { Color tmp = default; // Color Field表示 if (labelAttr != null) { tmp = EditorGUILayout.ColorField(label: labelAttr.label, value: previous); } else { tmp = EditorGUILayout.ColorField(previous); } if (presetAttr != null) { var preset = ScriptableObject.ColorPreset.Load(presetAttr.assetName); var rect = EditorGUILayout.GetControlRect(); var width = 40; var height = 20; var offset = 150; preset.colors.Select((c, i) => new { color = c, index = i }).ToList().ForEach((pair) => { EditorGUI.DrawRect(new Rect(rect.x + offset + width * pair.index, rect.y, width, height), pair.color); var selected = GUI.Button(new Rect(rect.x + offset + width * pair.index, rect.y + height, width, height), "選択"); if (selected) { tmp = pair.color; } }); GUILayout.Space(40); } return(tmp); }
//! //! @brief FoldStatusを設定 //! public void setFoldStatus(Attribute.LabelAttribute attr, bool status) { var key = attr.GetHashCode(); foldStatus[key] = status; }
//! //! @brief bool //! public bool Bool(bool previous, Attribute.LabelAttribute attr) { return(EditorGUILayout.Toggle(label: attr.label, value: previous)); }
//! //! @brief float //! public float Float(float previous, Attribute.LabelAttribute attr) { return(EditorGUILayout.FloatField(label: attr.label, value: previous)); }
//! //! @brief int //! public int Integer(int previous, Attribute.LabelAttribute attr) { return(EditorGUILayout.IntField(label: attr.label, value: previous)); }
public Vector4 Vector(Vector4 previous, Attribute.LabelAttribute attr) { return(EditorGUILayout.Vector4Field(label: attr.label, value: previous)); }