public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            RuleConfiguration obj      = property.objectReferenceValue as RuleConfiguration;
            float             center_y = position.y + position.height / 2f;
            float             center_x = position.x + position.width / 2f;

            GUIStyle style = new GUIStyle(EditorStyles.toolbarButton);

            style.stretchHeight = true;
            style.stretchWidth  = true;
            style.fixedHeight   = 0;
            style.fixedWidth    = 0;

            EditorGUI.BeginProperty(position, label, property);
            //draw hexagon blend tile orientation
            BlendTile tile       = obj.tile;
            Rect      point_rect = new Rect(0, 0, POINT_LENGTH, POINT_LENGTH);
            Rect      adj_rect   = new Rect(0, 0, OPTION_LENGTH, OPTION_LENGTH);

            for (int d = 0; d < 6; d++)
            {
                //calculate hexagon rect positions
                point_rect.x = center_x + point_center[d].x - (POINT_LENGTH / 2f);
                point_rect.y = center_y + point_center[d].y - (POINT_LENGTH / 2f);
                adj_rect.x   = center_x + option_center[d].x - (OPTION_LENGTH / 2f) + HORZ_OFFSET;
                adj_rect.y   = center_y + option_center[d].y - (OPTION_LENGTH / 2f) + VERT_OFFSET;
                //draw uninteractive toggle
                EditorGUI.Toggle(point_rect, tile.IsHighPoint(d), EditorStyles.radioButton);
                //draw adjacent blend option popup
                obj[d] = (AdjBlendOption)EditorGUI.EnumPopup(adj_rect, obj[d], style);
            }
            property.serializedObject.ApplyModifiedProperties();
            EditorGUI.EndProperty();
        }
示例#2
0
 public void Init()
 {
     config = ScriptableObject.CreateInstance <RuleConfiguration>();
     config.Init();
 }