示例#1
0
        public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
        {
            rect.height = DrawUtils.LINE_HEIGHT;

            var rectHead  = new Rect(rect.x, rect.y, rect.width, rect.height);
            var rectMoney = DrawUtils.LineDown(rectHead);

            rectMoney.width /= 2;
            var rectRep  = new Rect(rectMoney.x + rectMoney.width, rectMoney.y, rectMoney.width, rect.height);
            var rectMood = DrawUtils.LineDown(rect, 2);

            EditorGUI.LabelField(rectHead, "Deltas:", new GUIStyle()
            {
                fontStyle = FontStyle.Bold
            });
            EditorGUI.indentLevel += 1;
            DrawUtils.DrawHeadValueInLine(rectMoney, "Money:", 70, property.FindPropertyRelative("moneyDelta"));
            DrawUtils.DrawHeadValueInLine(rectRep, "Rep:", 70, property.FindPropertyRelative("repDelta"));

            var moodHeads = System.Enum.GetNames(typeof(AuditoryType));
            var moodProps = DrawUtils.GetPreparedArray(property.FindPropertyRelative("moodsDeltas"), moodHeads.Length);

            DrawUtils.DrawArray(rectMood, moodHeads, 60, moodProps, inLine: true);
            EditorGUI.indentLevel -= 1;

            EditorUtility.SetDirty(property.serializedObject.targetObject);
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.LabelField("Recognized type: " + Auditory.Type.ToString());
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Opinions on news types:");

            var newsTypesHeads = System.Enum.GetNames(typeof(NewsType));
            var newsTypesProps = DrawUtils.GetPreparedArray(serializedObject.FindProperty("opinionsNewsTypes"), newsTypesHeads.Length);

            for (var i = 0; i < newsTypesProps.Count; i++)
            {
                EditorGUILayout.PropertyField(newsTypesProps[i], new GUIContent(newsTypesHeads[i]), true);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Dynamic opinions on news params:");

            EditorGUI.BeginDisabledGroup(true);
            var newsParamsHeads = System.Enum.GetNames(typeof(NewsParamType));
            var newsParamsProps = DrawUtils.GetPreparedArray(serializedObject.FindProperty("opinionsNewsParams"), newsParamsHeads.Length);

            for (var i = 0; i < newsParamsProps.Count; i++)
            {
                EditorGUILayout.PropertyField(newsParamsProps[i], new GUIContent(newsParamsHeads[i]), true);
            }
            EditorGUI.EndDisabledGroup();

            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(serializedObject.targetObject);
        }
示例#3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.BeginHorizontal();
            Task.successesCount = EditorGUILayout.IntPopup(Task.successesCount, new string[] { "1 success", "2 successes" }, new int[] { 1, 2 }, GUILayout.MaxWidth(100));
            Task.isReversed     = EditorGUILayout.ToggleLeft("Reversed", Task.isReversed, GUILayout.MaxWidth(100));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            Task.withRating = EditorGUILayout.ToggleLeft("Min Rating", Task.withRating, GUILayout.MaxWidth(100));
            if (Task.withRating)
            {
                Task.minRating = (NewsRating)EditorGUILayout.EnumPopup(Task.minRating);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            Task.withType = EditorGUILayout.ToggleLeft("Require Type", Task.withType, GUILayout.MaxWidth(100));
            if (Task.withType)
            {
                Task.newsType = (NewsType)EditorGUILayout.EnumPopup(Task.newsType);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            Task.withIdea = EditorGUILayout.ToggleLeft("Require Idea", Task.withIdea, GUILayout.MaxWidth(100));
            if (Task.withIdea)
            {
                Task.idea = (Idea)EditorGUILayout.EnumPopup(Task.idea);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            Task.withInterests = EditorGUILayout.ToggleLeft("Min Interests", Task.withInterests, GUILayout.MaxWidth(100));
            if (Task.withInterests)
            {
                var interestsHeads = System.Enum.GetNames(typeof(AuditoryType));
                var interestsProps = DrawUtils.GetPreparedArray(serializedObject.FindProperty("minInterests"), interestsHeads.Length);
                EditorGUILayout.BeginVertical();
                for (var i = 0; i < interestsProps.Count; i++)
                {
                    EditorGUILayout.PropertyField(interestsProps[i], new GUIContent(interestsHeads[i]), true);
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(serializedObject.targetObject);
        }