Ejemplo n.º 1
0
    public void SetUp()
    {
        var knobsGo = new GameObject();

        knobs = knobsGo.AddComponent <Knobs>();

        knobA = knobs.Create(A.Letter("a"), 0, 0, 0, 0);
        knobB = knobs.Create(A.Letter("b"), 1, 0, 0, 0);
        knobC = knobs.Create(A.Letter("c"), 2, 0, 0, 0);
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
0
    // this class managing physical layout, so should probs handle zoffset, just
    // know it's a new logical layer?
    public string Arrange(float zOffset)
    {
        layers += 1;
        var ySpacing = 0.06f;
        var xSpacing = 0.1f;
        var yOffset  = -1.45f;
        var xOffset  = 0f;
        var slots    = 6;
        var index    = 0;
        var xStart   = -(xSpacing * slots) / 2;
        var yStart   = -(ySpacing * slots) / 2;
        var x        = xStart + xOffset;
        var y        = yStart + yOffset;
        var xIndex   = 0;
        var z        = -1f + zOffset;

        string placement = "placed: ";

        letters.ForEach((letter) =>
        {
            xIndex = index % slots;
            if (xIndex == 0)
            {
                y -= ySpacing;
                x  = xStart + xOffset;
            }
            else
            {
                x += xSpacing;
            }
            index     += 1;
            var knob   = knobs.Create(letter, x, y, z);
            placement += knob.Name + ", ";
        });
        return(placement);
    }