Beispiel #1
0
    private IEnumerator Start()
    {
        yield return(new WaitForSeconds(0.01f));

        scriptsContainer.ShowEnergyGraph(false);
        scriptsContainer.ShowMagnetizationGraph(false);
        UpdateButtonsColor();
    }
    private void ContainerWindow(int id)
    {
        GUI.Label(new Rect(OUTLINE_THICKNESS, INDENT, windowRect.width / 3, textFieldHeight), "<color=white>Width:</color>", textStyle);
        widthText = GUI.TextField(new Rect(OUTLINE_THICKNESS + windowRect.width / 3, INDENT, 2 * windowRect.width / 3 - INDENT, textFieldHeight), widthText, MAX_TEXT_LENGTH);

        GUI.Label(new Rect(OUTLINE_THICKNESS, INDENT + textFieldHeight + OUTLINE_THICKNESS, windowRect.width / 3, textFieldHeight), "<color=white>Height:</color>", textStyle);
        heightText = GUI.TextField(new Rect(OUTLINE_THICKNESS + windowRect.width / 3, INDENT + textFieldHeight + OUTLINE_THICKNESS, 2 * windowRect.width / 3 - INDENT, textFieldHeight), heightText, MAX_TEXT_LENGTH);

        if (GUI.Button(new Rect(OUTLINE_THICKNESS, INDENT + 2 * (textFieldHeight + OUTLINE_THICKNESS), windowRect.width - 2 * OUTLINE_THICKNESS, textFieldHeight), "Generate!"))
        {
            CloseWindow();

            int fieldWidth = 0, fieldHeight = 0;
            if (!Int32.TryParse(widthText, out fieldWidth))
            {
                Debug.LogError("You must put the number into the text field");
                return;
            }

            if (!Int32.TryParse(heightText, out fieldHeight))
            {
                Debug.LogError("You must put the number into the text field");
                return;
            }

            ScriptsContainer.fieldContainer.GenerateField(fieldWidth, fieldHeight);
            //ScriptsContainer.fieldGUI.OpenWindow();
            ScriptsContainer.fieldUI.OpenWindow();
            ScriptsContainer.settingsGUI.OpenWindow();

            scriptsContainer.ShowEnergyGraph(true);
            scriptsContainer.ShowMagnetizationGraph(true);

            ScriptsContainer.isingAlgorithm.StartModelling();
        }

        GUI.DragWindow();
    }