Пример #1
0
    // 1.
    void display0()
    {
        ClearAllChange();
        string[] xTimes  = new string[] { "Jan. 2021", "Feb. 2021", "Mar. 2021", "Apr. 2021", "May 2021" };
        string[] xSpaces = new string[] { "ESTIA1", "ESTIA2", "ESTIA3", "ESTIA4", "ESTIA5", "ESTIA6" };

        sbyte[] yData       = new sbyte[] { 12, 18, 25, 10, 20 };
        string  xAxisLegend = "<size=7><line-height=60>";

        for (int i = 0; i < xTimes.Length; i++)
        {
            xAxisLegend += xTimes[i] + "\n";
        }
        string yAxisLegend = "<size=7>";

        for (int i = 0; i < xSpaces.Length; i++)
        {
            yAxisLegend += xSpaces[i] + "<space=38>";
        }

        for (int i = 0; i < expanDialSticks.NbRows; i++)
        {
            for (int j = 0; j < expanDialSticks.NbColumns; j++)
            {
                int   datum = UnityEngine.Random.Range(0, 40);
                float coeff = datum / 40f;
                expanDialSticks[i, j].TargetText  = "<b>" + datum + " MWh</b>";
                expanDialSticks[i, j].TargetColor = new Color(1f - coeff, 1f - coeff, 1f);
                expanDialSticks[i, j].TargetTextureChangeDuration = 1f;

                expanDialSticks[i, j].TargetPosition            = (sbyte)datum;
                expanDialSticks[i, j].TargetShapeChangeDuration = 1f;
            }
        }
        expanDialSticks.triggerTextureChange();
        expanDialSticks.triggerShapeChange();

        /*string legend = "<line-height=1em><voffset=-8><size=32><color=\"green\">•</voffset><size=8><color=\"black\">energy production\n"
         + "<voffset=-8><size=32><color=\"orange\">•</voffset><size=8><color=\"black\">energy storage\n"
         + "<voffset=-8><size=32><color=\"blue\">•</voffset><size=8><color=\"black\">energy consumption\n";*/

        /*string labels = "<size=7><pos=3%>Past month <pos=85%>Next month\n";
         * string direction = "<line-height=10><size=9>◄────────────────────────────────────────────►\n";
         * string titles = "<b><line-height=10><size=10><pos=0%>Data Type<pos=30%>Mode<pos=50%>Time Scale<pos=75%>Space Scale</b>\n";
         * string firstOption = "<line-height=7><size=7><pos=0%><color=#0000FFFF>■ <color=#000000FF>Energy Consumption<pos=30%><alpha=#FF>Time<pos=50%><alpha=#AA>Hours<pos=75%><alpha=#AA>Devices\n";
         * string secondOption = "<line-height=7><size=7><pos=0%><color=#FF9900AA>■ <color=#000000AA>Energy Storage<pos=30%><alpha=#AA>Space<pos=50%><alpha=#AA>Days<pos=75%><alpha=#AA>Rooms\n";
         * string thirdOption = "<line-height=7><size=7><pos=0%><color=#00FF00AA>■ <color=#000000AA>Energy Production<pos=50%><alpha=#FF>Months<pos=75%><alpha=#FF>Buildings ► ESTIA1\n";
         * string legend = labels + direction + titles +  firstOption + secondOption + thirdOption;*/
        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, 16, Color.black, xAxisLegend, new Vector3(90f, -90f, 0f));
        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 8, Color.black, yAxisLegend, new Vector3(90f, -90f, 0f));
        //expanDialSticks.setRightBorderText(TextAlignmentOptions.Center, 16, Color.black, legend, new Vector3(90f, 90f, 0f));
    }
    private void HandleConnected(object sender, MqttConnectionEventArgs e)
    {
        Debug.Log("ExpanDialSticks connected.");
        connected = true;

        // Display Next Input
        string nextInput;

        while (!inputs.TryPeek(out nextInput))
        {
            ;
        }
        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 8, Color.black, nextInput, new Vector3(90f, -90f, 0f));

        //coroutine = UserScenario();
        //StartCoroutine(coroutine);
    }
Пример #3
0
    void GaugeInit(float duration)
    {
        Vector2 gaugePosition = gaugePositions[gaugeIndex];

        for (int i = 0; i < expanDialSticks.NbRows; i++)
        {
            for (int j = 0; j < expanDialSticks.NbColumns; j++)
            {
                expanDialSticks.modelMatrix[i, j].TargetColor = Color.white;                 //Color.green;
                if (i == (int)gaugePosition.x && j == (int)gaugePosition.y)
                {
                    expanDialSticks.modelMatrix[i, j].TargetPlaneTexture  = "LightCadran";
                    expanDialSticks.modelMatrix[i, j].TargetPlaneRotation = cadranRotation;
                    expanDialSticks.modelMatrix[i, j].TargetPlaneSize     = 0.6f;
                    expanDialSticks.modelMatrix[i, j].TargetPlaneColor    = Color.red;

                    expanDialSticks.modelMatrix[i, j].TargetProjectorTexture  = "aiguille";
                    expanDialSticks.modelMatrix[i, j].TargetProjectorRotation = aiguilleRotation;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorSize     = 2f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorColor    = Color.black;
                }

                else
                {
                    expanDialSticks.modelMatrix[i, j].TargetPlaneTexture  = "default";
                    expanDialSticks.modelMatrix[i, j].TargetPlaneRotation = cadranRotation;
                    expanDialSticks.modelMatrix[i, j].TargetPlaneSize     = 0f;
                    expanDialSticks.modelMatrix[i, j].TargetPlaneColor    = Color.white;

                    expanDialSticks.modelMatrix[i, j].TargetProjectorTexture  = "projector";
                    expanDialSticks.modelMatrix[i, j].TargetProjectorRotation = aiguilleRotation;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorSize     = 0f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorColor    = Color.white;
                }

                expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration   = duration;
                expanDialSticks.modelMatrix[i, j].TargetProjectorChangeDuration = duration;
            }
        }
        string participantNumber = "<pos=0%><b>P" + numeroParticipant + "</b>";
        string trialProgress     = "<pos=90%><b>" + (gaugeIndex + 1) + "/" + gaugePositions.Length + "</b>";
        string legend            = participantNumber + trialProgress;

        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 16, Color.black, legend, new Vector3(90f, -90f, 0f));
        expanDialSticks.setBorderBackground(Color.white);
        expanDialSticks.triggerTextureChange();
    }
Пример #4
0
    void MoleGreen(float duration)
    {
        Vector2 molePosition = molePositions[moleIndex];

        for (int i = 0; i < expanDialSticks.NbRows; i++)
        {
            for (int j = 0; j < expanDialSticks.NbColumns; j++)
            {
                if (i == (int)molePosition.x && j == (int)molePosition.y)
                {
                    expanDialSticks.modelMatrix[i, j].TargetColor = Color.white;                     //Color.green;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontTexture  = "dot";
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontRotation = 0f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontSize     = 2f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontColor    = Color.black;
                }
                else
                {
                    expanDialSticks.modelMatrix[i, j].TargetColor = Color.white;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontTexture  = "projector";
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontRotation = 0f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontSize     = 0f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontColor    = Color.white;
                }
                expanDialSticks.modelMatrix[i, j].TargetProjectorFrontChangeDuration = duration;
                expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration        = duration;
            }
        }
        string participantNumber = "<pos=0%><b>P" + numeroParticipant + "</b>";
        string trialProgress     = "<pos=90%><b>" + (moleIndex + 1) + "/" + molePositions.Length + "</b>";
        string legend            = participantNumber + trialProgress;

        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 16, Color.black, legend, new Vector3(90f, -90f, 0f));
        expanDialSticks.setBorderBackground(Color.white);
        expanDialSticks.triggerTextureChange();
    }
Пример #5
0
 private void DebugInSitu(string message, Color textColor, Color backgroundColor)
 {
     expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 16, textColor, message, new Vector3(90f, -90f, 0f));
     expanDialSticks.setBorderBackground(backgroundColor);
     expanDialSticks.triggerTextureChange();
 }
Пример #6
0
    public void LegendFromLabels()
    {
        string xLegendFirst  = "<line-height=6><size=4>";
        string xLegendSecond = "<line-height=8><size=6>";
        string xLegendThird  = "<line-height=10><size=8>";

        for (int i = 0; i < dataSet.xLabels.Length; i++)
        {
            string   xLabel    = dataSet.xLabels[i];
            string[] subLabels = xLabel.Split('\n');
            int      pos       = (int)((i / (float)dataSet.xLabels.Length) * 100f);
            switch (subLabels.Length)
            {
            case 1:
                xLegendThird += "<pos=" + pos + "%>" + subLabels[0];
                break;

            case 2:
                xLegendThird  += "<pos=" + pos + "%>" + subLabels[1];
                xLegendSecond += "<pos=" + pos + "%>" + subLabels[0];
                break;

            case 3:
                xLegendThird  += "<pos=" + pos + "%>" + subLabels[2];
                xLegendSecond += "<pos=" + pos + "%>" + subLabels[1];
                xLegendFirst  += "<pos=" + pos + "%>" + subLabels[0];
                break;

            default:
                xLegendThird += "<pos=" + pos + "%>" + subLabels[0];
                break;
            }
        }
        string xLegend = "";

        if (xLegendFirst != "<line-height=6><size=4>")
        {
            xLegend += xLegendFirst + "\n";
        }
        if (xLegendSecond != "<line-height=8><size=6>")
        {
            xLegend += xLegendSecond + "\n";
        }
        if (xLegendThird != "<line-height=10><size=8>")
        {
            xLegend += xLegendThird + "\n";
        }


        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 16, Color.black, xLegend, new Vector3(90f, -90f, 0f));

        string yLegend = "";

        for (int i = 0; i < dataSet.yLabels.Length; i++)
        {
            string   yLabel    = dataSet.yLabels[i];
            string[] subLabels = yLabel.Split('\n');
            switch (subLabels.Length)
            {
            case 1:
                yLegend += "<line-height=10><size=8>" + subLabels[0] + "<line-height=60>\n";
                break;

            case 2:
                yLegend += "<line-height=8><size=6>" + subLabels[0] + "\n";
                yLegend += "<line-height=10><size=8>" + subLabels[1] + "\n";
                yLegend += "<line-height=42>\n";
                break;

            case 3:
                yLegend += "<line-height=6><size=4>" + subLabels[0] + "\n";
                yLegend += "<line-height=8><size=6>" + subLabels[1] + "\n";
                yLegend += "<line-height=10><size=8>" + subLabels[2] + "\n";
                yLegend += "<line-height=36>\n";
                break;

            default:
                yLegend += "<line-height=10>" + subLabels[0] + "<line-height=60>\n";
                break;
            }
        }
        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, 16, Color.black, yLegend, new Vector3(90f, -90f, 0f));
    }