Ejemplo n.º 1
0
        protected HullEditorPanel(int x, int y, int width, int height, string defaultCurveConfiguration, PanelAlias panelType)
        {
            BoundingBox = new FloatingRectangle(x, y, width, height);
            PanelRenderTarget = new RenderPanel(x, y, width, height, DepthLevel.Medium);
            RenderPanel.BindRenderTarget(PanelRenderTarget);

            Curves = new BezierCurveCollection(
                defaultConfig: defaultCurveConfiguration,
                areaToFill: new FloatingRectangle(
                    x + width*0.1f,
                    y + height*0.1f,
                    width - width*0.2f,
                    height - height*0.2f
                    ),
                panelType: panelType
                );
            UIElementCollection.Collection.AddDragConstraintCallback(ClampChildElements);
            Background =
                new Button(
                    x: x,
                    y: y,
                    width: width,
                    height: height,
                    depth: DepthLevel.Background,
                    textureName: "HullEditorBgTex",
                    spriteTexRepeatX: width/(Curves.PixelsPerMeter*1),
                    spriteTexRepeatY: height/(Curves.PixelsPerMeter*1),
                    components: new IUIComponent[]{new PanelComponent()}
                    );
            Update();
        }
Ejemplo n.º 2
0
 public void SetReflectionType(PanelAlias panelType, HandleMovementRestriction restrictionType, bool hasInternalSymmetry = false)
 {
     _internalSymmetry = hasInternalSymmetry;
     switch (panelType){
         case PanelAlias.Side:
             _rotRestriction = restrictionType; //vert
             _reflectionX = 0;
             _reflectionY = 1;
             _dontTranslateHandles = true;
             _clampByNeighbors = SideNeighborClamp;
             break;
         case PanelAlias.Top:
             _rotRestriction = restrictionType; //vert
             _reflectionX = 1;
             _reflectionY = -1;
             _dontTranslateHandles = false;
             _clampByNeighbors = TopNeighborClamp;
             if (hasInternalSymmetry){
                 _reflectionX = 0;
             }
             break;
         case PanelAlias.Back:
             _rotRestriction = restrictionType; //vert
             _reflectionX = -1;
             _reflectionY = 1;
             _dontTranslateHandles = false;
             _clampByNeighbors = BackNeighborClamp;
             if (hasInternalSymmetry){
                 _reflectionY = 0;
             }
             break;
     }
 }