Ejemplo n.º 1
0
        private void DrawRange(int index, RangeConfig config, Color color)
        {
            HandlesDrawer.H.PushAndSetColor(color);
            HandlesDrawer.H.fillColor = true;
            switch (config.value)
            {
            case RangeConfig.RectItem v:
                HandlesDrawer.H.DrawRect(v.size, Matrix4x4.Translate(v.offset));
                break;

            case RangeConfig.CircleItem v:
                HandlesDrawer.H.DrawCircle(v.radius, Matrix4x4.Translate(v.offset));
                break;

            case RangeConfig.BoxItem v:
                HandlesDrawer.H.DrawBox(v.size, Matrix4x4.Translate(v.offset));
                break;

            case RangeConfig.SphereItem v:
                HandlesDrawer.H.DrawSphere(v.radius, Matrix4x4.Translate(v.offset));
                break;
            }
            HandlesDrawer.H.fillColor = false;
            HandlesDrawer.H.PopColor();
        }
Ejemplo n.º 2
0
        public static void RangeConfigDrawer(int index, ref bool selected, RangeConfig obj)
        {
            if (GUILayout.Button($"{index}", selected ? AEStyles.item_head_select : AEStyles.item_head_normal, GUILayout.ExpandHeight(true), GUILayout.Width(15)))
            {
                GUI.FocusControl(null);
                selected = !selected;
            }

            EditorGUILayoutEx.DrawObject(GUIContent.none, obj);
        }
Ejemplo n.º 3
0
        private void ProcessRanges(List <RangeConfig> ranges, Matrix4x4 localToWorld, bool enableControl, int selectIndex, Color color)
        {
            Matrix4x4 localToWorldNoScale = Matrix4x4.TRS(localToWorld.MultiplyPoint3x4(Vector3.zero), localToWorld.rotation, Vector3.one);

            Matrix4x4 oldMat = Handles.matrix;

            Handles.matrix = localToWorldNoScale;

            int length = ranges.Count;

            for (int i = 0; i < length; i++)
            {
                RangeConfig config = ranges[i];
                DrawRange(i, config, color);

                if (enableControl && (win.setting.enableAllControl || (selectIndex == i)))
                {
                    ControlRange(i, config.value);
                }
            }

            Handles.matrix = oldMat;
        }
Ejemplo n.º 4
0
 public RangeConfig(RangeConfig config)
 {
     this.value = config.value.Clone();
 }