Ejemplo n.º 1
0
    public string Arrange(float passedZOffset, string lastLetter = "", Nullable <HandSide> grabbedSide = null)
    {
        layers += 1;
        var           yOffset       = -0.2f;
        var           xOffset       = 0f;
        var           zOffset       = layers * (0.06f + (0.12f / (layers + 1)));
        var           z             = -1f + zOffset;
        LayerContents layerContents = layerCreator.NextLayer(lastLetter);
        List <Letter> layerLetters  = layerContents.letters;
        var           suggestions   = layerContents.suggestions;

        var logicalLettersLayout = layoutPlacer.PlaceInRows(layerLetters);

        var   ySpacing   = 0.05f * logicalLettersLayout.yFactor;
        var   xSpacing   = 0.07f * logicalLettersLayout.xFactor;
        float sideOffset = CalculateSideOffset(grabbedSide);

        var xStart        = sideOffset - (xSpacing * logicalLettersLayout.slots) / 2;
        var yStart        = 0f;
        var yLayerOffset  = 0.025f;
        var yLayersOffset = yLayerOffset * layers;
        var x             = xStart + xOffset;
        var y             = yStart + yOffset + yLayersOffset;

        string placement = "placed: ";
        int    layer     = layers - 1;

        var index  = 0;
        var xIndex = 0;

        logicalLettersLayout.rows.ForEach((row) =>
        {
            row.ForEach((letter) =>
            {
                if (letter != Letter.SPACE)
                {
                    var knob   = knobs.Create(letter, x, y, z, layer);
                    placement += knob.Name + ", ";
                }
                x += xSpacing;
            });
            xIndex++;
            x  = xStart + xOffset;
            y -= ySpacing;
        });
        y = yOffset + yLayersOffset;
        suggestions.ForEach(suggestion =>
        {
            y += ySpacing;
            knobs.CreateSuggestion(suggestion, xStart, y, z, layer);
        });
        return(placement);
    }